The AnswerPal API uses JWT Bearer tokens. Sign in once with the username and password of a representative, then send the token you get in the Authorization header of every call. The token is valid for 12 hours and carries the representative’s customer and role.
POST /api/Auth/login. This is the token an integration uses. It gives access to the data of one customer, within the limits of the representative’s role.POST /api/Auth/phone-login, with the phone number of a phone channel and the customer’s Twilio Account SID. It is meant for the phone runtime and works only on endpoints whose access line mentions the phone token, for its own channel.There are no API keys, no Basic authentication and no OAuth client credentials for calls to AnswerPal.
username (string, required)password (string, required)hostname (string, required)https://. It selects the customer: the representative must belong to the customer with that host name.token (string)Wrong credentials, an inactive account or a host name of another customer all give the same 401 Unauthorized with the text Invalid username or password. A missing field gives 400 Bad Request.
POST /api/Auth/login HTTP/1.1
Host: api.answerpal.eu
Content-Type: application/json
{
"username": "integration@example.com",
"password": "correct horse battery staple",
"hostname": "app.answerpal.eu"
} 200 OK
Content-Type: application/json; charset=utf-8
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
} 401 Unauthorized
Content-Type: text/plain; charset=utf-8
Invalid username or password. Send the token in the Authorization header, after the word Bearer and a space. Reuse the same token for all calls until it expires; there is no need to sign in per call.
The real-time hubs /chatHub and /ticketHub also accept the token as the access_token query parameter, because browsers cannot set headers on a WebSocket connection. No other endpoint reads the token from the query string.
GET /api/CustomerCustomFields HTTP/1.1
Host: api.answerpal.eu
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Accept: application/json 401 Unauthorized
WWW-Authenticate: Bearer error="invalid_token", error_description="The token expired at '...'"
Content-Length: 0 sub), the customer and representative IDs, the representative’s time zone, locale and country, the role (by name and as a number) and a unique token ID. A phone token holds the customer, the phone channel and its number. The Auth endpoints page lists every claim.Do not build logic on decoding the token yourself; treat it as an opaque string and keep track of the time you signed in.
What a representative token may do depends on its role: Restricted user, Agent, Supervisor, Configurator, Administrator or Analyst. Each endpoint page shows, per endpoint, which roles are allowed and whether a phone token works. A token never gives access to another customer’s data: the customer always comes from the token, not from the request.
Some features are part of specific subscriptions, such as mailings and place descriptions. Their endpoints also check that the customer’s subscription includes the feature.
401 UnauthorizedWWW-Authenticate header says why when a token was sent. The sign-in endpoints also answer 401, with a short text, when the credentials are wrong. Sign in again and repeat the call.403 Forbidden{ "error": "..." }. Signing in again does not help.See Error Codes for all error bodies.
A representative who forgot the password uses POST /api/Auth/request-password-reset (sends an e-mail with a reset link) and POST /api/Auth/reset-password (sets the new password with the token from that link). The Auth endpoints page describes both, with the password rule.
Store the time you signed in. Sign in again shortly before the 12 hours are over, or when a call answers 401 Unauthorized, and repeat that call once with the new token.
A separate representative account for the integration, with the lowest role that allows the endpoints it calls. Its changes can then be traced to that account, and you can deactivate it without locking out a person.
The token works, but its role is not allowed on that endpoint, or the feature is not part of the customer's subscription. Check the access line of the endpoint.
Not through the API. A token stays valid until it expires; keep tokens out of logs and source code.
AnswerPal: AI-powered customer service solutions to elevate your support and communication effortlessly.
For all support, sales, and partnership inquiries, email us at info@answerpal.eu
AnswerPal
Bisschoppenhoflaan 380
2100 Antwerp
Belgium
+32.36416685
BE 0862.692.858