Load Pinterest - Api data to DuckDB

Build a Pinterest - Api to DuckDB pipeline with your coding agent. One prompt scaffolds it with the dltHub AI harness, plus the Pinterest - Api API base URL, auth, endpoints, and incremental loading.

Source
Pinterest - Api
Pinterest API Documentation
Destination
DuckDB
In-process analytical database. The default local destination for dlt pipelines — browse all sources you can load into DuckDB.

Pinterest is a visual discovery service whose API manages user boards and Pins, including reading, creating, updating, and deleting them. Everything needed to build a working Pinterest - Api → DuckDB pipeline is on this page: the API's base URL, authentication, endpoints, pagination and incremental field — plus a prompt that hands the whole job to your coding agent.


Build your Pinterest - Api to DuckDB pipeline

Paste this prompt into Claude, Codex, or Cursor. The agent does the rest.

Prompt
Run uvx dlthub-init@latest to build a pipeline from Pinterest - Api to DuckDB and run it on dltHub

That scaffolds a dltHub workspace and installs the dltHub AI harness — the project rules, the secrets-management skill, and the dlt MCP server your agent needs to work safely. From there it reads the Pinterest - Api API, proposes the endpoints to load, then writes, runs and validates the pipeline while you review rather than type. Credentials are inspected through MCP tools, so your agent never reads secrets.toml itself. How the LLM-native workflow works →

Prefer to write it yourself? Every fact the agent uses is below.


Pinterest - Api API at a glance

Base URLhttps://api.pinterest.com/v5
Example endpointGET boards
Records found atitems
AuthenticationOAuth 2.0 bearer access token in the Authorization header — sent in the Authorization header, prefixed Bearer
PaginationCursor-based via bookmark, next cursor at bookmark, page size via page_size (default 25, max 250). Pinterest v5 list responses use cursor pagination: send page_size on the first request, then send the response's bookmark value as the bookmark query parameter on each subsequent request. The final response has bookmark=null. This applies to boards/list_pins and pins/list. OAuth is bearer-token based, with the relevant read scopes (boards
and/or pins
). No documented created_at filter or incremental-since parameter exists for these list endpoints. Pin objects do contain a created_at timestamp, but that is a returned item field, not a server-side pagination or filtering parameter; therefore incremental extraction by created_at must be implemented client-side (and may require overlap/deduplication).
Incremental fieldbookmark
Record idid
API referencehttps://developers.pinterest.com/docs/api/v5/introduction

These values come from the Pinterest - Api API reference — the authoritative source if anything here looks out of date.


How do I authenticate with the Pinterest - Api API?

Use the OAuth 2.0 access token in every API request as the HTTP header Authorization: Bearer <access_token>. JSON API requests may also send Content-Type: application/json; the token is obtained through POST https://api.pinterest.com/v5/oauth/token, whose token-exchange request uses Authorization: Basic <base64(client_id

)> and Content-Type: application/x-www-form-urlencoded.

1. Get your credentials

  1. Create or use a Pinterest business account and verify its email address. 2. Open Pinterest Developers > My apps, accept the Developer Terms, choose Connect app, and submit the app details and trial-access request. 3. After approval, open My apps, select Manage for the app, and use the Configure tab to obtain the App ID (client ID) and App secret key from the API keys section. 4. Configure at least one exact-match redirect URI in the app settings. 5. Implement OAuth 2 authorization-code flow: send the user to https://www.pinterest.com/oauth/ with the required client_id, redirect_uri, response_type=code, and requested scopes; receive the authorization code at the redirect URI; exchange it at https://api.pinterest.com/v5/oauth/token for an access token; store and refresh the token as required. For reading public boards and Pins, request boards
    and pins
    . API calls use the access token as an OAuth bearer token, for example Authorization: Bearer <access_token>. Pinterest also offers product-limited test tokens after trial approval; these expire after 24 hours.

2. Add them to .dlt/secrets.toml

[sources.pinterest_api_source] client_id = "your_pinterest_app_id" client_secret = "your_pinterest_app_secret" access_token = "your_oauth_access_token" refresh_token = "your_oauth_refresh_token"

dlt reads this file automatically at runtime. With the harness, the setup-secrets skill prompts you for the values and never handles the raw credential in chat. For production, see setting up credentials with dlt.


What Pinterest - Api data can I load into DuckDB?

These are the Pinterest - Api endpoints dlt can load into DuckDB:

ResourceEndpointMethodData selectorDescription
boardsboardsGETitemsList boards available to the OAuth operation user; supports bookmark and page_size.
boardboards/{board_id}GETGet one board.
board_pinsboards/{board_id}/pinsGETitemsList Pins on a board; supports bookmark and page_size.
pinspinsGETitemsList Pins owned by the OAuth operation user; supports bookmark and page_size.
pinpins/{pin_id}GETGet one Pin.
board_sectionsboards/{board_id}/sectionsGETitemsList sections for a board.
board_section_pinsboards/{board_id}/sections/{section_id}/pinsGETitemsList Pins in a board section; supports bookmark and page_size.

