media_library

Create one or more media library assets for a business. Assets are reusable image or video creatives at the business level, not Pins. Use them later in ads without creating a Pin first.

Before creating a media library asset:

  • Register the media upload.
  • Upload the asset file to the Pinterest Media AWS bucket using the URL and metadata returned to you in the preceding step.
  • Confirm the upload.

Get detailed steps for uploading assets.

You will use the media_id returned in the first step to create the media library asset in this endpoint.

A request with multiple assets succeeds if at least one asset is created, even if the others fail.

post/media_library/businesses/{business_id}/assets

Request

  • Base URL
    https://api.pinterest.com/v5
  • Auth
    OAuth 2
    Authorization codehttps://www.pinterest.com/oauth/
    Token URLhttps://api.pinterest.com/v5/oauth/token
    Scopesads:write

Path parameters

business_idstring required

Identifier of the business that owns the media library.

Request body

Example request

{
  "assets": [
    {
      "media_id": "12345",
      "name": "test name",
      "ad_account_id": "596736294873",
      "tags": [
        "lifestyle",
        "fashion"
      ]
    }
  ]
}

Response

The request has succeeded.

bookmarkstring nullable
status'SUCCESS' | 'PARTIAL_SUCCESS' | 'ERROR' required

Overall outcome of a bulk operation.

success_countinteger required

Number of successfully created assets.

failure_countinteger required

Number of assets that failed to create.

Example response

{
  "items": [
    {
      "error_code": "INTERNAL_ERROR",
      "asset_id": "549755885175"
    }
  ],
  "success_count": 1,
  "failure_count": 1
}

Changes