Overview
The Credentials API provides secure, server-side encryption for sensitive creator credentials (API keys, passwords, session cookies). All encryption uses AES-256-GCM with keys that never leave the server. Key Features:- Server-side encryption (clients never handle encryption keys)
- Multiple credential types: platform connections, download credentials, session cookies
- Directus JWT authentication for user-facing endpoints
- Shared secret authentication for server-to-server operations
Endpoint Categories
1. Platform Connections
User-facing endpoints for managing creator platform credentials (Instagram, TikTok, etc.)2. Download Credentials
YouTube-DL/yt-dlp compatible credentials (passwords, Netscape cookies)3. Platform Sessions
Browser extension cookie capture for HITL (Human-in-the-Loop) authenticationPlatform Connections
POST /api/credentials/create-profile
Create or update a creator profile with encrypted credentials. Authentication: Directus JWT (Bearer token)string
required
Platform identifier (e.g.,
instagram, tiktok, youtube)string
Creator’s username on the platform (optional)
object
required
Platform-specific credentials object (will be encrypted server-side)Example for Instagram:
boolean
Operation success status
string
UUID of the created/updated
platform_connections recordboolean
true if existing connection was updated, false if new record createdPOST /api/credentials/update-profile-creds
Update encrypted credentials on an existing creator profile the user owns. Authentication: Directus JWT (Bearer token)string
required
UUID of the
platform_connections record to updateobject
required
New credentials object (replaces existing encrypted data)
string
Update the platform username (optional)
Server-to-Server Endpoints
POST /api/credentials/store
Encrypt and save credentials to Directusplatform_connections table.
Authentication: X-RBAC-SYNC-SECRET header
string
required
UUID of the
platform_connections recordobject
required
Credentials object to encrypt and store
POST /api/credentials/reveal
Decrypt and return credentials for a creator profile. Authentication:X-RBAC-SYNC-SECRET header
string
required
UUID of the
platform_connections recordboolean
Operation success status
string
UUID of the profile
object
Decrypted credentials object
Download Credentials (yt-dlp)
POST /api/credentials/create-download-cred
Create credentials for yt-dlp/youtube-dl authentication (password or cookies). Authentication: Directus JWT (Bearer token)string
required
Platform identifier (e.g.,
youtube, instagram)string
required
UUID of the associated
platform_connections recordstring
required
Either
password or cookiesstring
Platform username (optional for cookies auth)
object
required
For For
password auth:cookies auth:string
Human-readable name for this credential set (optional)
POST /api/credentials/reveal-download-cred
Decrypt download credentials (server-to-server only). Authentication:X-RBAC-SYNC-SECRET header
string
required
UUID of the
download_credentials recordPlatform Sessions (Cookie Capture)
POST /api/credentials/store-platform-session
Store browser cookies captured via extension (HITL authentication). Authentication: Directus JWT (Bearer token)string
required
UUID of the
platform_connections recordstring
required
Platform identifier (e.g.,
instagram, tiktok)array
required
Array of browser cookie objects:
string
Browser user agent string (optional)
string
ISO 8601 expiry timestamp (optional)
POST /api/credentials/get-platform-session
Retrieve decrypted session cookies (server-to-server only). Authentication:X-RBAC-SYNC-SECRET header
string
required
UUID of the
platform_connections recordstring
required
Platform identifier
POST /api/credentials/revoke-platform-session
Mark a platform session as revoked (disables cookie usage). Authentication: Directus JWT (Bearer token)string
required
UUID of the
platform_sessions recordEncryption Details
All credential encryption uses theencryptJSON() and decryptJSON() utilities (server/utils/credentialsCrypto.js):
- Algorithm: AES-256-GCM
- Key derivation: Server-side environment variable (never exposed)
- IV: Randomly generated per encryption operation
- Output format: Base64-encoded
iv:authTag:ciphertext
- Encryption keys never leave the server
- Clients never handle plaintext encryption keys
- Each credential has unique IV (no key reuse)
- Authentication tags prevent tampering
