> ## Documentation Index
> Fetch the complete documentation index at: https://www.ayrshare.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Pinterest API

> 使用 Pinterest API 发布内容的选项

## 发布图片 Pin 到 Pinterest

Pinterest API 要求帖子中必须包含图片。其他参数是可选的。
更多信息请参见 [Pinterest 媒体指南](/media-guidelines/pinterest) 和 [Pinterest 授权](/dashboard/connect-social-accounts/pinterest)。

```json Pinterest Post theme={"system"}
{
  "post": "The best Pinterest API ever!", // Maximum 500 characters or empty string
  "platforms": ["pinterest"],
  "mediaUrls": ["https://images.ayrshare.com/imgs/GhostBusters.jpg"]
}
```

## Pinterest 选项

你可以使用 `pinterestOptions` 参数为帖子设置额外选项。

```json Pinterest Post theme={"system"}
{
  "post": "The best Pinterest API ever!", // Maximum 500 characters or empty string
  "platforms": ["pinterest"],
  "mediaUrls": ["https://images.ayrshare.com/imgs/GhostBusters.jpg"],
  "pinterestOptions": {
    "altText": ["This is my best pic", "😃 here is the next one"], // maximum 500 characters
    "boardId": "93383204522",
    "carouselOptions": [
      {
        "title": "Image 1",
        "link": "https://www.cnn.com",
        "description": "Super Image 1"
      },
      {
        "title": "Image 2",
        "link": "https://www.google.com",
        "description": "Super Image 2"
      }
    ],
    "link": "https://www.ayrshare.com", // maximum 2048 characters
    "note": "Private note", // maximum 1000 characters
    "thumbNail": "https://images.ayrshare.com/imgs/GhostBusters.jpg",
    "title": "A Pinterest Board for You" // maximum 100 characters
  }
}
```

Pinterest 选项是可选字段，可用于控制帖子。

