Create API Key
curl --request POST \
--url https://api.totalis.trade/v1/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"scopes": [
"<string>"
],
"confirm_withdraw": true
}
'import requests
url = "https://api.totalis.trade/v1/api-keys"
payload = {
"name": "<string>",
"scopes": ["<string>"],
"confirm_withdraw": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', scopes: ['<string>'], confirm_withdraw: true})
};
fetch('https://api.totalis.trade/v1/api-keys', 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.totalis.trade/v1/api-keys",
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([
'name' => '<string>',
'scopes' => [
'<string>'
],
'confirm_withdraw' => true
]),
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.totalis.trade/v1/api-keys"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"confirm_withdraw\": true\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.totalis.trade/v1/api-keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"confirm_withdraw\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.totalis.trade/v1/api-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"confirm_withdraw\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"key": "<string>",
"key_prefix": "<string>",
"name": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Missing or invalid authentication"
}
}API keys
Create API key
Create an API key for your Totalis account. The full secret is returned only in this response, so save it immediately. Needs a Privy session or a key that holds keys:manage.
POST
/
v1
/
api-keys
Create API Key
curl --request POST \
--url https://api.totalis.trade/v1/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"scopes": [
"<string>"
],
"confirm_withdraw": true
}
'import requests
url = "https://api.totalis.trade/v1/api-keys"
payload = {
"name": "<string>",
"scopes": ["<string>"],
"confirm_withdraw": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', scopes: ['<string>'], confirm_withdraw: true})
};
fetch('https://api.totalis.trade/v1/api-keys', 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.totalis.trade/v1/api-keys",
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([
'name' => '<string>',
'scopes' => [
'<string>'
],
'confirm_withdraw' => true
]),
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.totalis.trade/v1/api-keys"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"confirm_withdraw\": true\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.totalis.trade/v1/api-keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"confirm_withdraw\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.totalis.trade/v1/api-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"confirm_withdraw\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"key": "<string>",
"key_prefix": "<string>",
"name": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Missing or invalid authentication"
}
}Every body field is optional:
No key can hold a scope its creator lacks. Keys created here never expire; revoke one to end it.
An account can hold 10 active keys. The eleventh returns
| Field | Meaning |
|---|---|
name | A label for the key. |
preset | read_only, trading or full. With neither preset nor scopes, the key gets trading. |
scopes | An explicit scope list. Overrides preset. |
confirm_withdraw | Must be true for a key that would hold funds:withdraw. |
409 with reason api_key_limit.Authorizations
PrivyJWTApiKey
Privy JWT issued to the web dashboard. Sent as Authorization: Bearer <jwt>. The Privy session signer underpins all wallet-signed actions.
Body
application/json
Optional display name for the key.
A scope bundle. With neither preset nor scopes, the key gets trading.
Available options:
read_only, trading, full An explicit scope list. Overrides preset. A key can never hold a scope its creator lacks.
Required as true when the resulting key would hold funds:withdraw.
Response
API key created (full key visible once)
Returned only on creation; the full key is visible exactly once.
Show child attributes
Show child attributes
Was this page helpful?

