Skip to content

Images

Add an image

POST/v1/forms/{formId}/images

Add a picture to this form for an image choice option, from an upload or a public URL. A file that isn't a usable image answers 400 invalid_image, and the upload is deleted. A URL that can't be fetched answers 400 import_failed. Pictures that neither the draft nor a published version uses are deleted. That happens an hour after their option is removed, or a day after an upload that was never used.

Path parameters

  • formIdstringrequired

    The form's id.

Body

JSON, with Content-Type: application/json.

  • storageIdstring

    The storageId from an upload (see POST /v1/forms/{formId}/images/upload-url). Give this or url.

    1–64 chars

  • urlstring

    A public image to fetch and keep. Private and local addresses are refused. Give this or storageId. Either way, the file must be PNG, JPEG, WebP, GIF or SVG, checked by its bytes, and at most 5 MB. SVGs are cleaned and can be at most 200 KB. Large photos aren't resized, so shrink them to about 1200 px wide first, as the app does.

    max 2000 chars · uri

Response

  • idstringrequired

    The picture's id. Put it in an image choice option's imageId.

  • formIdstringrequired
  • urlstringrequired

    Where visitors load the picture from. The address is public and never changes, and it's cached for a year. A new picture always gets a new id.

  • contentTypestringrequired

    PNG, JPEG, WebP, GIF or SVG, read from the file's bytes.

  • sizeintegerrequired

    Size in bytes.

    -9007199254740991–9007199254740991

  • widthnumberrequired

    Width in pixels.

  • heightnumberrequired

    Height in pixels.

  • sourceUrlstring or nullrequired

    The url the picture was fetched from. Null for an upload.

  • createdAtnumberrequired

    When it was added, in milliseconds since the epoch.

Errors answer with a status and the error shape.