Account
Update Simulator Usage Settings
Turn usage-based billing for simulators on or off for the caller. With autoSwitchToCredits true, once a GPU simulator's free daily allowance is used, further jobs on it run and are charged from credits at the device's per-minute price. With it false (the default), those jobs are refused until the allowance resets at 00:00 UTC. The organization is taken from the API key, which is bound to a single organization.
Authorizations
X-API-KEYstringheaderrequiredAuthenticate requests using an API key linked to your qBraid account. Obtain your key by registering or logging in at account.qbraid.com.
Body
application/jsonrequiredautoSwitchToCreditsbooleanrequiredRun jobs past a GPU simulator's free daily allowance, charged from credits (true), or refuse them (false).
Response
200Success.
successbooleanrequireddataobjectrequired400Invalid request body.
401Authentication / org context required.
404Organization user not found.
curl --request PATCH \
--url https://api-v2.qbraid.com/api/v1/usage/simulator/settings \
--header 'X-API-KEY: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"autoSwitchToCredits": true
}'import requests
url = "https://api-v2.qbraid.com/api/v1/usage/simulator/settings"
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
payload = {
"autoSwitchToCredits": True
}
response = requests.patch(url, headers=headers, json=payload)
print(response.json())const url = "https://api-v2.qbraid.com/api/v1/usage/simulator/settings";
const options = {
method: "PATCH",
headers: {"X-API-KEY":"<api-key>","Content-Type":"application/json"},
body: JSON.stringify({
"autoSwitchToCredits": true
}),
};
const response = await fetch(url, options);
console.log(await response.json());<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-v2.qbraid.com/api/v1/usage/simulator/settings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => '{
"autoSwitchToCredits": true
}',
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>",
"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"
"io"
"net/http"
"strings"
)
func main() {
url := "https://api-v2.qbraid.com/api/v1/usage/simulator/settings"
payload := strings.NewReader(`{
"autoSwitchToCredits": true
}`)
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api-v2.qbraid.com/api/v1/usage/simulator/settings"))
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"autoSwitchToCredits\": true\n}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());require 'uri'
require 'net/http'
url = URI("https://api-v2.qbraid.com/api/v1/usage/simulator/settings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = <<~JSON
{
"autoSwitchToCredits": true
}
JSON
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"autoSwitchToCredits": true
}
}{
"success": false,
"message": "<string>",
"error": {
"message": "<string>",
"code": "<string>"
}
}{
"success": false,
"message": "<string>",
"error": {
"message": "<string>",
"code": "<string>"
}
}{
"success": false,
"message": "<string>",
"error": {
"message": "<string>",
"code": "<string>"
}
}PATCH
Update simulator usage settings
Update simulator usage settings
Response
Fill in the request and press Send to see the live response.Was this page helpful?
Thanks for your feedback.

