HomeGuidesAPI Reference
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In

Upload assets

Upload assets to library or 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, along with the related meta fields, through an HTTP POST request to the pre-signed upload URL.
    1. Payload must be in multipart/form-data.
    2. The field name for the file must be file.
    3. Ensure that the meta fields are in the same order as they are received.
    4. The file field must be appended at the end.
    5. If this URL is hit multiple times with the same meta fields, the last successfully uploaded file is used to create the asset in the next step.
  3. Upon success (204 HTTP response code) from the pre-signed 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 is 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

What’s Next