Skip to main content

Provider Configurations API

The Provider Configurations API allows you to manage telephony provider configurations. You can list, create, retrieve, update, and delete provider configurations for your telephony services.
Prerequisites: Make sure you have your API Token ready. See Authentication for details.

Create Provider Configuration

Create or update telephony provider settings by sending the required configuration details in the request body.
POST /api/v2/platform/telephony/providers-configurations/

Headers

NameTypeRequiredDescription
Org-HandlestringYesOrganization domain handle
AuthorizationstringYesAPI Key format: Token <token>
You can get the Org-Handle by hitting the Get All Organizations API. The domain_handle field in the response is your Org-Handle.

Example Request

POST /api/v2/platform/telephony/providers-configurations/
Headers:
  Org-Handle: your-org-handle
  Authorization: Token your-api-token
  Content-Type: application/json

Body:
{
  "name": "Twilio Suport",
  "provider": 3,
  "api_key": "sk_xxx",
  "api_secret": "secret_xxx"
}

Success Response (200)

{
  "status_code": 200,
  "message": "Success",
  "data": {
    "id": 1,
    "name": "Twilio Suport",
    "provider": 3,
    "provider_details": {
      "id": 3,
      "name": "Twilio",
      "description": "Desc 1",
      "icon": "https://ik.imagekit.io/techblog/channels/twilio.png"
    },
    "org_handle": "abc",
    "meta_json": [
      {
        "meta_key": "key",
        "meta_value": "mklsfjodfdo"
      }
    ],
    "active": true,
    "api_key": "sk_xxx",
    "api_secret": "secret_xxx",
    "base_url": null,
    "sip_url": ""
  }
}

Response Fields

FieldTypeDescription
status_codeintegerHTTP status code
messagestringResponse message
dataobjectCreated configuration details

Configuration Object Fields

FieldTypeDescription
idintegerConfiguration unique identifier
namestringConfiguration name
providerintegerProvider ID
provider_detailsobjectProvider information
org_handlestringOrganization domain handle
meta_jsonarrayAdditional metadata key-value pairs
activebooleanWhether the configuration is active
api_keystringProvider API key
api_secretstringProvider API secret
base_urlstringProvider base URL
sip_urlstringSIP URL for VoIP

Error Response (401  Unauthorized)

{
  "status_code": 401,
  "message": "Authentication credentials were not provided."
}

Get All Provider Configurations

Fetch information about all configured telephony providers to help identify and manage available calling services.
GET /api/v2/platform/telephony/providers-configurations/

Headers

NameTypeRequiredDescription
AuthorizationstringYesAPI Key format: Token <token>

Example Request

GET /api/v2/platform/telephony/providers-configurations/
Headers:
  Authorization: Token your-api-token

Success Response (200)

{
  "status_code": 200,
  "message": "Success",
  "data": [
    {
      "id": 1,
      "name": "Twilio Suport",
      "provider": 3,
      "provider_details": {
        "id": 3,
        "name": "Twilio",
        "description": "Twilio is your all in one solution channel",
        "icon": "https://ik.imagekit.io/bethere/unpod/channels/twilio.png"
      },
      "org_handle": "recalll.co",
      "meta_json": [
        {
          "meta_key": "key",
          "meta_value": "mklsfjodfdo"
        }
      ],
      "active": true,
      "api_key": "dsds154154xxxxx54fs5",
      "api_secret": "sfs1f5sxxxxxfs4f",
      "base_url": null,
      "sip_url": null
    }
  ]
}

Response Fields

FieldTypeDescription
status_codeintegerHTTP status code
messagestringResponse message
dataarrayArray of provider configuration objects

Configuration Object Fields

FieldTypeDescription
idintegerConfiguration unique identifier
namestringConfiguration name
providerintegerProvider ID
provider_detailsobjectProvider information
org_handlestringOrganization domain handle
meta_jsonarrayAdditional metadata key-value pairs
activebooleanWhether the configuration is active
api_keystringProvider API key
api_secretstringProvider API secret
base_urlstringProvider base URL
sip_urlstringSIP URL for VoIP

Error Response (401  Unauthorized)

{
  "status_code": 401,
  "message": "Authentication credentials were not provided."
}

Get Provider Configuration by ID

