Skip to main content

Documentation Index

Fetch the complete documentation index at: https://www.alttextlab.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

This endpoint lets you generate alt text for an image using AI, tailored to your preferred language, writing style, keywords, product attributes, and contextual information. The API takes a public image URL and returns generated alt text along with metadata about the request.

Endpoint

POST https://app.alttextlab.com/api/v1/alt-text/generate

Request headers

x-api-key: YOUR_API_KEY
Content-Type: application/json
See Authentication for details. Replace YOUR_API_KEY with your actual API key from dashboard settings.

Request

curl -X POST https://app.alttextlab.com/api/v1/alt-text/generate \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "imageUrl": "https://example.com/image.jpg",
    "lang": "en",
    "style": "neutral",
    "keywords": ["eco-friendly", "minimalist"],
    "ecommerce": {
      "product": "T-shirt Relaxed Fit",
      "brand": "Acme Co."
    }
  }'
imageUrl
string
required
Public URL of the image to process. The URL must be directly accessible without authentication or redirects — images behind login pages or private networks cannot be processed.
lang
string
Language code for the generated alt text (e.g. "en", "pl", "de"). Defaults to the language set in your account settings. See supported languages.
style
string
Writing style: "descriptive", "neutral" (default), "matter-of-fact", or "minimal". Defaults to account settings. See writing styles.
keywords
string[]
Keywords to include or emphasize in the output. Useful for SEO alignment. Example: ["healthy breakfast", "avocado toast"].Keywords are not guaranteed to appear in the output. The model will include them when they fit naturally and are consistent with what is depicted. If a keyword cannot be added concisely or contradicts the image content, it will be omitted.
ecommerce
object
Product metadata for e-commerce-optimized alt text. Including any field activates E-commerce Mode.
context
object
Additional context to improve accuracy for ambiguous images. Context clarifies meaning — it does not override what is visible.
customFields
object
Arbitrary key-value pairs (string: string) returned in the response unchanged. Use them to attach identifiers or metadata for matching results to assets in your system. They have no effect on generation.
  • Maximum 30 keys per request
  • Maximum key length: 70 characters
  • Maximum value length: 250 characters
Example: {"sku": "TSHIRT-001", "catalogId": "summer-2025"}

Response body

{
  "id": "gen_abc123xyz",
  "imageUrl": "https://example.com/image.jpg",
  "lang": "en",
  "result": "A white ceramic mug with a minimalist design on a wooden table.",
  "status": "generated",
  "style": "neutral",
  "keywords": ["eco-friendly", "minimalist"],
  "count": 64,
  "ecommerce": {
    "product": "T-shirt Relaxed Fit",
    "brand": "Acme Co.",
    "color": null,
    "material": null
  },
  "customFields": {
    "sku": "TSHIRT-001",
    "catalogId": "summer-2025"
  }
}
id
string
Unique identifier for the generation request.
imageUrl
string
The original image URL submitted.
lang
string
Language used for generation.
result
string | null
The generated alt text. null if the request failed or is still processing.
status
string
"generated" or "failed". Credits are deducted only when the status is "generated". A "failed" response does not consume credits.
style
string
Writing style used.
keywords
string[] | null
Keywords used, or null if none were provided.
count
number
Character count of the generated alt text.
ecommerce
object
The e-commerce fields submitted with the request (product, brand, color, material).
customFields
object | null
The key-value pairs submitted with the request, returned unchanged. null if none were provided.