Modifier ou suspendre un sous-compte
Renommez un sous-compte, modifiez ses limites, ou suspendez-le et réactivez-le.
PATCH
/
v1
/
sub-accounts
/
{id}
Update or suspend a sub-account
curl --request PATCH \
--url https://api.querying.ai/v1/sub-accounts/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"status": "suspended"
}
'import requests
url = "https://api.querying.ai/v1/sub-accounts/{id}"
payload = { "status": "suspended" }
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({status: 'suspended'})
};
fetch('https://api.querying.ai/v1/sub-accounts/{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.querying.ai/v1/sub-accounts/{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([
'status' => 'suspended'
]),
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.querying.ai/v1/sub-accounts/{id}"
payload := strings.NewReader("{\n \"status\": \"suspended\"\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.querying.ai/v1/sub-accounts/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"suspended\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.querying.ai/v1/sub-accounts/{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 \"status\": \"suspended\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"externalId": "<string>",
"status": "active",
"monthlyCreditLimit": 10000000.005,
"concurrencyLimit": 50000,
"createdAt": "2023-11-07T05:31:56Z",
"suspendedAt": "2023-11-07T05:31:56Z",
"usage": {
"month": "<string>",
"credits": 123,
"tasks": 123,
"reservedCredits": 123
}
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "unknown field creditLimit; allowed: name, externalId, monthlyCreditLimit, concurrencyLimit",
"timestamp": "2026-10-09T09:00:00.000Z"
}
}{
"success": false,
"error": {
"code": "MISSING_API_KEY",
"message": "Missing or invalid API key",
"timestamp": "2026-07-09T04:12:00.000Z"
}
}{
"success": false,
"error": {
"code": "SUB_ACCOUNT_FORBIDDEN",
"message": "Managing sub-accounts needs an API key without an engine scope or a daily credit limit",
"timestamp": "2026-10-09T09:00:00.000Z"
}
}{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "No sub-account with that id",
"timestamp": "2026-10-09T09:00:00.000Z"
}
}{
"success": false,
"error": {
"code": "SUB_ACCOUNT_EXISTS",
"message": "Another sub-account already has that externalId",
"timestamp": "2026-10-09T09:00:00.000Z"
}
}Autorisations
Your API key, sent as Authorization: Bearer <key>.
Paramètres de chemin
The sub-account id.
Corps
application/json
Required string length:
1 - 128Required string length:
1 - 128Null removes the cap.
Plage requise:
0.01 <= x <= 20000000Doit être un multiple de 0.01Null removes the cap.
Plage requise:
1 <= x <= 100000Options disponibles:
active, suspended ⌘I
Update or suspend a sub-account
curl --request PATCH \
--url https://api.querying.ai/v1/sub-accounts/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"status": "suspended"
}
'import requests
url = "https://api.querying.ai/v1/sub-accounts/{id}"
payload = { "status": "suspended" }
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({status: 'suspended'})
};
fetch('https://api.querying.ai/v1/sub-accounts/{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.querying.ai/v1/sub-accounts/{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([
'status' => 'suspended'
]),
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.querying.ai/v1/sub-accounts/{id}"
payload := strings.NewReader("{\n \"status\": \"suspended\"\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.querying.ai/v1/sub-accounts/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"suspended\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.querying.ai/v1/sub-accounts/{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 \"status\": \"suspended\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"externalId": "<string>",
"status": "active",
"monthlyCreditLimit": 10000000.005,
"concurrencyLimit": 50000,
"createdAt": "2023-11-07T05:31:56Z",
"suspendedAt": "2023-11-07T05:31:56Z",
"usage": {
"month": "<string>",
"credits": 123,
"tasks": 123,
"reservedCredits": 123
}
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "unknown field creditLimit; allowed: name, externalId, monthlyCreditLimit, concurrencyLimit",
"timestamp": "2026-10-09T09:00:00.000Z"
}
}{
"success": false,
"error": {
"code": "MISSING_API_KEY",
"message": "Missing or invalid API key",
"timestamp": "2026-07-09T04:12:00.000Z"
}
}{
"success": false,
"error": {
"code": "SUB_ACCOUNT_FORBIDDEN",
"message": "Managing sub-accounts needs an API key without an engine scope or a daily credit limit",
"timestamp": "2026-10-09T09:00:00.000Z"
}
}{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "No sub-account with that id",
"timestamp": "2026-10-09T09:00:00.000Z"
}
}{
"success": false,
"error": {
"code": "SUB_ACCOUNT_EXISTS",
"message": "Another sub-account already has that externalId",
"timestamp": "2026-10-09T09:00:00.000Z"
}
}