media_typemedia_library_imagemedia_library_videocurl --location --request POST 'https://api.pinterest.com/v5/media' \ --header 'Content-Type: application/json' \ --data-raw '{"media_type": "media_library_video"}'
media_id{ "media_id": "203014033110991560", "media_type": "media_library_video", "upload_url": "https://pinterest-media-upload.s3-accelerate.amazonaws.com/", "upload_parameters": { "Content-Type": "multipart/form-data", "key": "uploads/11/aa/22/3:video:203014033110991560:5212123920968240771", "policy": "eyJleHBpcmF0aW9nIjoiMj..==", "x-amz-algorithm": "AWS4-HMAC-SHA256", "x-amz-credential": "ASIA6QZJ64OPIKV7FRVX/20220127/us-east-1/s3/aws4_request", "x-amz-date": "20220127T185143Z", "x-amz-security-token": "IQoJb3JpZ2luX2VjEJr...==", "x-amz-signature": "fcd6309a6aaee213348666a72abed8b44552a43acb6b340e8e1b288d21a5fe92" } }
upload_urlContent-Typemultipart/form-dataupload_parameterscurl --location --request POST '{upload_url}' \ --form 'Content-Type="{upload_parameters.Content-Type}"' \ --form 'key="{upload_parameters.key}"' \ --form 'policy="{upload_parameters.policy}"' \ --form 'x-amz-algorithm="{upload_parameters.x-amz-algorithm}"' \ --form 'x-amz-credential="{upload_parameters.x-amz-credential}"' \ --form 'x-amz-date="{upload_parameters.x-amz-date}"' \ --form 'x-amz-security-token="{upload_parameters.x-amz-security-token}"' \ --form 'x-amz-signature="{upload_parameters.x-amz-signature}"' \ --form 'file=@"{path_to_your_file}"'
204 No Contentmedia_idcurl --location --request GET 'https://api.pinterest.com/v5/media/{media_id}' --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <Add your token here>' \
statusregisteredprocessedsucceededfailedmedia_id{ "media_id": "203014033110991560", "media_type": "media_library_video", "status": "registered" }
| Parameter | Description |
|---|---|
business_idString Path Required | Unique identifier for the business that owns the media file. |
media_idString Body Required | Unique identifier for the media file, which was returned when you registered the media upload. |
nameString Body Required | Your name for the asset. For uploads, use the file name. |
tagsArray of strings Body Optional | Words to categorize the assets so that you can filter on these categories later when fetching assets. Examples: LifestyleProductLogoOverlayOther |
ad_account_idString Body Optional | Unique identifier for an ad account of the user that created the media file. Useful filter for asset searches. |
curl --location --request POST 'https://api.pinterest.com/v5/media_library/businesses/1234567890123456789/assets' \ --header 'Authorization: Bearer <access_token>' \ --header 'Content-Type: application/json' \ --data-raw '{ "assets": [ { "media_id": "203014033110991560", "name": "spring_hero.mp4", "tags": ["product", "video"] }, { "media_id": "203014033110991561", "name": "spring_square.jpg", "tags": ["product", "image"] } ] }'
| Field | Description |
|---|---|
statusstring | Overall status of the request:
|
success_countInteger | Tally of all assets that succeeded and were created. |
failure_countInteger | Tally of all assets that failed and were not created. |
itemsarray | Container for each attempted asset creation and its status. |
items.statusString | Status of the specific item in the array, either SUCCESSERROR |
items.error_codeString | Reason an item failed. |
items.messageString | For a failed item, an additional explanation for the failure. |
items.asset_idString | A unique media library identifier for an asset that succeeded. Not applied to failed assets. |
PARTIAL_SUCCESS{ "status": "PARTIAL_SUCCESS", "success_count": 1, "failure_count": 1, "items": [ { "status": "ERROR", "error_code": "MEDIA_NOT_READY", "message": "The media for this asset is still being processed." }, { "status": "SUCCESS", "message": "", "asset_id": "549755885176" } ] }