Skip to content

Executions

A workflow execution processes a single image through a workflow. Create executions, monitor their status, and download results.

Create a workflow execution using a previously uploaded image. This is the recommended approach for better performance. If your workflow takes more than one input image, see Create Execution (with multiple images).

POST https://api.autoretouch.com/v1/workflow/execution/create
ParameterTypeRequiredDescription
workflowstringYesWorkflow ID
versionstringNoWorkflow version ID (uses latest if omitted)
organizationstringRecommendedOrganization ID
{
"image": {
"name": "product-photo.jpg",
"contentHash": "{hash from upload}",
"contentType": "image/jpeg"
},
"labels": {
"autoretouch_batch_id": "uuid",
"autoretouch_batch_name": "Spring Collection",
"autoretouch_batch_createdAt": "2024-02-08T09:09:01.960Z"
},
"webhooks": [
"https://your-server.com/webhook"
]
}
FieldTypeRequiredDescription
image.namestringYesOriginal filename
image.contentHashstringYesHash from upload endpoint
image.contentTypestringYesMIME type (image/jpeg, image/png)
labelsobjectNoCustom key-value pairs for batching
webhooksarrayNoURLs to notify on completion
Terminal window
curl -X POST "https://api.autoretouch.com/v1/workflow/execution/create?workflow={workflowId}&organization={organizationId}" \
-H "Authorization: Bearer {accessToken}" \
-H "Content-Type: application/json" \
-d '{
"image": {
"name": "product.jpg",
"contentHash": "d4d4a63a03c9543f4f21d474500a95d7bb5704c83c139ddc6e005eaba6d54b22",
"contentType": "image/jpeg"
},
"webhooks": ["https://your-server.com/webhook"]
}'

Returns the execution ID as plain text:

c8031492-b74f-44d3-8a7c-08bad01579a5

Some workflows need more than one input image to produce a result. For these, replace the single image object with an images object that holds every input, keyed by position.

POST https://api.autoretouch.com/v1/workflow/execution/create

The endpoint and query parameters are the same as Create Execution (with uploaded image). Upload each image first with the upload endpoint to get its content hash.

{
"images": {
"default": {
"name": "main-photo.jpg",
"contentHash": "{hash from upload}",
"contentType": "image/jpeg"
},
"1": {
"name": "additional-photo-1.jpg",
"contentHash": "{hash from upload}",
"contentType": "image/jpeg"
},
"2": {
"name": "additional-photo-2.jpg",
"contentHash": "{hash from upload}",
"contentType": "image/jpeg"
}
},
"labels": {
"autoretouch_batch_id": "uuid",
"autoretouch_batch_name": "Spring Collection",
"autoretouch_batch_createdAt": "2024-02-08T09:09:01.960Z"
},
"webhooks": [
"https://your-server.com/webhook"
]
}
FieldTypeRequiredDescription
images.defaultobjectYesThe main image. Must always use the default key
images.1, images.2, …objectNoAdditional images, keyed with incremental numbers starting at 1
images.{key}.namestringYesOriginal filename
images.{key}.contentHashstringYesHash from upload endpoint
images.{key}.contentTypestringYesMIME type (image/jpeg, image/png)
labelsobjectNoCustom key-value pairs for batching
webhooksarrayNoURLs to notify on completion

Key rules:

  • The main image always goes under default. An images object without a default key is invalid.
  • Additional images use string keys "1", "2", "3", and so on, in order, without gaps.
  • Send either image or images in a request, not both.

Multiple images work with batching, but the two do different things:

  • Multiple images are inputs processed together within a single execution. All the images in images produce one output.
  • Batching groups separate executions together, using the batch labels.

Whether an execution uses one image or several doesn’t change how you batch it. We recommend grouping executions into batches by logical group, such as SKU, reference, or upload day. To do that, give every execution in the group the same batch labels.

Terminal window
curl -X POST "https://api.autoretouch.com/v1/workflow/execution/create?workflow={workflowId}&organization={organizationId}" \
-H "Authorization: Bearer {accessToken}" \
-H "Content-Type: application/json" \
-d '{
"images": {
"default": {
"name": "main-photo.jpg",
"contentHash": "d4d4a63a03c9543f4f21d474500a95d7bb5704c83c139ddc6e005eaba6d54b22",
"contentType": "image/jpeg"
},
"1": {
"name": "additional-photo-1.jpg",
"contentHash": "df3b47d7c2f2d5bf0333ee086e31ff041d4aa85830290e6605e92d79341f9a54",
"contentType": "image/jpeg"
}
},
"webhooks": ["https://your-server.com/webhook"]
}'

Returns the execution ID as plain text, the same as a single-image execution:

c8031492-b74f-44d3-8a7c-08bad01579a5

Create a workflow execution by uploading the image directly. Simpler but slower for high-volume processing.

POST https://api.autoretouch.com/v1/workflow/execution/create
ParameterTypeRequiredDescription
workflowstringYesWorkflow ID
versionstringNoWorkflow version ID
organizationstringRecommendedOrganization ID
label[key]stringNoCustom labels (URL-encoded brackets)

Multipart form data with:

FieldTypeDescription
filefileImage file to process
Terminal window
curl -X POST "https://api.autoretouch.com/v1/workflow/execution/create?workflow={workflowId}&organization={organizationId}" \
-H "Authorization: Bearer {accessToken}" \
-F "file=@product.jpg"
StatusDescription
201 CreatedExecution created successfully
401 UnauthorizedInvalid or missing access token
404 Not FoundWorkflow not found
422 Unprocessable EntityImage cannot be processed

