Skip to content

Developers

Let an AI assistant run DLCode for you, or call the REST API from your own code. Both can manage products, links, recalls, lots, serial numbers, passports, QR styles and your team.

Connect to Claude

  1. In Claude, open Settings → Connectors and choose Add custom connector.
  2. Name it DLCode and paste https://dlcode.org/mcp as the URL.
  3. Choose Connect, sign in to DLCode and choose Allow.

On Team and Enterprise plans, an owner adds the connector first. Then each person connects their own DLCode account.

Connect to ChatGPT

  1. In ChatGPT, open Settings → Apps. Under Advanced settings, turn on Developer mode.
  2. Choose Create app. Name it DLCode, paste https://dlcode.org/mcp as the MCP server URL and pick OAuth.
  3. Sign in to DLCode and choose Allow.

Connect to Claude Code

Create a key on the API keys page, then run:

claude mcp add --transport http dlcode https://dlcode.org/mcp \
  --header "Authorization: Bearer dlc_live_..."

Or leave out --header and run /mcp in Claude Code to sign in with your browser.

Connect to Cursor

Add this to ~/.cursor/mcp.json, or to .cursor/mcp.json in a project:

{
  "mcpServers": {
    "dlcode": {
      "url": "https://dlcode.org/mcp",
      "headers": {
        "Authorization": "Bearer dlc_live_..."
      }
    }
  }
}

Any other client that supports remote MCP servers over Streamable HTTP works the same way: the URL, plus OAuth or a Bearer API key.

MCP tools

Products are always identified by GTIN. Write tools act on your live codes, so your assistant should confirm recalls with you first.

get_accountReadPlan, trial end, product count, product limit, seats, own domains and domain limit.
list_productsReadProducts, 50 at a time, with an optional text filter.
get_productReadOne product by GTIN, with its links, campaigns and offer.
add_productWriteRegister a GTIN and get its QR code URL.
update_productWriteChange the name, brand, main link or code domain.
list_domainsReadYour own domains, their status and which one is the default.
set_default_domainWritePick the domain new print files use.
set_recallWriteRecall a product, some lots, or lots by expiry date.
clear_recallWriteEnd a recall.
get_label_svgReadThe SVG print file for a product: label or QR code, plain or in your QR style, with an optional lot and expiry date.
list_lotsReadA product's lots with best-by dates and FSMA 204 data.
add_lotWriteAdd a lot with its dates, quantity and FSMA 204 data.
update_lotWriteChange or rename a lot.
delete_lotWriteDelete a lot record.
make_serialsWriteMake up to 10,000 serial numbers for a product, in order or random.
list_serialsReadSerial number batches, and each serial's first scan and scan count.
get_epcis_eventsReadEPCIS 2.0 events for serial batches and serial scans.
get_passportReadA product's digital product passport and its public page.
set_passportWriteSave the passport: maker, origin, materials, certifications, care, repair, recycling, carbon footprint and documents.
delete_passportWriteRemove the passport. Its page and link stop working.
list_teamReadThe owner, seats and each team member with their role.
invite_memberWriteInvite someone by email as admin, editor or viewer.
set_member_roleWriteChange a team member's role.
remove_memberWriteRemove someone from the team.
get_qr_styleReadThe brand QR style, or the style one product uses.
set_qr_styleWriteSet color, rounded modules, logo and label use, for the brand or one product.
clear_qr_styleWriteRemove a product's own style, or the brand style.

REST API

Base URL https://dlcode.org/api/v1. Send your key as Authorization: Bearer dlc_live_.... Create and revoke keys on the API keys page. We store only a hash, so copy the key when you create it. Bodies and responses are JSON.

GTINs can be 8, 12, 13 or 14 digits. Responses always use the 14-digit form. Each product has codeUrl, the URL inside its QR code. It uses the product's domain when that domain is active, else your default domain, else dlcode.org. domain is null when the product uses your default.

GET /account

Your plan, trial end date (null when not on a trial), product count, active product count, limit, seats (seats.limit is null when seats are unlimited), own domains (domains) and how many domains your plan allows (domainLimit).

curl https://dlcode.org/api/v1/account -H "Authorization: Bearer $DLCODE_KEY"

GET /products?q=&limit=&offset=

List products, newest first. q filters by GTIN, name or brand. limit is 1 to 100 (default 50). Returns products, total and nextOffset; nextOffset is null on the last page.

