Saltar al contenido principal
POST
/
v1
/
api_key
Create Api Key
import requests

url = "http://localhost:3000/v1/api_key/"

payload = {
    "name": "<string>",
    "restricted": True,
    "expiry_date": "2023-11-07T05:31:56Z",
    "permissions": ["companies.delete"]
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "name": "<string>",
  "created_date": "2023-11-07T05:31:56Z",
  "last_four_digits": "<string>",
  "creator_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "restricted": true,
  "permissions": [
    "companies.delete"
  ],
  "value": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
name
string
required

The name of the API key

restricted
boolean
required

Whether the API key is restricted to a set of specific permissions

expiry_date
string<date-time> | null

The date and time when the API key will expire. If not provided, the API key will not expire.

permissions
enum<string>[] | null

A list of permissions associated with the API key. Do not include this field if the key is unrestricted.

App permissions.

Opciones disponibles:
companies.delete,
companies.update,
calls.create,
calls.delete,
calls.update,
calls.view,
messages.view,
agents.view,
agents.create,
agents.update,
agents.delete,
phones.view,
phones.purchase,
phones.delete,
phones.update,
tools.view,
tools.create,
tools.delete,
tools.update,
contacts.view,
contacts.delete,
conversational_paths.view,
conversational_paths.create,
conversational_paths.delete,
conversational_paths.update,
knowledge_bases.view,
knowledge_bases.create,
knowledge_bases.delete,
knowledge_bases.update,
webhooks.view,
webhooks.create,
webhooks.delete,
webhooks.update,
members.view,
members.create,
members.delete,
members.update,
billing.view,
billing.update,
api_keys.view,
api_keys.create,
api_keys.delete,
api_keys.update,
voices.view,
transcriptions.view,
recordings.view,
stats.view,
notifications.view,
notifications.update,
integrations.view,
integrations.create,
integrations.update,
integrations.delete

Response

Successful Response

id
string<uuid>
required

The unique identifier for the API key

name
string
required

The name of the API key

created_date
string<date-time>
required

The date and time when the API key was created

last_four_digits
string
required

The last four digits of the API key

creator_id
string<uuid>
required

The ID of the user who created the API key

restricted
boolean
required

Whether the API key is restricted to a set of specific permissions

permissions
enum<string>[] | null

The permissions associated with the API key

App permissions.

Opciones disponibles:
companies.delete,
companies.update,
calls.create,
calls.delete,
calls.update,
calls.view,
messages.view,
agents.view,
agents.create,
agents.update,
agents.delete,
phones.view,
phones.purchase,
phones.delete,
phones.update,
tools.view,
tools.create,
tools.delete,
tools.update,
contacts.view,
contacts.delete,
conversational_paths.view,
conversational_paths.create,
conversational_paths.delete,
conversational_paths.update,
knowledge_bases.view,
knowledge_bases.create,
knowledge_bases.delete,
knowledge_bases.update,
webhooks.view,
webhooks.create,
webhooks.delete,
webhooks.update,
members.view,
members.create,
members.delete,
members.update,
billing.view,
billing.update,
api_keys.view,
api_keys.create,
api_keys.delete,
api_keys.update,
voices.view,
transcriptions.view,
recordings.view,
stats.view,
notifications.view,
notifications.update,
integrations.view,
integrations.create,
integrations.update,
integrations.delete
value
string | null

The value of the API key. This will only be returned at the time of creation. Note that this field is not present in the response for other operations.