Load SOS Inventory data to DuckDB
Build a SOS Inventory to DuckDB pipeline with your coding agent. One prompt scaffolds it with the dltHub AI harness, plus the SOS Inventory API base URL, auth, endpoints, and incremental loading.
SOS Inventory is an inventory management platform that provides an API for managing transactions and inventory data. Everything needed to build a working SOS Inventory → 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 SOS Inventory to DuckDB pipeline
Paste this prompt into Claude, Codex, or Cursor. The agent does the rest.
PromptRunuvx dlthub-init@latestto build a pipeline from SOS Inventory 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 SOS Inventory 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.
SOS Inventory API at a glance
| Base URL | https://api.sosinventory.com/api/v2/ |
| Example endpoint | GET api/v2/item |
| Authentication | all requests require a Bearer token in the Authorization header — sent in the Authorization header, prefixed Bearer |
| Pagination | Page-number via start, next cursor at none, page size via maxresults (default 200, max 200). SOS Inventory v2 endpoints use start (row number cursor) and maxresults to paginate. Documentation states a cursor is the row number in the full results set; for the next page, set start to the next row number (e.g., when fetching 200 at a time, use start=201). Limits: default 200 and maximum 200 results per call. |
| API reference | https://developer.sosinventory.com/apidoc/overview |
These values come from the SOS Inventory API reference — the authoritative source if anything here looks out of date.
How do I authenticate with the SOS Inventory API?
All API requests require an Authorization header with the format 'Bearer {access_token}'. Additionally, requests must include the Host header set to 'api.sosinventory.com'.
1. Get your credentials
- Navigate to the SOS Inventory Developer Portal at https://developer.sosinventory.com/. 2. Sign up or log in to your account. 3. Select the 'MY APPS' section in the header. 4. Register a new application to generate and view your 'Client ID' and 'Client Secret'. These credentials are required to initiate the OAuth2 authorization flow (using an authorization code) to obtain an 'access_token' for making API requests.
2. Add them to .dlt/secrets.toml
[sources.sos_inventory_source] client_id = "your_client_id_here" client_secret = "your_client_secret_here" access_token = "your_access_token_here" refresh_token = "your_refresh_token_here"
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 SOS Inventory data can I load into DuckDB?
These are the SOS Inventory endpoints dlt can load into DuckDB:
| Resource | Endpoint | Method | Data selector | Description |
|---|---|---|---|---|
| items | /api/v2/item | GET | Retrieve all items | |
| locations | /api/v2/location | GET | Retrieve all locations | |
| bins | /api/v2/bins | GET | Retrieve all bins | |
| sales_reps | /api/v2/salesrep | GET | Retrieve all sales representatives | |
| tax_codes | /api/v2/taxcode | GET | Retrieve all tax codes |
How do I load only new SOS Inventory records?
The SOS Inventory API reference does not document a timestamp or sequence field for these endpoints, so there is nothing to advertise here as verified. Pick a field from the endpoints table above that increases with every write, then set it as the cursor_path.
{"name": "items", "endpoint": { "path": "api/v2/item", # Replace with a field that increases on every write. "incremental": {"cursor_path": "REPLACE_ME", "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 SOS Inventory pipeline look like?
A standard dlt REST API pipeline — the same code you would write by hand, loading items and customers from the SOS Inventory API into DuckDB:
import dlt from dlt.sources.rest_api import RESTAPIConfig, rest_api_resources @dlt.source def sos_inventory_source(access_token=dlt.secrets.value): config: RESTAPIConfig = { "client": { "base_url": "https://api.sosinventory.com/api/v2/", "auth": {"type": "bearer", "token": access_token}, }, "resources": [ {"name": "items", "endpoint": {"path": "api/v2/item"}}, {"name": "locations", "endpoint": {"path": "api/v2/location"}} ], } yield from rest_api_resources(config) def load_sos_inventory_to_duckdb() -> None: pipeline = dlt.pipeline( pipeline_name="sos_inventory_pipeline", destination="duckdb", dataset_name="sos_inventory_data", ) load_info = pipeline.run(sos_inventory_source()) print(load_info) if __name__ == "__main__": load_sos_inventory_to_duckdb()
Run it with python sos_inventory_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 SOS Inventory data in DuckDB?
dlt creates one table per resource. Query the loaded data with Python or SQL — or ask your agent to, through the MCP server's execute_sql_query tool.
Python (pandas DataFrame):
import dlt data = dlt.pipeline("sos_inventory_pipeline").dataset() df = data.items.df() print(df.head())
SQL:
SELECT * FROM sos_inventory_data.items LIMIT 10;
See querying your data with dataset and exploring it in marimo notebooks.
How do I deploy the SOS Inventory 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 SOS Inventory loads into governed, documented models.
- Visualize & share — explore data in notebooks and publish live dashboards instead of static screenshots.
What other destinations can I load SOS Inventory data to?
dlt loads into any of these — only the destination argument changes:
| Destination | Example 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 SOS Inventory to DuckDB?
Request dlt skills, commands, AGENT.md files, and AI-native context.