← All posts
Linnworks + AI 2 December 2026 6 min read

Is there a Linnworks SDK? Swagger clients, the Macro SDK and plain HTTP

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?

How do you generate a Linnworks API client?

The Linnworks page walks through Swagger Codegen in two ways:

  1. 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.
  2. 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

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?

  1. A Linnworks Macro: use the Macro SDK, as Linnworks' docs say.
  2. A small script or one integration: plain HTTP with a thin wrapper.
  3. 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.
  4. 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).

Frequently asked questions

Is there an official Linnworks SDK?

Linnworks’ developer docs point to a Macro SDK, in the LinnworksNetSDK repository on GitHub, for developing Linnworks Macros. For other integrations they point to Swagger definitions of the API, in the PublicApiSpecs repository, which you can use to generate a client in your own language.

How do I generate a Linnworks API client?

Take a definition from Linnworks’ PublicApiSpecs repository, paste it into the online Swagger Editor and choose Generate Client and a language, or run Swagger Codegen on the command line. The result contains request and response models and client classes.

What does a generated Linnworks client not handle?

The regional server, which comes from each session; the session itself, which expires after inactivity and must be re-authorised; the Authorization header format, which is the bare token; and quirks such as GetOrdersById returning an array and some searches reporting no matches as an error.

Do I need an SDK to use the Linnworks API?

No. The API is a set of HTTP calls with a token header, so a small wrapper around your HTTP library is enough for most integrations. Add typed models only for the endpoints you actually call.

How long does a Linnworks session token last?

Linnworks’ Generating an API Key guide says it expires after 20 minutes of inactivity. When it expires, call AuthorizeByApplication again with the same permanent token.

Ask Claude about your Linnworks account

The Hosted MCP Server for Linnworks connects Claude to your own Linnworks account, read-only. 14-day free trial, then $18.99 a month + tax where applicable.

See the hosted server

Want to run it yourself today? Buy the Linnworks MCP source code and deploy it to your own Cloudflare account. $660 + tax where applicable, one-off.