curl "https://dlcode.org/api/v1/products?q=oat&limit=50&offset=0" -H "Authorization: Bearer $DLCODE_KEY"

POST /products

Add a product. Returns 201 with the product. url and brand are optional.

curl https://dlcode.org/api/v1/products -H "Authorization: Bearer $DLCODE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"gtin":"04012345678901","name":"Oat milk 1L","url":"https://example.com/oat"}'

GET /products/{gtin}

One product with all its links.

curl https://dlcode.org/api/v1/products/04012345678901 -H "Authorization: Bearer $DLCODE_KEY"

PATCH /products/{gtin}

Change name, brand, url or domain. Only the fields you send change. domain is a hostname from /domains for this product's new print files; null goes back to your default domain.

curl -X PATCH https://dlcode.org/api/v1/products/04012345678901 -H "Authorization: Bearer $DLCODE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/oat-1l"}'

GET /domains

Your own domains. Each has hostname, status (pending, active, moved or failed), default and onPlan. Only active domains with onPlan true go into print files. onPlan is false when the domain is over your plan's limit. Add and remove domains on the Domains page, since they need DNS records.

curl https://dlcode.org/api/v1/domains -H "Authorization: Bearer $DLCODE_KEY"

POST /domains/{hostname}/default

Make this domain the default for new print files. The domain must be active and on your plan. Products that picked their own domain keep it. Codes already printed do not change. Returns the domain list.

curl -X POST https://dlcode.org/api/v1/domains/qr.example.com/default -H "Authorization: Bearer $DLCODE_KEY"

POST /products/{gtin}/recall

Start a recall. Recalls need a paid pack. note is required. Leave out lots to recall every pack. lots recalls those lot codes; expiryBefore (YYYY-MM-DD) also recalls any pack whose expiry date is on or before that date, from the code or from the lot's saved expiry. expiryBefore needs lots, or lots saved with an expiry.

curl https://dlcode.org/api/v1/products/04012345678901/recall -H "Authorization: Bearer $DLCODE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"lots":["24B"],"note":"Glass may be present. Do not eat. Return for a refund."}'

PUT /products/{gtin}/lots/{lot}/recall

Recall or un-recall one lot. Needs a paid pack. recalled is true or false. note is optional. The call changes only that lot: lots already recalled stay recalled, and when you remove the last recalled lot the recall ends. Returns the product, with recalled, recallLots and recallNote. 400 for a bad lot or body, 403 without a paid pack, 404 for an unknown GTIN. Odoo users can do this from the lot form with the free DLCode Lot Recalls module.

curl -X PUT https://dlcode.org/api/v1/products/04012345678901/lots/24B/recall -H "Authorization: Bearer $DLCODE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"recalled":true,"note":"Do not eat. Return it to the store for a full refund."}'

DELETE /products/{gtin}/recall

End the recall.

curl -X DELETE https://dlcode.org/api/v1/products/04012345678901/recall -H "Authorization: Bearer $DLCODE_KEY"

GET /qr-style

Your brand QR style: color, rounded, onLabel, logo (true when set) and scope (brand, or plain when there is none). /products/{gtin}/qr-style gives the style that product uses, with scope product, brand or plain.

curl https://dlcode.org/api/v1/qr-style -H "Authorization: Bearer $DLCODE_KEY"

PATCH /qr-style

Set the brand QR style. Only the fields you send change. color is hex and needs a contrast of at least 4.5:1 on white. logo is a PNG data URL up to 200 KB, or an empty string to remove it. A logo raises error correction to H and covers at most 20% of the code. PATCH /products/{gtin}/qr-style sets a style for one product.

curl -X PATCH https://dlcode.org/api/v1/qr-style -H "Authorization: Bearer $DLCODE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"color":"#1E3A8A","rounded":true,"onLabel":false}'

DELETE /qr-style

Remove the brand style, so files go back to plain. DELETE /products/{gtin}/qr-style puts one product back on the brand style.

curl -X DELETE https://dlcode.org/api/v1/products/04012345678901/qr-style -H "Authorization: Bearer $DLCODE_KEY"

GET /products/{gtin}/passport

The product's digital product passport. Returns gtin, url (the public passport page) and passport, which is null when none is set. Scanning the code with ?linkType=gs1:sustainabilityInfo opens the same page. Send Accept: application/ld+json to the page URL for schema.org and GS1 JSON-LD.

curl https://dlcode.org/api/v1/products/04012345678901/passport -H "Authorization: Bearer $DLCODE_KEY"

