Skip to main content

Generate API Key

POST/api/v1/lead_providers/{id}/generate_api_key/

Generates a new API key (credential) for a specific provider and stores it in the database in hashed form.

Auth: Admin JWT + IsAdminOnlyPosition.

Path parameter

ParameterTypeDescription
idIntegerProvider ID

Body fields

FieldTypeRequiredDescription
nameStringOptionalKey name ("Production", "Sandbox"). Default: "default"

Response — 200 / 201

{
"api_key": "lp_live_7f2a91_r3vS6gG8-QzM5h...",
"credential_id": 1,
"key_prefix": "7f2a91"
}
FieldDescription
api_keyThe full key — shown only in this response
credential_idThe key record ID (for managing keys)
key_prefixThe public prefix of the key (for identification; not secret)

:::danger Security — the key is shown only once api_key is returned only once. The system does not store it in plain text (hash). If lost, it cannot be recovered; you must generate a new one and revoke the old one. Deliver the key to the provider over a secure channel (don't paste it in email/chat). :::

Code samples

curl -X POST https://api.navigo.example/api/v1/lead_providers/1/generate_api_key/ \
-H "Authorization: Bearer $NAVIGO_ADMIN_JWT" \
-H "Content-Type: application/json" \
-d '{"name": "Production"}'

Possible errors

StatusReason
404No provider with this id
401JWT is invalid
403No admin position

Full format: Errors.