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.

AI markdown

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 contract Webhook and polling AI prompt
MD automask-ai-integration.md Self-contained instruction for an AI agent ↓ Download file
POST

/api/v1/process

Queues a processing task and immediately returns a job_id. Successful plate hiding or background replacement costs 5 credits.

fileSource image file: JPG, PNG or WEBP.
urlSource image URL. Used when no file is provided.
modeplate or studio_background.
backgroundPreset: studio, warm, graphite, showroom.
background_fileCustom JPG/PNG/WEBP background. Overrides the preset.
plate_colorOptional license plate fill color: #141414, #ffffff, black, white, graphite.
plate_smoothingOptional plate edge smoothing: true/false, 1/0, smooth/raw. Falls back to the API key default.
plate_mask_onlySeparate flag. true fills strictly by the detected mask without edge alignment or softening. Falls back to the API key default.
webhook_urlOptional URL that receives the final task payload.
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"
POST

/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"
GET

/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
GET / PUT / DELETE

/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\"}"
Key Defaults

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);
?>

Credits And Errors

ProcessingPlate hiding and background replacement cost 5 credits per successful result.
ClassificationImage classification costs 1 credit per successful request.
401API key is missing, invalid or disabled.
402Not enough credits to start the operation.
415Unsupported file format.
422The model could not classify the image, create a background mask or detect the plate.