PUT /products/{gtin}/passport

Save the passport. Needs a paid pack. It replaces the whole passport, so fields you leave out become empty. Fields: manufacturerName, manufacturerAddress, countryOfOrigin (two letters), materials [{name, percent}] (percent 0 to 100 or null, 100 at most in total), certifications [{name, issuer, number, validUntil (YYYY-MM-DD)}], care, repair, recycling, carbonValue, carbonUnit (needed with carbonValue), carbonMethod, documents [{title, url}].

curl -X PUT https://dlcode.org/api/v1/products/04012345678901/passport -H "Authorization: Bearer $DLCODE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"manufacturerName":"Oat Co","countryOfOrigin":"DE","materials":[{"name":"Oats","percent":10}],"certifications":[{"name":"EU Organic","issuer":"DE-ÖKO-001","number":"A-1","validUntil":"2027-05-01"}],"recycling":"Carton goes in paper recycling.","carbonValue":0.42,"carbonUnit":"kg CO2e","documents":[{"title":"Spec sheet","url":"https://example.com/spec.pdf"}]}'

DELETE /products/{gtin}/passport

Remove the passport. Its page and link stop working.

curl -X DELETE https://dlcode.org/api/v1/products/04012345678901/passport -H "Authorization: Bearer $DLCODE_KEY"

GET /products/{gtin}/label.{svg|pdf|eps}

Print file: barcode and QR code at true size. SVG, PDF and EPS, all vector. Add ?lot= for a lot code, ?expiry=YYYY-MM-DD to put an expiry date in the code (GS1 AI 17), ?download=1 to download. qr.svg, qr.pdf and qr.eps give the QR code only. Files are plain black on white; add ?style=brand for your QR style. The label only takes the style when onLabel is true.

curl -o label.pdf "https://dlcode.org/api/v1/products/04012345678901/label.pdf?lot=24B&expiry=2026-12-31" -H "Authorization: Bearer $DLCODE_KEY"

GET /products/{gtin}/lots

The product's lot records: lot, expiry, packedOn, quantity, unit, the FSMA 204 fields sourceName, sourceAddress, location, refDocType and refDocNumber, note, whether the lot is recalled, and links to its print files.

curl https://dlcode.org/api/v1/products/04012345678901/lots -H "Authorization: Bearer $DLCODE_KEY"

POST /products/{gtin}/lots

Add a lot. Returns 201 with the lot. Only lot is required. Dates are YYYY-MM-DD. A saved expiry shows on the hosted page when that lot is scanned, and recalls by expiry date use it. Needs a paid pack.

curl https://dlcode.org/api/v1/products/04012345678901/lots -H "Authorization: Bearer $DLCODE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"lot":"24B","expiry":"2026-12-31","packedOn":"2026-06-01","quantity":1200,"unit":"cases","sourceName":"Northfield Foods","sourceAddress":"12 Mill Rd, Salem, OR"}'

PATCH /products/{gtin}/lots/{lot}

Change a lot. Only the fields you send change. Send newLot to rename it. URL-encode the lot code if it has a slash.

curl -X PATCH https://dlcode.org/api/v1/products/04012345678901/lots/24B -H "Authorization: Bearer $DLCODE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"refDocType":"Bill of lading","refDocNumber":"BOL-5521"}'

DELETE /products/{gtin}/lots/{lot}

Delete a lot record. Printed codes keep working.

curl -X DELETE https://dlcode.org/api/v1/products/04012345678901/lots/24B -H "Authorization: Bearer $DLCODE_KEY"

POST /products/{gtin}/serials

Make serial numbers (GS1 AI 21). Paid packs only. count is 1 to 10,000. mode is sequential (default, continues from the last number) or random (12 characters). lot and expiry (YYYY-MM-DD, from last year to 49 years ahead) are optional and go in every code. Your plan holds up to 25,000 serials (25 products), 100,000 (100 products) or 250,000 (1,000 products); 1,000 during the free trial. Returns 201 with the batch, including csvUrl and zipUrl.

curl https://dlcode.org/api/v1/products/04012345678901/serials -H "Authorization: Bearer $DLCODE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"count":500,"mode":"random","lot":"24B","expiry":"2027-06-30"}'

GET /products/{gtin}/serials?q=&limit=&offset=

The product's batches and its serial numbers, newest batch first. Each serial has lot, expiry, link (the URL in its QR code), batchId, firstScanAt (null until scanned) and scans. q finds a serial. limit is 1 to 500 (default 100).

