Create API key
curl --request POST \
--url https://relay.bayse.markets/v1/user/me/api-keys \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>"
}
'import requests
url = "https://relay.bayse.markets/v1/user/me/api-keys"
payload = { "name": "<string>" }
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({name: '<string>'})
};
fetch('https://relay.bayse.markets/v1/user/me/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://relay.bayse.markets/v1/user/me/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>'
]),
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://relay.bayse.markets/v1/user/me/api-keys"
payload := strings.NewReader("{\n \"name\": \"<string>\"\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://relay.bayse.markets/v1/user/me/api-keys")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://relay.bayse.markets/v1/user/me/api-keys")
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 \"name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3f7a1b2c-d4e5-6789-abcd-ef0123456789",
"name": "Trading bot",
"publicKey": "pk_live_abcdef123456",
"secretKey": "sk_live_secret789xyz",
"signingInstructions": {
"algorithm": "HMAC-SHA256",
"headers": ["X-Public-Key", "X-Timestamp", "X-Signature"],
"payloadFormat": "{timestamp}.{method}.{path}.{bodyHash}",
"timestampWindowSeconds": 300
},
"createdAt": "2026-02-17T10:30:00Z"
}
User
Create API key
Create a new API key pair for programmatic access
POST
/
v1
/
user
/
me
/
api-keys
Create API key
curl --request POST \
--url https://relay.bayse.markets/v1/user/me/api-keys \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>"
}
'import requests
url = "https://relay.bayse.markets/v1/user/me/api-keys"
payload = { "name": "<string>" }
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({name: '<string>'})
};
fetch('https://relay.bayse.markets/v1/user/me/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://relay.bayse.markets/v1/user/me/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>'
]),
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://relay.bayse.markets/v1/user/me/api-keys"
payload := strings.NewReader("{\n \"name\": \"<string>\"\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://relay.bayse.markets/v1/user/me/api-keys")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://relay.bayse.markets/v1/user/me/api-keys")
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 \"name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3f7a1b2c-d4e5-6789-abcd-ef0123456789",
"name": "Trading bot",
"publicKey": "pk_live_abcdef123456",
"secretKey": "sk_live_secret789xyz",
"signingInstructions": {
"algorithm": "HMAC-SHA256",
"headers": ["X-Public-Key", "X-Timestamp", "X-Signature"],
"payloadFormat": "{timestamp}.{method}.{path}.{bodyHash}",
"timestampWindowSeconds": 300
},
"createdAt": "2026-02-17T10:30:00Z"
}
Authentication
Requiresx-auth-token and x-device-id headers. Obtain these by calling the login endpoint with your Bayse account credentials.
You can also create API keys in the Bayse web app at app.bayse.markets/settings/api-keys, or in the web app, via More > Account Settings > API Keys in the Developer Tool section. Use this endpoint when you want to create keys programmatically.
Request body
A descriptive label for this key (e.g.
"Production", "Trading bot"). Each API key must have a unique name in your account.Example request
curl -X POST https://relay.bayse.markets/v1/user/me/api-keys \
-H "x-auth-token: YOUR_AUTH_TOKEN" \
-H "x-device-id: YOUR_DEVICE_ID" \
-H "Content-Type: application/json" \
-d '{"name": "Trading bot"}'
const response = await fetch('https://relay.bayse.markets/v1/user/me/api-keys', {
method: 'POST',
headers: {
'x-auth-token': 'YOUR_AUTH_TOKEN',
'x-device-id': 'YOUR_DEVICE_ID',
'Content-Type': 'application/json',
},
body: JSON.stringify({ name: 'Trading bot' }),
});
const { publicKey, secretKey } = await response.json();
import requests
resp = requests.post(
'https://relay.bayse.markets/v1/user/me/api-keys',
headers={
'x-auth-token': 'YOUR_AUTH_TOKEN',
'x-device-id': 'YOUR_DEVICE_ID',
},
json={'name': 'Trading bot'},
)
data = resp.json()
body := strings.NewReader(`{"name":"Trading bot"}`)
req, _ := http.NewRequest("POST", "https://relay.bayse.markets/v1/user/me/api-keys", body)
req.Header.Set("x-auth-token", "YOUR_AUTH_TOKEN")
req.Header.Set("x-device-id", "YOUR_DEVICE_ID")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
Response
Unique identifier for this API key.
The name you provided.
Public key (
pk_*) — include this in the X-Public-Key header on all authenticated requests.Secret key (
sk_*) — use this to generate HMAC signatures. Only returned on creation.Instructions for generating valid request signatures.
Show signingInstructions fields
Show signingInstructions fields
ISO 8601 creation timestamp.
{
"id": "3f7a1b2c-d4e5-6789-abcd-ef0123456789",
"name": "Trading bot",
"publicKey": "pk_live_abcdef123456",
"secretKey": "sk_live_secret789xyz",
"signingInstructions": {
"algorithm": "HMAC-SHA256",
"headers": ["X-Public-Key", "X-Timestamp", "X-Signature"],
"payloadFormat": "{timestamp}.{method}.{path}.{bodyHash}",
"timestampWindowSeconds": 300
},
"createdAt": "2026-02-17T10:30:00Z"
}
The
secretKey is only shown once. Store it securely — it cannot be retrieved again. If lost, rotate the key to generate a new one.⌘I