Media

Generate alternative text for an image

Generates alternative text from the stored 400-pixel JPEG thumbnail and optional post text used as untrusted context, then saves it only when the media still has no alternative text.

post/media/{id}/alt-text/generate

Request

  • Base URL: https://app.openpo.st/api/v1
  • URL: https://app.openpo.st/api/v1/media/{id}/alt-text/generate
  • Auth: one of:
    • HTTP bearer
    • API key in cookie openpost_session

Path parameters

idstring required

Media ID

Request body

$schemastring uri

A URL to the JSON Schema for this object.

localestring

BCP 47 locale for the generated alt text; defaults to English

post_contextstring

Optional post text used only to disambiguate details visible in the image

Example request

{
  "$schema": "https://example.com/api/v1/schemas/GenerateMediaAltTextInputBody.json"
}

Response

OK

$schemastring uri

A URL to the JSON Schema for this object.

alt_textstring required

Persisted alternative text

generatedboolean required

Whether this request generated and persisted new alternative text

modelstring required

Model that generated the alternative text; empty when existing text was returned

Example response

{
  "$schema": "https://example.com/api/v1/schemas/GenerateMediaAltTextOutputBody.json"
}

Changes

No recorded changes to this operation across all 1 revision of this API.