Create API key
Use this endpoint to create a new API key from an authenticated dashboard session. Use this when an owner or tools admin needs to mint a key - for a new integration, for key rotation, or to scope access to specific Accounts.
Required fields
name- display name of the API key (must be unique within the Company)
Optional fields
expirationInDays- number of days until the key expires. Accepted values:30,60,90,180,365. Default:90.enforceMtls- whentrue, requests with this key must use mTLS. Default:false.permissions- array of permission scopes the new key should have. See the permission reference.accountsAccess-{ scope: "all-accounts" | "specific-accounts", ids: [] }to scope the key to specific Accounts.
Optional headers
Snappy-Account-Id- optional account scopingSnappy-Company-Id- required for multi-company users to select the target Company
Behavior Notes
- The API key secret is visible only in this response. Store it securely - it cannot be retrieved later.
- Max 100 active API keys per Company. Delete an existing key before creating the 101st.
Permissions
Authenticated via Authorization: Bearer <dashboard user JWT>. Only Company owners and tools admins have access.
Authorizations
User Bearer Authentication
Use a dashboard user JWT in the Authorization header when managing API keys from the Snappy dashboard:
Authorization: Bearer YOUR_JWTFor multi-company users, also pass Snappy-Company-Id to select the target company.
Headers
Optional account identifier for swag validation/filtering.
"acc123456"
Optional company identifier for swag validation/filtering.
"cmp123456"
Body
Create API key request body.
The name of the API key. Must be unique within the company.
1"My API"
API key expiration period in days. Default: 90 days.
0.00069 <= x <= 365If true, the API key will be enforced to use mTLS.
false
The permissions of the API key.
gifts:create, gifts:create:demo, gifts:update, gifts:read:unmasked, gifts:read:masked, orders:create, orders:cancel, orders:read:unmasked, orders:read:masked, campaigns:create, campaigns:update, campaigns:read, collections:read, products:read, products:read:prices, recipients:create, recipients:update, recipients:read:unmasked, recipients:read:masked, recipients:delete, accounts:create, accounts:read, billingMethods:read Response
Created API key including the secret.
JSON:API single-resource envelope for a created API key.
API key object including the secret returned on create.