Linnworks Python API Docs | dltHub
Build a Linnworks-to-database pipeline in Python using dlt with AI Workbench support for Claude Code, Cursor, and Codex.
Last updated:
Linnworks is a commerce operations platform that exposes a granular REST API to programmatically access orders, inventory, listings and account data. The REST API base URL is Primary auth base: https://api.linnworks.net/api API call base (per-account/region): https://{region_host}.linnworks.net/api (example: https://eu1.linnworks.net/api) and All requests require an API Token obtained from AuthorizeByApplication and provided as an Authorization header or query parameter..
dlt is an open-source Python library that handles authentication, pagination, and schema evolution automatically. dlthub provides AI context files that enable code assistants to generate production-ready pipelines. Install with uv pip install "dlt[workspace]" and start loading Linnworks data in under 10 minutes.
What data can I load from Linnworks?
Here are some of the endpoints you can load from Linnworks:
| Resource | Endpoint | Method | Data selector | Description |
|---|---|---|---|---|
| orders_get_open_orders | Orders/GetOpenOrders | GET/POST (doc shows POST but can be requested) | Rows | Get list of open orders (Orders list returned under "Rows"). |
| orders_get_orders_by_id | Orders/GetOrdersById | GET/POST | (top-level array or object per call; detailed order object returned) | Fetch detailed order(s) by order id(s). |
| inventory_get_stock_locations | Inventory/GetStockLocations | GET/POST | (top-level array) | List of stock locations and IDs. |
| inventory_get_stock_levels | Stock/GetStockLevel | GET/POST | (single object or numeric response for stock level) | Get stock level for StockItem (by GUID). |
| listings_get_channels | Channel/GetChannels | GET/POST | (top-level array) | Available sales channels configured on account. |
| inventory_get_categories | Inventory/GetCategories | GET/POST | (top-level array) | Categories list. |
| orders_set_order_shipping_info | Orders/SetOrderShippingInfo | POST | Update order shipping info (included for completeness). |
How do I authenticate with the Linnworks API?
Linnworks issues an API Token via the AuthorizeByApplication (or AuthorizeByUser) endpoint. Clients call https://api.linnworks.net/api/Auth/AuthorizeByApplication with applicationId, applicationSecret and the installation token to receive a Token. Use that Token on subsequent requests either as an Authorization header (Authorization: Token or Authorization: ) or as a query parameter token=.
1. Get your credentials
- Go to https://developer.linnworks.com and sign in. 2. Create a System Integration (application) — copy Application Id and Application Secret from Edit Application -> General. 3. Install the application on the target Linnworks account using the install URL provided in the developer portal; during installation you receive an installation token (static). 4. Call POST https://api.linnworks.net/api/Auth/AuthorizeByApplication with applicationId, applicationSecret and installation token to receive the API Token. 5. Use the returned Token in subsequent API calls (Authorization header or token query param).
2. Add them to .dlt/secrets.toml
[sources.linnworks_operations_source] application_id = "your_application_id" application_secret = "your_application_secret" install_token = "your_installation_token" api_token = "your_api_token"
dlt reads this automatically at runtime — never hardcode tokens in your pipeline script. For production environments, see setting up credentials with dlt for environment variable and vault-based options.
How do I set up and run the pipeline?
Set up a virtual environment and install dlt:
uv venv && source .venv/bin/activate uv pip install "dlt[workspace]"
1. Install the dlt AI Workbench:
dlt ai init --agent <your-agent> # <agent>: claude | cursor | codex
This installs project rules, a secrets management skill, appropriate ignore files, and configures the dlt MCP server for your agent. Learn more →
2. Install the rest-api-pipeline toolkit:
dlt ai toolkit rest-api-pipeline install
This loads the skills and context about dlt the agent uses to build the pipeline iteratively, efficiently, and safely. The agent uses MCP tools to inspect credentials — it never needs to read your secrets.toml directly. Learn more →
3. Start LLM-assisted coding:
Use /find-source to load data from the Linnworks API into DuckDB.
The rest-api-pipeline toolkit takes over from here — it reads relevant API documentation, presents you with options for which endpoints to load, and follows a structured workflow to scaffold, debug, and validate the pipeline step by step.
4. Run the pipeline:
python linnworks_operations_pipeline.py
If everything is configured correctly, you'll see output like this:
Pipeline linnworks_operations_pipeline load step completed in 0.26 seconds 1 load package(s) were loaded to destination duckdb and into dataset linnworks_operations_data The duckdb destination used duckdb:/linnworks_operations.duckdb location to store data Load package 1749667187.541553 is LOADED and contains no failed jobs
Inspect your pipeline and data:
dlt pipeline linnworks_operations_pipeline show
This opens the Pipeline Dashboard where you can verify pipeline state, load metrics, schema (tables, columns, types), and query the loaded data directly.
Python pipeline example
This example loads orders_get_open_orders and inventory_get_stock_locations from the Linnworks API into DuckDB. It mirrors the endpoint and data selector configuration from the table above:
import dlt from dlt.sources.rest_api import RESTAPIConfig, rest_api_resources @dlt.source def linnworks_operations_source(application_id=dlt.secrets.value): config: RESTAPIConfig = { "client": { "base_url": "Primary auth base: https://api.linnworks.net/api API call base (per-account/region): https://{region_host}.linnworks.net/api (example: https://eu1.linnworks.net/api)", "auth": { "type": "bearer", "api_token": application_id, }, }, "resources": [ {"name": "orders_get_open_orders", "endpoint": {"path": "Orders/GetOpenOrders", "data_selector": "Rows"}}, {"name": "inventory_get_stock_locations", "endpoint": {"path": "Inventory/GetStockLocations"}} ], } yield from rest_api_resources(config) def get_data() -> None: pipeline = dlt.pipeline( pipeline_name="linnworks_operations_pipeline", destination="duckdb", dataset_name="linnworks_operations_data", ) load_info = pipeline.run(linnworks_operations_source()) print(load_info)
To add more endpoints, append entries from the resource table to the "resources" list using the same name, path, and data_selector pattern.
How do I query the loaded data?
Once the pipeline runs, dlt creates one table per resource. You can query with Python or SQL.
Python (pandas DataFrame):
import dlt data = dlt.pipeline("linnworks_operations_pipeline").dataset() sessions_df = data.orders_get_open_orders.df() print(sessions_df.head())
SQL (DuckDB example):
SELECT * FROM linnworks_operations_data.orders_get_open_orders LIMIT 10;
In a marimo or Jupyter notebook:
import dlt data = dlt.pipeline("linnworks_operations_pipeline").dataset() data.orders_get_open_orders.df().head()
See how to explore your data in marimo Notebooks and how to query your data in Python with dataset.
What destinations can I load Linnworks data to?
dlt supports loading into any of these destinations — only the destination parameter changes:
| Destination | Example value |
|---|---|
| DuckDB (local, default) | "duckdb" |
| PostgreSQL | "postgres" |
| BigQuery | "bigquery" |
| Snowflake | "snowflake" |
| Redshift | "redshift" |
| Databricks | "databricks" |
| Filesystem (S3, GCS, Azure) | "filesystem" |
Change the destination in dlt.pipeline(destination="snowflake") and add credentials in .dlt/secrets.toml. See the full destinations list.
Troubleshooting
Authentication failures
If AuthorizeByApplication returns 401/403 ensure you used the correct Application Id, Application Secret and install token for the account. Use the dedicated auth host https://api.linnworks.net/api/Auth/AuthorizeByApplication to generate the Token. The token returned must be passed on subsequent requests either in the Authorization header or as token query param.
401 Unauthorized on per-account API host
Per-account hosts (eg https://eu1.linnworks.net/api/...) return 401 if the Token is invalid or expired or if you are hitting the wrong account region. Ensure you used the Token for the same account where the application was installed.
Pagination and large result sets
Some endpoints (GetOpenOrders) return results in a container key (Rows) and accept filters. Use the documented filter parameters on the GetOpenOrders method to restrict results. When large result sets are expected, apply server-side filters (date range, order status) to avoid huge responses.
Rate limiting and errors
Linnworks does not publish a strict public rate limit in the scraped docs; implement exponential backoff for 429/5xx responses, retry with increasing delays and log request IDs. Handle 500-series as temporary server errors. For repeated auth failures, re-run AuthorizeByApplication to get a fresh API token.
Ensure that the API key is valid to avoid 401 Unauthorized errors. Also, verify endpoint paths and parameters to avoid 404 Not Found errors.
Next steps
Continue your data engineering journey with the other toolkits of the dltHub AI Workbench:
data-exploration— Build custom notebooks, charts, and dashboards for deeper analysis with marimo notebooks.dlthub-runtime— Deploy, schedule, and monitor your pipeline in production.
dlt ai toolkit data-exploration install dlt ai toolkit dlthub-runtime install
Was this page helpful?
Community Hub
Need more dlt context for Linnworks?
Request dlt skills, commands, AGENT.md files, and AI-native context.