Skip to content

API: Images

Create an image document, blank or from a template

POST /api/v1/images: Create an image document, blank or from a template

Last updated:

POST/api/v1/images

Authentication#

Send the secret in the header Authorization: Bearer <secret>: the local token in local mode, an API key in network mode. An API key needs the edit scope; the local token has every scope. See the API overview for both modes.

Request body#

Content type application/json.

NameTypeRequiredDescription
backgroundstringno#RRGGBB, #RRGGBBAA or transparent; default #FFFFFF.
heightintegernoPixels, 1 to 4096, with width.
idstringnoAn id of your own; E_ID_EXISTS when taken.
namestringno1 to 120 characters; default Untitled.
presetstringnovideo_thumbnail, square_post or vertical_cover.
templatebooleannoMake a template whose text and image layers may be slots.
template_idstringnoMake the image from this template.
valuesmap of image.SlotValuenoSlot name to {text} or {asset}, with template_id.
widthintegernoPixels, 1 to 4096, with height.

Responses#

200 OK#

Content type application/json. Schema: ImageCreateResult.

NameTypeRequiredDescription
heightintegerno
image_idstringno
revisioninteger (int64)no
textstringno
untrusted_noticestringno
widthintegerno

400#

Validation failed; errors maps each field to its messages and issues lists each problem with its code, key and params

Content type application/problem+json. Schema: Problem.

401 Unauthorized#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

403#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

409#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

422 Unprocessable Content#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

429#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

Any other status#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

curl -X POST "http://127.0.0.1:7878/api/v1/images" \
  -H "Authorization: Bearer $STUARTY_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Response examples

{
  "height": 0,
  "image_id": "string",
  "revision": 0,
  "text": "string",
  "untrusted_notice": "string",
  "width": 0
}

The examples are built from the schemas of the OpenAPI document, so a value is a placeholder of its type. The fields that carry the real values are in the tables.