Quickstart
Three steps take you from keys to a finished photo. Use a test key while you build: it is free and behaves exactly like a live key, except that results carry a watermark.
Keep your credentials on your server
You get a client ID and a subscription key. Store both as environment variables on your backend. Never ship the key in a mobile app or in browser code.
Send the photo
Post the image as
multipart/form-datawith the document id. The call waits for the engine and answers with the verdict, usually within 2 to 6 seconds.curl https://visapicture.com/api/v1/photos \ -H "X-Client-Id: $VISAPICTURE_CLIENT_ID" \ -H "Authorization: Bearer $VISAPICTURE_KEY" \ -H "Idempotency-Key: order-1042" \ -F "document=us-passport" \ -F "file=@portrait.jpg"Act on the status
If
statusispassed, download the image fromresult.urlwithin the hour and store it yourself. If it isfailed, show theissuesmessages to your user so they can retake the photo.
Authentication
Every request carries two headers. The client ID says who you are and is safe to log. The subscription key is the secret.
X-Client-Id: vp_cid_3f9a1c0d2b7e4f6a9c5d1e0b
Authorization: Bearer vp_test_sk_Zk3…| Credential | Looks like | Use |
|---|---|---|
| Client ID | vp_cid_… | Identifies your account. Sent in X-Client-Id. |
| Test key | vp_test_sk_… | Free. Results are watermarked. Has its own monthly quota. |
| Live key | vp_live_sk_… | Clean results. Counts toward your plan. |
A key is shown once, when it is created. We keep only a fingerprint of it, so a lost key cannot be recovered. Ask for a new one and have the old one revoked. You can hold several keys at once, which lets you rotate without downtime.
The API is for server-to-server calls. It sends no CORS headers, so browsers cannot call it directly, which protects your key.
Process a photo
POST /photos
| Field | Where | Description |
|---|---|---|
file | Form, required | The portrait. JPEG, PNG or HEIC, up to 4 MB. 2400 px on the long side is more than enough. |
document | Form, required | A document id such as us-passport. See Documents. |
Idempotency-Key | Header, optional | A unique string of up to 128 letters, digits or symbols without spaces, for example your order number. A retry with the same key returns the first result and is not counted twice. Test and live keys keep separate lists, and a request that ended in an error can be retried with the same key. |
The response is 201 Created with a photo object. A replayed idempotent request answers 200 with the header Idempotent-Replayed: true.
{
"object": "photo",
"id": "5b0c9d1e-7a41-4f0e-9c1b-2f6f0e7a3d55",
"mode": "live",
"document": "us-passport",
"status": "passed",
"issues": [
{
"code": "strong_smile",
"severity": "warn",
"message": "Use a neutral expression; a big smile may be rejected."
}
],
"measurements": {
"head_height_mm": 31.1,
"eye_from_bottom_mm": 31.0,
"eye_from_top_mm": 19.8,
"top_margin_mm": 4.4,
"chin_to_bottom_mm": 15.3,
"center_offset_mm": -0.1,
"upscale": 0.82
},
"ranges": {
"head_height": { "value": 31.1, "range": { "min": 25.4, "max": 34.9 }, "pass": true },
"eye_line": { "value": 31.0, "range": { "min": 28.6, "max": 34.9 }, "pass": true },
"top_margin": { "value": 4.4, "range": { "min": 2.0, "max": 8.1 }, "pass": true }
},
"output": { "width_px": 600, "height_px": 600, "dpi": 300 },
"source": { "width_px": 1920, "height_px": 2400 },
"result": {
"url": "https://…/photo.jpg?token=…",
"url_expires_at": "2026-11-27T15:04:05.000Z",
"content_type": "image/jpeg"
},
"error_code": null,
"processing_ms": 2840,
"created_at": "2026-11-27T14:04:05.000Z",
"expires_at": "2026-11-28T14:04:05.000Z"
}For the best results, send the original camera photo: face the camera, even light, nothing covering the face. The engine straightens a tilted head by up to 25 degrees and brightens a dim photo on its own. It cannot repair blur, a black-and-white photo or a turned head.
Reading the result
A request that reaches the engine always returns a photo object. The status field carries the verdict.
| Status | Meaning | What to do |
|---|---|---|
passed | The photo meets every rule we check. result.url holds the finished image. | Download and store it. Show any warn issues to your user. |
failed | The photo breaks at least one rule. There is no result. | Show the fail messages and ask for a new photo. Not counted toward your quota. |
Each entry in issues has a stable code for your logic, a severity and a plain-language message written for the person in the photo.
| Severity | Meaning |
|---|---|
fail | Breaks an official rule, for example a tilted head, closed eyes, a second face, blur or a black-and-white photo. |
warn | The photo passed, but something may still cause a rejection, for example a big smile or a low-resolution source. |
{
"object": "photo",
"id": "c1a7e6b2-3d94-4a8e-b0f5-91d2c4e8a771",
"mode": "live",
"document": "uk-passport",
"status": "failed",
"issues": [
{
"code": "head_tilted",
"severity": "fail",
"message": "Your head is tilted. Keep both eyes level."
}
],
"result": null
}measurements are taken on the finished photo, in millimetres at print size. ranges pairs each official rule with its allowed range and whether the photo is inside it, so you can show your users the proof.
Retrieve a photo
GET /photos/{id}
Returns the same photo object with a fresh download link. Use it when the first link has expired. Its status can also be processing while a request is still running, or error if that request failed. Photos made with a test key are only visible to test keys, and live photos to live keys.
curl https://visapicture.com/api/v1/photos/5b0c9d1e-7a41-4f0e-9c1b-2f6f0e7a3d55 \
-H "X-Client-Id: $VISAPICTURE_CLIENT_ID" \
-H "Authorization: Bearer $VISAPICTURE_KEY"Documents
GET /documents GET /documents/{id}
Lists every document the engine can produce, with the official size, head-height range and background it enforces. These are the ids you can use today.
| Document id | Document | Size | Head height |
|---|---|---|---|
us-passport | US Passport | 2 x 2 in (51 x 51 mm) | 25.4 to 34.9 mm |
us-visa | US Visa | 2 x 2 in (51 x 51 mm) | 25.4 to 34.9 mm |
uk-passport | UK Passport | 35 x 45 mm (1.38 x 1.77 in) | 29 to 34 mm |
schengen-visa | Schengen Visa | 35 x 45 mm (1.38 x 1.77 in) | 32 to 36 mm |
india-passport | Indian Passport | 35 x 45 mm (1.38 x 1.77 in) | 36 to 38.25 mm |
india-visa | Indian Visa (e-Visa) | 2 x 2 in (51 x 51 mm) | 25.4 to 34.9 mm |
curl https://visapicture.com/api/v1/documents \
-H "X-Client-Id: $VISAPICTURE_CLIENT_ID" \
-H "Authorization: Bearer $VISAPICTURE_KEY"Usage
GET /usage
Shows how many photos have passed this calendar month, in UTC, and what remains of your quota in each mode. Only photos that pass are counted. Failed photos and errors are free. Photos that are still being processed hold a place in the quota until they finish.
curl https://visapicture.com/api/v1/usage \
-H "X-Client-Id: $VISAPICTURE_CLIENT_ID" \
-H "Authorization: Bearer $VISAPICTURE_KEY"{
"object": "usage",
"client_id": "vp_cid_3f9a1c0d2b7e4f6a9c5d1e0b",
"period_start": "2026-11-01T00:00:00.000Z",
"period_end": "2026-12-01T00:00:00.000Z",
"live": { "photos_passed": 412, "monthly_quota": 1000, "remaining": 588 },
"test": { "photos_passed": 37, "monthly_quota": 200, "remaining": 163 },
"rate_limit_per_minute": 30
}Errors
Errors use standard HTTP status codes and always have the same body. Branch on error.code, and quote request_id when you ask us for help. Every response also carries it in the X-Request-Id header.
{
"error": {
"code": "invalid_credentials",
"message": "The client ID or subscription key is not valid.",
"request_id": "req_8f3a1c0d2b7e4f6a9c5d1e0b3a7f2c4d"
}
}| HTTP | Code | Meaning |
|---|---|---|
| 400 | invalid_request | A field is missing or malformed. The message says which one. |
| 400 | unknown_document | The document id is not one we support. |
| 401 | missing_credentials | The X-Client-Id or Authorization header is missing. |
| 401 | invalid_credentials | The client ID and key do not match, or the key was revoked. |
| 403 | client_disabled | The API client has been disabled. |
| 404 | not_found | No such photo or document. Photos are deleted after 24 hours. |
| 409 | request_in_progress | A request with the same Idempotency-Key is still running. |
| 413 | file_too_large | The upload is larger than 4 MB. |
| 413 | image_too_large | The image has more than 64 megapixels. |
| 422 | unsupported_format | The file is not a JPEG, PNG or HEIC image. |
| 422 | unreadable_image | The file is damaged or is not an image. |
| 429 | rate_limited | Too many requests in the last minute. Wait for Retry-After seconds. |
| 429 | quota_exceeded | The monthly quota for this mode is used up, or is held by photos still in progress. |
| 500 | engine_error | The engine failed or ran out of time. Retry, with the same Idempotency-Key if you sent one. Errors are never counted. |
| 503 | service_unavailable | A temporary outage. Retry with backoff. |
Retry 429, 500 and 503 with backoff, and send an Idempotency-Key so a retry can never be counted twice. Do not retry other 4xx errors without changing the request.
Two responses can come from the hosting platform instead of the API, with a body that is not our JSON: 413 when the upload is larger than about 4.5 MB, and 504 in the rare case a request runs out of time. Check the status code before you parse the body.
Limits and retention
| Limit | Value |
|---|---|
| Upload size | 4 MB and 64 megapixels per photo |
| Formats | JPEG, PNG, HEIC |
| Request time | Usually 2 to 6 seconds, up to about 15 after idle periods. Set your client timeout to 60 seconds. |
| Rate limit | 30 requests per minute by default, across all endpoints. A 429 includes Retry-After. |
| Monthly quota | Set per client, counted on photos that pass. See Usage. |
| Download link | Valid for 1 hour, or until the photo expires if that is sooner. Request a new one with Retrieve a photo. |
| Retention | A finished photo is available for 24 hours after processing and is erased from our storage within the following hour. The uploaded original is never stored. |
Download the result and keep it in your own storage. Once a photo is erased we hold only the usage record: the time and the outcome, with no image and no measurements.
Test mode
A test key runs the real engine with the real rules, so the status, issues and measurements you see are exactly what a live key would return. The only difference is a visible TEST watermark across the finished image. Test photos are free and have their own monthly quota, so you can build and run your automated tests without spending anything.
Switching to production is a one-line change: replace the test key with your live key.
Getting access
The API is in private beta. Keys are issued by our team: you receive a client ID, a test key to build with and, once you are ready, a live key with a monthly quota that fits your volume. Paid plans will follow the beta.
To ask for access, write to developers@visapicture.com with your company name and the number of photos you expect each month.
The full machine-readable description is available as an OpenAPI 3.1 document, which you can import into Postman or use to generate a client.