Partner API
The TimelinesAI Partner API enables B2B partners to programmatically provision and manage workspaces, users, and WhatsApp account connections. This server-to-server API allows partners to integrate TimelinesAI capabilities directly into their own platforms without requiring end-users to interact with the TimelinesAI UI.The Partner API uses JWT authentication, separate from the Public API’s bearer token. See Getting started below to set up your partner credentials.
Billing
Understanding the billing model is essential before provisioning workspaces and connecting WhatsApp accounts.| Concept | How it works |
|---|---|
| Billing unit | Each connected WhatsApp account (not seats or users) |
| Billing cycle | Monthly in arrears |
| Seats | Control the maximum number of users/WhatsApp accounts in a workspace (1–99). Seats are a capacity limit, not a billing unit. |
| Trials & offboarding | If a customer trial does not convert, actively disconnect their WhatsApp account using POST /workspaces/{id}/users/{user_id}/whatsapp/disconnect to stop billing. Simply deleting or ignoring the workspace is not enough — the connected account will continue to be billed. |
| Seat downgrades | When you reduce seats_purchased below current utilization, the platform may automatically suspend users and their associated WhatsApp accounts to comply with the new limit. |
| Quota monitoring | Subscribe to workspace:seats_full Partner API Webhooks to get alerted when all seats are utilized, so you can proactively manage capacity. |
Getting started
To begin using the Partner API, you need to have your partner records created in the TimelinesAI system. This is a one-time setup process.Contact TimelinesAI
Reach out to TimelinesAI at support@timelines.ai to request partner access. The team will set up your partner records in the system.
Receive your credentials
Once your partner account is provisioned, you will receive two credentials:
- Partner ID — your unique partner identifier (e.g.,
your-company-name) - Partner Secret — a secure key used to sign JWT tokens (keep this confidential)
Generate a JWT token
Use your credentials to generate a short-lived JWT token for authenticating API requests. See the Authentication section below for code examples.
Base URL
Authentication
The Partner API uses JWT (JSON Web Token) bearer authentication. Each request must include a valid JWT token signed with your Partner Secret using the HS256 algorithm.Required headers
Include the following headers in all API requests:| Header | Value |
|---|---|
Authorization | Bearer <jwt_token> |
X-TL-Partner-Id | Your partner ID |
Content-Type | application/json |
JWT token generation
Generate a short-lived JWT token with the following payload claims:| Claim | Type | Description |
|---|---|---|
partner_id | string | Your partner identifier |
nbf | number | Not before — set to 3 minutes in the past (Unix timestamp) |
exp | number | Expiration — set to 3 minutes in the future (Unix timestamp) |
Capabilities
Workspaces
Create and manage customer workspaces with configurable seat allocations. Update display names and scale seats up or down.
User Management
Create placeholder users in batch — each user consumes one seat and can have a WhatsApp account connected.
QR Code Onboarding
Generate QR code links for users to connect their WhatsApp accounts by scanning. Supports embedded (iframe) and standalone modes.
WhatsApp Accounts
Forcibly disconnect WhatsApp accounts from users when needed.
API Token Management
Retrieve and rotate Public API tokens for any managed workspace. Tokens don’t expire unless explicitly rotated.
Available endpoints
| Group | Endpoint | Description |
|---|---|---|
| Workspaces | POST /workspaces | Create a new partner-managed workspace with specified seats |
GET /workspaces/{workspace_id} | Get workspace details including quotas, users, and WhatsApp accounts | |
PATCH /workspaces/{workspace_id} | Update workspace display name and/or seat count | |
| Users | POST /workspaces/{workspace_id}/users | Create placeholder users in batch (each consumes one seat) |
| QR Codes | POST /workspaces/{workspace_id}/users/{user_id}/qr | Generate a QR code link for WhatsApp connection |
POST /workspaces/{workspace_id}/users/{user_id}/whatsapp/disconnect | Disconnect a WhatsApp account from a user | |
| API Tokens | GET /workspaces/{workspace_id}/api-token | Retrieve the Public API token (creates one if needed) |
POST /workspaces/{workspace_id}/api-token | Rotate the Public API token (invalidates the old one immediately) |
Use case examples
White-label WhatsApp platform
White-label WhatsApp platform
Embed WhatsApp messaging into your own SaaS product without exposing TimelinesAI to your end users.
- Use
POST /workspacesto create a workspace when a customer signs up - Create users with
POST /workspaces/{id}/users(one per WhatsApp number they need) - Generate QR codes with
POST /workspaces/{id}/users/{user_id}/qr— embed in your UI usingdisplay_mode=embedding - Retrieve their Public API token with
GET /workspaces/{id}/api-token - Use the Public API token in your backend to send/receive messages on their behalf
Managed service provider
Managed service provider
Offer WhatsApp as a service to multiple clients, managing everything from a single integration.
- Provision workspaces per client with
POST /workspaces - Configure seat allocations with
PATCH /workspaces/{id} - Onboard client WhatsApp numbers via QR codes
- Monitor workspace health using Partner API Webhooks (quota alerts, account connectivity)
- Rotate API tokens periodically for security with
POST /workspaces/{id}/api-token
Automated customer onboarding
Automated customer onboarding
Streamline the setup process so new customers can start using WhatsApp within minutes.
- Create workspace automatically when customer completes your sign-up flow
- Create users in batch for the number of WhatsApp accounts they need
- Present QR codes in your UI (iframe with
display_mode=embeddingto avoid session logout) - Listen for
whatsapp_account:connectedwebhook to detect successful connection - Retrieve the Public API token and begin message syncing automatically
Security & compliance management
Security & compliance management
Maintain control over API access across all managed workspaces.
- Rotate Public API tokens periodically with
POST /workspaces/{id}/api-token - Subscribe to
api-token:rotatedwebhook to track all token changes - Disconnect compromised WhatsApp accounts with the disconnect endpoint
- Monitor quota webhooks for billing compliance and to prevent service interruption
Typical integration flow
Create a workspace
POST /workspaces with display_name and seats_purchased — save the returned workspace_id for all subsequent operationsCreate users
POST /workspaces/{id}/users with the count of users needed — each user consumes one seatGenerate QR codes
POST /workspaces/{id}/users/{user_id}/qr for each user — present the QR link in your UI for WhatsApp scanningQR code embedding
By default, the QR link opens a standalone page. To embed it within your application (e.g., in an iframe), appenddisplay_mode=embedding to the QR link URL.
| Mode | Behavior |
|---|---|
Embedded (display_mode=embedding) | Does not log the user out of your application. Optimized for iframe usage. |
| Standalone (default) | Opens a full page — will trigger a logout from the current session. |
Important notes
API tokens
API tokens
Public API tokens obtained via
GET /api-token do not expire automatically. A token remains valid indefinitely unless explicitly rotated via POST /api-token. The old token is invalidated immediately upon rotation.Workspace IDs
Workspace IDs
Always store
workspace_id and user_id mappings in your system. There is currently no list-workspaces endpoint — losing a workspace ID requires a support ticket.WhatsApp account health
WhatsApp account health
Warm up new WhatsApp accounts before automation — exchange messages with 3–5 contacts first. Poll delivery statuses before running automation sequences. See WhatsApp mass messaging best practices for details.

