Start
Authentication
Keys, modes and scopes, how the first key is made, and how an agent signs in as a person instead.
Keys#
Send a key as Authorization: Bearer rt_test_… from your server. The key decides two things, and you never send either: the organization (one key is one org's) and the mode (rt_test_ is test, rt_live_ is live). Test and live data never mix.
There is no publishable key. A key never goes in a browser page, a mobile app or a public repository. That is why a checkout needs a small server of your own, and why the kit has one.
| Scope | May | Sees |
|---|---|---|
full | Everything an API key can do. | Everything. |
read | Every GET, and the searches that only read. | What opens the door or a holder's page is null, in event log rows too: a ticket's QR text and page link, an order's private link, a code's text. No QR image. |
checkin | The door endpoints: scan, look up, stats, the offline manifest. | Guests' names in short form. |
A call outside a key's scope answers 403 insufficient_scope. Ask a key what it is before an agent writes anything:
const me = await tickets.keys.current();
console.log(me.mode, me.scope, me.hint.length > 0); // test full truehint is the last characters of the secret, so you can tell your keys apart. The secret is never readable again after it was made.
How the first key is made#
A key is made by a person in a signed-in dashboard session, never by another key. This is on purpose: a leaked key must not be able to make more keys.
- The person signs in at
/loginwith their email. There are no passwords: a six-digit code or a link is emailed to them. - A first sign-in makes their organization.
- Under Developers, API keys, Create API key: pick a name and a scope, then copy the secret. It is shown once. The dashboard makes a test key.
- They give the secret to the agent or the server in
RCMS_TICKETS_KEY.
Rolling a key (POST /v1/keys/{id}/roll) makes a new secret and keeps the old one working for a time you choose, so a secret can change without downtime. Revoking (POST /v1/keys/{id}/revoke) stops it now and cannot be undone. Both are done in the dashboard too.
An agent without a key: sign in as the person#
An agent that works for several clients should not hold a key per client. It can connect to the MCP server and sign in as the person: the person approves it once on a consent page, choosing read only or full, and the agent then acts as them, in any organization they belong to, naming the organization and the mode on every call. The agent never holds a secret that lasts: its access renews every 15 minutes, and the person ends the connection under Settings.
A key stays one organization's, so a leaked key can reach one client, never all of them.
Other ways in#
| Who | How | For |
|---|---|---|
| A person | A session cookie from the emailed code, 7 days idle | The dashboard. Roles: owner, admin, staff, door, viewer. |
| A door phone | A device token rtd_…, from pairing | Scanning, and gate sales if allowed. The door |
| A ticket holder | A private link (/t/…), or a code to their email or phone | Their own tickets. |
| A partner | A private page link (/p#…) | Their own numbers. Partners and their pages |
Test it with curl#
export API=https://rcms-tickets-test.web.app/v1
curl -sS "$API/keys/current" -H "Authorization: Bearer $RCMS_TICKETS_KEY" | jq '{mode, scope}'
curl -sS -o /dev/null -w '%{http_code}\n' "$API/keys/current"
curl -sS "$API/keys/current" -H "Authorization: Bearer rt_test_nope" | jq -r .error.codeThe second call has no key and answers 401 missing_api_key. The third has a key that is not one of ours: invalid_api_key. A revoked key answers api_key_revoked.