1. The bootstrapping rule
This is the constraint that shapes every integration, and the one an API schema cannot express:
Every endpoint on this page except the token exchange refuses a service
credential with 401. Provisioning is done by a
principal — a user session or an API token — never by the machine
credential itself. A gateway that could mint its own successors could
escalate itself out of any scope you gave it.
| Credential you hold | Can it call these management endpoints? |
|---|---|
User session JWT (POST /auth/token) |
Yes — with tokens:manage_service |
API token (token_type: api) |
Yes — with tokens:manage_service |
Service credential (llk_svc_ / llk_cs_) |
No — 401, by design |
So an unattended provisioner holds two credentials: a long-lived API token that mints, and whatever it mints. Keep them in separate places — the minting one is the more powerful of the two.
2. Authenticating as a manager
Either works. An API token avoids storing a password and does not expire on a password change, so prefer it for anything unattended.
Content-Type: application/x-www-form-urlencoded
username=admin%40firm.example&password=…
→ 200 { "access_token": "eyJhbGci…", "token_type": "bearer" }
An API token is created once in the interface under API Tokens, or over HTTP:
{ "name": "provisioner", "expires_in_days": 365 }
→ 200 { "id": 221, "name": "provisioner", "token": "…", "expires_at": "…" }
Send either as Authorization: Bearer <value>. If the
principal belongs to more than one organization, also send
X-Active-Org-Id: <uuid> — credentials belong to one
organization and cannot be moved afterwards.
tokens:manage_service to create, rotate and revoke.
tokens:audit to list and to read the activity log. Both are
also capped by the organization's permission ceiling.
3. The scope vocabulary
Fetch it rather than hard-coding: it is the authoritative list, and it is what the interface renders from.
A scope is read, write, or
<resource>:<read|write>. write implies
read for the same resource.
| Resource | Covers |
|---|---|
contacts |
Contacts, people, leads |
matters |
Matters, cases, projects, opportunities |
notes |
Notes |
tasks |
Tasks |
events |
Calendar events |
documents |
Documents and folders |
billing |
Invoices, payments, time, trust |
firm_users |
Firm users |
connections |
Connection health and field schemas |
webhooks |
Webhooks |
court_data |
Court data (Trellis) |
An unknown scope is rejected at mint time rather than ignored — a typo that silently granted less than you meant is a bug you would find in production.
4. Minting a credential
{
"name": "n8n production gateway",
"description": "Nightly matter sync",
"scopes": ["read"], // or ["contacts:read","notes:write"]
"platform_scopes": ["clio-manage"], // optional; omit for all connected
"expires_in_days": 90, // default 90, max 366
"grant_type": "bearer" // or "client_credentials"
}
201 Created:
{
"id": 222,
"name": "n8n production gateway",
"grant_type": "bearer",
"token_prefix": "llk_svc_D4FQNP",
"scopes": ["read"],
"read_only": true,
"platform_scopes": [],
"org_id": "…",
"service_account_user_id": 125,
"created_by_user_id": 6,
"expires_at": "2026-12-13T12:37:15",
"is_expired": false,
"is_active": true,
"last_used_at": null,
"last_used_ip": null,
"secret": "llk_svc_…", // ONLY on this response
"secret_notice": "Store this now — it is shown once…"
}
secret is returned once and never again.
Only a hash is stored. If your provisioner does not persist it from this
response, the credential is unusable and must be rotated. Every other
endpoint returns the same object without secret.
platform_scopes uses hyphenated slugs — clio-manage,
lead-docket. An empty list means every platform the organization
has connected, not none.
5. Using it
grant_type: bearer
Send the secret directly. Nothing to exchange.
GET /api/v1/universal/matters?limit=25
Authorization: Bearer llk_svc_…
grant_type: client_credentials
The secret (llk_cs_…) is refused as a Bearer
token. Exchange it — once an hour, not per request:
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials&client_id=llk_cs_ApNkTZ&client_secret=llk_cs_…
→ 200 {
"access_token": "llk_svc_…",
"token_type": "Bearer",
"expires_in": 3599,
"scope": "read"
}
The client secret may also be sent as HTTP Basic, as the password half. Add
scope= to request less than the credential holds; asking
for more is refused with invalid_scope rather than quietly capped.
This is the only endpoint here that takes no Authorization header — the client secret authenticates the call, per RFC 6749 §4.4.
What a credential can reach
/api/v1/universal/…— the platform-agnostic data API/mcp— the MCP endpoint, same Bearer header
It cannot reach account, user, role or reporting endpoints, the per-platform
routers, or anything that connects or disconnects a platform. Those refuse it
with 401 or 403.
6. Rotate, revoke, list
{ "expires_in_days": 90 } // optional
→ 200 { …, "secret": "llk_svc_…" } // the new one, shown once
The previous secret stops working the moment this returns. Write the new one to your store before the next scheduled run, or sequence the rotation with your deploy.
Immediate. The next request with that secret is refused. The row remains, marked revoked, so its audit history stays answerable.
→ 200 {
"credentials": [ … ],
"requires_org": false,
"organizations": [ … ], // only for platform-wide accounts
"connected_platforms": ["clio-manage","lawmatics"],
"acting_org_id": "…"
}
connected_platforms is the valid domain for
platform_scopes — restricting to a platform the organization has
not connected narrows nothing.
7. Audit
Query: since_days (1–365, default 30), limit
(1–50000, default 1000), export=csv for a download.
→ 200 {
"credential": { … },
"since": "2026-08-15T09:00:00",
"count": 7,
"truncated": false,
"records": [
{ "timestamp_utc": "…", "credential_id": 222, "credential_prefix": "llk_svc_…",
"endpoint": "/api/v1/universal/contacts", "method": "GET",
"platform": "lawmatics", "status_code": 200, "response_time_ms": 412,
"error_category": null, "error_fingerprint": null }
]
}
Tokens minted by the client_credentials exchange are folded into
their parent's history, so a gateway using exchange does not read as idle.
platform is null for a call that named no
platform_id — that request fanned out across every connected
platform, so no single slug is the honest answer.
Never the request or response body. Platform responses routinely contain client data, and an exportable audit file is the last place that should end up. You get the endpoint, the method, the platform, the status and an error fingerprint.
8. Connection health and expiry
Pollable by the service credential itself — it is the one thing a gateway must be able to check without a human.
→ 200 {
"healthy": 3, "unhealthy": 1,
"platforms": [
{ "platform_id": "filevine", "platform": "Filevine",
"expires_at": "2026-06-04T06:03:49", "status": "error",
"probe": "contacts", "detail": "Exception: Failed to refresh Filevine token…" },
{ "platform_id": "lawmatics", "platform": "Lawmatics",
"expires_at": null, "status": "ok", "probe": "contacts" }
]
}
Each entry is proved by a real authenticated read, not by the existence of a
credential row. status is ok, error or
unknown — unknown means the platform exposes nothing
listable to probe and is not a failure.
A recorded history, with how long a platform has been failing and whether
anyone was told, is at
GET /api/v1/service-credentials/alerts/health — that one needs a
manager credential, not a service credential.
9. Tool schema version
Readable by any credential, deliberately unscoped: a credential narrowed to
matters:read still needs to know whether the matters tool changed
under it.
GET /api/v1/mcp/schema?since=2.0.0&include_tools=false
→ 200 {
"schema_version": "2.1.0",
"fingerprint": "99c8a49d…",
"up_to_date": false,
"action_required": true, // any release since yours is breaking
"changelog": [ … ]
}
Poll fingerprint to detect a change without diffing the whole
document. It covers tool names, parameter names and accepted action values,
and deliberately ignores description text so it does not move when wording is
improved. Gate a build on action_required.
You can also be told rather than poll — see
the Events tab for the
mcp.schema_changed webhook.
10. Errors
| Status | Means |
|---|---|
400 |
Malformed request — an unknown scope, an empty scope list, a non-HTTPS webhook URL, an address that is
not deliverable. The detail names what was wrong. |
401 |
The credential is not accepted here. Either it is invalid, expired or revoked — or it is a service credential on a management endpoint, which is rule 1. |
403 |
Authenticated but not permitted. Either the principal lacks the permission, or the credential's own scopes refuse this call. |
404 |
No such credential in this organization. Another firm's id is a 404, not a 403 — the two are deliberately indistinguishable. |
A scope refusal names what would have been needed, so the fix does not require guessing:
403 {
"detail": "This credential is not scoped for write access to Contacts.
Scopes held: read. Scope required: 'contacts:write'."
}
The token endpoint returns RFC 6749 error bodies —
invalid_client, invalid_scope,
unsupported_grant_type — so a standards-aware client reports
them properly.
Setting one up by hand instead? See the step-by-step guide.