# Create a Pinterest Pin from OpenCode

Take a product image and its destination URL, pick the exact Pinterest board, and approve the title, description, and alt text before posting.

Canonical page: https://pubnio.com/opencode/pinterest

## Connect OpenCode

### Add PubNio to opencode.json

opencode mcp add writes the same entry. Remote servers sit under mcp.servers with type remote.

```json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "servers": {
      "pubnio": {
        "type": "remote",
        "url": "https://pubnio.com/mcp"
      }
    }
  }
}
```

Or from a terminal:

```sh
opencode mcp add pubnio --url https://pubnio.com/mcp
opencode mcp auth pubnio
```

### Sign in

1. Run opencode mcp auth pubnio, or run /mcps inside OpenCode and select pubnio.
2. Your browser opens PubNio sign-in; approve the workspace.

### Install the skill (optional)

```sh
npx skills add pubnio/agent-skills
```

Installs the pnio skill from skills.sh.

### Connect your Pinterest account

[Open PubNio](https://pubnio.com/app), choose your workspace, and go to Accounts. Use the same workspace when you sign in from OpenCode.

- A Pinterest account with permission to post to the intended board.
- The image at an HTTPS URL, and the HTTPS destination you want visitors to open. A public or signed HTTPS link PubNio can fetch. A file of up to 8 MiB can go inline as base64 instead.
- A PubNio board connection authorized to read the board and create Pins.
- A title, description, and alt text that match the actual image.

### Check the destination

```
List the ready Pinterest board connections in my PubNio workspace. Show the account and board names. Do not create or publish a Pin.
```

## Worked job: Make a product image into a board-targeted Pin

Contract example: sample IDs and URLs. The request and both responses decode against PubNio's API schemas; no provider confirmed this post.

### Prompt

```
Prepare a Pin from https://cdn.example.com/product.jpg linking to https://example.com/product. Draft a title, description, and descriptive alt text. List my ready Pinterest boards and ask which to use if the name is ambiguous. Show me the image, board, and destination URL. On approval, import the JPEG, publish one image Pin, and check the delivery for its permalink.
```

### What OpenCode runs: the Code Mode flow

```text
search   -> find the media-import, media-status, create-post, and read-post operations
execute  -> import media { url: "https://cdn.example.com/product.jpg" }
         => 202 { mediaId: "…", status: "processing" }
execute  -> read media status, sleep 1s between checks
         => { status: "ready" }
execute  -> create post { text: "…", publishNow: true, targets: [ { accountId: "…", provider: "pinterest", placement: "pin", settings: { title: "Easy-grip garden shears", description: "A close-up of the handles and blade guard.", altText: "Garden shears with green handles and a black blade guard", link: "https://example.com/product" }, media: [ { mediaId: "…" } ] } ] }
            Idempotency-Key: opencode-pinterest-product-pin
         => 202 { postId, targets: [pinterest/pin: queued] }
execute  -> read post, sleep 1s between checks, within the 30s budget
         => { status: "published", url: "https://www.pinterest.com/pin/123/" }
```

### Settled result (200 OK)

```json
{
  "postId": "00000000-0000-4000-8000-000000000002",
  "isDraft": false,
  "revision": 1,
  "scheduledAt": null,
  "text": "Easy-grip garden shears",
  "media": [
    {
      "mediaId": "00000000-0000-4000-8000-000000000005"
    }
  ],
  "targets": [
    {
      "accountId": "00000000-0000-4000-8000-000000000001",
      "provider": "pinterest",
      "placement": "pin",
      "settings": {
        "title": "Easy-grip garden shears",
        "description": "A close-up of the handles and blade guard.",
        "altText": "Garden shears with green handles and a black blade guard",
        "link": "https://example.com/product"
      },
      "media": [
        {
          "mediaId": "00000000-0000-4000-8000-000000000005"
        }
      ]
    }
  ],
  "deliveries": [
    {
      "targetId": "00000000-0000-4000-8000-000000000003",
      "attemptId": "00000000-0000-4000-8000-000000000004",
      "accountId": "00000000-0000-4000-8000-000000000001",
      "provider": "pinterest",
      "placement": "pin",
      "canRetry": false,
      "canReconcile": false,
      "revision": 1,
      "status": "published",
      "providerRef": {
        "id": "123",
        "kind": "pin"
      },
      "url": "https://www.pinterest.com/pin/123/"
    }
  ],
  "status": "published",
  "createdAt": "2026-12-04T07:20:00.000Z",
  "updatedAt": "2026-12-04T07:20:18.000Z"
}
```

### From approval to delivery

Illustrative conversation and result with sample data.

**OpenCode:** I found the Product Ideas board. I’ll import product.jpg and link the Easy-grip garden shears Pin to example.com/product.

**You:** Use Product Ideas. The image and product URL are correct.

**OpenCode:** The image was ready, so I submitted one Pin. PubNio confirmed delivery to Product Ideas and returned its permalink.

#### Example delivery result

- Status: `published`

- Destination: Product Ideas · Pinterest board

- Sample URL: `https://www.pinterest.com/pin/123/`

## Check delivery and get the link

- Wait for the image to be ready before submitting the Pin.
- Match the delivery destination against the connected board you approved.
- Keep the PubNio post ID on hand if delivery is pending.
- Open the confirmed Pin to check its board and destination link.

## Pinterest rules OpenCode runs into

Account kinds: social board. Connection scopes: `pins:write`.

| Placement | Default | Media types | Max per target | Caption limit |
| --- | --- | --- | --- | --- |
| `pin` | Yes | image, video | 5 | 800 |

- A Pin takes up to 5 images or videos; this walkthrough uses one JPEG image.
- Descriptions run up to 800 characters.
- Set the destination link separately from the image and write alt text that describes the image.

## Failures and recovery

### Pinterest issue codes

| Code | Cause | Fix | Retry |
| --- | --- | --- | --- |
| `account_not_ready` | The connected account's OAuth token is expired, revoked, or disconnected. | Reconnect the account in the PubNio workspace, then re-validate. | After reconnect |
| `publish_permission_required` | The OAuth grant is missing a required publishing scope. | Re-authorize the account in the workspace with publish permissions enabled. | After reconnect |
| `media_required` | Placement (such as Instagram Feed/Reel, Pinterest Pin, TikTok, or YouTube) requires media. | Import or upload media and attach its `mediaId` to the target. | No |
| `media_type` | Media kind (image, video, document) does not match the placement. | Supply a matching media type for the selected placement. | No |
| `caption_too_long` | Text exceeds the destination placement's character limit (`caption.limit`). | Shorten the caption or add a shorter target-specific text override. | No |

### OpenCode setup problems

- Calls start failing with 401. Run opencode mcp auth pubnio again to renew the PubNio sign-in.
- OpenCode does not list pubnio in /mcps. Check that the entry is under mcp.servers with type remote in opencode.json.
- Writes fail with 403 read_only_mode. PubNio returns 403 read_only_mode when the server URL ends in ?readOnly=1. Point the entry at https://pubnio.com/mcp to allow writes.

### OpenCode quirks

- You can sign in from the CLI (opencode mcp auth pubnio) or from /mcps inside a session.
- A remote server needs type remote under mcp.servers; a bare url entry is not enough.

## What it won't do

- Create a text-only Pin. Every Pin needs an image or video.
- Post to a board that is not connected in PubNio. Each connection is one board.
- Connect accounts, create API keys, or manage webhooks from an MCP session that uses an API key. Those operations need a person signed in, so connect the MCP server with browser OAuth or use the PubNio web app.
- Stream binary uploads through execute. Import media from an HTTPS URL, or send a file of up to 8 MiB inline as base64.
- Run one execute call past 30 seconds or past its request limit. The script returns the post ID so the next call can check it.

## Frequently asked questions

### How do I select a Pinterest board in OpenCode?

Ask for the ready board connections. Confirm the account and board name before publishing.

### Can I add a product link to the Pin?

Yes. Set the Pin’s destination link and check it in the preview before publishing.

### Can I create a Pin with only text?

No. Import the image or video first, then attach it to the Pin.

### How do I verify it reached the board?

Open the confirmed Pin permalink and check the board shown by Pinterest.

### Where does OpenCode keep the PubNio server?

In opencode.json under mcp.servers.pubnio with type remote and url https://pubnio.com/mcp. opencode mcp add writes it for you.

### Can I sign OpenCode in without leaving the session?

Yes. Run /mcps, select pubnio, and approve the workspace in your browser.

## Also works with

- [Create a Pinterest Pin from Claude Code](https://pubnio.com/claude/pinterest)
- [Create a Pinterest Pin from Codex](https://pubnio.com/codex/pinterest)
- [Create a Pinterest Pin from Cursor](https://pubnio.com/cursor/pinterest)
- [Post to Instagram from OpenCode](https://pubnio.com/opencode/instagram)
- [Post to LinkedIn from OpenCode](https://pubnio.com/opencode/linkedin)
- [Upload YouTube Shorts from OpenCode](https://pubnio.com/opencode/youtube)
- [Post to a Facebook Page from OpenCode](https://pubnio.com/opencode/facebook)
- [Post a TikTok video from OpenCode](https://pubnio.com/opencode/tiktok)
- [Publish an X thread from OpenCode](https://pubnio.com/opencode/x)
- [OpenCode setup](https://pubnio.com/opencode)
- [Pinterest publishing API](https://pubnio.com/platforms/pinterest)
- [Pinterest MCP](https://pubnio.com/pinterest-mcp)
- [Pinterest network reference](https://pubnio.com/docs/networks/pinterest/)
- [Pinterest error codes](https://pubnio.com/docs/errors/pinterest/)
- [Pricing](https://pubnio.com/pricing)

## Get started with PubNio

Connect unlimited accounts at $0 per account. Pay as you go includes 50 free confirmed publishes a month on your first workspace, then $20 per 1,000. X API fees are separate.

## REST API reference

Contract example: sample IDs and URLs. The request and both responses decode against PubNio's API schemas; no provider confirmed this post.

```http
POST /api/v1/posts?workspaceId=00000000-0000-4000-8000-000000000006
Authorization: Bearer pn_live_***
Idempotency-Key: opencode-pinterest-product-pin
Content-Type: application/json

{
  "text": "Easy-grip garden shears",
  "publishNow": true,
  "targets": [
    {
      "accountId": "00000000-0000-4000-8000-000000000001",
      "provider": "pinterest",
      "placement": "pin",
      "settings": {
        "title": "Easy-grip garden shears",
        "description": "A close-up of the handles and blade guard.",
        "altText": "Garden shears with green handles and a black blade guard",
        "link": "https://example.com/product"
      },
      "media": [
        {
          "mediaId": "00000000-0000-4000-8000-000000000005"
        }
      ]
    }
  ]
}
```

### 202 Accepted

```json
{
  "postId": "00000000-0000-4000-8000-000000000002",
  "idempotencyKey": "opencode-pinterest-product-pin",
  "targets": [
    {
      "targetId": "00000000-0000-4000-8000-000000000003",
      "attemptId": "00000000-0000-4000-8000-000000000004",
      "accountId": "00000000-0000-4000-8000-000000000001",
      "provider": "pinterest",
      "placement": "pin",
      "canRetry": false,
      "canReconcile": false,
      "status": "queued",
      "scheduledAt": null,
      "url": null,
      "issue": null
    }
  ],
  "warnings": []
}
```

