Skip to main content
PATCH
/
v1
/
api-keys
/
sub-keys
/
{key_id}
Update Sub-API Key
curl --request PATCH \
  --url https://api.io.solutions/v1/api-keys/sub-keys/{key_id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <x-api-key>' \
  --data '
{
  "description": "<string>",
  "allowed_models": [
    "<string>"
  ],
  "credit_limit": 1,
  "expires_at": "2023-11-07T05:31:56Z"
}
'
import requests

url = "https://api.io.solutions/v1/api-keys/sub-keys/{key_id}"

payload = {
"description": "<string>",
"allowed_models": ["<string>"],
"credit_limit": 1,
"expires_at": "2023-11-07T05:31:56Z"
}
headers = {
"x-api-key": "<x-api-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'PATCH',
headers: {
'x-api-key': '<x-api-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
description: '<string>',
allowed_models: ['<string>'],
credit_limit: 1,
expires_at: '2023-11-07T05:31:56Z'
})
};

fetch('https://api.io.solutions/v1/api-keys/sub-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.io.solutions/v1/api-keys/sub-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([
'description' => '<string>',
'allowed_models' => [
'<string>'
],
'credit_limit' => 1,
'expires_at' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-api-key: <x-api-key>"
],
]);

$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.io.solutions/v1/api-keys/sub-keys/{key_id}"

payload := strings.NewReader("{\n \"description\": \"<string>\",\n \"allowed_models\": [\n \"<string>\"\n ],\n \"credit_limit\": 1,\n \"expires_at\": \"2023-11-07T05:31:56Z\"\n}")

req, _ := http.NewRequest("PATCH", url, payload)

req.Header.Add("x-api-key", "<x-api-key>")
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.io.solutions/v1/api-keys/sub-keys/{key_id}")
.header("x-api-key", "<x-api-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"<string>\",\n \"allowed_models\": [\n \"<string>\"\n ],\n \"credit_limit\": 1,\n \"expires_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.io.solutions/v1/api-keys/sub-keys/{key_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<x-api-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"<string>\",\n \"allowed_models\": [\n \"<string>\"\n ],\n \"credit_limit\": 1,\n \"expires_at\": \"2023-11-07T05:31:56Z\"\n}"

response = http.request(request)
puts response.read_body
{
  "status": "succeeded"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}
All body fields are optional — only the fields you include will be updated.

Unblocking an over-limit key

When a sub-key’s credit_used exceeds its credit_limit, the key is automatically blocked (returns 429 Too Many Requests on inference calls). To unblock it without waiting for the next cycle reset, raise the credit_limit via this endpoint:
curl -X PATCH "https://api.intelligence.io.solutions/v1/api-keys/sub-keys/{key_id}" \
  -H "x-api-key: $ADMIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"credit_limit": 50.0}'

Clearing model restrictions

Pass an empty array for allowed_models to remove all model restrictions, giving the sub-key access to all models available to the admin:
{ "allowed_models": [] }

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Headers

x-api-key
string
required

Admin API key that owns the sub-key. Admin API key (io.net Intelligence)

Path Parameters

key_id
string<uuid>
required

UUID of the sub-key to update.

Body

application/json

All fields are optional. Only provided fields are updated.

description
string | null
allowed_models
string[] | null

New model allow-list. Pass an empty array [] to remove all restrictions.

credit_limit
number | null

New per-cycle credit cap. Set to a higher value to unblock a key that has exceeded its limit.

Required range: x >= 0
credit_refresh_cycle
enum<string> | null
Available options:
8h,
daily,
weekly,
monthly
expires_at

Response

Sub-key updated successfully

status
string
Example:

"succeeded"