Skip to main content

Workflow triggers API

This page documents the 15 gateway endpoints tagged workflow triggers in the gateway's OpenAPI document. Every example targets a gateway on http://localhost:4000 and authenticates with the SPANWAY_API_KEY environment variable, which holds the master key or a virtual key that has access to the route. Request and response fields are taken from the schema the running gateway publishes at /openapi.json, and the same document is bundled with this site as openapi.json.

MethodPathSummary
GET/v1/triggers/listList workflow triggers
GET/v1/triggers/infoRead one trigger
GET/v1/triggers/firesRead a trigger's fire history
GET/v1/triggers/event_typesList the gateway events a trigger can subscribe to
POST/v1/triggers/newCreate a trigger
POST/v1/triggers/updateReplace a trigger's settings
POST/v1/triggers/deleteDelete a trigger
POST/v1/triggers/enableTurn a trigger on
POST/v1/triggers/disableTurn a trigger off
POST/v1/triggers/rotate_secretRotate a webhook trigger's signing secret
POST/v1/triggers/testQueue a test fire
POST/v1/triggers/webhook/{trigger_id}Receive a signed webhook delivery
POST/v1/triggers/chatSend a message to a chat trigger
GET/v1/triggers/form/schemaRead a form trigger's fields
POST/v1/triggers/form/submitSubmit a form trigger

Endpoints​

GET /v1/triggers/list​

List workflow triggers

List the triggers the caller may see, the webhooks, schedules, gateway events, chats and forms that start a saved workflow, with the workflow version each starts and whether it is on. Owners, members of a team or organization trigger's team or organization, proxy admins and admin viewers may see a trigger. Nothing changes. Docs (https://docs.spanway.ai/docs/proxy/workflow_triggers#who-can-do-what)

Example request:

curl -X GET "http://localhost:4000/v1/triggers/list" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The triggers the caller may seeapplication/json TriggerPage
401No valid key or Admin UI session was presentedapplication/json ErrorDetail
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
500The gateway hit an internal error, usually the database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
triggersarray of TriggerViewYesTriggers

GET /v1/triggers/info​

Read one trigger

