curl --request PATCH \
--url https://api.edenai.run/v3/manage/keys/{key_id}/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"active_balance": true,
"balance": "<string>",
"balance_reset_amount": "<string>"
}
'import requests
url = "https://api.edenai.run/v3/manage/keys/{key_id}/"
payload = {
"name": "<string>",
"active_balance": True,
"balance": "<string>",
"balance_reset_amount": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
active_balance: true,
balance: '<string>',
balance_reset_amount: '<string>'
})
};
fetch('https://api.edenai.run/v3/manage/keys/{key_id}/', 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/{key_id}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'active_balance' => true,
'balance' => '<string>',
'balance_reset_amount' => '<string>'
]),
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/{key_id}/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"active_balance\": true,\n \"balance\": \"<string>\",\n \"balance_reset_amount\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.edenai.run/v3/manage/keys/{key_id}/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"active_balance\": true,\n \"balance\": \"<string>\",\n \"balance_reset_amount\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.edenai.run/v3/manage/keys/{key_id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"active_balance\": true,\n \"balance\": \"<string>\",\n \"balance_reset_amount\": \"<string>\"\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,
"token_type": "sandbox_api_token",
"active_balance": true,
"expire_time": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z"
}Update an API key
Updates the display name and spending controls of an API key. Only the fields you send are changed. The environment (token_type) cannot be changed. Returns 409 if the new name is already used by one of the owner’s active keys. Requires the manage:write scope.
curl --request PATCH \
--url https://api.edenai.run/v3/manage/keys/{key_id}/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"active_balance": true,
"balance": "<string>",
"balance_reset_amount": "<string>"
}
'import requests
url = "https://api.edenai.run/v3/manage/keys/{key_id}/"
payload = {
"name": "<string>",
"active_balance": True,
"balance": "<string>",
"balance_reset_amount": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
active_balance: true,
balance: '<string>',
balance_reset_amount: '<string>'
})
};
fetch('https://api.edenai.run/v3/manage/keys/{key_id}/', 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/{key_id}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'active_balance' => true,
'balance' => '<string>',
'balance_reset_amount' => '<string>'
]),
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/{key_id}/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"active_balance\": true,\n \"balance\": \"<string>\",\n \"balance_reset_amount\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.edenai.run/v3/manage/keys/{key_id}/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"active_balance\": true,\n \"balance\": \"<string>\",\n \"balance_reset_amount\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.edenai.run/v3/manage/keys/{key_id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"active_balance\": true,\n \"balance\": \"<string>\",\n \"balance_reset_amount\": \"<string>\"\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,
"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.
Path Parameters
Body
Editable API key fields: the display name and the spending controls. All fields are
optional; only the fields you send are changed. The environment (token_type) cannot be changed:
create a new key instead. Renaming to a name already used by one of the owner's active keys
returns 409.
The token name
1 - 200Weither to use the balance field or not.
Optional remaining credits balance for this Token, if active_balance is set to True and the balance reaches 0, this token will become unusable
^-?\d{0,5}(?:\.\d{0,9})?$The amount this token's balance is reset to at the start of each balance_reset_period. Null when balance_reset_period is 'none'.
^-?\d{0,5}(?:\.\d{0,9})?$How often this token's balance is reinitialized to balance_reset_amount. 'none' = one-time balance (default, current behaviour).
none- Nonedaily- Dailyweekly- Weeklymonthly- Monthly
none, daily, weekly, monthly Response
An API key belonging to the organization. The secret is never included: masked shows the
key prefix and last characters for identification, and id is the stable identifier used in
/manage/keys/{key_id} URLs.
balance is the remaining spendable amount, including usage not yet settled, or null when the
key has no spending cap. Revoked keys stay listed with revoked: true and a revoked_at
timestamp. id is null for a legacy key that has not been regenerated yet; such a key is
listed but cannot be addressed by URL until it is regenerated.
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.