重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
pinterest-api by rawveg/skillsforge-marketplace
npx skills add https://github.com/rawveg/skillsforge-marketplace --skill pinterest-api提供 Pinterest API v5 开发的全面协助,包括 OAuth 认证、Pin/画板管理、分析以及 API 集成模式。
在以下情况应触发此技能:
https://api.pinterest.com/v5/Authorization: Bearer {access_token}广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
// Redirect user to Pinterest authorization page
const authUrl = `https://www.pinterest.com/oauth/?client_id={CLIENT_ID}&redirect_uri={REDIRECT_URI}&response_type=code&scope=boards:read,pins:read,user_accounts:read`;
window.location.href = authUrl;
# After user authorizes, exchange authorization code for access token
curl -X POST https://api.pinterest.com/v5/oauth/token \
--header "Authorization: Basic {BASE64_ENCODED_CLIENT_CREDENTIALS}" \
--header "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "grant_type=authorization_code" \
--data-urlencode "code={AUTHORIZATION_CODE}" \
--data-urlencode "redirect_uri={REDIRECT_URI}"
Base64 编码客户端凭据:
# Encode client_id:client_secret
echo -n "your_client_id:your_client_secret" | base64
响应:
{
"access_token": "pina_ABC123...",
"token_type": "bearer",
"expires_in": 2592000,
"refresh_token": "DEF456...",
"scope": "boards:read,pins:read,user_accounts:read"
}
curl -X POST https://api.pinterest.com/v5/pins \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"link": "https://example.com/my-article",
"title": "My Amazing Pin Title",
"description": "Detailed description of the pin content",
"board_id": "123456789",
"media_source": {
"source_type": "image_url",
"url": "https://example.com/image.jpg"
}
}'
curl -X GET https://api.pinterest.com/v5/pins/{PIN_ID} \
-H "Authorization: Bearer {ACCESS_TOKEN}"
响应:
{
"id": "987654321",
"created_at": "2025-01-15T10:30:00",
"link": "https://example.com/my-article",
"title": "My Amazing Pin Title",
"description": "Detailed description of the pin content",
"board_id": "123456789",
"media": {
"media_type": "image",
"images": {
"150x150": { "url": "...", "width": 150, "height": 150 },
"400x300": { "url": "...", "width": 400, "height": 300 },
"originals": { "url": "...", "width": 1200, "height": 800 }
}
}
}
curl -X PATCH https://api.pinterest.com/v5/pins/{PIN_ID} \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"title": "Updated Pin Title",
"description": "Updated description",
"link": "https://example.com/updated-link"
}'
curl -X DELETE https://api.pinterest.com/v5/pins/{PIN_ID} \
-H "Authorization: Bearer {ACCESS_TOKEN}"
curl -X POST https://api.pinterest.com/v5/boards \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"name": "My New Board",
"description": "A collection of my favorite ideas",
"privacy": "PUBLIC"
}'
隐私选项: PUBLIC, PROTECTED, SECRET
curl -X GET https://api.pinterest.com/v5/boards \
-H "Authorization: Bearer {ACCESS_TOKEN}"
curl -X GET https://api.pinterest.com/v5/boards/{BOARD_ID}/pins \
-H "Authorization: Bearer {ACCESS_TOKEN}"
curl -X GET https://api.pinterest.com/v5/user_account \
-H "Authorization: Bearer {ACCESS_TOKEN}"
响应:
{
"account_type": "BUSINESS",
"id": "123456789",
"username": "myusername",
"website_url": "https://example.com",
"profile_image": "https://i.pinimg.com/...",
"follower_count": 1500,
"following_count": 320,
"board_count": 25,
"pin_count": 450
}
curl -X GET "https://api.pinterest.com/v5/pins/{PIN_ID}/analytics?start_date=2025-01-01&end_date=2025-01-31&metric_types=IMPRESSION,SAVE,PIN_CLICK" \
-H "Authorization: Bearer {ACCESS_TOKEN}"
可用指标:
IMPRESSION - Pin 被展示的次数SAVE - Pin 被保存的次数PIN_CLICK - 点击 Pin 目的地的次数OUTBOUND_CLICK - 点击外部网站的次数VIDEO_START - 视频播放开始的次数响应:
{
"all": {
"daily_metrics": [
{
"date": "2025-01-01",
"data_status": "READY",
"metrics": {
"IMPRESSION": 1250,
"SAVE": 45,
"PIN_CLICK": 89
}
}
]
}
}
{
"code": 3,
"message": "Requested pin not found"
}
常见错误代码:
1 - 请求参数无效2 - 超出速率限制3 - 资源未找到4 - 权限不足8 - 访问令牌无效import requests
def create_pin(access_token, board_id, title, image_url):
url = "https://api.pinterest.com/v5/pins"
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
data = {
"board_id": board_id,
"title": title,
"media_source": {
"source_type": "image_url",
"url": image_url
}
}
try:
response = requests.post(url, headers=headers, json=data)
response.raise_for_status()
return response.json()
except requests.exceptions.HTTPError as e:
error_data = e.response.json()
print(f"Error {error_data.get('code')}: {error_data.get('message')}")
return None
except requests.exceptions.RequestException as e:
print(f"Request failed: {str(e)}")
return None
// Pinterest API Client Example
class PinterestClient {
constructor(accessToken) {
this.accessToken = accessToken;
this.baseUrl = 'https://api.pinterest.com/v5';
}
async request(endpoint, options = {}) {
const url = `${this.baseUrl}${endpoint}`;
const headers = {
'Authorization': `Bearer ${this.accessToken}`,
'Content-Type': 'application/json',
...options.headers
};
const response = await fetch(url, {
...options,
headers
});
if (!response.ok) {
const error = await response.json();
throw new Error(`Pinterest API Error: ${error.message}`);
}
return response.json();
}
async createPin(boardId, title, imageUrl, description = '', link = '') {
return this.request('/pins', {
method: 'POST',
body: JSON.stringify({
board_id: boardId,
title: title,
description: description,
link: link,
media_source: {
source_type: 'image_url',
url: imageUrl
}
})
});
}
async getUserBoards() {
return this.request('/boards');
}
async getPinAnalytics(pinId, startDate, endDate) {
const params = new URLSearchParams({
start_date: startDate,
end_date: endDate,
metric_types: 'IMPRESSION,SAVE,PIN_CLICK'
});
return this.request(`/pins/${pinId}/analytics?${params}`);
}
}
// Usage
const client = new PinterestClient('your_access_token');
const pin = await client.createPin('board_id', 'Pin Title', 'https://example.com/image.jpg');
此技能在 references/ 目录中包含完整的文档:
当需要特定端点的详细信息时,请使用 view 命令读取参考文件。
# Initial request
curl -X GET "https://api.pinterest.com/v5/boards/{BOARD_ID}/pins?page_size=25" \
-H "Authorization: Bearer {ACCESS_TOKEN}"
# Follow-up with bookmark from response
curl -X GET "https://api.pinterest.com/v5/boards/{BOARD_ID}/pins?page_size=25&bookmark={BOOKMARK}" \
-H "Authorization: Bearer {ACCESS_TOKEN}"
# Create multiple pins efficiently
def bulk_create_pins(access_token, board_id, pin_data_list):
results = []
for pin_data in pin_data_list:
result = create_pin(
access_token,
board_id,
pin_data['title'],
pin_data['image_url']
)
results.append(result)
time.sleep(0.5) # Respect rate limits
return results
您可能需要的一些常见作用域:
boards:read - 读取画板数据boards:write - 创建/更新画板pins:read - 读取 Pin 数据pins:write - 创建/更新 Pinuser_accounts:read - 读取用户账户数据ads:read - 读取广告账户分析数据(商业账户)X-RateLimit-LimitX-RateLimit-RemainingX-RateLimit-ResetBearer {token}X-RateLimit-Reset 请求头以获取重试时间此技能是根据 Pinterest 官方 API 文档生成的。要获取最新的 API 变更:
每周安装次数
47
代码仓库
GitHub 星标数
28
首次出现
2026年1月24日
安全审计
安装于
codex39
opencode38
gemini-cli37
cursor37
github-copilot35
amp33
Comprehensive assistance with Pinterest API v5 development, including OAuth authentication, pin/board management, analytics, and API integration patterns.
This skill should be triggered when:
https://api.pinterest.com/v5/Authorization: Bearer {access_token}// Redirect user to Pinterest authorization page
const authUrl = `https://www.pinterest.com/oauth/?client_id={CLIENT_ID}&redirect_uri={REDIRECT_URI}&response_type=code&scope=boards:read,pins:read,user_accounts:read`;
window.location.href = authUrl;
# After user authorizes, exchange authorization code for access token
curl -X POST https://api.pinterest.com/v5/oauth/token \
--header "Authorization: Basic {BASE64_ENCODED_CLIENT_CREDENTIALS}" \
--header "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "grant_type=authorization_code" \
--data-urlencode "code={AUTHORIZATION_CODE}" \
--data-urlencode "redirect_uri={REDIRECT_URI}"
Base64 Encoding Client Credentials:
# Encode client_id:client_secret
echo -n "your_client_id:your_client_secret" | base64
Response:
{
"access_token": "pina_ABC123...",
"token_type": "bearer",
"expires_in": 2592000,
"refresh_token": "DEF456...",
"scope": "boards:read,pins:read,user_accounts:read"
}
curl -X POST https://api.pinterest.com/v5/pins \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"link": "https://example.com/my-article",
"title": "My Amazing Pin Title",
"description": "Detailed description of the pin content",
"board_id": "123456789",
"media_source": {
"source_type": "image_url",
"url": "https://example.com/image.jpg"
}
}'
curl -X GET https://api.pinterest.com/v5/pins/{PIN_ID} \
-H "Authorization: Bearer {ACCESS_TOKEN}"
Response:
{
"id": "987654321",
"created_at": "2025-01-15T10:30:00",
"link": "https://example.com/my-article",
"title": "My Amazing Pin Title",
"description": "Detailed description of the pin content",
"board_id": "123456789",
"media": {
"media_type": "image",
"images": {
"150x150": { "url": "...", "width": 150, "height": 150 },
"400x300": { "url": "...", "width": 400, "height": 300 },
"originals": { "url": "...", "width": 1200, "height": 800 }
}
}
}
curl -X PATCH https://api.pinterest.com/v5/pins/{PIN_ID} \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"title": "Updated Pin Title",
"description": "Updated description",
"link": "https://example.com/updated-link"
}'
curl -X DELETE https://api.pinterest.com/v5/pins/{PIN_ID} \
-H "Authorization: Bearer {ACCESS_TOKEN}"
curl -X POST https://api.pinterest.com/v5/boards \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"name": "My New Board",
"description": "A collection of my favorite ideas",
"privacy": "PUBLIC"
}'
Privacy Options: PUBLIC, PROTECTED, SECRET
curl -X GET https://api.pinterest.com/v5/boards \
-H "Authorization: Bearer {ACCESS_TOKEN}"
curl -X GET https://api.pinterest.com/v5/boards/{BOARD_ID}/pins \
-H "Authorization: Bearer {ACCESS_TOKEN}"
curl -X GET https://api.pinterest.com/v5/user_account \
-H "Authorization: Bearer {ACCESS_TOKEN}"
Response:
{
"account_type": "BUSINESS",
"id": "123456789",
"username": "myusername",
"website_url": "https://example.com",
"profile_image": "https://i.pinimg.com/...",
"follower_count": 1500,
"following_count": 320,
"board_count": 25,
"pin_count": 450
}
curl -X GET "https://api.pinterest.com/v5/pins/{PIN_ID}/analytics?start_date=2025-01-01&end_date=2025-01-31&metric_types=IMPRESSION,SAVE,PIN_CLICK" \
-H "Authorization: Bearer {ACCESS_TOKEN}"
Available Metrics:
IMPRESSION - Number of times pin was shownSAVE - Number of times pin was savedPIN_CLICK - Number of clicks to pin destinationOUTBOUND_CLICK - Clicks to external websiteVIDEO_START - Video plays startedResponse:
{
"all": {
"daily_metrics": [
{
"date": "2025-01-01",
"data_status": "READY",
"metrics": {
"IMPRESSION": 1250,
"SAVE": 45,
"PIN_CLICK": 89
}
}
]
}
}
{
"code": 3,
"message": "Requested pin not found"
}
Common Error Codes:
1 - Invalid request parameters2 - Rate limit exceeded3 - Resource not found4 - Insufficient permissions8 - Invalid access tokenimport requests
def create_pin(access_token, board_id, title, image_url):
url = "https://api.pinterest.com/v5/pins"
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
data = {
"board_id": board_id,
"title": title,
"media_source": {
"source_type": "image_url",
"url": image_url
}
}
try:
response = requests.post(url, headers=headers, json=data)
response.raise_for_status()
return response.json()
except requests.exceptions.HTTPError as e:
error_data = e.response.json()
print(f"Error {error_data.get('code')}: {error_data.get('message')}")
return None
except requests.exceptions.RequestException as e:
print(f"Request failed: {str(e)}")
return None
// Pinterest API Client Example
class PinterestClient {
constructor(accessToken) {
this.accessToken = accessToken;
this.baseUrl = 'https://api.pinterest.com/v5';
}
async request(endpoint, options = {}) {
const url = `${this.baseUrl}${endpoint}`;
const headers = {
'Authorization': `Bearer ${this.accessToken}`,
'Content-Type': 'application/json',
...options.headers
};
const response = await fetch(url, {
...options,
headers
});
if (!response.ok) {
const error = await response.json();
throw new Error(`Pinterest API Error: ${error.message}`);
}
return response.json();
}
async createPin(boardId, title, imageUrl, description = '', link = '') {
return this.request('/pins', {
method: 'POST',
body: JSON.stringify({
board_id: boardId,
title: title,
description: description,
link: link,
media_source: {
source_type: 'image_url',
url: imageUrl
}
})
});
}
async getUserBoards() {
return this.request('/boards');
}
async getPinAnalytics(pinId, startDate, endDate) {
const params = new URLSearchParams({
start_date: startDate,
end_date: endDate,
metric_types: 'IMPRESSION,SAVE,PIN_CLICK'
});
return this.request(`/pins/${pinId}/analytics?${params}`);
}
}
// Usage
const client = new PinterestClient('your_access_token');
const pin = await client.createPin('board_id', 'Pin Title', 'https://example.com/image.jpg');
This skill includes comprehensive documentation in references/:
Use view to read reference files when detailed information about specific endpoints is needed.
# Initial request
curl -X GET "https://api.pinterest.com/v5/boards/{BOARD_ID}/pins?page_size=25" \
-H "Authorization: Bearer {ACCESS_TOKEN}"
# Follow-up with bookmark from response
curl -X GET "https://api.pinterest.com/v5/boards/{BOARD_ID}/pins?page_size=25&bookmark={BOOKMARK}" \
-H "Authorization: Bearer {ACCESS_TOKEN}"
# Create multiple pins efficiently
def bulk_create_pins(access_token, board_id, pin_data_list):
results = []
for pin_data in pin_data_list:
result = create_pin(
access_token,
board_id,
pin_data['title'],
pin_data['image_url']
)
results.append(result)
time.sleep(0.5) # Respect rate limits
return results
Common scopes you'll need:
boards:read - Read board databoards:write - Create/update boardspins:read - Read pin datapins:write - Create/update pinsuser_accounts:read - Read user account dataads:read - Read ad account analytics (business accounts)X-RateLimit-LimitX-RateLimit-RemainingX-RateLimit-ResetBearer {token}X-RateLimit-Reset header for retry timeThis skill was generated from Pinterest's official API documentation. To get the latest API changes:
Weekly Installs
47
Repository
GitHub Stars
28
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
codex39
opencode38
gemini-cli37
cursor37
github-copilot35
amp33
Lark CLI IM 即时消息管理工具:机器人/用户身份操作聊天、消息、文件下载
48,700 周安装