Retrieve complete telephony provider configuration data for a specific ID, allowing you to view settings stored in the system.
GET /api/v2/platform/telephony/providers-configurations/{id}/

Path Parameters

NameTypeRequiredDescription
idintegerYesConfiguration unique identifier
You can get the id by hitting the Get All Provider Configurations API. The id field in the response is your Configuration ID.

Headers

NameTypeRequiredDescription
Org-HandlestringYesOrganization domain handle
Product-IDintegerYesProduct identifier
You can get the Org-Handle by hitting the Get All Organizations API. The domain_handle field in the response is your Org-Handle.

Example Request

GET /api/v2/platform/telephony/providers-configurations/1/
Headers:
  Org-Handle: your-org-handle
  Product-ID: your-product-id

Success Response (200)

{
  "status_code": 200,
  "message": "Success",
  "data": {
    "id": 1,
    "name": "Twilio Suport",
    "provider": 3,
    "provider_details": {
      "id": 3,
      "name": "Twilio",
      "description": "Twilio is your all in one solution channel",
      "icon": "https://ik.imagekit.io/bethere/unpod/channels/twilio.png"
    },
    "org_handle": "recalll.co",
    "meta_json": [
      {
        "meta_key": "key",
        "meta_value": "mklsfjodfdo"
      }
    ],
    "active": true,
    "api_key": "dsds154xxxxxxxs54fs5",
    "api_secret": "sfs1fxxxxxxxfs4f",
    "base_url": null,
    "sip_url": null
  }
}

Response Fields

FieldTypeDescription
status_codeintegerHTTP status code
messagestringResponse message
dataobjectConfiguration details

Configuration Object Fields

FieldTypeDescription
idintegerConfiguration unique identifier
namestringConfiguration name
providerintegerProvider ID
provider_detailsobjectProvider information
org_handlestringOrganization domain handle
meta_jsonarrayAdditional metadata key-value pairs
activebooleanWhether the configuration is active
api_keystringProvider API key
api_secretstringProvider API secret
base_urlstringProvider base URL
sip_urlstringSIP URL for VoIP

Error Response (401  Unauthorized)

{
  "status_code": 401,
  "message": "Authentication credentials were not provided."
}

Update Provider Configuration

Partially modify a telephony provider’s configuration, enabling you to update only the required attributes without replacing the entire record.
PATCH /api/v2/platform/telephony/providers-configurations/{id}/

Path Parameters

NameTypeRequiredDescription
idintegerYesConfiguration unique identifier
You can get the id by hitting the Get All Provider Configurations API. The id field in the response is your Configuration ID.

Headers

NameTypeRequiredDescription
Org-HandlestringYesOrganization domain handle
Product-IDintegerYesProduct identifier
You can get the Org-Handle by hitting the Get All Organizations API. The domain_handle field in the response is your Org-Handle.

Request Body

FieldTypeRequiredDescription
namestringNoUpdated configuration name
api_keystringNoUpdated provider API key
api_secretstringNoUpdated provider API secret
activebooleanNoEnable/disable configuration
base_urlstringNoUpdated provider base URL
sip_urlstringNoUpdated SIP URL

Example Request

PATCH /api/v2/platform/telephony/providers-configurations/1/
Headers:
  Org-Handle: your-org-handle
  Product-ID: your-product-id
  Content-Type: application/json

Body:
{
  "name": "My Vapi Configuration",
  "api_key": "sk_xxx",
  "api_secret": "secret_xxx"
}

Success Response (200)

{
  "status_code": 200,
  "message": "Success",
  "data": {
    "id": 1,
    "name": "My Vapi Configuration",
    "provider": 3,
    "provider_details": {
      "id": 3,
      "name": "Twilio",
      "description": "Twilio is your all in one solution channel",
      "icon": "https://ik.imagekit.io/bethere/unpod/channels/twilio.png"
    },
    "org_handle": "recalll.co",
    "meta_json": [
      {
        "meta_key": "key",
        "meta_value": "mklsfjodfdo"
      }
    ],
    "active": true,
    "api_key": "sk_xxx",
    "api_secret": "secret_xxx",
    "base_url": null,
    "sip_url": null
  }
}

Response Fields

FieldTypeDescription
status_codeintegerHTTP status code
messagestringResponse message
dataobjectConfiguration details

