api keys
Create key
Creates a new API key with an optional expiry. The full key value is only returned once in the response.
AuthorizationBearer <token>
API key authentication - use your Zernio API key as a Bearer token
In: header
namestring
expiresIn?integer
Days until expiry
scope?string
'full' grants access to all profiles (default), 'profiles' restricts to specific profiles
Default
"full"Value in
"full" | "profiles"profileIds?array<string>
Profile IDs this key can access. Required when scope is 'profiles'.
permission?string
'read-write' allows all operations (default), 'read' restricts to GET requests only
Default
"read-write"Value in
"read-write" | "read"Response Body
application/json
application/json
curl -X POST "https://zernio.com/api/v1/api-keys" \ -H "Content-Type: application/json" \ -d '{ "name": "Analytics Read-Only Key", "scope": "profiles", "profileIds": [ "6507a1b2c3d4e5f6a7b8c9d0" ], "permission": "read" }'{
"message": "API key created successfully",
"apiKey": {
"id": "6507a1b2c3d4e5f6a7b8c9d0",
"name": "Analytics Read-Only Key",
"keyPreview": "sk_12345678...90abcdef",
"key": "sk_1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"expiresAt": null,
"createdAt": "2024-01-15T10:30:00Z",
"scope": "profiles",
"profileIds": [
{
"_id": "6507a1b2c3d4e5f6a7b8c9d0",
"name": "Main Brand",
"color": "#ffeda0"
}
],
"permission": "read"
}
}Empty
{
"error": "Unauthorized"
}