For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation
Overview Agent Access Ads ChatGPT + Codex user docs Use cases

API Reference

Upload Image

POST
/upload

Upload an image URL or image file and return a file id.

The same endpoint also accepts multipart/form-data with a binary file.

Set purpose to account_favicon when you upload an image for account brand review. The image must be at least 128 × 128 pixels.

To resolve an icon from the client's website, send its image_url and purpose: account_favicon.

To upload a local image, send purpose as a multipart form field.

Assign the returned file_id with POST /ad_account/brand.

Pass the returned file_id when you create or update an ad creative.

For an ad with multiple images, upload each image separately under the same ad account and pass the returned IDs in creative.file_ids. Use 4–6 distinct square (1:1) images in display order. See Create an ad with multiple images for requirements and a complete example.

Upload Image

curl https://api.ads.openai.com/v1/upload \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $OPENAI_ADS_API_KEY" \
    -d '{
          "image_url": "https://example.com/assets/workspace-planner-card.png"
        }'
200 — success
{
  "file_id": "file_901"
}
Body Parameters
JSON

Content type: application/json

file: optional file

Image file to upload using multipart/form-data. Cannot be combined with image_url.

image_url: optional string

URL of the image to upload. Cannot be combined with file.

purpose: optional "account_favicon"

Use account_favicon for an account icon of at least 128 x 128 pixels. The returned file ID can be assigned with POST /ad_account/brand.

Body Parameters
Form Data

Content type: multipart/form-data

file: optional file

Image file to upload using multipart/form-data. Cannot be combined with image_url.

image_url: optional string

URL of the image to upload. Cannot be combined with file.

purpose: optional "account_favicon"

Use account_favicon for an account icon of at least 128 x 128 pixels. The returned file ID can be assigned with POST /ad_account/brand.

Returns
file_id: string
Returns Examples
200 — success
{
  "file_id": "file_901"
}