keys

Embed
Preview of the card
<a href="https://lucidace.com/docs/ref-keys"><img src="https://lucidace.com/docs/_api/public/orgs/af34862a-c837-4478-8335-0505efe40459/spaces/da916cd3-c0fc-4b63-b971-b3c13623daf3/pages/4a00d76b-e07e-42ea-b940-e3987a710a86/social-card.svg?v=3e7ae33eec8b" alt="keys" width="600" height="315"></a>
POSThttps://lucidace.com/v1/projects/{project_id}/keys

The secret is in the response once and cannot be fetched again.

Give each integration the narrowest key. Rights requests and erasure (a Cookie Munch executor's secretKey, a GDPR deletion handler): {"kind":"secret","name":"erasure","scopes":["privacy:execute"]}. That key may call persons/bulk_delete, DELETE persons/{id} and the /privacy/* rights routes of this project and nothing else; never hand an executor an admin key. Server events: {"kind":"secret","scopes":["capture"]}. Minting needs an account key (lc_pat_) or a session; GET /v1/whoami shows what any key can do.

A read-only key for the query API: {"kind":"secret","scopes":["query:read"]} reads every project resource (insights, persons, replays, flags, experiments) and writes nothing. ?dry_run=true validates without creating (200, no secret). An Idempotency-Key retry within 24h returns the first response without the secret (replayed: true); rotate to get a new one.

Parameters

project_idstringpathrequired
dry_runbooleanquery
validate only
Idempotency-Keystringheader
replay-safe retries for 24h

Request body

application/json
environmentstring
Public and secret keys: the environment this SDK key serves (flags, config); defaults to the project's default environment.
expires_atstring
kindstringrequired
public, secret or personal.
namestringrequired
scopesstring[]
Personal keys: one or more scopes. Secret keys: at least one (capture for send-only). Fine-grained <resource>:read|write for insight, dashboard, replay, flag, experiment, cohort, person, connector, settings, plus pii:read, *:read, *:write, pipeline:read, pipeline:write, profiles:read (the gateway profile API), privacy:execute (rights requests and person erasure, nothing else), capture (secret keys: send events, read nothing), admin, delegate and the older broad query:read / draft:write. See GET /v1/scopes.
{
  "environment": "string",
  "expires_at": "2024-01-01T00:00:00Z",
  "kind": "string",
  "name": "string",
  "scopes": [
    "string"
  ]
}

Code samples

cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/keys" \
  -H "Idempotency-Key: <value>" \
  -H "Content-Type: application/json" \
  -d '{"environment":"string","expires_at":"2024-01-01T00:00:00Z","kind":"string","name":"string","scopes":["string"]}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200 dry run
201
Example
{
  "created_at": "2024-01-01T00:00:00Z",
  "created_by": "string",
  "environment": "string",
  "expires_at": "2024-01-01T00:00:00Z",
  "id": "string",
  "key_prefix": "string",
  "kind": "string",
  "last_used_at": "2024-01-01T00:00:00Z",
  "legacy_read_all": true,
  "name": "string",
  "org_id": "string",
  "project_id": "string",
  "public_value": "string",
  "revoked_at": "2024-01-01T00:00:00Z",
  "scopes": [
    "string"
  ],
  "secret": "string",
  "value": "string"
}
Schema
created_atstringrequired
created_bystring
environmentstring
Environment an SDK key is bound to. null means unbound: it serves the project's default environment, looked up when the key is used (so it follows a change of default); personal keys are never bound.
expires_atstring
idstringrequired
key_prefixstringrequired
kindstringrequired
last_used_atstring
legacy_read_allbooleanrequired
A secret key with no scopes: it reads the whole project (issued before secret keys needed explicit scopes). Rotate it to a scoped key.
namestringrequired
org_idstringrequired
project_idstringrequired
public_valuestring
The full key, kept only for public keys (they ship in web pages); null for secret and personal keys, which are shown once, and for public keys minted before this was stored.
revoked_atstring
scopesstring[]required
secretstringrequireddeprecated
Same as value, kept for older clients. On a public key it is NOT a secret (it equals public_value); read value and tell the keys apart by kind.
valuestringrequired
The full key to use: lc_pk_… for kind: public (ships in web pages), lc_sk_… for kind: secret (server only). Shown once for secret keys; only its SHA-256 is stored.
400
403
404
409 idempotency key reused
DELETEhttps://lucidace.com/v1/projects/{project_id}/keys/{key_id}Scope admin

Parameters

project_idstringpathrequired
key_idstringpathrequired

Code samples

cURL
curl -X DELETE "https://lucidace.com/v1/projects/{project_id}/keys/{key_id}"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

204
403
404
POSThttps://lucidace.com/v1/projects/{project_id}/keys/{key_id}/rotate

Issues a replacement with the same name, kind, scopes and expiry, and revokes the old key.

Parameters

project_idstringpathrequired
key_idstringpathrequired

Code samples

cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/keys/{key_id}/rotate"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

403
404
GEThttps://lucidace.com/v1/scopes

The scope catalogue, for key and OAuth app forms.

Code samples

cURL
curl -X GET "https://lucidace.com/v1/scopes"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200
Example
[
  {
    "level": "string",
    "name": "string",
    "resource": "string"
  }
]
Schema
levelstringrequired
read, write, admin or delegate.
namestringrequired
resourcestring
The resource for fine-grained scopes, * for all, null for special scopes.
GEThttps://lucidace.com/v1/whoami

`GET /v1/whoami`: the same answer as `GET /v1/keys/self`, under the name other platforms use.

Code samples

cURL
curl -X GET "https://lucidace.com/v1/whoami" \
  -H "Authorization: Bearer $LUCIDACE_API_KEY"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200
Example
{
  "environment": "string",
  "expires_at": "2024-01-01T00:00:00Z",
  "kind": "string",
  "name": "string",
  "org_ids": [
    "string"
  ],
  "prefix": "string",
  "project_id": "string",
  "scopes": [
    "string"
  ]
}
Schema
environmentstring
SDK keys: the environment the key serves (its binding, else the project default); null for personal and account keys.
expires_atstring
kindstringrequired
public, secret or personal (project keys); account for an account key.
namestringrequired
org_idsarray
Account keys: the orgs the key is limited to; null means every org the owner belongs to.
prefixstringrequired
project_idstring
Project keys: the project the key belongs to.
scopesstring[]required
An empty list on a legacy secret key means it reads the whole project.
401
404 The caller is not authenticated by a key
Updated