API and AI agents
Let your own software, or an AI assistant like ChatGPT or Claude, make QR codes, change where they go and read scan stats for you.
1. Get a key
Sign in, open Settings, and under API keys and AI agents create a key. It starts with loco_ and is shown once, so copy it somewhere safe. A key can see and change only its own workspace's codes. Delete it in Settings any time to cut off access.
Keys work on the Business and Business+ plans. See plans
2. Connect an AI assistant (MCP)
LocoCodes speaks the Model Context Protocol, the standard way AI assistants plug into apps. Point your assistant at this address and give it your key:
https://lococodes.com/api/mcp
Send the key as a header, Authorization: Bearer loco_…. If your app can't add headers, put the key on the end of the address instead (https://lococodes.com/api/mcp/loco_…). Keep that full address private, because it works like a password.
Claude Code
claude mcp add --transport http lococodes https://lococodes.com/api/mcp \ --header "Authorization: Bearer loco_YOUR_KEY"
Cursor, Claude Desktop and other apps with a config file
{
"mcpServers": {
"lococodes": {
"url": "https://lococodes.com/api/mcp",
"headers": { "Authorization": "Bearer loco_YOUR_KEY" }
}
}
}ChatGPT and apps that only take an address
Add a custom connector or MCP server and paste https://lococodes.com/api/mcp/loco_YOUR_KEY as the address, with no sign-in.
What the assistant can do
| create_code | Make an editable QR code or short link, with optional colors and style |
| list_codes | List codes, newest first, with search and tag filters |
| get_code | One code: where it goes, its short URL, printable QR image and scans |
| update_code | Change where a code goes, its title, tags or design, or pause it |
| get_code_stats | Scans by day, city, country, device and browser |
| get_account | Your plan, limits and how many codes you've used |
| delete_code | Delete a code (it stops working right away) |
Try asking: "Make a pink QR code for my spring menu at example.com/menu", or "Which of my codes got the most scans this month?"
3. Or use the REST API
Send the key with every request:
curl https://lococodes.com/api/v1/links \
-H "Authorization: Bearer loco_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"destination_url": "https://example.com/menu", "title": "Spring menu"}'| GET | /api/v1/account | Plan, limits and usage |
| GET | /api/v1/links?search=&tag=&limit= | List codes |
| POST | /api/v1/links | Create a code |
| GET | /api/v1/links/:id-or-slug | One code |
| PATCH | /api/v1/links/:id-or-slug | Change a code |
| DELETE | /api/v1/links/:id-or-slug | Delete a code |
| GET | /api/v1/links/:id-or-slug/stats?days=30 | Scan stats |
| GET | /api/qr/:slug.svg | The QR image (no key needed) |
A new code returns short_url (where scans go), qr_svg_url (the printable image) and nfc_url (for NFC tags). Fields you can send: destination_url, title, slug, tags, has_qr (false for a plain short link), qr_style (fg, bg, dots, eyes, eyeColor, frameText), external_ref and is_active.
Errors come back as {"error": "..."}: 401 bad key, 402 plan limit reached, 403 plan doesn't include the API, 404 not found, 409 slug taken.
4. Webhooks: hear about every scan (Business+)
Add a web address in Settings, Webhooks. Each time someone scans one of your codes, we send it a POST like this within a few seconds:
{
"type": "scan.created",
"created_at": "2026-11-27T18:04:11.000Z",
"code": { "id": "…", "slug": "menu", "title": "Spring menu",
"short_url": "https://lococodes.com/menu", "destination_url": "https://example.com/menu" },
"scan": { "channel": "qr", "device": "mobile", "os": "iOS", "browser": "Safari",
"country": "US", "region": "South Carolina", "city": "Charleston" }
}To check a message really came from us, read the LocoCodes-Signature header (t=…,v1=…) and compare v1 with an HMAC-SHA256 of t + "." + body using your signing secret. Answer with any 2xx code within 5 seconds. Bots and link checkers aren't sent, and a webhook that fails 25 times in a row is switched off until you turn it back on.