Obtain API credentials
Locate your API credentials in Klaviyo and differentiate between public and private keys.
Klaviyo uses public and private API keys to authenticate API requests. You can obtain and make changes to your API keys from your account's Settings page under the API Keys tab. To manage API keys, you must have an Owner, Admin, or Manager role on the account.
Public key / Site ID
Your 6-character public key, sometimes referred to as a site ID, is a short alphanumeric string that serves as the unique identifier for your Klaviyo account.
Public keys cannot be used to access secure data in your account and are safe to share. Use your public key when you need to track people and events in client-side JavaScript code.
Private key
Private keys will have the prefix pk_
followed by a longer alphanumeric string. Klaviyo allows you to generate multiple private keys for your applications.
Your private API keys can be used to read and write data to your Klaviyo account and should never be exposed in client-side code or made accessible from public repositories.
Scopes
API Key scopes allow you to restrict access for third parties using a private API key. Adding a scope helps you protect your and your customers’ data by limiting what third parties can access.
You can add any of the following scopes to any new private API key in Klaviyo:
- Read-only
Only allows third parties to view all data associated with the endpoint - Full
Allows third parties to create, delete, or make changes to anything associated with that endpoint - Custom
Allows you to decide how much access to give the third party
Note that you cannot add a scope to an existing private key, which have full access by default. You also cannot edit a private API key after it’s been created. If you need to remove access to a key based on its current scope, delete it and then create a new key with the correct scope.
Available scopes for each API
API endpoint | Associated scopes |
/api/accounts | accounts:read
accounts:write |
/api/catalogs | catalogs:read
catalogs:write |
/api/coupons | coupons:read
coupons:write |
/api/coupon-codes | coupon-codes:read
coupon-codes:write |
/api/campaigns | campaigns:read
campaigns:write |
/api/data-privacy | data-privacy:read
data-privacy:write |
/api/events | events:read
events:write |
/api/flows | flows:read
flows:write |
/api/images | images:read
images:write |
/api/lists | list:read
list:write |
/api/metrics | metrics:read
metrics:write |
/api/profiles | profiles:read |
/api/push-tokens | push-tokens:read
push-tokens:write |
/api/segments | segments:read
segments:write |
/api/subscriptions | subscriptions:read
subscriptions:write |
/api/tags | tags:read
tags:write |
/api/templates | templates:read
templates:write |
For more information about how to add a scope to an API key, please refer to the how to create a scope for a private API key guide.
Updated over 1 year ago