
How to Create a Pin with Pinterest API - Step by Step Guide
In order to Create a Pin for your boards in Pinterest using API we need an Access token for Authorization purposes, so let's generate it first.
What is Pinterest?
Pinterest is a popular social media platform that is used by millions of users to discover, save, and share ideas on a variety of topics. As a content creator or marketer, it's important to have your content accessible on Pinterest, and one way to do that is by using the Pinterest API.
The Pinterest API allows developers to create, read, and update pins on the platform programmatically. This means that you can automate the process of uploading your content to Pinterest, saving you time and effort.
Before Starting to use Pinterest we must have had to request permission for accessing their APIs,
Create a Pin with Pinterest API step by step
Generate Access Code for Pinterest
Go to your browser and paste the below link in the URL to ask for permission and access code.
Make sure to replace your client id in URl before pasting.
https://www.pinterest.com/oauth/?client_id=<ClientId>&redirect_uri=https://httpstat.us/200&response_type=code&scope=boards:read,boards:write,pins:read,pins:write,user_accounts:read,ads:read
Here we are asking for the following permission, which you can change according to your requirements:
Boards: read, write
Pins: read, write
user account: read
After that, it will ask for permission, click on Allow button.
Then you will receive the access code in the browser URL, copy that, and it will be needed to Generate an Access token.
Now we have got the permission and also acquired the access code, let's generate an Access token.
Generate Access Token:
Method : POST
https://api.pinterest.com/v5/oauth/token
Parameters:
grant_type : authorization_code
code: <Your Code>
redirect_uri : https://httpstat.us/200
In response you will get access token(Valid for 30days) and refresh token(Valid for 365 days).
So,using this access token now we can get our all boards,Create Pins etc.. in Pintereset.
Get all boards using API:
URL:
Method : GET
https://api.pinterest.com/v5/boards
Headers:
Authorization: Bearer <Your Access Token>
In response, you will get all your boards with their ids and other related details.
Create Pin using API in Pinterest:
URL:
Method : POST
https://api.pinterest.com/v5/pins
Headers:
Authorization: Bearer <Your Access Token>
Sample request:
{
"title": "Pin Title",
"link": "Your link",
"description": "desc.",
"dominant_color": "#ff5757",
"alt_text": "sample alt text",
"board_id": "your board id",
"media_source": {
"source_type": "image_url",
"url": "image url"
},
"parent_pin_id": null
}
After succesfuly your Pin will be created in your Given baord.
This is how we can create pins manually using Pinterest APIs.
Delete Created Pins:
URL:
Method: DELETE
https://api.pinterest.com/v5/pins/<Your-Pin-Id>
Headers:
Authorization: Bearer <Your Access Token>
Get Pins from Spiecifc Boards:
URL:
Method:GET
https://api.pinterest.com/v5/pins/<your-board-id>
Headers:
Authorization: Bearer <Your Access Token>
Conclusion
using the Pinterest API to create and upload your content to the platform is a great way to reach a larger audience and save time. By following this step by step guide, you can easily create Pins programmatically and share your content on Pinterest.