Fix Passport & ID Photo Problems with One API

For apps and photo workflows. Detect pose, expression, glasses, shadows, blur, and cut-off shoulders, then correct only where the issuer allows an edit. AI-edited photos are not acceptable for US or UK passports.

Do not submit an AI-edited photo for a US or UK passport. The US Department of State says not to use a photo created or edited with artificial intelligence or other digital tools. UK digital photo rules say the photo must be unedited and that you can’t “correct” it. GOV.UK guidance for photographers says digital enhancement is not acceptable. The AI Photo Editing API reference does not guarantee acceptance by an issuing authority.

The photo problems users actually submit

Real uploads are rarely studio portraits. The AI Photo Editing API reference groups them into six problems. POST /v2/aiEdit corrects only the problems it finds and leaves suitable regions unchanged.

ProblemWhat the edit doesWhat stays
PoseTurns a rotated or tilted head toward the camera and levels shoulders when needed.Facial structure, framing, and scale.
ExpressionCloses a broad smile or visible teeth into a calm expression.Lip shape, eye shape, and likeness.
GlassesRemoves eyeglasses, sunglasses, or novelty headwear that hides the face, and reconstructs only the hidden area.Hairline, ears, ordinary jewelry, and religious or cultural head coverings that do not hide the face.
LightingBalances harsh shadows, color casts, and exposure on the face.Skin tone, pores, age, and texture. No whitening or makeup.
QualityReduces blur, noise, compression, and weak local contrast when the source still has detail.Real detail. No invented features or plastic skin.
ShoulderRebuilds a shoulder or garment that ends on an unnatural edge inside the frame.Body proportions, clothing, lighting, background, and the existing crop.

Passport Photo API photo issue codes are the detection step: head yaw and pitch, expression, glasses, light balance, brightness, sharpness, and incomplete shoulders. Common passport photo mistakes explains the same problems in language you can show a user. For a guided capture on the person’s own device, point them to make a passport photo on your phone. That app is separate from this API, and an edit there is still subject to the issuer’s rules.

Before and after examples

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.

Synthetic portrait before editing, with the subject's head turned and teeth visible in a broad smile Before · turned head and visible teeth
Synthetic portrait after editing, with the same subject facing forward with a neutral closed-mouth expression After · front-facing and neutral
Pose and expression. The face is brought toward the camera and the expression is neutralized while age, hair, skin texture, clothing, and background stay consistent.
Synthetic portrait before editing, with prescription glasses and strong uneven lighting across the face Before · glasses and hard side light
Synthetic portrait after editing, with the same subject's glasses removed and facial lighting balanced After · clear face and even light
Face visibility and lighting. Glasses are removed, only the covered area is reconstructed, and the light imbalance is corrected without a new background or glamour retouching.
Synthetic portrait before editing, with the subject's eyes and eyebrows obscured by dark glasses Before · eyes hidden by dark glasses
Synthetic portrait after editing, with the same subject's dark glasses removed and the obscured eye area reconstructed After · obstruction removed
Dark-glasses removal. Frames and lenses are removed and only the hidden eye and eyebrow region is reconstructed.
Synthetic portrait before editing, with moderate focus softness, visible image noise, and compression artifacts Before · blur, noise, and compression
Synthetic portrait after editing, with the same subject rendered more clearly while retaining natural age and skin texture After · conservative quality recovery
Recoverable image quality. Noise, compression, softness, and weak contrast are reduced without aggressive sharpening or invented facial detail.
Synthetic portrait before editing, with one sweater shoulder ending at an unnatural straight edge inside the image Before · shoulder cut off inside the frame
Synthetic portrait after editing, with the same subject's missing shoulder and sweater area naturally reconstructed After · silhouette reconstructed
Incomplete silhouette. Only the missing shoulder and sweater continuation are repaired. A shoulder that already ends naturally is not changed.

Identity-preserving by design

The endpoint’s priority is that the person stays recognizable as the same individual. It is portrait normalization, not a beauty filter. It does not slim or reshape the face, change age or skin tone, add makeup, replace the background or clothing, or fill in detail that was never in the photo. If a region is already suitable, it is left as it is.

