- 08 Aug 2024
- 2 Minutes to read
- Print
- DarkLight
- PDF
Pinterest Ad Details
- Updated on 08 Aug 2024
- 2 Minutes to read
- Print
- DarkLight
- PDF
Pinterest Ad Details API
Before You Begin
In order to access the Pinterest API, you must first create and register an application with Pinterest, which will result in the ability to make API calls. Please see the directions outlined here to accomplish this.
Any instance where an entry in the below configuration has a leading $ represents a parameter that needs to be replaced with a static value.
Parameters in this document:
- $app_id and $app_secret - The App ID and App Secret will be used to authenticate calls to the Pinterest API. These values are provided upon completion of the application creation and registration.
- $ad_account_id - The unique identifier for your ad account, which can be found by following these steps:
- Log in to your Pinterest Ads Manager.
- In the upper-lefthand corner of the page, click on the
Pinterest
button to open the menu. - Under the
Ads
section, click on theAd Account Overview
option. - In the upper-righthand corner of the page, click on your account name to open a dropdown menu.
- With the dropdown menu opened, locate the
ID
, which will be a 12-digit number that starts with549
. This is your Ad Account ID, and will be used for this parameter value.
- $resource_name - The Resource Name represents the name of the resource to be appended and used as part of the Destination Table name. Details of the value that should be used here can be found in the API Resources section below.
API Resources
For a list of API Resources available for Pinterest Ads, please refer to the list of endpoints found below:
Resource | $resource_name |
---|---|
List Campaigns | campaigns |
List Ad Groups | ad_groups |
List Ads | ads |
Connector configuration
- Base url: https://api.pinterest.com/v5/ad_accounts/$ad_account_id / $resource_name
- Method: GET
- URL Parameters: page_size=100
- Headers:
Destination Table naming convention is ultimately up to you as the data owner. One common structure used for this API is pinterest_ads_$resourcename. For example, if ingesting the Campaign resource, the Destination Table would be pinterest_ads_campaign
.
Authorization
- Authorization: OAuth2
- Authorization URL: https://www.pinterest.com/oauth/
- Access Token URL: https://api.pinterest.com/v5/oauth/token
- Client Id: {app_id}
- Client Secret: {app_secret}
- Scope: ads:read
- Access Token header key: Authorization
- Token prefix: Bearer
- Add to: Headers
Refresh access token
- Enable:
- Use refresh token once:
- URL: https://api.pinterest.com/v5/oauth/token
- Method: POST
- POST data: {"grant_type":"refresh_token","scope":"ads:read"}
- Headers: {"Content-Type":"application/x-www-form-urlencoded","Authorization":"{basic_auth}"}
- Access token response key: access_token
- Refresh token response key: refresh_token
- Use Bearer authentication:
- Error status codes: 401; 403
Variables
- Secured Variables:
Variable name | Variable value |
---|---|
app_id | $app_id |
app_secret | $app_secret |
Pagination
- Enable:
- Get next page value: Dynamic (next page value included in the response)
- Next page key in response: bookmark
- Use next page value: As a URL parameter value
- URL/body key: bookmark
- Stop iterating when: Stop key-value pair in response
- Key in response: bookmark
- Value in response: null
Additional Setting (optional)
- Data key: items