Create API key
Use this endpoint to programmatically create a new API key for your Company. Use this when rotating keys, provisioning a key for a new integration, or spinning up a scoped key for a specific Account from a backend service or automation pipeline.
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.accountIds- array of Account IDs the key should be scoped to. Omit for all-Accounts access.
Behavior Notes
- The API key secret is visible only in this response. The
apiKeyfield in the response body is your one and only chance to capture the secret value - store it securely. After this response, only metadata is retrievable. - Permission inheritance. Keys created via the API can only have the same permissions as the calling key, or a more restrictive subset. Attempts to grant permissions the calling key doesn’t have are rejected.
- 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
Company Level Authentication
Company level authentication provides access to all resources under your company, including accounts, campaigns, gifts, and recipients.
Getting Your API Key
- Create an API Key: Use the
POST /v2/authentication/apiKeysendpoint to generate a new API key - Set Expiration: Choose from 30, 60, 90, or 180 days (default: 90 days)
- Optional mTLS: Enable mutual TLS for enhanced security
- Name Your Key: Provide a descriptive name for easy identification
Using Your API Key
Include your API key in the X-Api-Key header for every request:
X-Api-Key: YOUR_24_CHARACTER_API_KEYAPI Key Management
- Maximum Keys: Up to 3 active API keys per company
- Rotation: Delete old keys before creating new ones when at the limit
- Security: Keys are hashed and cannot be retrieved after creation
Enhanced Security (mTLS)
For production environments, enable mutual TLS authentication:
- Set
enforceMtls: truewhen creating the API key - Contact support to obtain your client certificates
- Use the mTLS endpoint:
https://mtls-api.snappy.com/public-api
Headers
Source of the request
api_native, api_zapier, api_salesforce, api_ftp, api_make "api_native"
Query Parameters
Company ID
^[A-Za-z0-9]{8,}$"12345678"
Body
Create API key request body.
The name of the API key. The name is used to identify the API key. The name must be unique.
1"My API"
API key expiration period in days. Valid values: 30, 60, 90, 180, 365. Default: 90 days.
0.00069 <= x <= 365If true, the API key will be enforced to use mTLS. If false, the API key will not be enforced to use mTLS. The default value is false.
true
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, recipients:create, recipients:update, recipients:read:unmasked, recipients:read:masked, recipients:delete, accounts:create, accounts:read, billingMethods:read Response
Ok
API key object.
The API key id
"abc123456"
The date the API key will expire. Date Format: YYYY-MM-DDThh:mm:ss.sZ.
"2022-12-06T09:50:38.536Z"
The date the API key was created. Date Format: YYYY-MM-DDThh:mm:ss.sZ.
"2022-12-06T09:50:38.536Z"
If true, the API key will be enforced to use mTLS. If false, the API key will not be enforced to use mTLS.
true
The name of the API key
"My API key"
The company id
"abc12345678"
The API key
^[a-fA-F0-9]{24}$"abc123456abc123454542343"
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, recipients:create, recipients:update, recipients:read:unmasked, recipients:read:masked, recipients:delete, accounts:create, accounts:read, billingMethods:read The accounts access of the API key.