Get Available Virtual Numbers
This API is used to retrieve a list of available virtual numbers that can be purchased.
Parameters for Getting Available Virtual Numbers
Headers Parameters
| Parameters | Description |
|---|---|
| Authorization | Please add provided Bearer token - linked to your Cellcast account. Check here |
| Content-Type | application/json |
Code Samples
Get https://api.cellcast.com/api/v1/virtual-number/available
bash
curl --location 'https://api.cellcast.com/api/v1/apiClient/virtual-number/available' \
--header 'authorization: Bearer {{API_KEY}}'js
const axios = require('axios');
async function getAvailableVirtualNumbers() {
const url = 'https://api.cellcast.com/api/v1/apiClient/virtual-number/available';
const apiKey = 'your_api_key_here'; // Replace with your actual API key
try {
const response = await axios.get(url, {
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
});
console.log('Response:', response.data);
} catch (error) {
console.error('Error:', error.response ? error.response.data : error.message);
}
}
getAvailableVirtualNumbers();Replace with the actual API key that you own.
Responses
200 Success
json
{
"app_type": "web",
"app_version": "1.0",
"maintainence": 0,
"new_version": 0,
"force_update": 0,
"invalid_token": 0,
"refresh_token": "",
"show_message": 0,
"is_enc": false,
"status": true,
"message": "Success",
"message_type": "toast",
"data": [
{
"_id": "66ea98514f0c1a121c76ec17",
"audNumber": "400222227",
"type": "MMS",
"status": "active",
"availability": "available",
"isDefault": false,
"billingStatus": "",
"monthlyProductId": "prod_PFdN753rT3lNFW",
"yearlyProductId": ""
}
],
"error": {
}
}Important Note on Product IDs
When purchasing a virtual number using the Purchase Virtual Number API:
- If
recurring_timeis set to"month", use themonthlyProductIdfrom the response - If
recurring_timeis set to"year", use theyearlyProductIdfrom the response
Ensure you select the correct product ID that matches your desired billing cycle to avoid purchase errors.
:::
401 Unauthorized
json
{
"code": 401,
"message": "Token expired",
"stack": "APIError: Token expired ...."
}