API keys
An API key sends data to one environment. Keys are listed per environment on the project page (the Keys entry of the sidebar opens it).
Create a key
Section titled “Create a key”Owners, admins and members can create keys; viewers see the list. On the project page, in the environment’s API keys card, choose Create key and give it a name (one per service or deployment, so you can revoke them one by one).
The secret is shown once. It looks like ctx_<8 hex>_<43 characters>. ctxflow stores only its SHA-256 hash and the visible prefix ctx_<8 hex>. If you lose it, revoke it and create another.
The dialog shows the settings with your key filled in, in two tabs:
-
From the SDK (the default): the key goes in the app’s exporter headers, as in Where to send:
Terminal window export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://app.ctxflow.sh/v1/tracesexport OTEL_EXPORTER_OTLP_TRACES_HEADERS="Authorization=Bearer%20<key>"export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobufWrite the space after
Beareras%20: OpenTelemetry header values are URL-encoded. -
Through your collector (optional): the key goes in the collector (
CTXFLOW_API_KEY); the app only knows the collector address. See Deploy the collector.
The list
Section titled “The list”One row per key: name, prefix and a state: “in use” (with the last use, updated at most once a minute), “never used”, “rejected … · revoked” or “· wrong secret”, “replaced, still in use” or “revoked”.
A rejection mark “rejected 2 min ago · revoked” or “· wrong secret” means a request used that key and got 401:
- revoked: the key was revoked and something still uses it. Create a new key and put it in the collector or the app.
- wrong secret: the prefix of a key matched but the secret did not. Copy the full key again.
The mark goes away when the key is accepted again, and after an hour. A key ctxflow does not know at all leaves no mark: look for 401 in the exporter or collector log.
Rotate and revoke
Section titled “Rotate and revoke”An environment can have several active keys, so you can rotate without a gap. On the Keys page of the environment, choose Rotate on a key:
- Name the new key (it suggests
<old name>-2) and choose Create new key. The old key keeps working. - Copy the new secret (shown once) and put it in the collector or the app.
- Choose Revoke now, or Later. After Later the old key shows “replaced, still in use” and has a Revoke button until you revoke it. ctxflow never revokes it for you.
Revoke stops every service that uses the key at once and cannot be undone. Owners, admins and members can create, rotate and revoke keys (Roles). The project page lists the keys and lets you create and revoke; rotation is on the Keys page.
Related
Section titled “Related”- Use the key: Quickstart, Where to send, Deploy the collector.
- Check that it works: Verify your setup. Errors: OTLP endpoint.
- API:
POST .../api-keys,.../api-keys/<keyId>/rotateand.../revoke(HTTP API).