Pinterest Developer account & token Generation

Steps to Setup Pinterest Developer account & token Generation

Prerequisites for API Access

  1. You Must have a Pinterest Business Account to Create and Apply for a Pinterest Developer account and if don’t create a Pinterest account
  2. Access to the Pinterest Marketing API requires an approved App. Please follow the steps below to create an App and Apply for access.

Apply for an App

  1. Log into your Pinterest Business Account with the user ID that you’ll use to manage your developer account’s applications.

  1. You can skip next step if already have a Pinterest Business Account

Create a Pinterest Business Account

    1. Click on Create

    1. Enter the Email, Password and Age and click Create Account

    1. Enter the Business Name, Website Address, Country and Language and click Next

    1. Describe your business and click Next

    1. Select the Ads Preference and your Business Account Created

    1. Follow Step 2 for App Creation
    2. Create a developer Account if you don’t have one

        1. Accept the Terms

Steps Connect/Create an App in Pinterest

  1. Click on Connect App.

  1. Fill in the Details and upload the App Icon Image.

  1. Enter App purpose, Use case and s, Audience and click Submit

  1. It will take 24 – 48 hours to get App Approved.
  2. After Approval You Dashboard look Like this

  1. Once approved, be sure to complete your App profile by providing
      1. Technical Contact email – This will ensure you are Subscribed for updates.
      2. Redirect URIs – This will ensure you can get started with User Authorization as redirect_uri is a required field for OAuth.
        1. Go to Manage and Add Redirect URI

        1. Add Redirect URI and click Add

How to Find App Id and App Secret

  1. Go to the Dashboard
  2. Select the Manage

  1. Click on SHOW App secret key

  1. Copy the App ID and App Secret

Note: Client id and Client Secret are needed to complete Further Step

Authenticate your account & Token Generation

  1. Copy the authentication URL below into your browser’s address field.

https://www.pinterest.com/oauth/?client_id=12345678&redirect_uri=https://sprighub.ai/&response_type=code&scope=boards:read,pins:read,ads:read,user_accounts:read,catalogs:read

  • client_id with your real App ID.

  • callback_placeholder (after redirect_uri=) with your callback URL.

Example:

https://www.pinterest.com/oauth/?client_id=12345678&redirect_uri=https://sprighub.ai/&response_type=code&scope=boards:read,pins:read,ads:read,user_accounts:read,catalogs:read

  1. Click on Give access

  1. Copy the Code Part

  1. Check the browser address bar for the parameter code=XXXXXXXX

Example:

Home

Note: The access code is valid for 10 minutes. Save the code for Step 6

  1. Open a terminal window and run the command shown below. In this command, replace client_id and client_secret with your real client ID and secret campaigns product. Save the output for Step 6.

echo -n [client_id]:[client_secret] | base64

Get the Client id and Client Secret From here

Example: Encode the String in base64

echo -n db405514becc4a028fc6f008aec0ccef:c1d7cdb2fb7644c0b142e179f315e1a4 | base64

Copy the output

  1. Run the command shown below to generate an access token. A valid token is required to make API requests

curl –location –request POST ‘https://api.pinterest.com/v5/oauth/token’ \

–header ‘Authorization: Basic MTQ3OTE2NjpkYTVjZTI3NTc3ZGI0OTlhZXXXXXXXXXXX’ \

–header ‘Content-Type: application/x-www-form-urlencoded’ \

–data-urlencode ‘grant_type=authorization_code’ \

–data-urlencode ‘code=abbcc24f99f172bXXXXXXXXXXXXXXXXXXX’ \

–data-urlencode ‘redirect_uri=https://sprighub.ai/’

In this command, replace:

  • CODE_FROM_STEP_4 with the code from Step 4.
  • BASE64_OUTPUT_FROM_STEP_5 with the code from Step 5.

Example:

curl –location –request POST ‘https://accounts.spotify.com/api/token’ \

–header ‘Authorization: Basic ZGI0MDU1MTRiZWNjNGEwMjhmYzZmMDA4YWVjMGNjZxxxxxxxxxxxxxxxxxxxxxxxxUxYTQ=’ \

–header ‘Content-Type: application/x-www-form-urlencoded’ \

–data-urlencode ‘code=AQCQ1vc2frQMVPwu2GIUUHXsOcZpng1VAeD7MH7XXXXXXXXXXXXXXXXXXXXXXXGtV8Eu2HdsxhLaGQhUZC1OhlFW’ \

–data-urlencode ‘redirect_uri=https://sprighub.ai/’ \

–data-urlencode ‘grant_type=authorization_code’

Response: We will Get a Refresh Token and Access Token in Response

*** Refresh Token is the required Attribute for the ETL Team ***

Pawan Rai
DevOps Engineer at SprigHub
Cookie Value: