Create API key
Use this endpoint to programmatically create a new API key.
Keys created via the API can only have the same scope as the key making the request, or a more restrictive one.
Permissions
- No additional scope required. Accessible with any valid API key.
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_KEY
API 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, products:read:prices, recipients:create, recipients:update, recipients:read:unmasked, recipients:read:masked, recipients:delete, accounts:create, accounts: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, products:read:prices, recipients:create, recipients:update, recipients:read:unmasked, recipients:read:masked, recipients:delete, accounts:create, accounts:read The accounts access of the API key.