---
title: "Authentication – Ltd24 API"
description: "Most of the Ltd24 API is public: plans, prices, comparisons, recommendations, search and the MCP server need no credentials. OAuth 2.0 is only needed to act for a user, for example to create a…"
canonical: https://ltd24.co.uk/auth.md
last-updated: 2026-12-04
---

# Authentication – Ltd24 API

Most of the Ltd24 API is public: plans, prices, comparisons, recommendations, search and the MCP server need **no credentials**. OAuth 2.0 is only needed to act for a user, for example to create a pre-filled free-consultation booking link.

## Discover
- Authorization server metadata (RFC 8414): https://ltd24.co.uk/.well-known/oauth-authorization-server
- Protected resource metadata (RFC 9728): https://ltd24.co.uk/.well-known/oauth-protected-resource/api
- Issuer: `https://ltd24.co.uk` · Resource: `https://ltd24.co.uk/api`
- Protected endpoints answer `401` with `WWW-Authenticate: Bearer resource_metadata="https://ltd24.co.uk/.well-known/oauth-protected-resource/api"`.

## Pick a method
- **Agent acting on its own (server-to-server):** client credentials grant.
- **Agent acting for a person:** authorization code with PKCE (S256). The person sees a consent page and clicks Allow; no Ltd24 account is needed.

Scopes:
- `plans:read` – read plans, prices and comparisons
- `booking:write` – create free-consultation booking links the user confirms

## Register
Self-serve, free, no approval:

```http
POST https://ltd24.co.uk/api/oauth/register
Content-Type: application/json

{"client_name": "My agent", "redirect_uris": ["https://example.com/callback"], "token_endpoint_auth_method": "client_secret_basic"}
```

The response contains `client_id` and `client_secret`. You can also use a **Client ID Metadata Document**: pass an `https://` URL as `client_id` (public client, `token_endpoint_auth_method: none`, PKCE required).

## Claim
Authorization code flow: send the user to

```
https://ltd24.co.uk/api/oauth/authorize?response_type=code&client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&scope=booking:write&state=STATE&code_challenge=CHALLENGE&code_challenge_method=S256
```

After Allow, the user returns to `REDIRECT_URI?code=...&state=...&iss=https://ltd24.co.uk`. Codes expire after 5 minutes and can be used once.

## Exchange
```http
POST https://ltd24.co.uk/api/oauth/token
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code&code=CODE&redirect_uri=REDIRECT_URI&code_verifier=VERIFIER&client_id=CLIENT_ID
```

Client credentials:

```http
POST https://ltd24.co.uk/api/oauth/token
Authorization: Basic base64(client_id:client_secret)
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&scope=booking:write
```

Tokens last 1 hour. The authorization code flow also returns a `refresh_token` (30 days, rotated on use): `grant_type=refresh_token&refresh_token=...`.

## Use the access_token
```http
POST https://ltd24.co.uk/api/v1/booking-links
Authorization: Bearer ACCESS_TOKEN
Idempotency-Key: 4d1c2b8e-...
Content-Type: application/json

{"name": "Mario Rossi", "email": "mario@example.com", "topic": "Open a UK LTD", "language": "it"}
```

Check a token with `GET https://ltd24.co.uk/api/v1/whoami` or `POST https://ltd24.co.uk/api/oauth/introspect`.

## Errors
Errors are JSON. OAuth endpoints return `{"error": "invalid_grant", "error_description": "...", "hint": "..."}` (RFC 6749). API endpoints return RFC 9457 problem details (`application/problem+json`) with `code`, `detail` and `hint`:

- `401 missing_token` / `invalid_token` – get a new token
- `403 insufficient_scope` – request the scope named in `required_scope`
- `429 rate_limited` – wait 60 seconds (limit 120 requests/minute per IP)

## Revocation
```http
POST https://ltd24.co.uk/api/oauth/revoke
Content-Type: application/x-www-form-urlencoded

token=ACCESS_OR_REFRESH_TOKEN
```

Questions: info@ltd24ore.com
