curl --request PATCH \
--url https://api.deepinfra.com/v1/api-tokens/id/{token_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"scopes": []
}'import requests
url = "https://api.deepinfra.com/v1/api-tokens/id/{token_id}"
payload = { "scopes": [] }
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({scopes: []})
};
fetch('https://api.deepinfra.com/v1/api-tokens/id/{token_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.deepinfra.com/v1/api-tokens/id/{token_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([
'scopes' => [
]
]),
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.deepinfra.com/v1/api-tokens/id/{token_id}"
payload := strings.NewReader("{\n \"scopes\": []\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.deepinfra.com/v1/api-tokens/id/{token_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"scopes\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deepinfra.com/v1/api-tokens/id/{token_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 \"scopes\": []\n}"
response = http.request(request)
puts response.read_body{
"created_at": 123,
"name": "<string>",
"token_id": "<string>",
"allowed_ips": [
"<string>"
],
"prefix": "",
"fragment": "",
"scopes": []
}{
"error": "Model not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Update Api Token Scopes By Id
Replace an API token’s scopes, by token_id.
token_id comes from Get Api Tokens (GET /v1/api-tokens).
curl --request PATCH \
--url https://api.deepinfra.com/v1/api-tokens/id/{token_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"scopes": []
}'import requests
url = "https://api.deepinfra.com/v1/api-tokens/id/{token_id}"
payload = { "scopes": [] }
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({scopes: []})
};
fetch('https://api.deepinfra.com/v1/api-tokens/id/{token_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.deepinfra.com/v1/api-tokens/id/{token_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([
'scopes' => [
]
]),
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.deepinfra.com/v1/api-tokens/id/{token_id}"
payload := strings.NewReader("{\n \"scopes\": []\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.deepinfra.com/v1/api-tokens/id/{token_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"scopes\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deepinfra.com/v1/api-tokens/id/{token_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 \"scopes\": []\n}"
response = http.request(request)
puts response.read_body{
"created_at": 123,
"name": "<string>",
"token_id": "<string>",
"allowed_ips": [
"<string>"
],
"prefix": "",
"fragment": "",
"scopes": []
}{
"error": "Model not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
what the key may do: at least one scope, never unrestricted
What an API key may do; a login session may do everything. Listed in the order the dashboard shows.
A scope x also grants x:read (see covers_scope).
Adding or renaming a scope needs its dashboard description in deepinfra/web too:
pages.dashboard.api_keys.scopes.descriptions.<name with ':' as '_'> in
public/locales/en/common.json. Without one the dashboard shows the bare name.
A new scope is not initial, so unrestricted keys do not get it; one split from an initial scope is, so they keep what they could do.
inference, models:read, account:read, models, lora:read, lora, voice:read, voice, account_scoped_jwt:read, account_scoped_jwt, batch, compute:sandbox, compute:agents, compute:containers, billing:read, metrics, unrestricted Response
Successful Response
creation unix timestamp
sk-di-, or empty on a token minted before it
display suffix; last 5 chars of the secret
what the key may do
What an API key may do; a login session may do everything. Listed in the order the dashboard shows.
A scope x also grants x:read (see covers_scope).
Adding or renaming a scope needs its dashboard description in deepinfra/web too:
pages.dashboard.api_keys.scopes.descriptions.<name with ':' as '_'> in
public/locales/en/common.json. Without one the dashboard shows the bare name.
A new scope is not initial, so unrestricted keys do not get it; one split from an initial scope is, so they keep what they could do.
inference, models:read, account:read, models, lora:read, lora, voice:read, voice, account_scoped_jwt:read, account_scoped_jwt, batch, compute:sandbox, compute:agents, compute:containers, billing:read, metrics, unrestricted