### Create or Refresh Token using PHP Source: https://developer.cloudnumbering.com/reference/index This snippet shows how to create or refresh an OAuth token using PHP. It uses cURL to make the POST request to the token endpoint. This example assumes you have cURL enabled in your PHP installation. ```php $grantType, 'client_id' => $clientId, 'client_secret' => $clientSecret ]; if ($grantType === 'refresh_token') { $params['refresh_token'] = $refreshToken; } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'accept: application/json' ]); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } else { $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($httpCode == 200) { echo 'Token:' . $response; } else { echo 'Error:' . $response; } } curl_close($ch); ?> ``` -------------------------------- ### GET /websites/developer_cloudnumbering_reference Source: https://developer.cloudnumbering.com/reference/get_organisationgetv1_1 Retrieves reference data for cloud numbering services. This endpoint allows you to fetch details about available numbering products, their balances, and associated currencies. ```APIDOC ## GET /websites/developer_cloudnumbering_reference ### Description Retrieves reference data for cloud numbering services. This endpoint allows you to fetch details about available numbering products, their balances, and associated currencies. ### Method GET ### Endpoint /websites/developer_cloudnumbering_reference ### Parameters #### Query Parameters - **productDescription** (string) - Optional - Filters results by product description. - **balance** (number) - Optional - Filters results by balance amount. - **currency** (string) - Optional - Filters results by currency. ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **result** (object) - Contains the list of numbering reference data. - **productDescription** (string) - Description of the numbering product. - **balance** (number) - The current balance for the product. - **currency** (string) - The currency of the balance. #### Response Example ```json { "success": true, "result": [ { "productDescription": "Example Product", "balance": 100.50, "currency": "USD" } ] } ``` #### Error Response (400) - **success** (boolean) - Indicates if the request was successful. - **error** (string) - Description of the error. #### Error Response Example ```json { "success": false, "error": "Invalid request" } ``` #### Error Response (401) - **success** (boolean) - Indicates if the request was successful. - **error** (string) - Description of the error. #### Error Response Example ```json { "success": false, "error": "Unauthorized" } ``` ``` -------------------------------- ### GET /websites/developer_cloudnumbering_reference Source: https://developer.cloudnumbering.com/reference/put_organisationupdatev1_1 Retrieves information about the Developer Cloud Numbering Reference. This endpoint provides details on available numbering resources and their configurations. ```APIDOC ## GET /websites/developer_cloudnumbering_reference ### Description Retrieves information about the Developer Cloud Numbering Reference. This endpoint provides details on available numbering resources and their configurations. ### Method GET ### Endpoint /websites/developer_cloudnumbering_reference ### Parameters #### Query Parameters - **limit** (integer) - Optional - The maximum number of results to return. - **offset** (integer) - Optional - The number of results to skip before starting to collect the result set. ### Request Example ```json { "example": "GET /websites/developer_cloudnumbering_reference?limit=10&offset=0" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **error** (string) - Contains an error message if the request failed. #### Response Example ```json { "success": true, "error": null } ``` #### Error Response (401) - **success** (boolean) - Indicates if the request was successful. - **error** (string) - Contains an error message if the request failed. - **X-Request-Id** (string) - The request ID for reference. ``` -------------------------------- ### GET /v1.1/organisation Source: https://developer.cloudnumbering.com/reference/get_organisationgetv1_1 Retrieves the details of your organization, including address, trading name, and financial information. ```APIDOC ## GET /v1.1/organisation ### Description Retrieves the details of your organization, including address, trading name, and financial information. ### Method GET ### Endpoint https://api.cloudnumbering.com/v1.1/organisation ### Parameters #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **X-Request-Id** (string) - The request ID for reference - **success** (boolean) - Indicates if the request was successful - **result** (object) - Contains the organization details - **sid** (string) - The unique identifier for the organization - **name** (string) - The name of the organization - **tradingName** (string) - The trading name of the organization - **addr1** (string) - The first line of the organization's address - **addr2** (string) - The second line of the organization's address - **city** (string) - The city of the organization's address - **state** (string) - The state or province of the organization's address - **postcode** (string) - The postal code of the organization's address - **countryIso** (string) - The ISO country code for the organization's address - **registeredCountryIso** (string) - The ISO country code for the organization's registered country - **vatNumber** (string) - The VAT number of the organization - **typeOfBusiness** (string) - The type of business the organization operates - **productUseCase** (string) - The use case for the product - **website** (string) - The website of the organization - **productDescription** (string) - A description of the product - **balance** (number) - The current balance of the organization's account - **currency** (string) - The currency used for the account balance #### Response Example ```json { "success": true, "result": { "sid": "OR12345678901234567890123456789012", "name": "My Organisation", "tradingName": "My Trading Name", "addr1": "123 Fake Street", "addr2": "", "city": "Exeter", "state": "Devon", "postcode": "EX1 111", "countryIso": "GB", "registeredCountryIso": "GB", "vatNumber": "GB123456789", "typeOfBusiness": "Software", "productUseCase": "Internal", "website": "https://example.com", "productDescription": "A description of the product", "balance": 100, "currency": "GBP" } } ``` ``` -------------------------------- ### Create or Refresh Token using Ruby Source: https://developer.cloudnumbering.com/reference/index This snippet demonstrates how to create or refresh an OAuth token using Ruby. It uses the 'net/http' library to perform the POST request. This is a standard library, so no external installation is typically needed. ```ruby require 'net/http' require 'uri' require 'json' client_id = 'YOUR_CLIENT_ID' client_secret = 'YOUR_CLIENT_SECRET' grant_type = 'client_credentials' # or 'refresh_token' refresh_token = 'YOUR_REFRESH_TOKEN' # Only needed if grant_type is 'refresh_token' uri = URI.parse('https://api.cloudnumbering.com/v1/oauth/token') params = { 'grant_type' => grant_type, 'client_id' => client_id, 'client_secret' => client_secret } if grant_type == 'refresh_token' params['refresh_token'] = refresh_token end http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.request_uri) request['accept'] = 'application/json' request.set_form_data(params) response = http.request(request) if response.code == '200' puts "Token: #{response.body}" else puts "Error: #{response.body}" end ``` -------------------------------- ### Create or Refresh Token using Python Source: https://developer.cloudnumbering.com/reference/index This snippet demonstrates how to create or refresh an OAuth token using Python. It uses the 'requests' library to send a POST request to the API. Make sure 'requests' is installed. ```python import requests client_id = 'YOUR_CLIENT_ID' client_secret = 'YOUR_CLIENT_SECRET' grant_type = 'client_credentials' # or 'refresh_token' refresh_token = 'YOUR_REFRESH_TOKEN' # Only needed if grant_type is 'refresh_token' url = 'https://api.cloudnumbering.com/v1/oauth/token' params = { 'grant_type': grant_type, 'client_id': client_id, 'client_secret': client_secret } if grant_type == 'refresh_token': params['refresh_token'] = refresh_token headers = { 'accept': 'application/json' } response = requests.post(url, headers=headers, data=params) if response.status_code == 200: print('Token:', response.json()) else: print('Error:', response.json()) ``` -------------------------------- ### Create or Refresh Token using Node.js Source: https://developer.cloudnumbering.com/reference/index This snippet shows how to create or refresh an OAuth token using Node.js. It utilizes the 'axios' library to make a POST request to the token endpoint. Ensure you have 'axios' installed. ```javascript const axios = require('axios'); const clientId = 'YOUR_CLIENT_ID'; const clientSecret = 'YOUR_CLIENT_SECRET'; const grantType = 'client_credentials'; // or 'refresh_token' const refreshToken = 'YOUR_REFRESH_TOKEN'; // Only needed if grant_type is 'refresh_token' const url = 'https://api.cloudnumbering.com/v1/oauth/token'; const params = { grant_type: grantType, client_id: clientId, client_secret: clientSecret }; if (grantType === 'refresh_token') { params.refresh_token = refreshToken; } axios.post(url, null, { headers: { 'accept': 'application/json' }, params: params }) .then(response => { console.log('Token:', response.data); }) .catch(error => { console.error('Error:', error.response.data); }); ``` -------------------------------- ### GET /websites/developer_cloudnumbering_reference Source: https://developer.cloudnumbering.com/reference/get_endpointslistv1_1 Retrieves reference information for cloud numbering. ```APIDOC ## GET /websites/developer_cloudnumbering_reference ### Description Retrieves reference information for cloud numbering. ### Method GET ### Endpoint /websites/developer_cloudnumbering_reference ### Parameters #### Query Parameters #### Request Body ### Request Example ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **error** (string) - Contains an error message if the request failed. #### Response Example ```json { "success": true, "error": null } ``` #### Error Response (401) - **success** (boolean) - Indicates if the request was successful. - **error** (string) - Contains an error message if the request failed. - **X-Request-Id** (string) - The request ID for reference. ``` -------------------------------- ### GET /v1.1/orders/{sid} Source: https://developer.cloudnumbering.com/reference/get_ordersgetv1_1-1 Retrieves details of a specific order by its SID. Supports pagination for orders. ```APIDOC ## GET /v1.1/orders/{sid} ### Description Retrieves details of a specific order by its SID. Supports pagination for orders. ### Method GET ### Endpoint https://api.cloudnumbering.com/v1.1/orders/{sid} ### Parameters #### Path Parameters - **sid** (string) - Required - The SID of the order #### Query Parameters - **page** (number) - Optional - The page number to retrieve (default: 1, minimum: 1) - **perPage** (number) - Optional - The number of entries per page (default: 10, minimum: 1, maximum: 100) ### Request Example ```json { "example": "GET /v1.1/orders/NOFEAD4A8A13B045DF98A35B54A99712F6?page=1&perPage=10" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **result** (object) - Contains the order details. - **sid** (string) - The SID of the order. - **createdAt** (string) - The timestamp when the order was created. - **total** (number) - The total cost of the order. - **numbersOrdered** (number) - The total number of phone numbers included in the order. - **currency** (string) - The currency used for the order (e.g., "GBP"). - **rateCardSid** (string) - The SID of the rate card used for this order. - **rateCardEntrySid** (string) - The SID of the rate card entry used for this order. - **numberRentalLength** (number) - The duration (in months) for which the numbers were purchased. #### Response Example ```json { "example": { "success": true, "result": { "sid": "NOFEAD4A8A13B045DF98A35B54A99712F6", "createdAt": "2023-10-27T10:00:00Z", "total": 30.00, "numbersOrdered": 3, "currency": "GBP", "rateCardSid": "RC12345678901234567890123456789012", "rateCardEntrySid": "RE12345678901234567890123456789012", "numberRentalLength": 12 } } } ``` #### Headers - **X-Request-Id** (string) - The request ID for reference. ``` -------------------------------- ### GET /v1.1/endpoints/{endpointType}/ips Source: https://developer.cloudnumbering.com/reference/get_endpointipslistv1_1 Retrieves a list of IP addresses that are allowed to initialize phone calls to the API for a specified endpoint type. ```APIDOC ## GET /v1.1/endpoints/{endpointType}/ips ### Description Retrieves a list of IP addresses that are allowed to initialize phone calls to the API for a specified endpoint type. ### Method GET ### Endpoint /v1.1/endpoints/{endpointType}/ips ### Parameters #### Path Parameters - **endpointType** (string) - Required - The type of endpoint for which to list allowed IPs. ### Request Example ```json { "example": "No request body needed for this GET request." } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **result** (object) - Contains the result of the operation. - **entries** (array) - A list of allowed IP addresses (strings). #### Error Response (400) - **success** (boolean) - Indicates if the request was successful. - **error** (string) - A message describing the error. #### Error Response (401) - **success** (boolean) - Indicates if the request was successful. - **error** (string) - A message describing the error. #### Response Example (200 OK) ```json { "success": true, "result": { "entries": [ "192.168.1.1", "10.0.0.5" ] } } ``` #### Response Example (400 Bad Request) ```json { "success": false, "error": "Invalid endpoint type provided." } ``` #### Response Example (401 Unauthorized) ```json { "success": false, "error": "Authentication failed." } ``` ``` -------------------------------- ### GET /websites/developer_cloudnumbering_reference Source: https://developer.cloudnumbering.com/reference/get_ordersgetv1_1-1 Retrieves a list of cloud numbers with their associated details. Supports pagination and filtering. ```APIDOC ## GET /websites/developer_cloudnumbering_reference ### Description Retrieves a list of cloud numbers with their associated details. Supports pagination and filtering. ### Method GET ### Endpoint /websites/developer_cloudnumbering_reference ### Parameters #### Query Parameters - **page** (integer) - Optional - The page number to retrieve. - **per_page** (integer) - Optional - The number of items to retrieve per page. ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **result** (object) - Contains the list of numbers and pagination metadata. - **numbers** (array) - An array of number objects. - **sid** (string) - The unique identifier for the number. - **number** (string) - The phone number. - **nextBillingDate** (string) - The next billing date for the number. - **lineRental** (number) - The line rental cost for the number. - **meta** (object) - Pagination information. - **page** (number) - The current page number. - **perPage** (number) - The number of items per page. - **pageCount** (number) - The total number of pages. - **total** (number) - The total number of items. #### Response Example ```json { "success": true, "result": { "numbers": [ { "sid": "ANFEAD4A8A13B045DF98A35B54A99712F6", "number": "+447700900000", "nextBillingDate": "1970-01-01T00:00:00.000Z", "lineRental": 1.2 } ], "meta": { "page": 1, "perPage": 10, "pageCount": 1, "total": 1 } } } ``` #### Error Response (400) - **success** (boolean) - Indicates if the request was successful. - **error** (string) - A message describing the error. #### Error Response (401) - **success** (boolean) - Indicates if the request was successful. - **error** (string) - A message describing the error. ``` -------------------------------- ### GET /v1.1/orders Source: https://developer.cloudnumbering.com/reference/get_orderslistv1_1-1 Retrieves a list of all orders associated with the account. This endpoint is useful for tracking past purchases and managing existing phone number rentals. ```APIDOC ## GET /v1.1/orders ### Description Retrieves a list of all orders associated with the account. This endpoint is useful for tracking past purchases and managing existing phone number rentals. ### Method GET ### Endpoint https://api.cloudnumbering.com/v1.1/orders ### Parameters #### Query Parameters - **limit** (integer) - Optional - The maximum number of orders to return. - **offset** (integer) - Optional - The number of orders to skip before starting to collect the result set. ### Request Example ``` GET /v1.1/orders?limit=10&offset=0 HTTP/1.1 Host: api.cloudnumbering.com Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **result** (object) - Contains the list of orders. - **entries** (array) - An array of order objects. - **sid** (string) - The unique identifier for the order. - **createdAt** (string) - The date and time the order was created. - **total** (number) - The total cost of the order. - **numbersOrdered** (number) - The quantity of numbers ordered. - **currency** (string) - The currency used for the order (e.g., GBP). - **rateCardSid** (string) - The identifier of the rate card used for this order. - **rateCardEntrySid** (string) - The identifier of the specific rate card entry used for this order. - **numberRentalLength** (number) - The duration (in months) for which the numbers were purchased. #### Response Example ```json { "success": true, "result": { "entries": [ { "sid": "NOFEAD4A8A13B045DF98A35B54A99712F6", "createdAt": "2023-10-27T10:00:00Z", "total": 10, "numbersOrdered": 3, "currency": "GBP", "rateCardSid": "RC12345678901234567890123456789012", "rateCardEntrySid": "RE12345678901234567890123456789012", "numberRentalLength": 12 } ] } } ``` #### Error Response (400) - **message** (string) - A message describing the error. - **code** (integer) - The error code. - **more_info** (string) - A URL for more information about the error. #### Error Response Example ```json { "message": "Invalid request parameters.", "code": 400, "more_info": "https://docs.cloudnumbering.com/errors/400" } ``` ``` -------------------------------- ### GET /v1.1/endpoints Source: https://developer.cloudnumbering.com/reference/get_endpointslistv1_1 Retrieves a paginated list of your current endpoints. This endpoint is useful for managing and viewing the configured endpoints for voice and SMS. ```APIDOC ## GET /v1.1/endpoints ### Description Retrieves a paginated list of your current endpoints. This endpoint is useful for managing and viewing the configured endpoints for voice and SMS. ### Method GET ### Endpoint /v1.1/endpoints ### Query Parameters * **page** (integer) - Optional - The page number to retrieve. * **pageSize** (integer) - Optional - The number of items to return per page. ### Request Example ```json { "example": "GET /v1.1/endpoints?page=1&pageSize=20" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **result** (object) - Contains the result of the request. - **entries** (array) - A list of endpoint objects. - **sid** (string) - The unique identifier for the endpoint. - **type** (string) - The type of endpoint (e.g., "voice", "sms"). - **description** (string) - A description of the endpoint. - **uri** (string) - The URI where the endpoint sends traffic. - **createdAt** (string) - The timestamp when the endpoint was created. - **updatedAt** (string) - The timestamp when the endpoint was last updated. - **isDefault** (boolean) - Indicates if this is the default endpoint. #### Response Example ```json { "example": "{\n \"success\": true,\n \"result\": {\n \"entries\": [\n {\n \"sid\": \"EP12345678901234567890123456789012\",\n \"type\": \"voice\",\n \"description\": \"Default Voice\",\n \"uri\": \"sip:%e164@127.0.0.1\",\n \"createdAt\": \"2023-10-27T10:00:00Z\",\n \"updatedAt\": \"2023-10-27T10:00:00Z\",\n \"isDefault\": true\n }\n ]\n }\n}" } ``` #### Error Response (400) - **success** (boolean) - Indicates if the request was successful. - **error** (object) - Contains error details. - **code** (integer) - The error code. - **message** (string) - A description of the error. ``` -------------------------------- ### GET /websites/developer_cloudnumbering_reference Source: https://developer.cloudnumbering.com/reference/get_numberslistv1_1-1 Retrieves a list of cloud numbering reference entries. This endpoint allows filtering and pagination to fetch specific sets of data. ```APIDOC ## GET /websites/developer_cloudnumbering_reference ### Description Retrieves a list of cloud numbering reference entries. This endpoint allows filtering and pagination to fetch specific sets of data. ### Method GET ### Endpoint /websites/developer_cloudnumbering_reference ### Parameters #### Query Parameters - **page** (number) - Optional - The page number to retrieve. - **perPage** (number) - Optional - The number of entries per page. - **countryIso** (string) - Optional - Filter by country ISO code. - **number** (string) - Optional - Filter by phone number. - **numberRental** (boolean) - Optional - Filter by number rental availability. ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **result** (object) - Contains the list of numbering entries. - **entries** (array) - A list of numbering objects. - **sid** (string) - The unique identifier for the number. - **countryIso** (string) - The ISO code of the country. - **number** (string) - The phone number. - **numberRental** (object) - Details about number rental. - **available** (boolean) - Whether the number is available for rental. - **price** (number) - The rental price. - **currency** (string) - The currency of the rental price. - **meta** (object) - Metadata about the response. - **pagination** (object) - Pagination details. - **page** (number) - The current page number. - **perPage** (number) - The number of entries per page. - **pageCount** (number) - The total number of pages. - **total** (number) - The total number of entries. #### Error Response (400) - **success** (boolean) - Always false. - **error** (string) - A message describing the error. #### Error Response (401) - **success** (boolean) - Always false. - **error** (string) - A message indicating unauthorized access. ### Response Example ```json { "success": true, "result": { "entries": [ { "sid": "some_sid", "countryIso": "US", "number": "+12025550100", "numberRental": { "available": true, "price": 10.00, "currency": "USD" } } ] }, "meta": { "pagination": { "page": 1, "perPage": 10, "pageCount": 1, "total": 1 } } } ``` ``` -------------------------------- ### Catalogue API Source: https://developer.cloudnumbering.com/reference/get_cataloguelistv1_1 This endpoint allows you to list the available products in the catalogue. It returns details such as product ID, description, cost, currency, billing terms, and highlights. ```APIDOC ## GET /v1.1/catalogue ### Description Lists the available products in the catalogue, including their pricing and terms. ### Method GET ### Endpoint https://api.cloudnumbering.com/v1.1/catalogue ### Parameters #### Query Parameters None ### Request Example ```json { "example": "No request body needed for GET request." } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **result** (object) - Contains the catalogue entries. - **entries** (array) - A list of catalogue items. - **sid** (string) - The unique identifier for the product. - **description** (string) - A description of the product. - **cost** (number) - The cost of the product. - **currency** (string) - The currency of the cost (e.g., GBP). - **terms** (string) - The billing terms (e.g., MONTHLY, QUARTERLY). - **highlights** (array) - A list of key features or highlights for the product. #### Response Example ```json { "success": true, "result": { "entries": [ { "sid": "RE12345678901234567890123456789012", "description": "A description of the product", "cost": 10, "currency": "GBP", "terms": "MONTHLY", "highlights": [ "Great product", "Monthly billing" ] } ] } } ``` #### Error Response (400) - **description**: Invalid request. - **headers**: X-Request-Id (string, uuid) - The request ID for reference. ``` -------------------------------- ### POST /v1.1/oauth/token Source: https://developer.cloudnumbering.com/reference/post_authtokenv1_1 This endpoint is used to create or refresh an authentication token. It supports 'client_credentials' and 'refresh_token' grant types. ```APIDOC ## POST /v1.1/oauth/token ### Description Creates or refreshes an authentication token. This endpoint is crucial for authenticating with the CloudNumbering API. ### Method POST ### Endpoint https://api.cloudnumbering.com/v1.1/oauth/token ### Parameters #### Query Parameters - **client_id** (string) - Required - The client ID provided by CloudNumbering. - **client_secret** (string) - Required - The client secret provided by CloudNumbering. - **grant_type** (string) - Required - Specifies the type of grant. Must be either 'client_credentials' or 'refresh_token'. - **refresh_token** (string) - Optional - Required when `grant_type` is 'refresh_token'. The token used to obtain a new access token. ### Request Example ```json { "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET", "grant_type": "client_credentials" } ``` ### Response #### Success Response (200) - **access_token** (string) - The access token for API authentication. - **refresh_token** (string) - The refresh token to obtain a new access token. - **token_type** (string) - The type of the token (e.g., 'Bearer'). - **expires_in** (number) - The time in seconds until the token expires. - **X-Request-Id** (string) - The request ID for reference. #### Response Example ```json { "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "refresh_token": "def456ghi789jkl0mno123pqr456stu789vwx", "token_type": "Bearer", "expires_in": 3600 } ``` #### Error Response (400) - **error** (string) - The error code. - **error_description** (string) - A description of the error. - **X-Request-Id** (string) - The request ID for reference. #### Error Response Example ```json { "error": "invalid_request", "error_description": "Missing required parameter: client_id" } ``` #### Error Response (401) - **error** (string) - The error code. - **error_description** (string) - A description of the error. - **X-Request-Id** (string) - The request ID for reference. #### Error Response Example ```json { "error": "invalid_client", "error_description": "Invalid client credentials" } ``` ``` -------------------------------- ### GET /v1.1/numbers Source: https://developer.cloudnumbering.com/reference/get_numberslistv1_1-1 Retrieves a list of assigned phone numbers. Supports pagination to manage large result sets. ```APIDOC ## GET /v1.1/numbers ### Description Retrieves a list of assigned phone numbers. Supports pagination to manage large result sets. ### Method GET ### Endpoint https://api.cloudnumbering.com/v1.1/numbers ### Parameters #### Query Parameters - **page** (number) - Optional - The page number to retrieve. Defaults to 1. - **perPage** (number) - Optional - The number of entries per page. Defaults to 10, maximum 100. ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **result** (object) - Contains the list of numbers and their details. - **entries** (array) - A list of number objects. - **sid** (string) - The unique identifier for the number resource. - **numberSid** (string) - The unique identifier for the number. - **numberGroupSid** (string) - The unique identifier for the number group. - **countryIso** (string) - The ISO country code for the number's country. - **number** (string) - The phone number in E.164 format. - **voiceEndpointSid** (string) - The unique identifier for the associated voice endpoint. - **voiceEndpointName** (string) - The name of the associated voice endpoint. - **smsEndpointSid** (string) - The unique identifier for the associated SMS endpoint. - **smsEndpointName** (string) - The name of the associated SMS endpoint. - **nextBillingDate** (string) - The date when the number's rental is next due. - **numberRental** (number) - The monthly rental cost for the number. #### Response Example ```json { "success": true, "result": { "entries": [ { "sid": "AN12345678901234567890123456789012", "numberSid": "NB12345678901234567890123456789012", "numberGroupSid": "NG12345678901234567890123456789012", "countryIso": "GB", "number": "+447700900000", "voiceEndpointSid": "EP12345678901234567890123456789012", "voiceEndpointName": "Default Voice", "smsEndpointSid": "EP12345678901234567890123456789012", "smsEndpointName": "Default SMS", "nextBillingDate": "2025-03-01T00:00:00.000Z", "numberRental": 1.2 } ] } } ``` ``` -------------------------------- ### Create or Refresh Token using cURL Source: https://developer.cloudnumbering.com/reference/index This snippet demonstrates how to create or refresh an OAuth token using a cURL request. It requires the client ID, client secret, and grant type. The response will contain your access token. ```shell curl --request POST \ --url 'https://api.cloudnumbering.com/v1/oauth/token?grant_type=client_credentials' \ --header 'accept: application/json' ``` -------------------------------- ### OAuth2 Authentication Source: https://developer.cloudnumbering.com/reference/get_organisationgetv1_1 Details on how to authenticate using OAuth2 client credentials flow. ```APIDOC ## OAuth2 Authentication ### Description This API uses OAuth2 client credentials flow for authentication. Obtain your access token from the token URL. ### Method POST ### Endpoint https://api.cloudnumbering.com/v1/oauth/token ### Parameters #### Request Body - **grant_type** (string) - Required - Must be 'client_credentials' - **client_id** (string) - Required - Your client ID - **client_secret** (string) - Required - Your client secret ### Request Example ```json { "grant_type": "client_credentials", "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET" } ``` ### Response #### Success Response (200) - **access_token** (string) - The obtained access token - **token_type** (string) - The type of token (e.g., 'Bearer') - **expires_in** (integer) - The token's expiration time in seconds #### Response Example ```json { "access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjEyMzQ1", "token_type": "Bearer", "expires_in": 3600 } ``` ``` -------------------------------- ### Developer Cloud Numbering Reference API Source: https://developer.cloudnumbering.com/reference/put_endpointsupdatev1_1 This section details the structure and expected responses for the Developer Cloud Numbering Reference API. ```APIDOC ## Developer Cloud Numbering Reference API ### Description This API provides reference information for cloud numbering. ### Method GET ### Endpoint /websites/developer_cloudnumbering_reference ### Parameters #### Query Parameters - **request_id** (string) - Optional - The request ID for reference. ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **error** (string) - Contains an error message if the request failed. ``` -------------------------------- ### POST /v1/oauth/token Source: https://developer.cloudnumbering.com/reference/index Creates or refreshes an OAuth token. This endpoint is used for authenticating with the Cloud Numbering API. ```APIDOC ## POST /v1/oauth/token ### Description Creates or refreshes an OAuth token. This endpoint is used for authenticating with the Cloud Numbering API. ### Method POST ### Endpoint https://api.cloudnumbering.com/v1/oauth/token ### Parameters #### Query Parameters - **grant_type** (string) - required - The grant type. Allowed values: `client_credentials`, `refresh_token`. - **client_id** (string) - required - The client ID. - **client_secret** (string) - required - The client secret. - **refresh_token** (string) - optional - The refresh token (used when `grant_type` is `refresh_token`). ### Request Example ```json { "grant_type": "client_credentials", "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET" } ``` ### Response #### Success Response (200) - **access_token** (string) - The generated access token. - **token_type** (string) - The type of token (e.g., 'Bearer'). - **expires_in** (integer) - The token's expiration time in seconds. #### Response Example ```json { "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "token_type": "Bearer", "expires_in": 3600 } ``` #### Error Responses - **400** - Invalid request. - **401** - Unauthorized. ``` -------------------------------- ### PUT /v1.1/endpoints/{sid} Source: https://developer.cloudnumbering.com/reference/put_endpointsupdatev1_1 Updates an existing endpoint with new description and URI. This endpoint is used to modify the configuration of a previously created endpoint, such as a voice or SMS callback URL. ```APIDOC ## PUT /v1.1/endpoints/{sid} ### Description Updates an existing endpoint with new description and URI. This endpoint is used to modify the configuration of a previously created endpoint, such as a voice or SMS callback URL. ### Method PUT ### Endpoint /v1.1/endpoints/{sid} ### Parameters #### Path Parameters - **sid** (string) - Required - The SID of the endpoint to update #### Request Body - **description** (string) - Required - A description of the endpoint - **uri** (string) - Required - The URI of the endpoint. For Voice endpoints, this must start with `sip:` and supports variables: `%e164`, `%raw` and `%national` for the E.164, raw and national number formats respectively. e.g. `sip:%e164@127.0.0.1:5060`. For SMS endpoints, this can be a HTTPS or Email URI. e.g. `https://example.com/callback` or `mailto:youremail@example.com` ### Request Example ```json { "description": "My updated voice endpoint", "uri": "sip:%e164@127.0.0.1:5060" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **result** (object) - Contains the result of the operation. - **sid** (string) - The SID of the updated endpoint. #### Response Example ```json { "success": true, "result": { "sid": "enp_xxxxxxxxxxxxxxxx" } } ``` #### Error Response (400) - **success** (boolean) - Indicates if the operation was successful. - **error** (string) - A message describing the error. #### Response Example ```json { "success": false, "error": "Invalid request body" } ``` #### Error Response (401) - **success** (boolean) - Indicates if the operation was successful. - **error** (string) - A message describing the error. #### Response Example ```json { "success": false, "error": "Unauthorized" } ``` ``` -------------------------------- ### Cloud Numbering Reference API Source: https://developer.cloudnumbering.com/reference/get_cataloguelistv1_1 This section details the structure of responses for the Cloud Numbering Reference API, including success and error scenarios. ```APIDOC ## Cloud Numbering Reference API ### Description This API provides reference data for cloud numbering services. It outlines the expected response structure for successful operations and various error conditions, including unauthorized access. ### Method GET (Implied, as this describes response structures) ### Endpoint /websites/developer_cloudnumbering_reference ### Parameters None for this documentation snippet, as it focuses on response schemas. ### Request Example N/A ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **error** (string) - Contains an error message if the request failed; otherwise, it might be null or empty. #### Response Example ```json { "success": true, "error": null } ``` #### Error Response (401) - **success** (boolean) - Indicates if the request was successful (will be false for errors). - **error** (string) - A message describing the authentication or authorization error. - **X-Request-Id** (string, uuid) - The request ID for reference. #### Response Example ```json { "success": false, "error": "Unauthorized access" } ``` ``` -------------------------------- ### Cloud Numbering Reference API Documentation Source: https://developer.cloudnumbering.com/reference/post_orderscreatev1_1 This section provides detailed documentation for the Cloud Numbering Reference API, covering request and response structures, as well as error codes. ```APIDOC ## Cloud Numbering Reference API ### Description This API provides reference information for cloud numbering services. It includes details on available numbers, features, and associated metadata. ### Method GET ### Endpoint /websites/developer_cloudnumbering_reference ### Parameters #### Query Parameters - **region** (string) - Optional - The geographical region for which to retrieve numbering information. - **type** (string) - Optional - The type of numbering service (e.g., "mobile", "landline"). ### Request Example ```json { "example": "GET /websites/developer_cloudnumbering_reference?region=US&type=mobile" } ``` ### Response #### Success Response (200) - **data** (object) - Contains the numbering reference data. - **numbers** (array) - List of available numbers. - **number** (string) - The phone number. - **type** (string) - The type of number. - **region** (string) - The region the number belongs to. - **features** (array) - List of supported features. - **name** (string) - The name of the feature. - **description** (string) - A description of the feature. #### Response Example ```json { "example": { "success": true, "data": { "numbers": [ { "number": "+15551234567", "type": "mobile", "region": "US" } ], "features": [ { "name": "VoIP", "description": "Voice over IP calling" } ] } } } ``` #### Error Response (401) - **success** (boolean) - Indicates if the request was successful (false in case of error). - **error** (string) - A message describing the error. ### Error Handling - **401 Unauthorized**: Returned when the request lacks valid authentication credentials. - **X-Request-Id** (string, uuid) - The request ID for reference. #### Error Response Example (401) ```json { "example": { "success": false, "error": "Authentication failed" } } ``` ```