Read one trigger with its source settings, whether it is on and why it was switched off, and the last characters of its signing secret. The same people who may list it may read it, otherwise it answers 404. Nothing changes. Docs (https://docs.spanway.ai/docs/proxy/workflow_triggers)

Parameters:

NameInTypeRequiredDescription
trigger_idquerystringYes

Example request:

curl -X GET "http://localhost:4000/v1/triggers/info?trigger_id=trigger_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The triggerapplication/json TriggerView
401No valid key or Admin UI session was presentedapplication/json ErrorDetail
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
404No object with that id is visible to the callerapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway hit an internal error, usually the database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
trigger_idstringYesTrigger Id
namestringYesName
descriptionstring or nullYesDescription
kindenum: "webhook", "cron", "event", "chat", "form"YesKind
sourceWebhookSource or CronSource or EventSource or ChatSource or FormSource or nullYesSource
definition_idstringYesDefinition Id
definition_versionintegerYesDefinition Version
enabledbooleanYesEnabled
disabled_reasonstring or nullYesDisabled Reason
visibilityenum: "private", "team", "org"YesVisibility
event_reachenum: "owner", "org", "proxy"YesEvent Reach
owner_user_idstring or nullYesOwner User Id
owner_team_idstring or nullYesOwner Team Id
actor_user_idstring or nullYesActor User Id
run_budget_usdnumber or nullYesRun Budget Usd
max_fires_per_minuteintegerYesMax Fires Per Minute
input_mappingobject or nullYesInput Mapping
next_fire_atstring or nullYesNext Fire At
secret_hintstring or nullYesSecret Hint
webhook_urlstring or nullYesWebhook Url
consecutive_failuresintegerYesConsecutive Failures
revisionintegerYesRevision
created_atstringYesCreated At
updated_atstringYesUpdated At

GET /v1/triggers/fires​

Read a trigger's fire history

Read a trigger's fire history, newest first: when each fire arrived, whether it started a run, the run id and why a fire was refused. The trigger's owner, its team admins and proxy admins may call it, plus admin viewers for reading. Payloads are never shown, and nothing changes. Docs (https://docs.spanway.ai/docs/proxy/workflow_triggers#failures-and-auto-disable)

Parameters:

NameInTypeRequiredDescription
trigger_idquerystringYes
pagequeryintegerNo

Example request:

curl -X GET "http://localhost:4000/v1/triggers/fires?trigger_id=trigger_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200One page of fires, newest firstapplication/json FirePage
401No valid key or Admin UI session was presentedapplication/json ErrorDetail
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
404No object with that id is visible to the callerapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway hit an internal error, usually the database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
firesarray of FireViewYesFires
pageintegerYesPage

GET /v1/triggers/event_types​

List the gateway events a trigger can subscribe to

List every gateway event an event trigger may subscribe to, such as a key going over its budget, with the shape of the filter each one accepts. Any key may call it, and nothing changes. Docs (https://docs.spanway.ai/docs/proxy/workflow_triggers#gateway-events)

Example request:

curl -X GET "http://localhost:4000/v1/triggers/event_types" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The event types and their filtersapplication/json EventTypes
401No valid key or Admin UI session was presentedapplication/json ErrorDetail
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
event_typesarray of EventTypeViewYesEvent Types

POST /v1/triggers/new​

Create a trigger

Create a trigger that starts a saved workflow when a webhook arrives, a schedule comes due, a gateway event happens, or someone chats or submits a form. Roles that can write may create one, and the run uses the key given as actor_key. A webhook trigger's signing secret is returned once, here, and never again. The creation is written to the audit log. Docs (https://docs.spanway.ai/docs/proxy/workflow_triggers#create-a-trigger)

Request body (application/json, schema TriggerFields):

FieldTypeRequiredDescription
namestringYesName
descriptionstring or nullNoDescription
sourceWebhookSource or CronSource or EventSource or ChatSource or FormSourceYesSource
definition_idstringYesDefinition Id
definition_versionintegerYesDefinition Version
visibilityenum: "private", "team", "org"NoVisibility
owner_team_idstring or nullNoOwner Team Id
event_reachenum: "owner", "org", "proxy"NoEvent Reach
actor_keystring or nullNoActor Key
run_budget_usdnumber or nullNoRun Budget Usd
max_fires_per_minuteintegerNoMax Fires Per Minute
input_mappingobject or nullNoInput Mapping
provider_secretstring or nullNoThe signing secret Slack or the Teams security token, write only

Example request:

curl -X POST "http://localhost:4000/v1/triggers/new" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "string",
"source": "string",
"definition_id": "definition_id-123",
"definition_version": 1
}'

Responses:

StatusDescriptionBody
200The new trigger, with a webhook's signing secret shown this once. A Slack or Teams trigger keeps the secret pasted as provider_secret and answers signing_secret nullapplication/json TriggerCreated
401No valid key or Admin UI session was presentedapplication/json ErrorDetail
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
404No object with that id is visible to the callerapplication/json ErrorDetail
409The object already exists or is in a state that does not allow this changeapplication/json ErrorDetail
422The trigger cannot be created as sentapplication/json ErrorDetail
500The gateway hit an internal error, usually the database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
triggerTriggerViewYes
signing_secretstring or nullYesSigning Secret

POST /v1/triggers/update​

Replace a trigger's settings

Replace a trigger's settings, for example to point it at a newer workflow version. Roles that can write may change triggers they manage, and a webhook, cron or event trigger then runs as the editor's own key. Its kind and signing secret do not change here. The change is written to the audit log. Docs (https://docs.spanway.ai/docs/proxy/workflow_triggers#who-can-do-what)

Request body (application/json, schema UpdateTrigger):

FieldTypeRequiredDescription
namestringYesName
descriptionstring or nullNoDescription
sourceWebhookSource or CronSource or EventSource or ChatSource or FormSourceYesSource
definition_idstringYesDefinition Id
definition_versionintegerYesDefinition Version
visibilityenum: "private", "team", "org"NoVisibility
owner_team_idstring or nullNoOwner Team Id
event_reachenum: "owner", "org", "proxy"NoEvent Reach
actor_keystring or nullNoActor Key
run_budget_usdnumber or nullNoRun Budget Usd
max_fires_per_minuteintegerNoMax Fires Per Minute
input_mappingobject or nullNoInput Mapping
provider_secretstring or nullNoThe signing secret Slack or the Teams security token, write only
trigger_idstringYesTrigger Id

Example request:

curl -X POST "http://localhost:4000/v1/triggers/update" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"trigger_id": "trg_01J...",
"name": "support tickets",
"source": {
"kind": "webhook"
},
"definition_id": "def-support-triage",
"definition_version": 3,
"actor_key": "sk-...",
"run_budget_usd": 2
}'

Responses:

StatusDescriptionBody
200The trigger after the changeapplication/json TriggerView
401No valid key or Admin UI session was presentedapplication/json ErrorDetail
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
404No object with that id is visible to the callerapplication/json ErrorDetail
409The object already exists or is in a state that does not allow this changeapplication/json ErrorDetail
422The change is not allowed through updateapplication/json ErrorDetail
500The gateway hit an internal error, usually the database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
trigger_idstringYesTrigger Id
namestringYesName
descriptionstring or nullYesDescription
kindenum: "webhook", "cron", "event", "chat", "form"YesKind
sourceWebhookSource or CronSource or EventSource or ChatSource or FormSource or nullYesSource
definition_idstringYesDefinition Id
definition_versionintegerYesDefinition Version
enabledbooleanYesEnabled
disabled_reasonstring or nullYesDisabled Reason
visibilityenum: "private", "team", "org"YesVisibility
event_reachenum: "owner", "org", "proxy"YesEvent Reach
owner_user_idstring or nullYesOwner User Id
owner_team_idstring or nullYesOwner Team Id
actor_user_idstring or nullYesActor User Id
run_budget_usdnumber or nullYesRun Budget Usd
max_fires_per_minuteintegerYesMax Fires Per Minute
input_mappingobject or nullYesInput Mapping
next_fire_atstring or nullYesNext Fire At
secret_hintstring or nullYesSecret Hint
webhook_urlstring or nullYesWebhook Url
consecutive_failuresintegerYesConsecutive Failures
revisionintegerYesRevision
created_atstringYesCreated At
updated_atstringYesUpdated At

POST /v1/triggers/delete​

Delete a trigger

Delete a trigger and its fire history, so it never fires again. Roles that can write may delete triggers they manage. Runs it already started keep going, and the deletion is written to the audit log. Docs (https://docs.spanway.ai/docs/proxy/workflow_triggers#who-can-do-what)

Request body (application/json, schema TriggerRef):

FieldTypeRequiredDescription
trigger_idstringYesTrigger Id

Example request:

curl -X POST "http://localhost:4000/v1/triggers/delete" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"trigger_id": "trg_01J..."
}'

Responses:

StatusDescriptionBody
200The id of the deleted triggerapplication/json TriggerRef
401No valid key or Admin UI session was presentedapplication/json ErrorDetail
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
404No object with that id is visible to the callerapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway hit an internal error, usually the database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
trigger_idstringYesTrigger Id

POST /v1/triggers/enable​

Turn a trigger on

Turn a trigger back on, for example after it was switched off for repeated failures. For a webhook, cron or event trigger only the user whose key it runs as or a proxy admin may. Its failure count and disabled reason clear, a cron trigger's next fire is computed from now, and the change is written to the audit log. Docs (https://docs.spanway.ai/docs/proxy/workflow_triggers#failures-and-auto-disable)

Request body (application/json, schema TriggerRef):

FieldTypeRequiredDescription
trigger_idstringYesTrigger Id

Example request:

curl -X POST "http://localhost:4000/v1/triggers/enable" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"trigger_id": "trg_01J..."
}'

Responses:

StatusDescriptionBody
200The trigger, on againapplication/json TriggerView
401No valid key or Admin UI session was presentedapplication/json ErrorDetail
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
404No object with that id is visible to the callerapplication/json ErrorDetail
409The object already exists or is in a state that does not allow this changeapplication/json ErrorDetail
422A field failed validation and the detail names itapplication/json ErrorDetail
500The gateway hit an internal error, usually the database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
trigger_idstringYesTrigger Id
namestringYesName
descriptionstring or nullYesDescription
kindenum: "webhook", "cron", "event", "chat", "form"YesKind
sourceWebhookSource or CronSource or EventSource or ChatSource or FormSource or nullYesSource
definition_idstringYesDefinition Id
definition_versionintegerYesDefinition Version
enabledbooleanYesEnabled
disabled_reasonstring or nullYesDisabled Reason
visibilityenum: "private", "team", "org"YesVisibility
event_reachenum: "owner", "org", "proxy"YesEvent Reach
owner_user_idstring or nullYesOwner User Id
owner_team_idstring or nullYesOwner Team Id
actor_user_idstring or nullYesActor User Id
run_budget_usdnumber or nullYesRun Budget Usd
max_fires_per_minuteintegerYesMax Fires Per Minute
input_mappingobject or nullYesInput Mapping
next_fire_atstring or nullYesNext Fire At
secret_hintstring or nullYesSecret Hint
webhook_urlstring or nullYesWebhook Url
consecutive_failuresintegerYesConsecutive Failures
revisionintegerYesRevision
created_atstringYesCreated At
updated_atstringYesUpdated At

POST /v1/triggers/disable​

Turn a trigger off

Stop a trigger from firing until it is turned on again. Roles that can write may disable triggers they manage. Fires already queued are refused when the dispatcher reaches them, and the change is written to the audit log. Docs (https://docs.spanway.ai/docs/proxy/workflow_triggers#failures-and-auto-disable)

Request body (application/json, schema TriggerRef):

FieldTypeRequiredDescription
trigger_idstringYesTrigger Id

Example request:

curl -X POST "http://localhost:4000/v1/triggers/disable" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"trigger_id": "trg_01J..."
}'

Responses:

StatusDescriptionBody
200The trigger, now offapplication/json TriggerView
401No valid key or Admin UI session was presentedapplication/json ErrorDetail
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
404No object with that id is visible to the callerapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway hit an internal error, usually the database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
trigger_idstringYesTrigger Id
namestringYesName
descriptionstring or nullYesDescription
kindenum: "webhook", "cron", "event", "chat", "form"YesKind
sourceWebhookSource or CronSource or EventSource or ChatSource or FormSource or nullYesSource
definition_idstringYesDefinition Id
definition_versionintegerYesDefinition Version
enabledbooleanYesEnabled
disabled_reasonstring or nullYesDisabled Reason
visibilityenum: "private", "team", "org"YesVisibility
event_reachenum: "owner", "org", "proxy"YesEvent Reach
owner_user_idstring or nullYesOwner User Id
owner_team_idstring or nullYesOwner Team Id
actor_user_idstring or nullYesActor User Id
run_budget_usdnumber or nullYesRun Budget Usd
max_fires_per_minuteintegerYesMax Fires Per Minute
input_mappingobject or nullYesInput Mapping
next_fire_atstring or nullYesNext Fire At
secret_hintstring or nullYesSecret Hint
webhook_urlstring or nullYesWebhook Url
consecutive_failuresintegerYesConsecutive Failures
revisionintegerYesRevision
created_atstringYesCreated At
updated_atstringYesUpdated At

POST /v1/triggers/rotate_secret​

Rotate a webhook trigger's signing secret

Issue a new signing secret for a webhook trigger, returned once, for example after the old one leaked. Only the user whose key the trigger runs as or a proxy admin may. The old secret keeps verifying for grace_seconds so the sender can switch over, and the rotation is written to the audit log. A Slack or Teams trigger takes the new secret from that service as provider_secret instead. Docs (https://docs.spanway.ai/docs/proxy/workflow_service_triggers#secrets)

Request body (application/json, schema RotateSecret):

FieldTypeRequiredDescription
trigger_idstringYesTrigger Id
grace_secondsintegerNoGrace Seconds
provider_secretstring or nullNoThe new Slack signing secret or Teams security token, for those triggers

Example request:

curl -X POST "http://localhost:4000/v1/triggers/rotate_secret" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"trigger_id": "trigger_id-123"
}'

Responses:

StatusDescriptionBody
200The new secret, shown this once, and when the old one stops verifying. A Slack or Teams trigger stores the pasted provider_secret instead and answers signing_secret nullapplication/json SecretRotated
401No valid key or Admin UI session was presentedapplication/json ErrorDetail
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
404No object with that id is visible to the callerapplication/json ErrorDetail
422The trigger has no secret to rotate, or the provider_secret does not fitapplication/json ErrorDetail
500The gateway hit an internal error, usually the database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
trigger_idstringYesTrigger Id
signing_secretstring or nullYesSigning Secret
secret_hintstringYesSecret Hint
previous_secret_expires_atstring or nullYesPrevious Secret Expires At

POST /v1/triggers/test​

Queue a test fire

Queue a fire with a sample payload to check a trigger end to end. It goes through the same dispatcher, key and approval checks as a real fire and counts toward the trigger's per-minute limit. For a webhook, cron or event trigger only the user whose key it runs as or a proxy admin may, and the test is written to the audit log. Docs (https://docs.spanway.ai/docs/proxy/workflow_triggers#who-can-do-what)

Request body (application/json, schema SampleFire):

FieldTypeRequiredDescription
trigger_idstringYesTrigger Id
payloadobjectNoPayload

Example request:

curl -X POST "http://localhost:4000/v1/triggers/test" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"trigger_id": "trg_01J...",
"payload": {
"ticket": {
"title": "Printer on fire"
}
}
}'

