Creates a new key in the specified project
You must create your first API Key using the Deepgram Console. After you have your first API key, you can use that to create more keys for a specified project. Refer to the documentation Creating API Keys for more details.
Deepgram API Keys
At a minimum to create a new Deepgram API key you will be required the set the scope:
keys:write
. Refer to the documentation Working with Roles & API Scopes for more details.
Deepgram API Keys can be created with different levels of roles and scopes as needed. To create a Deepgram API Key you can use the following example and set any additional roles and scopes.
Replace
YOUR_DEEPGRAM_API_KEY
with your Deepgram API Key.
curl --request POST \
--url https://api.deepgram.com/v1/projects/{project_id}/keys \
--header 'Authorization: Token ' YOUR_DEEPGRAM_API_KEY \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"comment": " A comment",
"tags": ["A Tag"],
"scopes": [
"usage:write",
"keys:write"
.. additional scopes
]
}
'
A successful response:
{
"api_key_id": "xxxxxx",
"key": "xxxxxx",
"comment": "A Comment",
"scopes": [
"keys:write",
"keys:read",
"usage:write"
],
"tags": [
"A Tag"
],
"created": "2024-05-21T17:19:49.373761Z"
}TBD
Deepgram Self-Hosted API Keys
To create a new self-hosted API key, you will be required to set the scopes at a minimum:
self-hosted:product:api
andself-hosted:product:engine
. Refer to the documentation Self-Hosted Product Scopes for more details.
Self-Hosted API keys can also be created by including the desired role in the same scopes list as the self-hosted product scopes when submitting the key creation request.
To create a self-hosted API Key, you can use the following example which includes the default self-hosted product scopes for a given project.
Replace
YOUR_DEEPGRAM_API_KEY
with your Deepgram API Key.
curl --request POST \
--url https://api.deepgram.com/v1/projects/3f2504e0-4f89-11d3-9a0c-0305e82c3301/keys \
--header 'Authorization: YOUR_DEEPGRAM_API_KEY ' \
--header 'Content-Type: application/json' \
--header 'accept: application/json' \
--data '
{
"comment": "My self-hosted API key",
"scopes": [
"member",
"self-hosted:products"
]
}
'
A successful response:
{
"api_key_id": "xxxxxx",
"key": "xxxxxxx",
"comment": "My on-prem API key",
"scopes": [
"member",
"self-hosted:product:api",
"self-hosted:product:engine"
],
"created": "2023-06-29T00:33:46.443412Z"
}