Accesskey
Accesskey API Overview
The Accesskey API provides a secure and efficient way to authenticate and interact with the VoIPBIN platform. It utilizes access keys as API tokens to enable authorized access to API endpoints. This ensures seamless integration while maintaining the security and integrity of your operations.
API Usage
To use the Accesskey, pass the token in the query parameters or headers of your API requests. Below is an example usage:
Example Request
curl --location 'https://api.voipbin.net/v1.0/calls?accesskey=DuRWq5T4DAK32dw4'
Description of Parameters
Accesskey: The accesskey query parameter must contain the token issued for the customer. This token uniquely identifies and authorizes the request.
Authentication
The token serves as the authentication credential. Ensure you store it securely and avoid exposing it in client-side code or public repositories.
Lifecycles and Expiry
Accesskeys come with lifecycle timestamps:
tm_create: The creation timestamp.
tm_update: The last updated timestamp.
tm_expire: The expiration timestamp. Ensure you rotate keys before this date.
tm_delete: The deletion timestamp, if applicable.
Notes
Always use HTTPS to ensure secure communication.
Tokens should be rotated periodically to enhance security.
Struct
Accesskey
{
"id": "5f1f8f7e-9b3d-4c60-8465-b69e9f28b6db",
"customer_id": "a1d9b2cd-4578-4b23-91b6-5f5ec4a2f840",
"name": "My API Key",
"detail": "For accessing reporting APIs",
"token": "DuRWq5T4DAK32dw4",
"tm_expire": "2025-04-28 01:41:40.503790",
"tm_create": "2022-04-28 01:41:40.503790",
"tm_update": "2022-04-28 01:41:40.503790",
"tm_delete": "9999-01-01 00:00:00.000000"
}
id: A unique identifier (UUID) for the access key. This is auto-generated when the key is created.
customer_id: The UUID representing the customer to whom the access key belongs. This links the key to a specific customer account.
name: An optional string field that allows users to assign a human-readable name to the access key. This is useful for identification purposes in multi-key environments.
detail: An optional string field for additional information about the access key, such as its intended use or description.
token: The API token string. This is the credential used to authenticate API requests. It must be treated as sensitive information and stored securely.
tm_expire: A timestamp (ISO 8601 format) indicating when the access key will expire. After this time, the key will no longer be valid.
tm_create: A timestamp (ISO 8601 format) indicating when the access key was created.
tm_update: A timestamp (ISO 8601 format) showing the last time the access key was updated. This is useful for tracking modifications to the key.
tm_delete: A timestamp (ISO 8601 format) indicating when the key was marked for deletion. If the value is set to a far-future date (e.g., “9999-01-01 00:00:00.000000”), it implies the key is not deleted.
Tutorial
Create, Retrieve, and Manage Accesskeys
This tutorial demonstrates how to create an access key, retrieve a list of access keys, and retrieve a specific access key using the API. All requests must include the accesskey query parameter for authentication.
Create an Accesskey
Use the following command to create a new access key. The expire parameter specifies the duration in seconds before the key expires.
$ curl -k --location --request POST 'https://api.voipbin.net/v1.0/accesskeys?accesskey=<your-access-key>' \ --header 'Content-Type: application/json' \ --data-raw '{ "name": "My New Accesskey", "detail": "This key is used for reporting", "expire": 31536000 }'
Example Response:
{ "id": "2f1f8f7e-9b3d-4c60-8465-b69e9f28b6dc", "customer_id": "a1d9b2cd-4578-4b23-91b6-5f5ec4a2f840", "name": "My New Accesskey", "detail": "This key is used for reporting", "token": "3yTqk5F4ABCD2xy9", "tm_expire": "2025-12-01 10:15:30.123456", "tm_create": "2024-12-01 10:15:30.123456", "tm_update": "2024-12-01 10:15:30.123456", "tm_delete": "9999-01-01 00:00:00.000000" }
Get a List of Accesskeys
Retrieve all existing access keys associated with your account. Include the accesskey query parameter in the request URL for authentication.
$ curl -k --location --request GET 'https://api.voipbin.net/v1.0/accesskeys?accesskey=<your-access-key>'
Example Response:
{ "result": [ { "id": "2f1f8f7e-9b3d-4c60-8465-b69e9f28b6dc", "customer_id": "a1d9b2cd-4578-4b23-91b6-5f5ec4a2f840", "name": "My New Accesskey", "detail": "This key is used for reporting", "token": "3yTqk5F4ABCD2xy9", "tm_expire": "2025-12-01 10:15:30.123456", "tm_create": "2024-12-01 10:15:30.123456", "tm_update": "2024-12-01 10:15:30.123456", "tm_delete": "9999-01-01 00:00:00.000000" } ], "next_page_token": null }
Get a Specific Accesskey
Retrieve details of a specific access key using its unique ID. Include the accesskey query parameter for authentication.
$ curl -k --location --request GET 'https://api.voipbin.net/v1.0/accesskeys/2f1f8f7e-9b3d-4c60-8465-b69e9f28b6dc?accesskey=<your-access-key>'
Example Response:
{ "id": "2f1f8f7e-9b3d-4c60-8465-b69e9f28b6dc", "customer_id": "a1d9b2cd-4578-4b23-91b6-5f5ec4a2f840", "name": "My New Accesskey", "detail": "This key is used for reporting", "token": "3yTqk5F4ABCD2xy9", "tm_expire": "2025-12-01 10:15:30.123456", "tm_create": "2024-12-01 10:15:30.123456", "tm_update": "2024-12-01 10:15:30.123456", "tm_delete": "9999-01-01 00:00:00.000000" }