Linnworks' developer docs point to two things rather than a ready-made SDK for every language: Swagger definitions of the API on GitHub, which you can feed to a code generator to get a client in the language you use, and a Macro SDK for code that runs as a Linnworks Macro. Outside macros, you either generate a client or call the API over plain HTTP. Either way, sessions, regional servers and a few response quirks stay your job.
What does Linnworks publish for developers?
- Swagger definitions. The API Definitions & Swagger page says the API is described in Swagger 2.0 specifications, kept in Linnworks' PublicApiSpecs repository on GitHub. The changelog entry announcing them says they let you create clients in many languages.
- An OpenAPI definition on every reference page. Each endpoint page in the API Reference embeds its own definition, so you can check one call without opening the whole specification.
- The Macro SDK. The same page says that if you are developing a Macro you don't need to generate a client, because it is part of the Macro SDK in the LinnworksNetSDK repository. A later changelog entry says that SDK was updated to match the documentation, and asks anyone developing macros locally to update.
- llms.txt. A Markdown version of the whole reference at apidocs.linnworks.net/llms.txt, which is useful context for a coding assistant writing the client with you.
How do you generate a Linnworks API client?
The Linnworks page walks through Swagger Codegen in two ways:
- In the browser. Paste a definition into the online Swagger Editor, check the endpoints and models it shows, then choose Generate Client and a language. You download a folder of code.
- On the command line. Run Swagger Codegen yourself, following Swagger's own documentation, which suits a build pipeline.
The generated folder holds request and response models plus client classes for each controller. That saves typing out every schema by hand, which matters when objects like OrderDetails have dozens of fields.
What will a generated client not do for you?
Pick the right server
The definitions on the reference pages list https://eu-ext.linnworks.net as the server, and a generated client will usually default to whatever server its definition names. Linnworks' System Integration Setup guide says to use the Server field returned by AuthorizeByApplication as the base URL instead. Set the client's base path from each session, never from the definition. Why the server URL is never hard-coded explains what goes wrong otherwise.
Run the session
Your code exchanges the application ID, application secret and the account's permanent token for a session token, sends that token with every call, and authorises again when it expires. The Generating an API Key guide says the session expires after 20 minutes of inactivity. The hosted server's open code handles it in the simplest robust way: cache the session with its Server, and on any 401 authorise again once and retry the call once. If you serve more than one Linnworks account, keep one session per account; that code gives every merchant account its own session provider so that a token can never be used for the wrong account.
Format the header
The security scheme is an API key in a header named Authorization, and the value is the session token on its own: no "Bearer" prefix. If your generator or HTTP library adds a prefix to authorisation headers by default, turn that off.
Match the body format to the endpoint
The definitions describe JSON request bodies. The hosted server's open code, which works against live accounts, calls the classic Orders, Stock and ProcessedOrders endpoints with form-encoded bodies, where any object or array value is sent as a JSON string, and uses JSON only for newer Inventory endpoints whose comments say they reject form encoding. Generated code will follow the definition. Test every endpoint you rely on against a real account, and keep the ones that need special handling in one place.
Handle the quirks the schema doesn't show
- Arrays for single items. GetOrdersById returns an array even for one order; getting an order by number, reference or ID covers the order lookups.
- "Not found" as an error. The hosted code treats GetStockItemsFull's HTTP 400 "No items found with given filter." as an empty result, not a failure.
- "Not found" as success. GetOrderDetailsByNumOrderId returns an empty object, with a 200, when no order matches.
- Writes that replace, not merge. The open code's notes say SetOrderGeneralInfo and SetOrderNotes replace the whole block, so read the order, merge, then write it all back.
- Half-finished writes. Creating an order is more than one call: create an empty order, then add lines, then set the address. The open code looks up everything it needs before it creates the order, and deletes the new order if a later step fails, so a failed attempt doesn't leave an empty shell in the order book.
- The zero GUID.
00000000-0000-0000-0000-000000000000appears in the definitions as an example value. It is a placeholder, not a real location or country: the open code notes that an address saved with the zero GUID as its CountryId and only a country name ends up with its delivery country as "UNKNOWN", so it looks up real country IDs first.
Is plain HTTP good enough?
For most integrations, yes. The Linnworks API is a set of POST and GET calls with a token header, so a thin wrapper around fetch covers it: build the URL from the session's Server, add the header, encode the body, parse the reply, retry once on 401. The body encoding, for example, is a few lines:
function toForm(params) {
const body = new URLSearchParams();
for (const [key, value] of Object.entries(params)) {
if (value == null) continue; // skip missing values
body.append(key, typeof value === "object" ? JSON.stringify(value) : String(value));
}
return body;
}
Add typed models only for the calls you actually use, taken from their reference pages, and you get most of a generated client's benefit without its defaults.
Which route should you take?
- A Linnworks Macro: use the Macro SDK, as Linnworks' docs say.
- A small script or one integration: plain HTTP with a thin wrapper.
- A large integration in a strongly typed language: generate a client from the Swagger definitions, then wrap it to handle servers, sessions and the quirks above.
- Letting an AI assistant read your Linnworks data: you don't need a client of your own at all. An MCP server sits between the assistant and the Linnworks API; what is an MCP server? explains the idea.
Or skip building it
The Linnworks MCP source code is a working Linnworks client and MCP server in TypeScript for Cloudflare Workers: the source we run in production, which you deploy to your own Cloudflare account. Besides the read tools for orders, stock, purchase orders and returns, it includes tools to update base retail prices, archive or restore stock items, create an open order and look up customers, and you decide whether to deploy those. The Hosted MCP Server for Linnworks is the read-only version with nothing to deploy: connect Linnworks, paste one URL into Claude, and ask.
MCP-G is part of Green & Home Limited and is not affiliated with, endorsed by or sponsored by Linnworks or Anthropic.
Skip the client work: buy the self-host source ($660 + tax where applicable, one-off, 12 months of free updates), or start a 14-day free trial of the hosted server (Starter is $18.99 a month + tax where applicable afterwards).