API Reference
HTTP API for car photo processing
Submit images as multipart/form-data, receive a job_id, then get the final result by polling or webhook. Use X-API-Key or the api_key form field for authentication.
Create an API key in the personal account and replace YOUR_API_KEY in the examples below.
Integration file for AI agents
Give this markdown file to ChatGPT, Claude, Cursor, Copilot or another AI agent so it can connect AutoMask processing without guessing the API contract.
/api/v1/process
Queues a processing task and immediately returns a job_id. Successful plate hiding or background replacement costs 5 credits.
plate or studio_background.studio, warm, graphite, showroom.#141414, #ffffff, black, white, graphite.true/false, 1/0, smooth/raw. Falls back to the API key default.true fills strictly by the detected mask without edge alignment or softening. Falls back to the API key default.curl -X POST https://automask.ru/api/v1/process \
-H "X-API-Key: YOUR_API_KEY" \
-F "mode=studio_background" \
-F "background=studio" \
-F "plate_color=#111111" \
-F "plate_smoothing=true" \
-F "plate_mask_only=false" \
-F "file=@car.jpg"
/api/v1/analyze
Classifies the photo without editing it. Successful classification costs 1 credit and returns photo type, angle and model classes.
curl -X POST https://automask.ru/api/v1/analyze \
-H "X-API-Key: YOUR_API_KEY" \
-F "file=@car.jpg"
/api/v1/jobs/{job_id}
Polls the queued task. Status values: queued, processing, success, failed.
curl -H "X-API-Key: YOUR_API_KEY" \
https://automask.ru/api/v1/jobs/job_123
/api/v1/webhook
Reads, sets or removes the default webhook URL for an API key. A per-task webhook_url sent to /api/v1/process overrides the default URL.
curl -X PUT https://automask.ru/api/v1/webhook \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"webhook_url\":\"https://automask.ru/webhooks/automask\"}"
Default Background And Plate Color
An API key can store a default background and a default license plate fill color. If plate_color is not sent in /api/v1/process, the service uses the key setting. A per-request plate_color overrides the key default.
Webhook Payload
{
"job_id": "job_123",
"status": "success",
"result": true,
"mode": "studio_background",
"plate_color": "#111111",
"plate_smoothing": true,
"plate_mask_only": false,
"url": "/results/result.webp",
"mask_url": "/masks/result_mask_bg.png",
"analysis": {
"photo_type": {"value": "exterior", "label": "Exterior", "conf": 97},
"view": {"value": "three_quarters_left", "label": "Three quarters left", "conf": 97}
}
}
Python Example
import time
import requests
BASE_URL = "https://automask.ru"
API_KEY = "YOUR_API_KEY"
with open("car.jpg", "rb") as image:
response = requests.post(
f"{BASE_URL}/api/v1/process",
headers={"X-API-Key": API_KEY},
files={"file": image},
data={"mode": "studio_background", "background": "studio", "plate_color": "#111111", "plate_smoothing": "true", "plate_mask_only": "false"},
timeout=60,
)
response.raise_for_status()
job_id = response.json()["job_id"]
while True:
status_response = requests.get(
f"{BASE_URL}/api/v1/jobs/{job_id}",
headers={"X-API-Key": API_KEY},
timeout=30,
)
payload = status_response.json()
if payload["status"] in ("success", "failed"):
print(payload)
break
time.sleep(2)
PHP Example
<?php
$baseUrl = "https://automask.ru";
$apiKey = "YOUR_API_KEY";
$ch = curl_init("$baseUrl/api/v1/process");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["X-API-Key: $apiKey"],
CURLOPT_POSTFIELDS => [
"mode" => "studio_background",
"background" => "studio",
"plate_color" => "#111111",
"plate_smoothing" => "true",
"plate_mask_only" => "false",
"file" => new CURLFile(__DIR__ . "/car.jpg"),
],
]);
$payload = json_decode(curl_exec($ch), true);
curl_close($ch);
$jobId = $payload["job_id"];
do {
sleep(2);
$statusCh = curl_init("$baseUrl/api/v1/jobs/$jobId");
curl_setopt_array($statusCh, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["X-API-Key: $apiKey"],
]);
$status = json_decode(curl_exec($statusCh), true);
curl_close($statusCh);
} while (!in_array($status["status"], ["success", "failed"], true));
print_r($status);
?>