Create an API key
A Strent API key lets your server ask Strent about the customers of one project. It works like a password for your server: never give it to your users or put it in browser code.
Create and store the key
Section titled “Create and store the key”- Open Configuration → API keys.
- Create a key with a name that identifies its consumer, such as
api-production. - Copy the secret immediately. Strent reveals the full value only once.
- Store it where your server keeps secrets, such as its environment variables.
STRENT_API_KEY=strent_test_your_opaque_secretEach key starts with its project’s mode, so a key in the wrong place is easy to spot:
strent_test_<opaque-secret>for Test projects.strent_live_<opaque-secret>for Live projects.
Send the key
Section titled “Send the key”The Node.js SDK adds the header for you. Direct HTTP clients must send:
Authorization: Bearer strent_test_your_opaque_secretA missing or malformed header returns 401 INVALID_AUTH_HEADER. A well-formed but invalid or unknown key returns 401 API_KEY_INVALID; a revoked key returns 403 API_KEY_REVOKED.
Rotate a key
Section titled “Rotate a key”Create a replacement, deploy it to the consumer, verify traffic, and then revoke the old key. Because keys belong to one project, rotation does not affect other application environments.
A project keeps at most 100 keys, revoked ones included, and names of up to 120 characters. When it is full, creating a key deletes the key revoked longest ago, which from then on returns 401 API_KEY_INVALID instead of 403 API_KEY_REVOKED. Creating a key fails only when all 100 are active; revoke one first.