Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

Dev GuideAPI ReferenceChangelog
Dev GuideAPI ReferenceUser GuideLegal TermsDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Upload assets to library or task

Upload assets (images, videos, and raw files) to the library or a task.

  1. Fetch the pre-signed upload URL and its related meta-fields using the GET /v3/upload-url endpoint. The validity time for this URL is 60 minutes.

  2. Upload the file and related meta fields through an HTTP POST request to the pre-signed upload URL.

    • The payload must be in multipart/form-data.
    • The field name for the file must be file.
    • Ensure that the meta fields are in the same order as received.
    • The file field must be appended at the end.
      If this URL is accessed multiple times with the same meta-fields, the asset is created by the last successfully uploaded file in the next step.
  3. Upon success (204 HTTP response code) from the pre-signed URL, access the POST endpoint for the desired destination (library or task) by passing the key that was previously obtained from the GET /v3/upload-url endpoint and an arbitrary title as the request payload. If this endpoint is accessed multiple times with the same key, each access creates an asset for the same uploaded file.

POST endpoints

  • Add asset to Library – POST /v3/assets
  • Add version to a Library Asset – POST /v3/assets/{asset_id}/versions
  • Add asset to a Task – POST /v3/tasks/{id}/assets
  • Add draft to a Task Asset –POST /v3/tasks/{task_id}/assets/{asset_id}/drafts