---
title: POST /assets/{asset_id}/versions
slug: content-marketing-platform/api/post-assetsassetidversions
docTags: 
createdAt: 2026-10-01T18:51:28.134Z
---

{
  "id": "cp3id262KBR1m_LfNJhJm",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.cmp.optimizely.com/v3/assets/{asset_id}/versions",
    "servers": [
      {
        "url": "https://api.cmp.optimizely.com/v3/assets/{asset_id}/versions",
        "description": "v3 version of Optimizely CMP Open API"
      }
    ],
    "name": "POST /assets/{asset_id}/versions",
    "description": "<p>Add a new version to a library asset. Supports adding versions to only <code>images</code>, <code>videos</code>, and <code>raw files</code> type assets. See <a href=\"https://docs.developers.optimizely.com/content-marketing-platform/docs/upload-assets\" target=\"_blank\">Upload assets</a> to upload a version to a library asset.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "asset_id",
          "type": "string",
          "example": "5d7f910551b00a722e0418830cee6631",
          "description": "Unique identifier of the asset"
        }
      ],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "Payload to add a version to a library asset",
          "customType": "AssetVersionCreateRequest",
          "schema": [
            {
              "name": "key",
              "kind": "required",
              "type": "string",
              "description": "<p>Unique identifier of the file upload session. This is the <code>upload_meta_fields.key</code> field retrieved from the <code>/v3/upload-url</code> endpoint.</p>",
              "maxLength": 100
            },
            {
              "name": "title",
              "kind": "required",
              "type": "string",
              "description": "Title of the asset",
              "example": "sample_image.png",
              "minLength": 1,
              "maxLength": 100
            }
          ],
          "modelRef": "#/components/schemas/AssetVersionCreateRequest",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "OAuth2",
          "name": "OAuth2",
          "kind": "optional",
          "type": "oauth2",
          "oauth2Flows": {
            "clientCredentials": {
              "tokenUrl": "https://accounts.cmp.optimizely.com/o/oauth2/v1/token",
              "scopes": {}
            },
            "authorizationCode": {
              "authorizationUrl": "https://accounts.cmp.optimizely.com/o/oauth2/v1/auth",
              "tokenUrl": "https://accounts.cmp.optimizely.com/o/oauth2/v1/token",
              "scopes": {
                "openid": "Grants the ability to receive a unique identifier for the user.",
                "profile": "Grants access to user profile information.",
                "offline_access": "Grants the ability to refresh access_token using the refresh token even when user is not present (not logged in)."
              }
            }
          },
          "requiredScopes": [
            "openid",
            "profile",
            "offline_access"
          ]
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "201",
        "description": "Created version",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "LibraryAssetVersionResponse",
            "schema": [
              {
                "name": "version_number",
                "kind": "required",
                "type": "integer",
                "description": "The serial number of the version",
                "example": 2
              },
              {
                "name": "asset_id",
                "kind": "required",
                "type": "string",
                "description": "Unique identifier of the asset",
                "example": "5d7f910551b00a722e0418830cee6631"
              },
              {
                "name": "title",
                "kind": "required",
                "type": "string",
                "description": "Title of the asset",
                "example": "sample_image.png"
              },
              {
                "name": "type",
                "kind": "required",
                "type": "string<image | video | raw_file>",
                "description": "Type of the version",
                "example": "image",
                "enum": [
                  "image",
                  "video",
                  "raw_file"
                ]
              },
              {
                "name": "mime_type",
                "kind": "required",
                "type": "string",
                "description": "MIME type of the version",
                "example": "image/png"
              },
              {
                "name": "created_at",
                "kind": "required",
                "type": "string<date-time>",
                "description": "<p>Date and time on which the version was created,  in ISO 8601 UTC format (2020-02-10T10:40</p><div></div>)<p></p>",
                "example": "2019-10-06T13:15:30Z",
                "format": "date-time"
              },
              {
                "name": "content",
                "kind": "required",
                "type": "object",
                "description": "Content of the version",
                "example": "",
                "schema": [
                  {
                    "name": "type",
                    "kind": "required",
                    "type": "string<url>",
                    "description": "Type of the content",
                    "example": "url",
                    "enum": [
                      "url"
                    ]
                  },
                  {
                    "name": "value",
                    "kind": "required",
                    "type": "string",
                    "description": "<p>Content of the version. It is the download URL for image, raw file, and video.</p>",
                    "example": "http://images.cmp.optimizely.com/Zz0xODQ3NDU3Y2Y2YmYzOTlmNjkyOTgyZDY3Y2I3YWM2OA==S"
                  }
                ]
              },
              {
                "name": "links",
                "kind": "required",
                "type": "object",
                "description": "Meta links",
                "example": "",
                "schema": [
                  {
                    "name": "asset",
                    "kind": "required",
                    "type": "string",
                    "description": "URL of the asset that the version is associated with",
                    "example": "https://api.cmp.optimizely.com/v3/images/5d7f910551b00a722e0418830cee6631"
                  }
                ]
              }
            ],
            "modelRef": "#/components/schemas/LibraryAssetVersionResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Client error",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"message\":\"Unsupported arguments: a,b,c\"}",
            "description": "Error payload",
            "customType": "Error",
            "schema": [
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "Message describing the error",
                "example": "Not found"
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "map",
                "description": "Additional information",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "401",
        "description": "Authorization error",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"message\":\"Unauthorized\"}",
            "description": "Error payload",
            "customType": "Error",
            "schema": [
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "Message describing the error",
                "example": "Not found"
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "map",
                "description": "Additional information",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "403",
        "description": "Permission error",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"message\":\"You do not have the permission to perform this operation\"}",
            "description": "Error payload",
            "customType": "Error",
            "schema": [
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "Message describing the error",
                "example": "Not found"
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "map",
                "description": "Additional information",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "404",
        "description": "Not found error",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"message\":\"Resource not found\"}",
            "description": "Error payload",
            "customType": "Error",
            "schema": [
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "Message describing the error",
                "example": "Not found"
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "map",
                "description": "Additional information",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "422",
        "description": "Unprocessable entity error",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"message\":\"Resource cannot be processed\"}",
            "description": "Error payload",
            "customType": "Error",
            "schema": [
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "Message describing the error",
                "example": "Not found"
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "map",
                "description": "Additional information",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "HM8g4CUNahctdQf39wbvC",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.cmp.optimizely.com/v3/assets/{asset_id}/versions \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"key\": \"\",\n     \"title\": \"sample_image.png\"\n     }'"
        },
        {
          "id": "JleIklb3tuQsQU3cAVtFx",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"key\": \"\",\n   \"title\": \"sample_image.png\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.cmp.optimizely.com/v3/assets/{asset_id}/versions\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "jjQHDay2L1s_1KVzvznfq",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.cmp.optimizely.com/v3/assets/{asset_id}/versions\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"key\": \"\",\n   \"title\": \"sample_image.png\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "9_QpflfXOvzo-Gn5DHa8e",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.cmp.optimizely.com/v3/assets/{asset_id}/versions\"\n\npayload = json.dumps({\n   \"key\": \"\",\n   \"title\": \"sample_image.png\"\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "HM8g4CUNahctdQf39wbvC"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-201",
          "language": "201",
          "code": "// Created version\n{\n  \"version_number\": 2,\n  \"asset_id\": \"5d7f910551b00a722e0418830cee6631\",\n  \"title\": \"sample_image.png\",\n  \"type\": \"image\",\n  \"mime_type\": \"image/png\",\n  \"created_at\": \"2019-10-06T13:15:30Z\",\n  \"content\": {\n    \"type\": \"url\",\n    \"value\": \"http://images.cmp.optimizely.com/Zz0xODQ3NDU3Y2Y2YmYzOTlmNjkyOTgyZDY3Y2I3YWM2OA==S\"\n  },\n  \"links\": {\n    \"asset\": \"https://api.cmp.optimizely.com/v3/images/5d7f910551b00a722e0418830cee6631\"\n  }\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Client error\n{\n  \"message\": \"Not found\",\n  \"errors\": \"\"\n}"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// Authorization error\n{\n  \"message\": \"Not found\",\n  \"errors\": \"\"\n}"
        },
        {
          "id": "response-3-403",
          "language": "403",
          "code": "// Permission error\n{\n  \"message\": \"Not found\",\n  \"errors\": \"\"\n}"
        },
        {
          "id": "response-4-404",
          "language": "404",
          "code": "// Not found error\n{\n  \"message\": \"Not found\",\n  \"errors\": \"\"\n}"
        },
        {
          "id": "response-5-422",
          "language": "422",
          "code": "// Unprocessable entity error\n{\n  \"message\": \"Not found\",\n  \"errors\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "response-0-201"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}