Create API key
POST
https://app.speybooks.com/api/v1/api-keys/Generate a new API key. The full plaintext key is returned exactly once in the response — it cannot be retrieved again. Store it securely immediately.
The key is hashed with Argon2id before storage. Default scopes grant full access (["*"]). Invalid scopes are rejected with a validation error listing the bad values.
Body parameters
environment string optionalKey environment. Live keys use sk_live_ prefix, test keys use sk_test_.
livetestname string optionalHuman-readable name for the key (e.g. Production Backend).
scopes array<string> optionalPermission scopes. Use ["*"] for full access, or specific scopes like ["invoices:read", "contacts"].
Response
201 API key created. The full key is returned ONCE in this response and cannot be retrieved again.
Show response fields
createdAt string date-timeenvironment stringid integerkey stringkeyPreview stringname stringscopes array<string>scopesSummary stringwarning stringError codes
400 Validation error: invalid scope(s) or missing required fields.