<!-- Generated by scripts/generate-llms.mjs from docs/connectors/pinterest.md. Do not edit. -->

Source: https://qbash.com/docs/connectors/pinterest

# Connect Pinterest

Tasks call Pinterest through `qbash.integrations.pinterest`. The connector reads the signed-in account's boards, sections, Pins, followers and analytics, and finds trending searches. It also creates and deletes boards and sections, saves and deletes Pins, and uploads videos for video Pins.

Pinterest Ads is a separate connector. See [Connect Pinterest Ads](https://qbash.com/docs-markdown/connectors/pinterest-ads.md).

## Use a Pinterest business account

Pinterest lets new apps read Pins and boards only for the business account that signed in, and some of its analytics need a business account too. A personal account can sign in, but its Pin and board calls fail with a message about pinner data access.

To switch a personal account, open Pinterest's **Settings → Account management** and convert it to a business account. It's free, and the account keeps its boards and Pins.

## Add the credential in qbash

1. Open **Connectors → Pinterest → Connect**.
2. Name the credential, for example after the account, and select **Connect Pinterest**.
3. Sign in to Pinterest in the popup and select **Give access**.

Pinterest asks for read and write access to the account's boards and Pins, secret ones included, and read access to the account itself. The credential stays connected as long as a task or chat uses it at least every 60 days, because each refresh extends Pinterest's sign-in.

## Read analytics

Select the credential under your task's **Tools → Integrations**, then call the connector:

```python
end = (datetime.now(timezone.utc) - timedelta(days=1)).date()
stats = qbash.integrations.pinterest.get_account_analytics(
    start_date=(end - timedelta(days=29)).isoformat(),
    end_date=end.isoformat(),
    metric_types=["IMPRESSION", "SAVE", "OUTBOUND_CLICK"],
)
qbash.output(stats["analytics"]["all"]["summary_metrics"])
```

`get_pin_analytics` does the same for one Pin, and `get_top_pins` ranks the account's Pins by impressions, saves or clicks. See the [SDK Reference](https://qbash.com/docs/sdk-reference) for every method.

## Boards, Pins and videos

- `create_board` and `create_board_section` add boards and sections. A board can be public, protected or secret.
- `save_pin` saves an existing Pin to one of the account's boards or sections.
- `upload_video` takes a video URL or a qbash file (.mp4, .mov or .m4v) and returns a `media_id`. `get_video_upload_status` says when Pinterest has finished processing it.
- `delete_board` deletes the board and every Pin on it, and Pinterest can't restore either.

`create_pin` publishes a new Pin to one of the account's boards from an image URL, two to five images or an uploaded video. Pinterest refuses it until it approves qbash's Pinterest app for standard access. `update_pin` is a feature Pinterest turns on for each app on request, and it refuses that call for qbash's app for now.

Pinterest asks that each Pin a task publishes is one the account owner chose to post, from content they made.

## Seed test data

Make a secret board in Pinterest and add a Pin or two with your own images. Secret boards stay off your profile, and `list_pins` only returns their Pins with `pin_type="PRIVATE"`. A new business account shows no analytics until its Pins get impressions.

## Limits

- List methods return up to 250 items a page. Pass `next_cursor` back as `cursor` for the next page.
- Analytics cover at most 90 days and start no more than 90 days back.
- Pinterest limits how many calls qbash's Pinterest app makes each day across all accounts. A call over the limit fails with a rate limit error until the limit resets.
