Skip to main content
A key should hold only the scopes its job needs. A key for an SDK, a log forwarder, or a CI job that sends telemetry needs one scope: events:ingest. A key with that scope cannot read your data, so a leak of it does not expose your project. This recipe creates such a key, checks it, and revokes it. The caller needs permission to manage keys, and a key can only give scopes that the caller holds. See API keys for the rules.

Create the key

The secret appears once, in the response. Put it straight into your secret store. Do not print it, log it, or paste it into a prompt.
The command asks for confirmation unless you pass --yes. Read the secret from new-key.json with jq -r .key, move it to your secret store, and delete the file.
The response is the only time the full key appears:
expires_at is optional. Use it for keys that you only need for a while.

Check what the key can do

Keys are listed by key_prefix, never by secret. A key with only events:ingest is refused when it reads data:
The status is 403. To send telemetry with this key, see the Ingestion API. Now list the keys of the project:
The list has one object for each active key:

Revoke the key

Revoking is permanent. A revoked key stops working within a minute, and it leaves the list.

Next steps

API keys API

Every scope and the rules for giving them.

Ingestion API

Send telemetry with an ingest-only key.