# Upscrape Pinterest Scraper LLM Integration Prompt

Give this to an LLM or coding agent. It must fetch the OpenAPI spec first and use this brief only for orientation.

## First Step

Fetch and read this OpenAPI spec before writing code:

https://data.upscrape.com/catalog/platforms/pinterest/openapi.json?token=SFMyNTY.g2gDdAAAAAFtAAAAC3BsYXRmb3JtX2lkbQAAAAlwaW50ZXJlc3RuBgDZotdKnwFiAAFRgA.imia9bSvGc4q5Ogc4j8SURew7o-gXaYNRQOrZw8wyAo
This signed OpenAPI URL is valid for approximately 7 days.

## Hard Rules

- Use the OpenAPI spec as the source of truth for endpoints, request bodies, response bodies, errors, and JSON schemas.
- Do not infer fields from capability descriptions; fetch the spec and use its component schemas.
- Authenticate every request with `Authorization: Bearer YOUR_API_KEY`.
- Start runs with `POST /execute`; do not invent platform-specific execute endpoints.
- Poll `GET /jobs/{id}` or `GET /jobs/{id}/result` until `state` is `completed` or `failed`.
- Optionally send `Prefer: wait=N` on `POST /execute` to wait up to N seconds for inline results.
- If the response is `200`, the job completed — read `results[0].data`. If `202`, poll `GET /jobs/{id}`.
- `stream` is public-facing but must remain `false` today.

## API Base

- Base URL: `https://data.upscrape.com`
- OpenAPI spec: `https://data.upscrape.com/catalog/platforms/pinterest/openapi.json?token=SFMyNTY.g2gDdAAAAAFtAAAAC3BsYXRmb3JtX2lkbQAAAAlwaW50ZXJlc3RuBgDZotdKnwFiAAFRgA.imia9bSvGc4q5Ogc4j8SURew7o-gXaYNRQOrZw8wyAo`
- Execute endpoint: `POST /execute`
- Job poll endpoint: `GET /jobs/{id}`
- Result alias: `GET /jobs/{id}/result`
- Content-Type: `application/json`
- Optional header: `Idempotency-Key`
- Optional header: `Prefer: wait=N` (hold connection up to N seconds for synchronous result)

## Execution Flow

1. Send `POST /execute` with a platform capability ID and its `input` object.
2. The API responds with a queued `job_id`.
3. Poll the job endpoint until `state` becomes `completed` or `failed`.
4. If completed, read `results[0].data`; its exact shape is defined by the OpenAPI component schema for the selected capability.

## Example Execute Request

```json
{
  "capability": "pinterest.board-full.get",
  "input": {
    "max_pins": 25,
    "max_sections": 0,
    "page_size": 25,
    "url": "https://www.pinterest.com/PinterestPredicts/gimme-gummy/"
  }
}
```

## Optional Request Fields

- `network.session_id`: explicit reusable session identifier
- `network.session_key`: stable key used to derive a reusable session
- `network.sticky`: reuse the resolved session when `true`
- `timeout_ms`: per-capability timeout override up to the capability maximum listed below
- `stream`: must be `false`

## Supported Capabilities

- `pinterest.board-full.get` - Get Full Board. Fetches complete board data including all pins and sections. IMPORTANT: 'pins' contains board-level pins NOT in any section. Section-specific pins are nested inside 'sections[].pins'. This separation preserves the exact board organization. Also returns summary statistics. Max `timeout_ms`: 120000. Streaming: disabled.
- `pinterest.board-id.get` - Get Board ID. Extracts the numeric board ID from a Pinterest board URL. The board ID is required for some API operations and is extracted from the page's embedded data. Max `timeout_ms`: 30000. Streaming: disabled.
- `pinterest.board-info.get` - Get Board Info. Fetches board metadata without pins. Returns board name, description, pin count, section count, owner, privacy setting, cover images, and section list with pin counts. Max `timeout_ms`: 45000. Streaming: disabled.
- `pinterest.pin.get` - Get Pin. Fetches complete metadata for a single Pinterest pin including title, description, images at multiple resolutions, engagement metrics (saves, repins), creator info, rich metadata (for articles/products), and video URL for video pins. Max `timeout_ms`: 30000. Streaming: disabled.
- `pinterest.section.get` - Get Section. Fetches a board section with all its pins. Returns section metadata (title, slug, pin count) and complete pin data for all pins in that section. Max `timeout_ms`: 60000. Streaming: disabled.
- `pinterest.user-boards.get` - Get User Boards. Fetches all public boards for a Pinterest user. Returns board metadata including name, description, pin count, section count, privacy setting, cover image, and owner information. Max `timeout_ms`: 60000. Streaming: disabled.
- `pinterest.user.get` - Get User. Fetches a Pinterest user's public profile data including username, display name, follower count, profile image URL, and verification status (partner, merchant, domain verified). Max `timeout_ms`: 30000. Streaming: disabled.