Responses:

StatusDescriptionBody
200The queued test fireapplication/json FireAccepted
401No valid key or Admin UI session was presentedapplication/json ErrorDetail
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
404No object with that id is visible to the callerapplication/json ErrorDetail
409The object already exists or is in a state that does not allow this changeapplication/json ErrorDetail
413The body is larger than the gateway acceptsapplication/json ErrorDetail
422A field failed validation and the detail names itapplication/json ErrorDetail
429A rate or concurrency limit was reached, retry after Retry-After secondsapplication/json ErrorDetail
500The gateway hit an internal error, usually the database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
fire_idstringYesFire Id
statusenum: "pending", "starting", "started", "skipped", "refused", "failed"YesStatus
run_idstring or nullNoRun Id

POST /v1/triggers/webhook/{trigger_id}​

Receive a signed webhook delivery

Receive a Standard Webhooks or X-Hub-Signature-256 delivery, or an event from Slack, Microsoft Teams, Microsoft Graph (Outlook mail and calendar), Gmail over Pub/Sub push or Google Calendar. The signature is the only credential, Slack's and Graph's setup checks are answered, a connected service's sender and place must be in the trigger's access mapping, a replayed delivery returns the original fire, and the run starts in the background. Docs (https://docs.spanway.ai/docs/proxy/workflow_service_triggers)

Parameters:

NameInTypeRequiredDescription
trigger_idpathstringYes

Request body (application/json, object):

Example request:

curl -X POST "http://localhost:4000/v1/triggers/webhook/trigger_id-123" \
-H "Content-Type: application/json" \
-d '{}'

Responses:

StatusDescriptionBody
200The fire was accepted, a replayed delivery returned its original fire, or a connected service's setup check or event was answered. Slack's url_verification gets its challenge back, Microsoft Teams gets a message reply, Microsoft Graph's validationToken is echoed as text/plain, and a Slack or Google Calendar event the trigger ignores gets an empty 200application/json FireAccepted or SlackChallengeAnswer or TeamsMessageReply
202A Microsoft Graph notification batch was accepted, or Graph sent a lifecycle notice or a change the trigger ignores. The body is empty
204A verified ping delivery, acknowledged without starting a run
400The signature verified but the body is not what the sender sends, or a Standard Webhooks body is not a JSON objectapplication/json object
401Missing or invalid webhook signature, or the trigger id is unknown or the trigger is offapplication/json object
404No object with that id is visible to the callerapplication/json ErrorDetail
413The body is larger than the trigger allows, or has no Content-Lengthapplication/json object
422Validation Errorapplication/json HTTPValidationError
429The gateway, the sender's address or the trigger fired more often than its per-minute limitapplication/json object

POST /v1/triggers/chat​

Send a message to a chat trigger

Send a message to a chat trigger. The run acts as your own key, and with wait the reply carries the run's step outputs when it finishes within the trigger's wait window.

Request body (application/json, schema ChatRequest):

FieldTypeRequiredDescription
trigger_idstringYesTrigger Id
messagestringYesMessage
waitbooleanNoWait
run_as_keystring or nullNoRun As Key

Example request:

curl -X POST "http://localhost:4000/v1/triggers/chat" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"trigger_id": "trg-chat",
"message": "Summarize yesterday'\''s incidents",
"wait": true
}'