curl "https://dlcode.org/api/v1/products/04012345678901/serials?limit=100" -H "Authorization: Bearer $DLCODE_KEY"

GET /products/{gtin}/serials/{batchId}.{csv|zip}

One batch as a CSV (gtin, serial, lot, expiry, link, first_scan, scans), or a ZIP with an SVG and a PDF QR code for every serial plus the CSV.

curl -o serials.zip https://dlcode.org/api/v1/products/04012345678901/serials/BATCH_ID.zip -H "Authorization: Bearer $DLCODE_KEY"

GET /epcis/events?gtin=&since=

EPCIS 2.0 JSON-LD (application/ld+json). One ObjectEvent with action ADD and bizStep commissioning per serial batch, with the lot and expiry in ilmd. One ObjectEvent with action OBSERVE per known serial per day it was scanned, at that day's first scan; the read point is not known. EPCs are GS1 Digital Link URIs, like https://id.gs1.org/01/04012345678901/21/1001. Leave out gtin for every product. since (ISO date-time) returns only later events. One document holds up to 50,000 scan events; when it is full, pass the eventTime of its last event as since for the next part. Paid packs only.

curl -o events.jsonld "https://dlcode.org/api/v1/epcis/events?gtin=04012345678901" -H "Authorization: Bearer $DLCODE_KEY"

GET /team

The owner's email, seats used and seat limit (null means unlimited), and each member with id, email, role, status (pending until they log in) and invitedAt.

curl https://dlcode.org/api/v1/team -H "Authorization: Bearer $DLCODE_KEY"

POST /team

Invite someone by email. role is admin, editor or viewer (default editor). Admins can do everything except pay. Editors change products, links, recalls and leads. Viewers can only look. We email the invite. Returns 201 with the team. 403 when every seat is taken.

curl https://dlcode.org/api/v1/team -H "Authorization: Bearer $DLCODE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email":"sam@example.com","role":"editor"}'

PATCH /team/{id}

Change a member's role.

curl -X PATCH https://dlcode.org/api/v1/team/MEMBER_ID -H "Authorization: Bearer $DLCODE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"role":"viewer"}'

DELETE /team/{id}

Remove a member. They lose access right away.

curl -X DELETE https://dlcode.org/api/v1/team/MEMBER_ID -H "Authorization: Bearer $DLCODE_KEY"

Product fields

{
  "gtin": "04012345678901",
  "active": true,
  "name": "Oat milk 1L",
  "brand": "Acme",
  "url": "https://example.com/oat",
  "recalled": false,
  "recallNote": "",
  "recallLots": [],
  "recallExpiryBefore": "",
  "scans30d": 42,
  "domain": null,
  "codeUrl": "https://dlcode.org/01/04012345678901",
  "labelSvgUrl": "https://dlcode.org/api/v1/products/04012345678901/label.svg",
  "qrSvgUrl": "https://dlcode.org/api/v1/products/04012345678901/qr.svg",
  "links": [{ "type": "pip", "href": "https://example.com/oat", "country": "", "lot": "" }],
  "utmTags": true,
  "campaigns": [{ "name": "Summer sale", "url": "https://example.com/sale", "startsAt": "2026-07-01T04:00:00.000Z", "endsAt": "2026-08-01T04:00:00.000Z", "live": false }],
  "offer": null
}

active is false when the product is over your plan's limit. Its code opens a page that says the code is not active. links, utmTags, campaigns and offer come back from single-product routes only. They are read-only here. Campaign times are UTC and endsAt is the first moment after the campaign. In MCP results, labelSvgUrl and qrSvgUrl point to https://dlcode.org/app/products/…, which opens when you're signed in to DLCode.

Errors and limits

Errors return {"error": "..."} with a message you can show to a person. In MCP, the same message comes back as a tool error.

400The input is wrong, for example a GTIN with a bad check digit. The message says what to fix.
401The key or token is missing, wrong or revoked.
403Your plan or role doesn't allow it, for example the plan is full, recalls, serial numbers and passports on the free plan, or a viewer making a change.
404No product with that GTIN, or no domain with that hostname, in your account.
409That GTIN is already on DLCode.
429More than 120 requests in a minute. Wait for Retry-After seconds.

Each account can make 120 requests per minute, counted across the REST API and MCP together.

OAuth access tokens last one hour and refresh on their own. Revoking an API key stops it right away. To disconnect an assistant, click Disconnect on the API keys page. It stops working right away.