Where AI edits are allowed, and where they are not

Government passport and visa rules are not uniform, and several of them forbid this kind of edit:

For a government ID, the workflow to recommend is detect, crop and size within the published rules, and send the person back for a new photo when the issue is pose, expression, glasses, or a changed face. Do not tell them an edited file will be accepted.

Edits fit employee badges, member cards, internal directories, and platform profile photos when your customer’s own policy allows a corrected portrait. Employee badge photos are that kind of workflow. Confirm the policy before you turn the edit on.

Recommended workflow: detect, correct, re-check

Detect issues with the Passport Photo API

POST /v2/makeIdPhoto returns the sized photo and an issues array. Map photo issue codes to a retake message. For passports, stop here when the issue is something an edit would conceal.

Correct with POST /v2/aiEdit

Use this only for scenes where a corrected portrait is allowed. One request handles the problems present in that image. Access may need to be enabled on the account.

Re-validate against the target spec

Pass the edited portrait through the Passport Photo API again with the destination specCode. A successful edit does not select a document size or clear the issue list. Read photo spec codes for the code to send.

API request and response

Full fields are in the AI Photo Editing API reference. Hosts are https://api-us.idphotoapp.com and https://api-eu.idphotoapp.com.

curl -sS -X POST "https://api-us.idphotoapp.com/v2/aiEdit" \
  -H "Content-Type: application/json" \
  -d '{
    "apiKey": "YOUR_API_KEY",
    "apiSecret": "YOUR_API_SECRET",
    "imageBase64": "BASE64_IMAGE",
    "outputFormat": "JPEG",
    "outputType": "IMAGE_BASE64"
  }'
{
  "output": "/9j/4AAQSkZJRgABAQ...",
  "width": 600,
  "height": 800
}

output is Base64 without a data-URI prefix. width and height are the output pixels. To show a JPEG, prefix data:image/jpeg;base64,. Do not log credentials or the full image payload.

Use cases

Why use this endpoint instead of a generic editor

POST /v2/aiEdit looks at one portrait and corrects only the problems it finds: pose, expression, glasses, lighting, recoverable quality, and a shoulder that ends on an unnatural inner edge. Regions that are already fine stay as they are. The edit is built to keep the person recognizable. It does not slim the face, add makeup, or replace the background and clothing. You still pass the result through the Passport Photo API, because an edit does not choose a document size or clear the issue list. Access may need to be enabled on the account. The boundary is part of the product: AI-edited photos are not acceptable for US or UK passports. Use the endpoint for employee badges, member cards, directories, and other workflows whose policy allows a corrected portrait. For a government passport, detect the issue and ask for a new photo.

FAQ

Can I use AI-edited photos for a passport?

No for US and UK passports. The US Department of State says not to use a photo created or edited with artificial intelligence or other digital tools. UK rules say a digital passport photo must be unedited and that you cannot correct it. Other issuers set their own rules. For a government passport or visa, detect problems, crop and size only where that is allowed, and ask the person to retake the photo when an edit would change them.

Does it change the person's face?

It is built to keep the person recognizable. The edit does not slim, reshape, rejuvenate, or beautify the face, change skin tone, replace clothing or the background, or invent detail the source photo does not contain. Review the result before you use it.

What formats are supported?

Send a Base64 JPEG or PNG of a single person, with or without a data URI prefix. outputFormat may be JPEG or PNG. If you omit it, the input format is used. The response returns the image as Base64 in output, plus width and height.

How is data handled?

Send the image from your server to the US or EU regional endpoint. Transmission is encrypted. This endpoint returns Base64, so you can avoid storing the photo on our service. See the data privacy policy for retention options on other endpoints.

Is access enabled by default?

Not always. The AI Photo Editing API documentation says access to POST /v2/aiEdit may need to be enabled for the account. Contact support if the endpoint is not available on your key.

Correct portraits only where the rules allow

Access to POST /v2/aiEdit may need to be enabled. Read the API reference, then try a single-person portrait on your server.