Authentication
Every request to the Soku API must be authenticated. The API supports two authentication methods, each used in different contexts. This page covers both methods, when to use each, how to obtain credentials, and how to keep them secure.Two Authentication Methods
The Soku API uses different authentication depending on the type of endpoint:Method 1: API Key Authentication
API key authentication is what most developers use. It covers all content endpoints for creating posts, uploading media, rendering templates, and transcribing audio/video.Obtaining an API Key
API keys are created in the Soku dashboard:- Log in to your account at mysoku.io.
- Navigate to Settings > API Keys.
- Click Create API Key.
- Give the key a descriptive name (for example, “Production Server” or “CI Pipeline”).
- Copy the key immediately. For security, the full key is only shown once at creation time.
API Key Format
API keys follow the formatsk_live_ followed by a random string, totaling approximately 55 characters:
Using Your API Key
Include your API key in thesoku-api-key header on every content endpoint request:
Method 2: Firebase ID Token Authentication
The API key management endpoints (/v1/api-keys) and the metrics refresh endpoint (/v1/metrics/refresh) use Firebase ID token authentication. This is because creating and revoking API keys is a privileged operation that requires proof of account ownership.
Obtaining a Firebase ID Token
You can obtain a Firebase ID token by authenticating through the Firebase Authentication SDK in your application. See the Firebase documentation for details.Using an ID Token
Include the Firebase ID token in theAuthorization header as a Bearer token:
Firebase ID tokens expire after 1 hour. Refresh your token before making key management requests if needed.
Quick Reference: Which Auth Method?
Subscription Requirement
API access requires an active Soku subscription. Your account must be in one of the following states:
If your subscription is not active, the API returns a
403 Forbidden error:
Authentication Errors
Missing or Invalid API Key (401)
If thesoku-api-key header is missing or the key is invalid, the API returns a 401 Unauthorized error:
Missing or Invalid ID Token (401)
If theAuthorization header is missing or the Firebase ID token is invalid on a key management endpoint:
API Key Security Best Practices
API keys grant full access to your Soku account through the API. Treat them with the same care as passwords.Store keys in environment variables
Never hard-code API keys in source code, configuration files checked into version control, or client-side code.Never expose keys in client-side code
API keys must only be used in server-side code. Never include them in frontend JavaScript, mobile apps, or any code that runs in a browser. If you need to make API calls from a client application, proxy them through your own backend server.Use separate keys for each environment
Create distinct API keys for development, staging, and production. This lets you revoke a compromised key without affecting other environments.Rotate keys periodically
Revoke and replace API keys on a regular schedule, even if you have no reason to believe they have been compromised. This limits the window of exposure if a key is leaked without your knowledge.Restrict access
Only share API keys with team members and services that need them. Audit your active keys periodically in Settings > API Keys and revoke any that are no longer in use.API Key Management Endpoints
You can also create, list, and revoke API keys programmatically using the key management endpoints with Firebase ID token authentication.For details on the API key management endpoints, see API Keys.
Request Tracking
Every API response includes anX-Request-ID header that uniquely identifies the request. Include this value when contacting support about a specific request.