Difference between revisions of "Twilio Access Token"

From docs
Jump to: navigation, search
(Generate Twilio Access Token)
(Successful Response (200))
 
Line 37: Line 37:
 
| device_type || string || Yes || Device platform used to select push credentials. Use <code>android</code> for Android; other values (for example, <code>ios</code>) use iOS push credentials
 
| device_type || string || Yes || Device platform used to select push credentials. Use <code>android</code> for Android; other values (for example, <code>ios</code>) use iOS push credentials
 
|}
 
|}
 +
 +
=== cURL Example for Android ===
 +
 +
<pre> curl --location 'https://apimobile.callproof.com/api/generate-access-Token' \ --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ --header 'Content-Type: application/json' \ --data '{ "device_type": "android" }' </pre>
 +
 +
=== cURL Example for iOS ===
 +
 +
<pre> curl --location 'https://apimobile.callproof.com/api/generate-access-Token' \ --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ --header 'Content-Type: application/json' \ --data '{ "device_type": "ios" }' </pre>
  
 
=== Successful Response (200) ===
 
=== Successful Response (200) ===

Latest revision as of 07:25, 21 July 2026

Mobile_API »Generate Twilio Access Token

Base URL

https://apimobile.callproof.com

Endpoint

/api/generate-access-Token

Purpose

Generates a Twilio Voice access token for the authenticated user so the mobile app can make and receive calls. Also returns the user’s caller ID information when available.

HTTP Method

POST

Headers

Header Required Description
Authorization Yes Bearer access token

Security

  • Yes – Requires Bearer Token authentication.

Parameters

Path Parameters

None.

Query Parameters

None.

Request Body

Parameter Type Required Description
device_type string Yes Device platform used to select push credentials. Use android for Android; other values (for example, ios) use iOS push credentials

cURL Example for Android

 curl --location 'https://apimobile.callproof.com/api/generate-access-Token' \ --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ --header 'Content-Type: application/json' \ --data '{ "device_type": "android" }' 

cURL Example for iOS

 curl --location 'https://apimobile.callproof.com/api/generate-access-Token' \ --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ --header 'Content-Type: application/json' \ --data '{ "device_type": "ios" }' 

Successful Response (200)

Returns the Twilio Voice JWT and caller ID details.

Field Type Description
clientStatusCode integer Status indicator for the client (for example, 200)
user_id integer Identifier of the authenticated user
company_id integer Identifier of the authenticated user’s company
data object Token and caller ID payload (see below)
message string Present in some responses when caller ID is missing (for example, "Caller ID not found")
uri string Requested resource URI

data

Field Type Description
token string Twilio Voice JWT access token used by the client SDK
caller_id string Outbound caller ID phone number (with country code when available); empty string when not found
message_caller_id boolean/string Messaging caller ID value when configured; otherwise false

Error Responses

Status Code Meaning
400 Bad Request – the access token could not be generated
401 Unauthorized – missing, invalid, or expired Bearer token
  • 400 – Token generation failed (for example, "Error while generating token").
  • 401 – Authentication failed or the access token is missing/expired.