curl --request POST \
--url 'https://api.example.com/user/temporary-keys?HAIQU_API_KEY=' \
--header 'Content-Type: application/json' \
--data '
{
"client": "<string>",
"label": "<string>",
"minutes": 30,
"credit_limit": 600
}
'import requests
url = "https://api.example.com/user/temporary-keys?HAIQU_API_KEY="
payload = {
"client": "<string>",
"label": "<string>",
"minutes": 30,
"credit_limit": 600
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({client: '<string>', label: '<string>', minutes: 30, credit_limit: 600})
};
fetch('https://api.example.com/user/temporary-keys?HAIQU_API_KEY=', 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.example.com/user/temporary-keys?HAIQU_API_KEY=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'client' => '<string>',
'label' => '<string>',
'minutes' => 30,
'credit_limit' => 600
]),
CURLOPT_HTTPHEADER => [
"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.example.com/user/temporary-keys?HAIQU_API_KEY="
payload := strings.NewReader("{\n \"client\": \"<string>\",\n \"label\": \"<string>\",\n \"minutes\": 30,\n \"credit_limit\": 600\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://api.example.com/user/temporary-keys?HAIQU_API_KEY=")
.header("Content-Type", "application/json")
.body("{\n \"client\": \"<string>\",\n \"label\": \"<string>\",\n \"minutes\": 30,\n \"credit_limit\": 600\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/user/temporary-keys?HAIQU_API_KEY=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"client\": \"<string>\",\n \"label\": \"<string>\",\n \"minutes\": 30,\n \"credit_limit\": 600\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"prefix": "<string>",
"client": "<string>",
"label": "<string>",
"credit_limit": 123,
"created_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z",
"key": "<string>",
"credits_spent": 0
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Create Temporary Api Key
Create a temporary API key
A temporary key acts for the caller, and the caller’s credits pay for its jobs, but within limits. It expires after
minutes and is never extended. It may use up to credit_limit credits, runs jobs on simulators only (a dry run may
name any device), and can’t delete anything, restart jobs, choose the handle, manage temporary keys, or use the MCP
server. Values above the maximums are lowered to them. Every request creates a new key; the key is in the response this
one time only.
Only the main API key may create temporary keys. The endpoint answers 402 when the caller has no credits, or their
temporary keys have used the day’s credits, and 429 when the caller has the most active keys allowed or has created
the most keys allowed in 24 hours.
Args: user (User): User authenticated with their main API key. data (TemporaryApiKeySubmitModel): What the key is for, and its lifetime and credit limit. db: Database.
Returns: NewTemporaryApiKeyModel: The new key, with the key itself.
curl --request POST \
--url 'https://api.example.com/user/temporary-keys?HAIQU_API_KEY=' \
--header 'Content-Type: application/json' \
--data '
{
"client": "<string>",
"label": "<string>",
"minutes": 30,
"credit_limit": 600
}
'import requests
url = "https://api.example.com/user/temporary-keys?HAIQU_API_KEY="
payload = {
"client": "<string>",
"label": "<string>",
"minutes": 30,
"credit_limit": 600
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({client: '<string>', label: '<string>', minutes: 30, credit_limit: 600})
};
fetch('https://api.example.com/user/temporary-keys?HAIQU_API_KEY=', 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.example.com/user/temporary-keys?HAIQU_API_KEY=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'client' => '<string>',
'label' => '<string>',
'minutes' => 30,
'credit_limit' => 600
]),
CURLOPT_HTTPHEADER => [
"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.example.com/user/temporary-keys?HAIQU_API_KEY="
payload := strings.NewReader("{\n \"client\": \"<string>\",\n \"label\": \"<string>\",\n \"minutes\": 30,\n \"credit_limit\": 600\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://api.example.com/user/temporary-keys?HAIQU_API_KEY=")
.header("Content-Type", "application/json")
.body("{\n \"client\": \"<string>\",\n \"label\": \"<string>\",\n \"minutes\": 30,\n \"credit_limit\": 600\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/user/temporary-keys?HAIQU_API_KEY=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"client\": \"<string>\",\n \"label\": \"<string>\",\n \"minutes\": 30,\n \"credit_limit\": 600\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"prefix": "<string>",
"client": "<string>",
"label": "<string>",
"credit_limit": 123,
"created_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z",
"key": "<string>",
"credits_spent": 0
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Body
A request for a temporary API key. Values above the maximums are lowered to them.
Response
Successful Response
A new temporary API key, with the key itself, which is shown this one time only.