Getting an API key
Needlepath is in early access. Keys are issued per organisation, not self-serve: request access through nextmoca.com and a key arrives with your onboarding. Everything below applies to the key you receive. Every request carries one header:x-api-key. The
legacy x-api-key header was retired at the Bearer cutover and now fails
authorization outright.
Key format
np_test_ is reserved and is not minted today.
Scope: keys belong to the organisation, not to you
An API key is org-scoped. This has two consequences that surprise people at exactly the wrong moment:When someone leaves, their keys keep working
When someone leaves, their keys keep working
That is correct behaviour, not an oversight. Revoking a person must not strand
their company’s production traffic. What you should do at offboarding is review
the keys that person created and rotate the ones nobody is now accountable for.Keep your own record of which key belongs to which service and who provisioned
it — a “keys created by X” view arrives with the dashboard, and until then
that mapping lives with you.
The secret is shown exactly once
At mint time you see the full key. After that we hold only its hash and a display prefix, so nobody — including us — can recover it. If you lose it, rotate.Rotation is create-then-revoke, never in place
Key operations go through us today. There is no self-serve console for
minting, rotating or revoking yet — that arrives with the account dashboard. The
sequence below is what we will do on your behalf, and it is what the self-serve
flow will do when it lands, so it is worth understanding either way.
1
Create a second key
Both keys are now live. Your per-org key cap has to have room for the extra —
see Limits.
2
Deploy the new key
Roll it out everywhere the old one was used. Take as long as you need; there
is no window where neither key works.
3
Confirm the old key is idle
Wait until nothing is using it. Your own deploys are the primary evidence; ask
us and we can confirm from telemetry, which is per-key. A per-key
last-used timestamp you can read yourself arrives with the dashboard.
4
Revoke the old key
Revocation is not instantaneous on the request path — see below.
Revocation takes up to 60 seconds to bite
Authorization decisions are cached for 60 seconds. A revoked key can therefore still be accepted for up to a minute after you revoke it. This is a deliberate trade: the same cache is what keeps authorization off the request path, and a 60-second TTL is already five times tighter than the platform default. The same TTL applies to every claim carried on your key — tier, limits, status. A plan change or a suspension is subject to the same window.What never to put in a request
Two fields, for two different reasons.Record content belongs in
records[].text, not in metadata.keywords, tags and attributes are structurally bounded and are not
metered. They are bounded by the published size cap; values beyond it are
outside the contract and may be rejected.They are read, as indexing hints, so short well-chosen values help. They are not
content: nothing parked there can be selected, excerpted or returned to you.Errors you will see
The
403 body deliberately does not say which of those it was. An error that
distinguishes “no such key” from “suspended organisation” is an oracle for
anyone probing keys.
Full error reference
Every status this API returns, what causes it, and whether to retry.