API reference
OAuth 2.0
Build third-party apps that access JagCall on behalf of your users with the standard authorization code flow.
Overview
JagCall implements the OAuth 2.0 Authorization Code flow, the industry standard for third-party integrations. Your application requests specific permissions from a JagCall user, who approves access through a consent screen, and then exchanges the authorization code for access and refresh tokens.
OAuth is ideal when your application acts on behalf of another JagCall user. For server-to-server access to your own account, use API keys instead.
Authorization code flow
- 1
Register an OAuth client
Before you can authenticate users, register your application as an OAuth client:
- Open Settings → General → OAuth Applications (requires superadmin role).
- Click Register App.
- Enter your application name and redirect URI.
- Copy the
client_idandclient_secret.
Each app has a scope allowlist; a request can only be granted scopes on that list. MCP clients such as Claude can instead self-register with dynamic client registration (
POST /api/oauth/register, RFC 7591), and public clients (token_endpoint_auth_method: none) have no secret and must use PKCE. Server metadata is published at/.well-known/oauth-authorization-server.Store your client secret securely
Theclient_secretis shown only once and cannot be retrieved later. - 2
Redirect to the authorization URL
Direct the user to the JagCall authorization endpoint with your client ID, redirect URI, requested scopes, and a CSRF state parameter. Add a PKCE challenge (
S256only;plainis rejected) — it is required for public clients and recommended for all:urlhttps://jagcall.com/oauth/authorize? response_type=code &client_id=YOUR_CLIENT_ID &redirect_uri=https://yourapp.com/callback &scope=agents:read calls:read calls:write &state=random_csrf_token &code_challenge=BASE64URL_SHA256_OF_VERIFIER &code_challenge_method=S256The
redirect_urimust exactly match a registered URI. The one exception is a loopbackhttp://URI (127.0.0.1,localhost,[::1]), where the port may vary. - 3
User approves consent
JagCall displays a consent screen showing your application name and the requested scopes. When the user approves, JagCall redirects back to your
redirect_uriwith an authorization code:redirecthttps://yourapp.com/callback?code=jc_auth_code_xxx&state=random_csrf_tokenVerify state
Always confirm thestateparameter matches the value you sent to prevent CSRF attacks. The authorization code expires in 10 minutes. - 4
Exchange the code for tokens
Exchange the authorization code for an access token and refresh token. Send
code_verifierif you sent acode_challenge; public clients omitclient_secret. The token endpoint accepts JSON, form-encoded bodies, or HTTP Basic client authentication, and is limited to 30 requests per minute.curlcurl -X POST https://jagcall.com/api/oauth/token \ -H "Content-Type: application/json" \ -d '{ "grant_type": "authorization_code", "code": "AUTH_CODE_FROM_REDIRECT", "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET", "redirect_uri": "https://yourapp.com/callback", "code_verifier": "YOUR_PKCE_CODE_VERIFIER" }'response{ "access_token": "jca_xxx...", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "jcr_xxx...", "scope": "agents:read calls:read calls:write"} - 5
Use the access token
Include the access token as a Bearer token in API requests, just like an API key. Access tokens use the
jca_prefix and expire after 1 hour. They are limited to the granted scopes, act on the organization the user chose on the consent screen, and are subject to the same rate limits as API keys.curlcurl -X GET https://jagcall.com/v1/agents \ -H "Authorization: Bearer jca_xxx..." \ -H "Content-Type: application/json" - 6
Refresh the token
When the access token expires, use the refresh token (prefix
jcr_) to obtain a new one without user interaction:curlcurl -X POST https://jagcall.com/api/oauth/token \ -H "Content-Type: application/json" \ -d '{ "grant_type": "refresh_token", "refresh_token": "jcr_xxx...", "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET" }'response{ "access_token": "jca_new_xxx...", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "jcr_new_xxx...", "scope": "agents:read calls:read calls:write"}Refresh tokens are single-use
Each refresh response includes a new refresh token that must be stored for the next refresh cycle. Refresh tokens expire after 30 days without use. Presenting a refresh token that was already used revokes the whole grant, so store the new one before discarding the old one.invalid_grant means reconnect
If a refresh returnsinvalid_grant(the token expired, was replayed, or the grant was destroyed, for example because the authorizing user was deleted), the grant cannot be recovered. Send the user through the authorization flow again. CallGET /v1/oauth/grant(needsworkspaces:read) to check a grant's health and seerefreshTokenExpiresInSeconds. - 7
Revoke when the user disconnects
Revoke an access or refresh token when the user disconnects your integration:
curlcurl -X POST https://jagcall.com/api/oauth/revoke \ -H "Content-Type: application/json" \ -d '{ "token": "jcr_xxx...", "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET" }'
Available scopes
Request only the scopes your application needs. Users see the full list of requested permissions on the consent screen. Scopes are named resource:read or resource:write; a :write scope does not imply :read, so request both if you need both. A token missing a scope gets 403 from the endpoint.
| Scope | Description |
|---|---|
agents:read | List and view agent details |
agents:write | Create, update, and delete agents |
calls:read | List calls, transcripts, and recordings |
calls:write | Initiate outbound calls and browser calls |
phone-numbers:read | List and view phone numbers; search available numbers |
phone-numbers:write | Purchase, update, and release numbers |
sms:read | List SMS conversations and messages |
sms:write | Send SMS messages |
contacts:read | List and view contacts, contact notes, and follow-up tasks |
contacts:write | Create and update contacts; create, edit, and delete notes and tasks |
campaigns:read | List campaigns and their contacts |
campaigns:write | Create, edit, and run outbound campaigns |
calendar:read | View calendar integrations and availability |
calendar:write | Book appointments on connected calendars |
automations:read | List automations and their runs |
automations:write | Create, edit, and delete automations |
knowledge:read | List and search knowledge bases |
knowledge:write | Create knowledge bases and add or remove documents |
analytics:read | View analytics and reports |
billing:read | View account balance and usage |
webhooks:read | List webhook endpoints and deliveries |
webhooks:write | Create, update, and delete webhook endpoints; rotate secrets; replay deliveries |
integrations:write | Set integration credentials for the organization |
workspaces:read | List workspaces (child organizations) on a Corporate account |
workspaces:write | Create workspaces |
workspaces:delete | Delete workspaces. Never granted by default; it must be added to an app on purpose |
Access can be paused
403 (oauth_client_paused, organization_api_paused) or 503 (api_paused, with Retry-After), and the message includes the reason when one was given.Token format reference
| Token type | Prefix | Expiration |
|---|---|---|
| API key | jc_live_ | No expiry by default |
| OAuth access token | jca_ | 1 hour |
| OAuth refresh token | jcr_ | 30 days (renewed on each refresh) |
Still need help?
Can't find what you're looking for? Send us a message and our team will get back to you.