HomeGuidesAPI Reference
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In

Upload assets

Uploading assets (images, videos and raw files) to Library or Task

  1. Fetch the presigned upload URL and it's related meta fields using the GET /v3/upload-url endpoint. The validity time for this URL is 60 minutes.
  2. Upload the file, along with the related meta fields, through an HTTP POST request to the presigned upload URL. Payload must be in multipart/form-data. The field name for the file must be file. Please make sure that the meta fields are in the same order as they are received. The file field must be appended at the end. If this url is hit multiple times with the same meta fields, the last successfully uploaded file will be used to create the asset in the next step.
  3. Upon success (204 HTTP response code) from the presigned URL, hit the POST endpoint for desired destination (Library or Task) passing the key which was previously obtained from the GET /v3/upload-url endpoint and an arbitrary title as the request payload. If this endpoint is hit multiple times with the same key, each time a new asset will be created 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

Did this page help you?