Appearance
Fix Passport Photo API
Product overview: Fix Passport Photo API.
Fix an existing passport or ID photo so it meets official requirements. The API evaluates the whole image, corrects only the problems it finds, and leaves already suitable regions unchanged.
This endpoint is for portrait normalization, not beautification. Its highest priority is keeping the person recognizable as the same real individual.
United States and United Kingdom passport rules require an unedited photograph. Do not use this API to correct those documents. Detect the problem and ask for a new capture. Other issuers set their own rules.
The problem it solves
Real users rarely submit a perfectly controlled studio photo. A single image may combine a turned head, a tilted posture, visible teeth, glasses, hard shadows, compression artifacts, or a shoulder that was cut off during an earlier background-removal step. Fixing these issues manually is slow, and chaining separate edits can introduce inconsistent results.
POST /v2/aiEdit applies the necessary corrections together while protecting details that should not change: identity, natural skin texture, age, hair, clothing, background, crop, and overall photographic character.
Use it before specification-based processing
This endpoint improves the portrait itself. It does not select a country-specific document size or guarantee acceptance by an issuing authority. For sizing, background processing, validation, and issue codes, pass the normalized result to the Passport Photo API.
What the API corrects
| Input problem | Correction | What remains protected |
|---|---|---|
| Head turned or tilted; uneven posture | Makes the face naturally front-facing, keeps the head upright, and levels the shoulders when needed | Recognizable facial structure, natural anatomy, framing, and scale |
| Broad smile, open mouth, or visible teeth | Produces a calm, natural, closed-mouth expression | Characteristic lip shape, eye shape, and the person's likeness |
| Eyeglasses, sunglasses, or unsuitable novelty headwear | Removes the obstruction and conservatively reconstructs only hidden facial regions | Hairline, ears, head shape, ordinary jewelry, and religious or cultural head coverings that do not obscure the face |
| Harsh shadows, color casts, overexposure, or underexposure | Balances facial light and color while preserving real skin tone | Pores, age, complexion, and natural texture—without whitening or makeup |
| Blur, noise, compression, or weak local contrast | Restores only the clarity needed for a usable ID-style portrait | Real detail—without invented features, aggressive sharpening, or plastic skin |
| A shoulder or garment ends at an unnatural internal edge | Reconstructs only the missing continuation of the existing clothing and silhouette | Body proportions, clothing, lighting, background, and the existing crop |
If a region already meets these requirements, the API is instructed to leave it unchanged.
Before and after
These synthetic examples illustrate the kinds of corrections the endpoint is designed to make. They are not real customers or identity documents, and individual results vary with the input image.
Before · turned head and visible teeth

After · front-facing and neutral

Before · glasses and hard side light

After · clear face and even light

Before · eyes hidden by dark glasses

After · obstruction removed

Before · blur, noise, and compression

After · conservative quality recovery

Before · shoulder cut off inside frame

After · silhouette reconstructed

Identity-preserving boundaries
The endpoint is designed to preserve facial proportions, face shape, eyes, eyebrows, nose, lips, jawline, cheeks, ears, skin tone and texture, hairstyle, hairline, age, and distinctive characteristics.
It does not intentionally:
- slim, reshape, rejuvenate, beautify, or cosmetically retouch the person;
- change ethnicity or gender presentation;
- whiten skin, add makeup, or create glamour lighting;
- replace the background or clothing;
- add objects or alter regions that are already suitable;
- invent fine facial detail when the source does not contain enough information.
API endpoint
The Fix Passport Photo API uses the request path below. Send the request to the region where your account and data processing are configured:
https://api-us.idphotoapp.com— US regionhttps://api-eu.idphotoapp.com— EU region- Other regional deployments are available on request
http
POST /v2/aiEditRequest
Send exactly one input: imageBase64 or photoUuid.
| Field | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | Your API key. Send requests from your server; do not expose credentials in browser code. |
apiSecret | string | Yes | Your API secret. |
imageBase64 | string | One of the two | Base64-encoded JPEG or PNG, with or without a data URI prefix, up to 20 MB. Use a single-person portrait. |
photoUuid | string | One of the two | The photoUuid of an ID photo that your account made with the Passport Photo API. That photo is used as the input, so you do not need to resend the image. |
specCode | string | No | A specification code, for example uk-passport. When set, previewOutput also shows the specification's measurement guides. It does not resize or crop output. See Find a photo specification. |
outputFormat | string | No | JPEG or PNG. When omitted, the input image format is used. |
outputType | string | No | IMAGE_BASE64 (default) returns the image as Base64. URL stores the image and returns a link that is valid for 2 days. |
jsonc
{
"apiKey": "your-api-key",
"apiSecret": "your-api-secret",
"imageBase64": "data:image/jpeg;base64,...",
"outputFormat": "JPEG",
"outputType": "IMAGE_BASE64"
}To edit an ID photo you already made, pass its photoUuid instead of the image:
jsonc
{
"apiKey": "your-api-key",
"apiSecret": "your-api-secret",
"photoUuid": "your-photo-uuid",
"specCode": "uk-passport",
"outputType": "URL"
}Response
| Field | Type | Description |
|---|---|---|
output | string | The edited image. Base64 without a data URI prefix for IMAGE_BASE64, or a link valid for 2 days for URL. |
previewOutput | string | The same edited image with a Preview watermark, in the same form as output. Show it to your user before they pay or confirm. When specCode is set it also shows the specification's measurement guides. |
width | integer | Output width in pixels. |
height | integer | Output height in pixels. |
photoUuid | string | Returned only when outputType is URL. Identifies the stored result. |
jsonc
{
"output": "/9j/4AAQSkZJRgABAQ...",
"previewOutput": "/9j/4AAQSkZJRgABAQ...",
"width": 600,
"height": 800
}To display a Base64 result as a JPEG in an application, prepend data:image/jpeg;base64, to the value. For storage or further API processing, decode it as binary image data instead. Download URL results within 2 days.
Errors
Errors return a JSON body with a detail field that describes the problem.
| Status | Meaning |
|---|---|
400 | The image cannot be used: no face, more than one face, not a JPEG or PNG, or too large. |
402 | Your account cannot make this call right now. Contact support@idphoto.ai. |
403 | The credentials are invalid, or the account cannot use this endpoint. |
404 | The photoUuid or specCode was not found. |
422 | The request is invalid (for example, both or neither of imageBase64 and photoUuid were sent), or the photo could not be edited. |
502, 503, 504 | Temporary service problem or timeout. Try again later. |
Integration guidance
- Use a clear, single-person portrait and keep the complete image payload on your server. If you already made the ID photo with this account, send its
photoUuidinstead of the image. - Set a client timeout of about 200 seconds. Edits can take a while to finish.
- Do not log credentials or full Base64 values.
- Show
previewOutputto end users before they pay, and deliveroutputonly after they confirm. - Treat authentication failures,
402, invalid image data, and processing failures separately from a successful edit. - Review the edited portrait before passing it to the Passport Photo API. A successful edit does not by itself select or validate a document specification.