Configuration Object Fields

FieldTypeDescription
idintegerConfiguration unique identifier
namestringConfiguration name
providerintegerProvider ID
provider_detailsobjectProvider information
org_handlestringOrganization domain handle
meta_jsonarrayAdditional metadata key-value pairs
activebooleanWhether the configuration is active
api_keystringProvider API key
api_secretstringProvider API secret
base_urlstringProvider base URL
sip_urlstringSIP URL for VoIP

Error Response (401  Unauthorized)

{
  "status_code": 401,
  "message": "Authentication credentials were not provided."
}

Delete Provider Configuration

Permanently delete a telephony provider’s configuration identified by ID, ensuring it is no longer available or used in the platform.
DELETE /api/v2/platform/telephony/providers-configurations/{id}/

Path Parameters

NameTypeRequiredDescription
idintegerYesConfiguration unique identifier
You can get the id by hitting the Get All Provider Configurations API. The id field in the response is your Configuration ID.

Headers

NameTypeRequiredDescription
Org-HandlestringYesOrganization domain handle
Product-IDintegerYesProduct identifier
You can get the Org-Handle by hitting the Get All Organizations API. The domain_handle field in the response is your Org-Handle.

Example Request

DELETE /api/v2/platform/telephony/providers-configurations/1/
Headers:
  Org-Handle: your-org-handle
  Product-ID: your-product-id

Success Response (204)

{
  "status_code": 204,
  "message": "Provider configuration deleted successfully",
  "data": {}
}

Response Fields

FieldTypeDescription
status_codeintegerHTTP status code
messagestringResponse message
dataobjectEmpty object

Error Response (401  Unauthorized)

{
  "status_code": 401,
  "message": "Authentication credentials were not provided."
}

Common Error Codes

Status CodeDescription
200Success - Request completed successfully
204No Content - Resource deleted successfully
400Bad Request - Invalid parameters provided
401Unauthorized - Invalid or missing API token
403Forbidden - Access denied to the resource
404Not Found - Configuration not found
500Internal Server Error - Server-side error

Code Examples

const axios = require('axios');

const headers = {
  'Org-Handle': 'your-org-handle',
  'Authorization': 'Token your-api-token',
  'Product-ID': 'your-product-id',
  'Content-Type': 'application/json'
};

const BASE_URL = 'https://unpod.dev/api/v2/platform/telephony/providers-configurations';

// Get all provider configurations
const getConfigurations = async () => {
  const response = await axios.get(`${BASE_URL}/`, { headers });
  console.log(`Total configurations: ${response.data.data.length}`);
  return response.data.data;
};

// Create a new provider configuration
const createConfiguration = async (name, providerId, apiKey, apiSecret) => {
  const response = await axios.post(
    `${BASE_URL}/`,
    { name, provider: providerId, api_key: apiKey, api_secret: apiSecret },
    { headers }
  );
  console.log(`Configuration created: ${response.data.data.name}`);
  return response.data.data;
};

// Get a specific configuration
const getConfiguration = async (id) => {
  const response = await axios.get(`${BASE_URL}/${id}/`, { headers });
  console.log(`Configuration: ${response.data.data.name}`);
  return response.data.data;
};

// Update a configuration
const updateConfiguration = async (id, updates) => {
  const response = await axios.patch(`${BASE_URL}/${id}/`, updates, { headers });
  console.log(`Configuration updated: ${response.data.data.name}`);
  return response.data.data;
};

// Delete a configuration
const deleteConfiguration = async (id) => {
  const response = await axios.delete(`${BASE_URL}/${id}/`, { headers });
  console.log('Configuration deleted successfully');
  return response.data;
};

// Example usage
getConfigurations();

Best Practices

  1. Secure Credentials: Never expose API keys or secrets in client-side code
  2. Configuration Naming: Use descriptive names to easily identify configurations
  3. Provider Selection: Choose the appropriate provider based on your region and requirements
  4. Validation: Verify provider credentials before saving configurations
  5. Cleanup: Delete unused configurations to maintain a clean setup
  6. Error Handling: Always handle potential errors and implement retry logic
  7. Security: Keep API tokens secure and rotate them regularly
  8. Backup: Keep a record of configuration details before making changes