How do I load only new Pinterest - Api records?

Pinterest - Api exposes bookmark on boards, so dlt can request only the records that changed since the last run. Set it as the cursor_path and dlt tracks the high-water mark for you between runs.

{"name": "boards", "endpoint": { "path": "boards", "data_selector": "items", "incremental": {"cursor_path": "bookmark", "initial_value": "2024-01-01T00:00:00Z"}, }}

On the first run dlt loads everything from initial_value; on every run after that it requests only what changed and appends with write_disposition="merge" if you set a primary key. See incremental loading.


What does the generated Pinterest - Api pipeline look like?

A standard dlt REST API pipeline — the same code you would write by hand, loading GET /v5/boards and GET /v5/boards/{board_id}/pins from the Pinterest - Api API into DuckDB:

import dlt from dlt.sources.rest_api import RESTAPIConfig, rest_api_resources @dlt.source def pinterest_api_source(access_token=dlt.secrets.value): config: RESTAPIConfig = { "client": { "base_url": "https://api.pinterest.com/v5", "auth": {"type": "bearer", "token": access_token}, }, "resources": [ {"name": "boards", "endpoint": {"path": "boards", "data_selector": "items"}}, {"name": "pins", "endpoint": {"path": "pins", "data_selector": "items"}} ], } yield from rest_api_resources(config) def load_pinterest_api_to_duckdb() -> None: pipeline = dlt.pipeline( pipeline_name="pinterest_api_pipeline", destination="duckdb", dataset_name="pinterest_api_data", ) load_info = pipeline.run(pinterest_api_source()) print(load_info) if __name__ == "__main__": load_pinterest_api_to_duckdb()

Run it with uv run python pinterest_api_pipeline.py. The agent iterates on this until it loads cleanly — you review and approve, rather than write it from scratch.


How do I query Pinterest - Api data in DuckDB?

After a run, pipeline.dataset() holds the loaded tables, one per resource. A Relation is a query on that dataset, either a whole table or a SQL string, and reading it gives you the data as a Pandas DataFrame, a PyArrow table or Python tuples. Nothing is read until you ask for it.

import dlt pipeline = dlt.pipeline("pinterest_api_pipeline") # Step 1: Get the dataset from the pipeline dataset = pipeline.dataset() # Step 2: Get a Relation, either a whole table... pins = dataset.table("pins") # ...or any SQL query against DuckDB sample = dataset("SELECT * FROM pins LIMIT 100") # Step 3: Read the data df = pins.df() # or .df(chunk_size=50) for a large table arrow_table = sample.arrow() # a PyArrow Table rows = sample.fetchall() # a list of Python tuples # Which tables were loaded, and how big are they? print(dataset.row_counts().df()) """ table_name row_count 0 boards 13 1 pins 3 """

The columns are the fields the Pinterest - Api API returns. Your agent can run the same queries through the MCP server's execute_sql_query tool, and uv run dlthub show opens the Pipeline Dashboard with the schema, load metrics and a query box. See access loaded data in Python and exploring it in marimo notebooks.


How do I deploy the Pinterest - Api to DuckDB pipeline in production?

The pipeline runs locally, which is ideal for prototyping and one-off analysis. When you need it on a schedule, monitored on every load, and shared with your team, deploy the same dlt code on the dltHub platform — no infrastructure to maintain. The prompt above already ends with "run it on dltHub", so your agent can take it there directly.

  • Deploy & schedule — run the pipeline as a managed job with automatic retries.
  • Monitor — observable job queues, alerting, and load metrics for every run.
  • Transform — promote raw Pinterest - Api loads into governed, documented models.
  • Visualize & share — explore data in notebooks and publish live dashboards instead of static screenshots.

Book a demo →


What other destinations can I load Pinterest - Api data to?

dlt loads into any of these — only the destination argument changes:

DestinationExample value
PostgreSQL"postgres"
BigQuery"bigquery"
Snowflake"snowflake"
Redshift"redshift"
Databricks"databricks"
Filesystem (S3, GCS, Azure)"filesystem"

Set dlt.pipeline(destination="snowflake") and add credentials in .dlt/secrets.toml. On the dltHub platform the same pipeline runs against a managed Iceberg lakehouse. See the full destinations list.


Next steps

Was this page helpful?

Community Hub

Need more dlt context for Pinterest - Api to DuckDB?

Request dlt skills, commands, AGENT.md files, and AI-native context.