Automations_create
const url = 'http://localhost:3000/api/automations';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","triggerEvent":"example","steps":[{"type":"email","subject":"example","body":"example","doc":{"additionalProperty":"example"},"editorVersion":"example","seconds":1,"tag":"example","id":"example","url":"example","headers":[{"name":"example","value":"example"}],"secret":"example","clearSecret":true,"hasSecret":true}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:3000/api/automations \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "triggerEvent": "example", "steps": [ { "type": "email", "subject": "example", "body": "example", "doc": { "additionalProperty": "example" }, "editorVersion": "example", "seconds": 1, "tag": "example", "id": "example", "url": "example", "headers": [ { "name": "example", "value": "example" } ], "secret": "example", "clearSecret": true, "hasSecret": true } ] }'Create a resource
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Request body for creating an automation (always created as a draft)
object
One node in an automation’s ordered, linear sequence. A flat shape: email steps carry subject/body, wait steps carry seconds, tag steps carry the tag name.
object
Step kind
Email subject (email steps)
Email body as HTML (email steps), or the Liquid JSON request body (HTTP steps: Contact bindings only, strings JSON-escaped, up to 64 KiB, must render to valid JSON)
The editor’s JSON document an email step’s body was built from, an opaque object checked by the
server against the schema email_schema returns. Write it instead of body (both is a 422): the
server renders the body from it in the same save, and a document that cannot be rendered refuses
the whole save, naming the step. Writing only a body clears the step’s document.
object
Version of the editor that rendered the document (email steps, read only)
Delay before the next step, in seconds (wait steps)
Tag name to apply to or remove from the enrolled contact (apply_tag and remove_tag steps)
Step id (HTTP steps). Assigned on save; send it back on edit so the step keeps its secrets.
Hook URL to POST to (HTTP steps). A secret: never returned. Omit it when editing to keep the stored URL. Up to 2 KiB, http or https.
Up to 5 request headers (HTTP steps). On read, only the names are returned.
One request header of an HTTP step. The value is a secret: it is never returned.
object
Header name. Content-Type, Content-Length, Host and the webhook-* headers are set by sphericon.
Header value. Omit it when editing to keep the stored value of the header with this name.
Signing secret (HTTP steps): when set, the request is signed with Standard Webhooks. Never returned. Omit it when editing to keep the stored secret.
Remove the signing secret on save (HTTP steps)
Whether a signing secret is stored (HTTP steps, read only)
Responses
Section titled “Responses”The request has succeeded and a new resource has been created as a result.
An Automation: an event-triggered, ordered sequence of steps. Created automations are always draft; activating is a separate, send-class operation.
object
Unique identifier
Automation name
Lifecycle status
Event action that enrolls a contact (e.g. “contact.created”, “email.opened”)
The automation’s ordered, linear steps
One node in an automation’s ordered, linear sequence. A flat shape: email steps carry subject/body, wait steps carry seconds, tag steps carry the tag name.
object
Step kind
Email subject (email steps)
Email body as HTML (email steps), or the Liquid JSON request body (HTTP steps: Contact bindings only, strings JSON-escaped, up to 64 KiB, must render to valid JSON)
The editor’s JSON document an email step’s body was built from, an opaque object checked by the
server against the schema email_schema returns. Write it instead of body (both is a 422): the
server renders the body from it in the same save, and a document that cannot be rendered refuses
the whole save, naming the step. Writing only a body clears the step’s document.
object
Version of the editor that rendered the document (email steps, read only)
Delay before the next step, in seconds (wait steps)
Tag name to apply to or remove from the enrolled contact (apply_tag and remove_tag steps)
Step id (HTTP steps). Assigned on save; send it back on edit so the step keeps its secrets.
Hook URL to POST to (HTTP steps). A secret: never returned. Omit it when editing to keep the stored URL. Up to 2 KiB, http or https.
Up to 5 request headers (HTTP steps). On read, only the names are returned.
One request header of an HTTP step. The value is a secret: it is never returned.
object
Header name. Content-Type, Content-Length, Host and the webhook-* headers are set by sphericon.
Header value. Omit it when editing to keep the stored value of the header with this name.
Signing secret (HTTP steps): when set, the request is signed with Standard Webhooks. Never returned. Omit it when editing to keep the stored secret.
Remove the signing secret on save (HTTP steps)
Whether a signing secret is stored (HTTP steps, read only)
When the automation was archived; null while it is kept
Creation timestamp
Last update timestamp
Example
{ "status": "draft", "steps": [ { "type": "email" } ]}RFC 7807 bad request response
RFC 7807 Problem Details
object
Why the request was refused, when the client should act on it
A URI reference that identifies the problem type
A short, human-readable summary of the problem type
HTTP status code
A human-readable explanation specific to this occurrence
A URI reference that identifies the specific occurrence
Validation errors grouped by field
object
Form-level validation error
Field validation errors
object
Seconds to wait before retrying; set on a 429 so a client that only sees the body can show the wait
Why a 500 happened, sent only by a development server (SPHERICON_ENV=development)
object
The error that failed the request, or the panic value
The goroutine stack of a panic; absent for an error a handler returned
The request id the server log carries for this request
The HTTP method of the failed request
The path of the failed request
Example
{ "code": "second_factor_required"}RFC 7807 unauthorized response
RFC 7807 Problem Details
object
Why the request was refused, when the client should act on it
A URI reference that identifies the problem type
A short, human-readable summary of the problem type
HTTP status code
A human-readable explanation specific to this occurrence
A URI reference that identifies the specific occurrence
Validation errors grouped by field
object
Form-level validation error
Field validation errors
object
Seconds to wait before retrying; set on a 429 so a client that only sees the body can show the wait
Why a 500 happened, sent only by a development server (SPHERICON_ENV=development)
object
The error that failed the request, or the panic value
The goroutine stack of a panic; absent for an error a handler returned
The request id the server log carries for this request
The HTTP method of the failed request
The path of the failed request
Example
{ "code": "second_factor_required"}RFC 7807 validation response
RFC 7807 Problem Details
object
Why the request was refused, when the client should act on it
A URI reference that identifies the problem type
A short, human-readable summary of the problem type
HTTP status code
A human-readable explanation specific to this occurrence
A URI reference that identifies the specific occurrence
Validation errors grouped by field
object
Form-level validation error
Field validation errors
object
Seconds to wait before retrying; set on a 429 so a client that only sees the body can show the wait
Why a 500 happened, sent only by a development server (SPHERICON_ENV=development)
object
The error that failed the request, or the panic value
The goroutine stack of a panic; absent for an error a handler returned
The request id the server log carries for this request
The HTTP method of the failed request
The path of the failed request
Example
{ "code": "second_factor_required"}RFC 7807 too many requests response: a rate limit was exceeded (ADR 0025)
RFC 7807 Problem Details
object
Why the request was refused, when the client should act on it
A URI reference that identifies the problem type
A short, human-readable summary of the problem type
HTTP status code
A human-readable explanation specific to this occurrence
A URI reference that identifies the specific occurrence
Validation errors grouped by field
object
Form-level validation error
Field validation errors
object
Seconds to wait before retrying; set on a 429 so a client that only sees the body can show the wait
Why a 500 happened, sent only by a development server (SPHERICON_ENV=development)
object
The error that failed the request, or the panic value
The goroutine stack of a panic; absent for an error a handler returned
The request id the server log carries for this request
The HTTP method of the failed request
The path of the failed request
Example
{ "code": "second_factor_required"}Headers
Section titled “Headers”Seconds to wait before retrying
The request budget of the window that was exceeded
Requests left in the current window
Unix time at which the window resets