X API media metadata: alt text up to 1000 characters for AI images

X's media metadata endpoint takes alt_text.text up to 1000 characters. Write alt text for generated images and size the image with the Sume images API first.

4 min readSume
All posts

X's media metadata request accepts an alt_text object whose text is at most 1000 characters. That is the field to fill for a generated image, so a screen-reader user hears what the picture shows. Sume generates the image; you write the description, since the images API returns pixels and usage data, not an accessibility description.

What does the spec say about alt text?

In the X OpenAPI document, the media metadata schema has alt_text with a text string capped at 1000 characters. The same metadata object also carries a content_expiration timestamp in seconds, which is a different field and does not affect alt text.

X media metadata fields (read 2026-10-02)
FieldDetail
alt_text.textString, maxLength 1000
content_expiration.timestamp_secExpiry timestamp in seconds
Media per post1-4 media_ids in the create-post body

How do I write alt text for a generated image?

Describe what is visible, in plain sentences, and keep it well under the cap. Say what the picture is, such as an illustration or a product render, followed by the subject and any text that appears inside the image. Do not stuff keywords; the cap is a ceiling, not a target.

  • Lead with the subject, then setting and style.
  • Transcribe any words rendered in the image.
  • Leave out phrases like image of; the reader already knows.
  • Keep one description per image when a post has several.

How do I get the right image from Sume?

Request an aspect_ratio that suits the timeline crop, plus output_format jpeg or png. The response gives Sume-hosted image URLs; download one and upload it to X's media endpoint, then set its metadata with the alt text and finally create the post.

import json, os, urllib.request

body = {
    "model": "bytedance-seed/seedream-4.5",
    "prompt": "minimal poster, a paper boat on calm water, soft morning light",
    "aspect_ratio": "16:9",
    "output_format": "png"
}
req = urllib.request.Request(
    "https://api.sume.com/v1/images",
    data=json.dumps(body).encode(),
    headers={
        "Authorization": "Bearer " + os.environ["SUME_API_KEY"],
        "Content-Type": "application/json",
    },
    method="POST",
)
print(urllib.request.urlopen(req).read().decode())

What else should I check?

Confirm the endpoint paths and version in X's live OpenAPI file; they are the source of truth. The images guide lists the parameters Sume accepts.

Sources

Related posts

More in Integrations

All Integrations posts

Written by Sume