Responses:

StatusDescriptionBody
200Successful responseapplication/json ChatReply
401No valid key or Admin UI session was presentedapplication/json ErrorDetail
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
404No object with that id is visible to the callerapplication/json ErrorDetail
409The object already exists or is in a state that does not allow this changeapplication/json ErrorDetail
422A field failed validation and the detail names itapplication/json ErrorDetail
429A rate or concurrency limit was reached, retry after Retry-After secondsapplication/json ErrorDetail
500The gateway hit an internal error, usually the database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
fire_idstringYesFire Id
statusenum: "pending", "starting", "started", "skipped", "refused", "failed" or enum: "completed", "running", "failed", "cancelled"YesStatus
run_idstring or nullYesRun Id
outputsobjectNoOutputs

GET /v1/triggers/form/schema​

Read a form trigger's fields

The title and fields of a form trigger, so a client can render the form before submitting it. Docs (https://docs.spanway.ai/docs/proxy/workflow_triggers#chat-and-forms)

Parameters:

NameInTypeRequiredDescription
trigger_idquerystringYes

Example request:

curl -X GET "http://localhost:4000/v1/triggers/form/schema?trigger_id=trigger_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200Successful responseapplication/json FormSchema
401No valid key or Admin UI session was presentedapplication/json ErrorDetail
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
404No object with that id is visible to the callerapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway hit an internal error, usually the database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
trigger_idstringYesTrigger Id
titlestringYesTitle
fieldsarray of TextField or LongTextField or NumberField or SelectField or BooleanFieldYesFields

POST /v1/triggers/form/submit​

Submit a form trigger

Submit a form trigger. Values are checked against the form's fields, and the run acts as your own key.

Request body (application/json, schema FormSubmission):

FieldTypeRequiredDescription
trigger_idstringYesTrigger Id
valuesobjectYesValues
run_as_keystring or nullNoRun As Key

Example request:

curl -X POST "http://localhost:4000/v1/triggers/form/submit" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"trigger_id": "trg_01K...",
"values": {
"service": "checkout"
}
}'

Responses:

StatusDescriptionBody
200Successful responseapplication/json ChatReply
401No valid key or Admin UI session was presentedapplication/json ErrorDetail
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
404No object with that id is visible to the callerapplication/json ErrorDetail
409The object already exists or is in a state that does not allow this changeapplication/json ErrorDetail
422A field failed validation and the detail names itapplication/json ErrorDetail
429A rate or concurrency limit was reached, retry after Retry-After secondsapplication/json ErrorDetail
500The gateway hit an internal error, usually the database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
fire_idstringYesFire Id
statusenum: "pending", "starting", "started", "skipped", "refused", "failed" or enum: "completed", "running", "failed", "cancelled"YesStatus
run_idstring or nullYesRun Id
outputsobjectNoOutputs