APIAuthentication

Authentication

The Twenty2 API uses HTTP Basic Authentication. Every request must include an Authorization header with your Base64-encoded credentials.

Step 1: Get your API credentials

  1. Log in to your Twenty2 account at app.twentytwo.in

  2. Click the profile icon in the top-right corner

  3. Go to IntegrationsBuild with Twenty2 API

  4. Under API Keys, click Create new

  5. Give your key a name and click Create

  6. A Credentials modal will appear showing your API Key and API Secret

Step 2: Build your token

Combine your API Key and API Secret in the format below, then Base64-encode the result:

base64(api_key:api_key_secret)

Example — on the command line:

echo -n "your_api_key:your_api_key_secret" | base64

Step 3: Pass the header

Include the encoded token in the Authorization header of every request:

Authorization: Basic <base64(api_key:api_key_secret)>

Full example:

curl -X POST "https://api.twentytwo.in/api/agent/trigger-outbound-call" \
  -H "Authorization: Basic N1VHdXFJamRyOTZTVjNpOlZSVFlsMUtW..." \
  -H "Content-Type: application/json" \
  -d '{ ... }'

Security best practices

Authentication Errors

HTTP StatusCodeMeaning
401UNAUTHORIZEDAPI key is missing or invalid
403FORBIDDENAPI key does not have access to this resource

If you receive a 401, verify that your Authorization header is correctly formatted and that the Base64 encoding is applied to the full api_key:api_key_secret string.