Authentication
Learn how to authenticate your requests to the Twenty2 API.
All Twenty2 API requests must include a valid API key in the request header. API keys are scoped per workspace — a key from one workspace cannot access resources in another.
How to Get Your API Key
-
Log in to your Twenty2 workspace
-
Go to Profile → Integrations → Build with Twenty2 API
-
Click API Keys → Create New
-
Copy the generated key and store it securely
Never expose your API Key in client-side code or public repositories. Treat it like a password.
Using Your API Key
Pass your API key as a Bearer token in the Authorization header on every request.
curl -X POST https://api.twentytwo.in/api/calls \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
const headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
};
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
request['Authorization'] = 'Bearer YOUR_API_KEY'
request['Content-Type'] = 'application/json'
Authentication Errors
| HTTP Status | Code | Meaning |
|---|---|---|
401 | UNAUTHORIZED | API key is missing or invalid |
403 | FORBIDDEN | API key does not have access to this resource |
If you receive a 401, double-check that you're passing the key correctly as Bearer YOUR_API_KEY with no extra spaces or characters.
Managing API Keys
You can create, view, and revoke API keys anytime from Profile → Integrations → Build with Twenty2 API → API Keys. If a key is compromised, revoke it immediately and generate a new one.
Next Steps
Last updated 1 week ago
Built with Documentation.AI