<ParamField body="altText" type="array of strings">
  用于无障碍和屏幕阅读器的图片和视频替代文本。最多 500 个字符。

  更多信息请参见 [Pinterest 替代文本](/apis/post/social-networks/pinterest#alternative-text)。
</ParamField>

<ParamField body="boardId" type="string">
  通过指定 /user/details 端点获取的 ID，发布到用户的其他 Pinterest 看板。

  如果未指定，将发布到默认关联的看板。

  更多信息请参见 [Pinterest 看板 ID](/apis/post/social-networks/pinterest#board-id)。
</ParamField>

<ParamField body="carouselOptions" type="array of objects">
  将最多 5 张图片作为 Pinterest 轮播添加，可选包含标题、链接和描述。

  每个对象可以包含：`title`、`link` 和 `description`。

  更多信息请参见 [Pinterest 图片轮播](/apis/post/social-networks/pinterest#pinterest-image-carousel)。
</ParamField>

<ParamField body="link" type="string">
  用户点击 Pin 图片时将被引导到的目标 URL。最多 2048 个字符。

  在你的 Pin 上创建一个可点击的链接。

  更多信息请参见 [Pin 链接](/apis/post/social-networks/pinterest#pin-link)。
</ParamField>

<ParamField body="note" type="string">
  为单个 Pin 添加私人备注，只有你和看板协作者可以查看。最多 1000 个字符。

  更多信息请参见 [Pin 备注](/apis/post/social-networks/pinterest#pin-note)。
</ParamField>

<ParamField body="thumbNail" type="string">
  为视频 Pin 设置缩略图。必须为 PNG 或 JPG，与视频尺寸相同，大小不超过 10MB。

  视频 Pin 必填。

  更多信息请参见 [视频 Pin（缩略图）](/apis/post/social-networks/pinterest#video-pin-thumbnail)。
</ParamField>

<ParamField body="title" type="string">
  Pin 的标题，显示在 "Add your title" 部分。最多 100 个字符。

  更多信息请参见 [Pin 标题](/apis/post/social-networks/pinterest#pin-title)。
</ParamField>

<sup>\*</sup>`post` 字段中的链接不可点击。请使用 `link` 字段为 Pin 添加
可点击的链接。

更多信息请参见 [Pinterest 媒体指南](/media-guidelines/pinterest)。

## 替代文本

为 Pinterest 图片或视频添加替代文本（也称为 alt text）。Pinterest 替代文本是一项无障碍功能，用于提供附加的用户信息并支持屏幕阅读器。

在 `pinterestOptions` 对象中使用 `altText`。

```json Pinterest Alt Text theme={"system"}
{
  "pinterestOptions": {
    "altText": ["This is my best pic", "😃 here is the next one"]
  }
}
```

替代文本限制为 500 个字符。

## 看板 ID

通过指定从 [/user/details](/apis/user/pinterest-board) 端点获取的 ID，发布到用户的其他 Pinterest 看板。否则发布到默认关联的看板。

在 `pinterestOptions` 对象中使用 `boardId`。

```json Pinterest Board ID theme={"system"}
{
  "pinterestOptions": {
    "boardId": "93383204522"
  }
}
```

## 字符限制

更多信息请参见 [Pinterest 字符限制](/help-center/technical-support/character_limits#pinterest-character-limits)。

## Pin 链接

用户点击你的 Pin 图片时将被引导到的目标 URL。这会在你的 Pin 上创建一个可点击的链接。最大长度为 2048 个字符。

在 `pinterestOptions` 对象中使用 `link`。

```json Pin Link theme={"system"}
{
  "pinterestOptions": {
    "link": "https://www.ayrshare.com"
  }
}
```

## Pin 备注

你可以为你看板上的单个 Pin 添加私人备注。只有你和看板协作者可以看到它们。

在 `pinterestOptions` 对象中使用 `note`。

```json Pin Note theme={"system"}
{
  "pinterestOptions": {
    "note": "Private note for collaborators"
  }
}
```

## Pinterest 图片轮播

将最多五张图片作为 Pinterest 轮播发布。通过添加多个媒体 URL，会自动创建轮播。你还可以添加可选的轮播参数。请见下方。

```json Pinterest Carousel Post theme={"system"}
{
  "post": "Carousel Time",
  "platforms": ["pinterest"],
  "mediaUrls": [
    "https://img.ayrshare.com/random/photo-1.jpg",
    "https://img.ayrshare.com/random/photo-2.jpg"
  ],
  "pinterestOptions": {
    "carouselOptions": [
      // optional
      {
        "title": "Image 1",
        "link": "https://www.cnn.com",
        "description": "Super Image 1"
      },
      {
        "title": "Image 2",
        "link": "https://www.google.com",
        "description": "Super Image 2"
      }
    ]
  }
}
```

可选的 `carouselOptions` 字段接受一个对象数组。每个轮播对象对应等效的媒体 URL 字符串，例如，第一个轮播对象引用第一个 `mediaUrl` 字符串。

<ul class="custom-bullets">
  <li>`title`：图片标题。</li>
  <li>`link`：图片的外部目标链接。</li>
  <li>`description`：图片描述。</li>
</ul>

## Pinterest 提及

虽然你可以在 Pinterest 帖子中添加 @handle，但 Pinterest 不支持在帖子文本中解析提及。
@handle 将保留为纯文本。

## Pin 标题

要显示的 Pin 标题。它出现在新 Pin 的 "Add your title" 部分。最多 100 个字符。

在 `pinterestOptions` 对象中使用 `title`。

```json Pin Title theme={"system"}
{
  "pinterestOptions": {
    "title": "A Pinterest Board for You"
  }
}
```

## 视频 Pin（缩略图）

可以使用 [/post 端点](/apis/post/post) 中的标准 `mediaUrls` 字段将视频作为 Pin 发布。此外，视频**必须**包含缩略图图片 URL，并具有有效的媒体 Content-Type，例如 `image/jpeg`。
请参见[要求](/media-guidelines/pinterest)。

```json Video Pin with Thumbnail theme={"system"}
{
  "pinterestOptions": {
    // required
    "thumbNail": "https://images.unsplash.com/photo-1513093496871-0a81425386e5?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxNjQ1ODN8MHwxfHJhbmRvbXx8fHx8fHx8fDE2Mzg0ODAzNDA&ixlib=rb-1.2.1&q=80&w=400"
  }
}
```

关于[使用 API 发布 Pin](https://www.ayrshare.com/blog/pinterest-api-integration-on-ayrshare/) 的更多信息。

如果你的视频不是以已知的视频扩展名（如 mp4）结尾，请使用 `isVideo` 参数。详情请参见 [/post 端点](/apis/post/post)。
