curl --request POST \
--url https://api.edenai.run/v3/manage/keys/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"token_type": "api_token",
"member": "jsmith@example.com",
"balance": "<string>",
"expire_time": "2023-11-07T05:31:56Z",
"active_balance": true,
"balance_reset_amount": "<string>",
"balance_reset_period": "none"
}
'import requests
url = "https://api.edenai.run/v3/manage/keys/"
payload = {
"name": "<string>",
"token_type": "api_token",
"member": "jsmith@example.com",
"balance": "<string>",
"expire_time": "2023-11-07T05:31:56Z",
"active_balance": True,
"balance_reset_amount": "<string>",
"balance_reset_period": "none"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
token_type: 'api_token',
member: 'jsmith@example.com',
balance: '<string>',
expire_time: '2023-11-07T05:31:56Z',
active_balance: true,
balance_reset_amount: '<string>',
balance_reset_period: 'none'
})
};
fetch('https://api.edenai.run/v3/manage/keys/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.edenai.run/v3/manage/keys/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'token_type' => 'api_token',
'member' => 'jsmith@example.com',
'balance' => '<string>',
'expire_time' => '2023-11-07T05:31:56Z',
'active_balance' => true,
'balance_reset_amount' => '<string>',
'balance_reset_period' => 'none'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.edenai.run/v3/manage/keys/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"token_type\": \"api_token\",\n \"member\": \"jsmith@example.com\",\n \"balance\": \"<string>\",\n \"expire_time\": \"2023-11-07T05:31:56Z\",\n \"active_balance\": true,\n \"balance_reset_amount\": \"<string>\",\n \"balance_reset_period\": \"none\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.edenai.run/v3/manage/keys/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"token_type\": \"api_token\",\n \"member\": \"jsmith@example.com\",\n \"balance\": \"<string>\",\n \"expire_time\": \"2023-11-07T05:31:56Z\",\n \"active_balance\": true,\n \"balance_reset_amount\": \"<string>\",\n \"balance_reset_period\": \"none\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.edenai.run/v3/manage/keys/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"token_type\": \"api_token\",\n \"member\": \"jsmith@example.com\",\n \"balance\": \"<string>\",\n \"expire_time\": \"2023-11-07T05:31:56Z\",\n \"active_balance\": true,\n \"balance_reset_amount\": \"<string>\",\n \"balance_reset_period\": \"none\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"member": "jsmith@example.com",
"masked": "<string>",
"balance": 0,
"revoked": true,
"secret": "<string>",
"token_type": "sandbox_api_token",
"active_balance": true,
"expire_time": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z"
}Create an API key
Creates a new API key for the organization, optionally attributed to a member and with spending controls. The response includes the key’s secret exactly once; it cannot be retrieved afterwards. Returns 409 if the name is already used by one of the owner’s active keys and 403 if the plan’s key limit is reached. Requires the manage:write scope.
curl --request POST \
--url https://api.edenai.run/v3/manage/keys/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"token_type": "api_token",
"member": "jsmith@example.com",
"balance": "<string>",
"expire_time": "2023-11-07T05:31:56Z",
"active_balance": true,
"balance_reset_amount": "<string>",
"balance_reset_period": "none"
}
'import requests
url = "https://api.edenai.run/v3/manage/keys/"
payload = {
"name": "<string>",
"token_type": "api_token",
"member": "jsmith@example.com",
"balance": "<string>",
"expire_time": "2023-11-07T05:31:56Z",
"active_balance": True,
"balance_reset_amount": "<string>",
"balance_reset_period": "none"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
token_type: 'api_token',
member: 'jsmith@example.com',
balance: '<string>',
expire_time: '2023-11-07T05:31:56Z',
active_balance: true,
balance_reset_amount: '<string>',
balance_reset_period: 'none'
})
};
fetch('https://api.edenai.run/v3/manage/keys/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.edenai.run/v3/manage/keys/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'token_type' => 'api_token',
'member' => 'jsmith@example.com',
'balance' => '<string>',
'expire_time' => '2023-11-07T05:31:56Z',
'active_balance' => true,
'balance_reset_amount' => '<string>',
'balance_reset_period' => 'none'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.edenai.run/v3/manage/keys/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"token_type\": \"api_token\",\n \"member\": \"jsmith@example.com\",\n \"balance\": \"<string>\",\n \"expire_time\": \"2023-11-07T05:31:56Z\",\n \"active_balance\": true,\n \"balance_reset_amount\": \"<string>\",\n \"balance_reset_period\": \"none\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.edenai.run/v3/manage/keys/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"token_type\": \"api_token\",\n \"member\": \"jsmith@example.com\",\n \"balance\": \"<string>\",\n \"expire_time\": \"2023-11-07T05:31:56Z\",\n \"active_balance\": true,\n \"balance_reset_amount\": \"<string>\",\n \"balance_reset_period\": \"none\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.edenai.run/v3/manage/keys/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"token_type\": \"api_token\",\n \"member\": \"jsmith@example.com\",\n \"balance\": \"<string>\",\n \"expire_time\": \"2023-11-07T05:31:56Z\",\n \"active_balance\": true,\n \"balance_reset_amount\": \"<string>\",\n \"balance_reset_period\": \"none\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"member": "jsmith@example.com",
"masked": "<string>",
"balance": 0,
"revoked": true,
"secret": "<string>",
"token_type": "sandbox_api_token",
"active_balance": true,
"expire_time": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z"
}Authorizations
A management key (created from the organization dashboard or with POST /v3/manage/auth-keys), sent as Authorization: Bearer <management_key>. Inference API keys (sk-eden...) are not accepted on these endpoints.
Body
Settings for a new API key.
name must be unique among the owner's active keys. token_type selects the production
(api_token) or sandbox (sandbox_api_token) environment and cannot be changed later.
member attributes the key to an organization member so their usage is reported per user;
omit it to create a service key attributed to the organization itself.
Spending controls are optional: balance with active_balance caps what the key can spend,
expire_time sets a hard expiry (at least one day ahead), and balance_reset_period with
balance_reset_amount refills the balance on a schedule. The same rules apply as when creating
a key from the dashboard.
1 - 200api_token- api_tokensandbox_api_token- sandbox_api_token
api_token, sandbox_api_token 1^-?\d{0,5}(?:\.\d{0,9})?$^-?\d{0,5}(?:\.\d{0,9})?$none- Nonedaily- Dailyweekly- Weeklymonthly- Monthly
none, daily, weekly, monthly Response
A freshly created API key. Identical to the key resource plus secret, the full key value.
The secret is shown only in this response and cannot be retrieved again; store it securely.
The token name
200-100000 < x < 100000sandbox_api_token- Sandboxapi_token- Back
sandbox_api_token, api_token Weither to use the balance field or not.