Get phone number data

This section explains how to use the /phone-number endpoint to get phone number data using TalkStack's API.

Step 1: Prepare Your Request

  • Endpoint: /phone-number

  • Method: POST

  • URL: https://api.talkstackai.com/phone-number

  • Headers: Include Content-Type: application/json.

  • Authorization: Bearer token or x-api-key in headers

Step 2: Construct Request Body

You can get phone numbers using phoneNumberId, agentId, and projectId. You can only use one of these in each request if more than one are passed then the precedence order is: phoneNumberId -> agentId -> projectId

  • phoneNumberId: This is the ID of the phone number you are inquiring about..

  • agentId: This is the agent ID linked to the phone number you are inquiring about.

  • projectId: This is the project ID linked to the phone number(s) you are inquiring about.

Step 3: Send the Request

Use your preferred HTTP client to send the POST request with the above JSON body.

Step 4: Handle the Response

The response will provide detailed information about the phone number associated with the given identifier.

Success Response:

  • Status Code: 200 OK

  • Body:

{
    "message": "Phone number details fetched successfully.",
    "status": "error",
    "data": {
        "e164": "+14152148508",
        "id": "3189fbff-f9fa-4920-b95c-63387b1204a4",
        "status": "AVAILABLE",
        "projectId": "94f53ecd-ec99-42fc-bc69-e79468550af2",
        "agentId": "232ac42a-2ea0-4276-a5d8-43c8c9f7b857"
    }
}
  • Confirm that the projectId is correctly included in the request body.

  • Ensure that the agentId is valid and corresponds to the phone number searched for.

  • Contact our support team for further assistance in case of persistent issues or errors.

Troubleshooting

  • 400 Bad Request: If the identifier is missing in the request.

  • 404 Not Found: If the phone number is not found.

  • 500 Internal Server Error: For errors in fetching phone number details.

Last updated