Authentication
To call the API, create an API key and send it in the Authorization header. With the SDK, pass it when creating the client.
1. Create and save your API key
In the app, open Settings → API Keys, enter an API Key name and click Create API Key. You need access to that section and an owner or administrator role.
Copy the key: it is shown only once. Store it in an environment variable or a secrets manager. Name it after the integration so you know which key to replace later.
See API keys to manage keys in the app.
2. Use it in your code
Pass the key once when creating the client:
import { Platic } from "platic-sdk";
const platic = new Platic({ apiKey: process.env.PLATIC_API_KEY! }); Include Authorization: Bearer with the key in each request:
curl -X GET "https://api.platic.ai/v1/agents" \
-H "Authorization: Bearer $PLATIC_API_KEY" \
-H "Content-Type: application/json" Workspaces
An API key you create in the app works only in the workspace where you created it, even if your account belongs to others. The API selects it automatically. To use API keys across several workspaces, create one in each. A key issued for several workspaces must name one with ?workspace= where an endpoint requires it, as explained in OAuth for MCP and multiple workspaces below.
Use List workspaces to find their IDs and Workspaces to understand how your data is organized.
Call the API from your server. Keep the key out of public repositories, browser code and mobile apps. To replace it, create and deploy the new key before revoking the old one in the app. If you think someone obtained your key, contact help@platic.ai.
If you receive an error
A 401 Unauthorized means the credential is missing, invalid, expired or revoked. Check Authorization and the key your server is using.
{
"code": 401,
"error": "Unauthorized - Invalid or expired API key",
"details": {
"code": "UNAUTHENTICATED",
"message": "Invalid or expired API key"
}
} To connect Claude, ChatGPT, Cursor, VS Code or another client, add https://api.platic.ai/mcp and sign in with OAuth. Follow MCP authentication.
| Credential | Prefix | What it's for |
|---|---|---|
| API key | pl_key_ | REST integrations, scripts, CI, Postman. Full access to the key's workspace. |
| OAuth (MCP) | pl_at_ | Access token Platica issues when connecting an MCP client. It respects your authorized workspaces, scopes and user role. |
Both credentials use the same header:
Authorization: Bearer pl_key_xxxxxxxxxxxxx
Authorization: Bearer pl_at_xxxxxxxxxxxxx With OAuth, you can authorize several workspaces. When an operation requires a specific one, send ?workspace=<id>. If it is missing, you receive 400 INVALID_REQUEST with the available IDs in details.available.
Contact, V1 conversation and message lists, GET /v1/conversations/{id} and a contact’s conversations can query authorized workspaces without this parameter. Some message, template and email sends also allow this when the channel identifies the workspace. Getting a contact requires ?workspace= when you can access several. Every /v2/conversations call works in one workspace: an API key that covers several sends ?workspace=. Each endpoint states its rule.
If an OAuth token (pl_at_…) receives a 401, the WWW-Authenticate header tells the client how to authorize again under RFC 9728.
If platica:write is missing, you receive 403 with details.code set to INSUFFICIENT_SCOPE and the insufficient_scope notice. The client can request write permission; this is called step-up. See MCP authentication and Errors.