Skip to content

Headshot API ​

Generate professional portrait variations from a reference image and a text prompt. A fixed prompt and seed can be reused to create a consistent visual style for different subjects.

Headshot generation is a creative portrait workflow. It does not produce or validate a passport, visa, or identity-document photo. Use the Passport Photo API for document-photo processing.

Access and the service base URL are provided separately. Use the base URL assigned to your integration.

Generate a portrait ​

http
POST /api/generate-portrait

Request ​

FieldTypeRequiredDefaultDescription
apiKeystringYes—API key enabled for Headshot generation.
promptstringYes—Describes the desired lighting, background, clothing, and photographic style.
seedintegerNo-1Positive fixed value for repeatable style behaviour; -1 selects a random seed.
sampleNumberintegerNo1Number of output images, from 1 to 8.
identityScalenumberNo0.8Identity-preservation strength from 0 to 1.
inputImagesarray of stringsYes—Base64 reference images. Currently one primary reference image is supported.
outputImageWidthintegerNo768Output width in pixels, from 512 to 2024.
outputImageHeightintegerNo1024Output height in pixels, from 512 to 2024.

Recommended output sizes include 768 × 768 for a square portrait and 768 × 1024 for a 3:4 portrait.

json
{
  "apiKey": "your-api-key",
  "prompt": "Professional studio headshot, neutral background, soft even lighting, business attire",
  "seed": 18421,
  "sampleNumber": 2,
  "identityScale": 0.8,
  "inputImages": [
    "data:image/jpeg;base64,..."
  ],
  "outputImageWidth": 768,
  "outputImageHeight": 1024
}

Response ​

json
{
  "outputImages": [
    "data:image/jpeg;base64,...",
    "data:image/jpeg;base64,..."
  ]
}

The number of entries in outputImages follows sampleNumber.

Build reusable styles ​

The prompt controls the requested visual direction, while the seed helps keep a similar style across calls. Once you find a useful combination:

  1. Save the prompt and positive seed in your application.
  2. Give the combination a name such as corporate-headshot.
  3. Reuse it with different reference images.
  4. Review outputs before delivery; generated results may still vary between subjects and inputs.

A fixed prompt and seed improve style consistency but do not guarantee pixel-identical composition.

Input and output guidance ​

  • Use a clear, front-facing reference portrait with one subject.
  • Avoid small faces, severe blur, heavy occlusion, and extreme poses.
  • Keep the API key and source images on your server.
  • Base64 images can make responses large; set an appropriate request timeout and avoid logging full payloads.
  • Review identity preservation and visual artifacts before presenting or storing an output.
  • Generated headshots should not be represented as official identity-document photos.