Skip to content

Headshot API ​

Product overview: Headshot API.

Generate a professional portrait from a selfie with POST /v2/makeIdPhoto. Select a predefined photographic style with specCode; each portrait- code defines the setting, clothing, lighting and composition. You do not need to write a prompt or supply a seed.

Before you start ​

  • Get an API key and API secret from the Dashboard.
  • Contact support@idphoto.ai to enable portrait styles for your account.
  • Send requests from your server. Keep credentials, source images and full image payloads out of browser code and logs. See Data Privacy.

Intended use

These are creative portraits for team pages, directories and professional profiles. They are not passport, visa or identity-document photos. For document-photo processing, use the Passport Photo API.

Style examples ​

All six examples below were generated from the same test selfie. The images show each style's visual direction, not a guaranteed result. Review generated portraits for recognizable features and visual artifacts before delivery.

Original selfie used as input for all six portrait examples
Input · original selfie

One person, face clearly visible, with room around the head and shoulders. Select any image to open the full-size WebP in a new tab.

Style codes ​

Send the code exactly as written. To generate a second style from the same selfie, send another request with a different specCode.

StylespecCode
Modern Executiveportrait-executive-gray
Classic Corporateportrait-corporate-blue
Natural Officeportrait-office-natural
Outdoor Professionalportrait-outdoor-professional
LinkedIn Cleanportrait-linkedin-clean
LinkedIn Warmportrait-linkedin-warm

Presets are designed to retain recognizable features and natural texture while changing the scene and styling. Results vary between people and requests. The selected specification determines output dimensions; read widthPx and heightPx from the response.

Endpoint and authentication ​

Choose the API region configured for your account:

RegionBase URL
United Stateshttps://api-us.idphotoapp.com
European Unionhttps://api-eu.idphotoapp.com
http
POST /v2/makeIdPhoto
Content-Type: application/json

Pass apiKey and apiSecret in the JSON request body, using the same authentication as the Passport Photo API.

Quickstart ​

Replace the placeholders with your credentials and a Base64-encoded selfie. This example requests the Modern Executive style and returns image data directly.

bash
curl --request POST \
  --url https://api-us.idphotoapp.com/v2/makeIdPhoto \
  --header 'Content-Type: application/json' \
  --data '{
    "apiKey": "your-api-key",
    "apiSecret": "your-api-secret",
    "imageBase64": "your-base64-encoded-selfie",
    "specCode": "portrait-executive-gray",
    "outputFormat": "IMAGE_BASE64"
  }'

Request fields ​

FieldTypeRequiredDescription
apiKeystringYesYour API key, enabled for portrait styles.
apiSecretstringYesYour API secret.
imageBase64stringYesBase64-encoded source image. A data URI prefix is optional.
specCodestringYesOne of the six portrait- codes listed above.
outputFormatstringNoS3_URL (default) for an image URL, or IMAGE_BASE64 for image data.

Style and composition are controlled by the preset. There are no custom prompt, seed or sample-count fields in this workflow. The endpoint generates one portrait per request.

Response and image handling ​

The response uses the shared Passport Photo API response format. These are the fields most useful for headshot integrations; other shared fields may also be present.

FieldDescription
photoUuidIdentifier for the generated photo.
specCodeThe selected portrait style.
idPhotoUrlGenerated image URL when outputFormat is S3_URL.
idPhotoImageBase64Base64 image data when outputFormat is IMAGE_BASE64.
widthPx, heightPxActual output dimensions in pixels.
issuesShared response field. Portrait generation does not run document-photo issue checks.
  1. Confirm that the request succeeded and the chosen output field is present.
  2. Retrieve the image from idPhotoUrl, or decode idPhotoImageBase64 as image bytes.
  3. Use the returned dimensions when displaying or saving the image.
  4. Review the portrait for identity preservation, framing and generation artifacts before delivery.

Validation limits

The portrait workflow detects and crops the source face before applying the selected style. It does not run document-photo issue checks or a post-generation face match. An empty issues array is not a compliance, identity-match or quality approval.

Input photo guidance ​

  • Use a sharp, well-lit photo with one person and a clearly visible face.
  • Leave room around the head and shoulders. Office portraits use a wider composition than LinkedIn headshots.
  • Avoid severe blur, heavy obstruction, extreme poses and faces that are too small in the frame.
  • Show users the source and generated portrait together when reviewing the result.

Errors and integration guidance ​

SituationWhat to check
403 access deniedConfirm that the credentials and account status are valid and portrait access is enabled. Contact support if the response says the specification is not permitted.
400 unsupported portrait codeUse one of the exact six codes listed on this page.
Request fails or the expected image is missingHandle the failure explicitly. Allow time for AI image processing and do not treat missing image data as success.

For teams, use the same specCode across people to keep a shared visual direction; identical composition is not guaranteed. For a preview followed by final-image delivery, see Watermarked preview and keep the portrait code and account region consistent throughout the flow.