Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.withsutro.com/llms.txt

Use this file to discover all available pages before exploring further.

Triggers bind your internal Actions to the outside world. They handle input mapping, authentication, and protocol specifics.

HTTP triggers

Expose an action as a REST endpoint.
trigger CreatePatient on HttpRequest
  description "Public endpoint to register a patient."
  endpoint POST /clinics/{clinicId}/patients
  
  arguments
    clinicId := @request.path.clinicId
    fullName := @request.body.fullName
    dateOfBirth := @request.body.dateOfBirth
  
  auth
    @subject can "patients:write"

Argument mapping

You can map data from various parts of the HTTP request to your Action arguments:
  • @request.body.fieldName: JSON body payload.
  • @request.path.paramName: URL path parameters.
  • @request.query.paramName: URL query string.
  • @request.files.fieldName: Uploaded files from a multipart/form-data file field, resolved as FILE values.
For file uploads, use a FILE action argument and match the multipart field name to the trigger binding:
action UploadDocument(title: TEXT, file: FILE): Document
  body
    storedFile := store file
    doc := create Document {
      title := title
      attachment := storedFile
    }
    return doc

trigger UploadDocument on HttpRequest
  endpoint POST /documents
  arguments
    title := @request.body.title
    file := @request.files.file

Queue triggers

Process background jobs asynchronously.
queue patientProcessingQueue with Patient

trigger ProcessPatient on Queue
  queue patientProcessingQueue
  arguments
    patient := @message
To trigger this, you would use enqueue inside an action:
action SubmitPatient(...): Patient
  body
    p := create Patient { ... }
    enqueue patientProcessingQueue with p
    return p