Get a list of workflow executions.

GET https://api.autoretouch.com/v2/workflow/execution/
ParameterTypeDefaultDescription
organizationstring-Organization ID (recommended)
workflowIdstring-Filter by workflow
batchNamestring-Filter by batch name
statusstring-Filter by status
inputFileNamestring-Filter by exact input filename
noBatchboolean-Filter to non-batch executions
limitinteger50Maximum results per page
offsetinteger0Number of results to skip
Terminal window
curl -X GET "https://api.autoretouch.com/v2/workflow/execution/?organization={organizationId}&workflowId={workflowId}&limit=50" \
-H "Authorization: Bearer {accessToken}"
{
"entries": [
{
"id": "97830693-ec56-4773-8706-95ddf3444a40",
"workflow": "a0f0b604-85c0-45fd-85cf-4428bb3941ba",
"workflowVersion": "cd1be60e-6574-44aa-b1cf-f49f9028d56d",
"organizationId": "69f7d0ac-bd88-494d-a38a-f825da7e0c88",
"status": "COMPLETED",
"userId": "google-oauth2|123456789",
"createdAt": "2020-08-04T16:21:56.305Z",
"startedAt": "2020-08-04T14:21:56.504Z",
"finishedAt": "2020-08-04T14:21:56.933Z",
"inputFileName": "product.jpg",
"inputContentHash": "14a47ef8f2a302cf10ebf10e9ac2e368a32ba4c35805aff2f25710e719c38774",
"resultContentHash": "09ad3a37cdd83475c88f99b65ee64167933c93573d7df0326cca72ab4d155a70",
"resultFileName": "product.png",
"resultPath": "/image/09ad3a37cdd83475c88f99b65ee64167933c93573d7df0326cca72ab4d155a70/product.png",
"labels": {
"autoretouch_batch_name": "Spring Collection"
},
"chargedCredits": 10
}
],
"total": 1
}

Get details of a specific execution.

GET https://api.autoretouch.com/v1/workflow/execution/{executionId}
ParameterTypeDescription
executionIdstringExecution ID
Terminal window
curl -X GET "https://api.autoretouch.com/v1/workflow/execution/{executionId}?organization={organizationId}" \
-H "Authorization: Bearer {accessToken}"
{
"id": "97830693-ec56-4773-8706-95ddf3444a40",
"workflow": "a0f0b604-85c0-45fd-85cf-4428bb3941ba",
"workflowVersion": "cd1be60e-6574-44aa-b1cf-f49f9028d56d",
"organizationId": "69f7d0ac-bd88-494d-a38a-f825da7e0c88",
"status": "COMPLETED",
"userId": "google-oauth2|123456789",
"createdAt": "2020-08-04T16:21:56.305Z",
"startedAt": "2020-08-04T14:21:56.504Z",
"finishedAt": "2020-08-04T14:21:56.933Z",
"inputFileName": "product.jpg",
"inputContentHash": "14a47ef8f2a302cf10ebf10e9ac2e368a32ba4c35805aff2f25710e719c38774",
"resultContentHash": "09ad3a37cdd83475c88f99b65ee64167933c93573d7df0326cca72ab4d155a70",
"resultFileName": "product.png",
"resultPath": "/image/09ad3a37cdd83475c88f99b65ee64167933c93573d7df0326cca72ab4d155a70/product.png",
"labels": {},
"chargedCredits": 10
}

Get the status of an execution with server-sent events. The request blocks until the execution reaches a final state.

GET https://api.autoretouch.com/v1/workflow/execution/{executionId}/status
Terminal window
curl -X GET "https://api.autoretouch.com/v1/workflow/execution/{executionId}/status?organization={organizationId}" \
-H "Authorization: Bearer {accessToken}"
id:COMPLETED
event:COMPLETED
data:COMPLETED

Wait for execution to complete and download the result image in one request.

GET https://api.autoretouch.com/v1/workflow/execution/{executionId}/result/default
Terminal window
curl -X GET "https://api.autoretouch.com/v1/workflow/execution/{executionId}/result/default?organization={organizationId}" \
-H "Authorization: Bearer {accessToken}" \
--output result.png

Returns the binary image file on success.

StatusDescription
200 OKImage file returned
404 Not FoundExecution not found

Download a result image using its result path.

GET https://api.autoretouch.com{resultPath}
Terminal window
curl -X GET "https://api.autoretouch.com/image/{contentHash}/filename.png?organization={organizationId}" \
-H "Authorization: Bearer {accessToken}" \
--output result.png
StatusDescription
200 OKImage file returned
403 ForbiddenNot authorized to access this image
404 Not FoundImage not found

Retry a failed or payment-required execution.

POST https://api.autoretouch.com/v1/workflow/execution/{executionId}/retry
Terminal window
curl -X POST "https://api.autoretouch.com/v1/workflow/execution/{executionId}/retry?organization={organizationId}" \
-H "Authorization: Bearer {accessToken}"
  • FAILED executions: Retry at no additional cost
  • PAYMENT_REQUIRED executions: Retry after adding credits (will be charged)
StatusDescription
200 OKRetry initiated
404 Not FoundExecution not found or already completed