Skip to content

Errors & Status

Understanding error responses and execution statuses helps you build robust integrations with the AutoRetouch API.

CodeMeaningDescription
200 OKSuccessRequest completed successfully
201 CreatedCreatedResource created (e.g., execution, upload)
CodeMeaningDescription
400 Bad RequestInvalid requestMalformed request body or parameters
401 UnauthorizedAuthentication requiredMissing or invalid access token
403 ForbiddenAccess deniedValid token but insufficient permissions
404 Not FoundResource not foundWorkflow, execution, or image doesn’t exist
422 Unprocessable EntityInvalid contentImage cannot be processed (format, size, etc.)
CodeMeaningDescription
500 Internal Server ErrorServer errorUnexpected error on our side
503 Service UnavailableTemporarily unavailableService is temporarily down

Most error responses follow this JSON structure:

{
"timestamp": "2020-09-16T21:09:15.863+00:00",
"status": 404,
"error": "Not Found",
"message": "Workflow execution not found",
"path": "/v1/workflow/execution/invalid-id"
}
FieldDescription
timestampWhen the error occurred (ISO 8601)
statusHTTP status code
errorError type
messageHuman-readable description
pathRequest path that caused the error

OAuth errors use a different format:

{
"error": "invalid_grant",
"error_description": "Invalid or expired device code."
}
ErrorDescription
invalid_grantDevice code expired, invalid, or refresh token revoked
authorization_pendingUser hasn’t confirmed device yet (keep polling)
slow_downPolling too frequently (increase interval)

Workflow executions go through several states:

StatusDescriptionAction
CREATEDExecution queued, waiting to startWait for processing
ACTIVECurrently processingWait for completion
COMPLETEDSuccessfully finishedDownload result
IN_QAAwaiting quality assurance reviewWait for QA approval
PAYMENT_REQUIREDInsufficient creditsAdd credits, then retry
FAILEDProcessing failedRetry or investigate
CREATED → ACTIVE → COMPLETED
→ IN_QA → COMPLETED
→ PAYMENT_REQUIRED
→ FAILED

The execution finished successfully. The response includes:

  • resultPath: Path to download the result image
  • resultContentHash: Hash of the result image
  • chargedCredits: Credits consumed

The execution has finished processing but is awaiting quality assurance review. This happens when QA is enabled for the workflow or batch.

Resolution:

  • Wait for QA approval in the AutoRetouch web app
  • Use webhooks to get notified when the status changes

The organization’s credit balance was insufficient when the execution was created or processed.

Resolution:

  1. Add credits to the organization
  2. Call the retry endpoint

The execution encountered an error during processing. This could be due to:

  • Invalid input image
  • Processing component failure
  • System error

Resolution:

  1. Check the input image is valid
  2. Retry the execution (no additional cost)
  3. If persistent, contact support

Check if the API is available:

GET https://api.autoretouch.com/health

Returns 200 OK with empty body if healthy.

Check a specific API version:

GET https://api.autoretouch.com/v1/health

Returns 200 OK if the v1 API is available and supported.


The API implements rate limiting to ensure fair usage. Rate limit headers are included in responses:

HeaderDescription
X-RateLimit-LimitMaximum requests allowed
X-RateLimit-RemainingRequests remaining in window
X-RateLimit-ResetUnix timestamp when limit resets

If you exceed the rate limit, you’ll receive a 429 Too Many Requests response. Wait until the reset time before retrying.


Implement exponential backoff for transient errors:

import time
import requests
def api_request_with_retry(url, headers, max_retries=3):
for attempt in range(max_retries):
response = requests.get(url, headers=headers)
if response.status_code == 200:
return response
if response.status_code in [429, 500, 503]:
wait_time = (2 ** attempt) + 1 # 1s, 3s, 5s
time.sleep(wait_time)
continue
# Non-retryable error
response.raise_for_status()
raise Exception("Max retries exceeded")
  1. Always check HTTP status codes before parsing response body
  2. Handle 401 errors by refreshing the access token
  3. Log error responses including the full response body for debugging
  4. Implement retries for 429, 500, and 503 errors
  5. Monitor execution statuses and handle FAILED/PAYMENT_REQUIRED appropriately