Run an automation for a contact
Queues a run of the automation for one contact and answers 202 at once. Runs an automation that is on and has the manual or the webhook trigger (find them with list_automations by trigger_type, is_active set to true). Needs the emails.full permission.
The body names the contact by contact_id or gives it as contact, exactly one of the two. contact is created or updated by e-mail as upsert_contact does, then run; a status the contact cannot take refuses the run and writes nothing. It needs contacts.edit on top of emails.full and spends the contact creation limit, even when the automation refuses the run. A limit hit here is not kept under the Idempotency-Key: the same key runs again once the window passes. The contact and the run are saved together: on 202 both are; on any error, neither is.
The two triggers run differently:
- manual is a sequence of steps that other automations start too. A contact is in it once at a time: while its run is queued or going on, a new run is refused. Once the run finishes, the contact may be run again. Other manual starts (the dashboard, contact imports, the "start automation" step) honour the same check; starts by other trigger types and bulk event packs are not seen by it. A run that failed may be repeated at once through this operation only: the other manual starts skip a contact whose run in this automation failed. data is not read.
- webhook takes an event with its values: every call is a new run, also for a contact already in the automation. data reaches the steps as {{$webhook.<key>}}, the values its e-mails and conditions use; the contact is {{$contact.<field>}}. The automation's webhook_url from get_automation starts the same automation without credentials, for a service that can only send a request: it takes a flat body, finds the contact in it and answers before the automation is checked. Its whole body is $webhook, while here $webhook holds only data: a value the automation reads from $webhook, the e-mail included, goes into data.
The response carries no run id: the run waits to start; follow it with list_automation_runs by contact_id and order=newest. Send an Idempotency-Key to retry safely: a retry with the same key gets the stored 202, not a 409.
An unsubscribed contact is run as well, but the steps send it no e-mails.
Request
- Base URLhttps://api.getsitecontrol.com
- AuthHTTP bearer
Path parameters
Automation id from list_automations
Headers
Makes a retry of a POST safe: a repeat with the same key, body and GSC-Version returns the stored response with Idempotency-Replayed: true instead of running again. The key protects against repeated execution while the key store works. Saving the change and storing the response under the key are not atomic: if the process or the key store fails between them, the change is kept, the key is released after 15 minutes and a retry runs the request again. After a timeout or a 5xx, read the resource to check the result before retrying. 5xx and 429 responses and responses over 256 KB are not stored, so a repeat runs the request again. A key is kept for 24 hours. The same key with another body or version is 422; a repeat while the first request runs is 409.
Request body
Example request
{
"contact": {
"email": "jane@example.com",
"first_name": "Jane"
},
"data": {
"order_id": "A-981",
"total": 129.9
}
}Response
Successful Response
Changes
No recorded changes to this operation across all 1 revision of this API.