Login
curl --request POST \
--url https://relay.bayse.markets/v1/user/login \
--header 'Content-Type: application/json' \
--data '
{
"email": "<string>",
"password": "<string>"
}
'import requests
url = "https://relay.bayse.markets/v1/user/login"
payload = {
"email": "<string>",
"password": "<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({email: '<string>', password: '<string>'})
};
fetch('https://relay.bayse.markets/v1/user/login', 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/login",
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([
'email' => '<string>',
'password' => '<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/login"
payload := strings.NewReader("{\n \"email\": \"<string>\",\n \"password\": \"<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/login")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"<string>\",\n \"password\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://relay.bayse.markets/v1/user/login")
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 \"email\": \"<string>\",\n \"password\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"deviceId": "d_abc123",
"userId": "usr_456def"
}
User
Login
Authenticate with your Bayse account to get a session token
POST
/
v1
/
user
/
login
Login
curl --request POST \
--url https://relay.bayse.markets/v1/user/login \
--header 'Content-Type: application/json' \
--data '
{
"email": "<string>",
"password": "<string>"
}
'import requests
url = "https://relay.bayse.markets/v1/user/login"
payload = {
"email": "<string>",
"password": "<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({email: '<string>', password: '<string>'})
};
fetch('https://relay.bayse.markets/v1/user/login', 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/login",
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([
'email' => '<string>',
'password' => '<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/login"
payload := strings.NewReader("{\n \"email\": \"<string>\",\n \"password\": \"<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/login")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"<string>\",\n \"password\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://relay.bayse.markets/v1/user/login")
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 \"email\": \"<string>\",\n \"password\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"deviceId": "d_abc123",
"userId": "usr_456def"
}
Overview
Log in with your Bayse account credentials to obtain a session token and device ID. These are required to manage API keys (create, list, revoke, rotate). Use this endpoint when you want to manage API keys programmatically. If you prefer a UI, you can also manage 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.This endpoint is rate-limited to 1 request per 2 minutes per email address. See Rate limits for details.
Request body
string
required
Your Bayse account email address.
string
required
Your Bayse account password (max 128 characters).
Example request
curl -X POST https://relay.bayse.markets/v1/user/login \
-H "Content-Type: application/json" \
-d '{
"email": "you@example.com",
"password": "your-password"
}'
const response = await fetch('https://relay.bayse.markets/v1/user/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
email: 'you@example.com',
password: 'your-password',
}),
});
const { token, deviceId } = await response.json();
import requests
resp = requests.post(
'https://relay.bayse.markets/v1/user/login',
json={
'email': 'you@example.com',
'password': 'your-password',
},
)
data = resp.json()
token = data['token']
device_id = data['deviceId']
body := strings.NewReader(`{"email":"you@example.com","password":"your-password"}`)
req, _ := http.NewRequest("POST", "https://relay.bayse.markets/v1/user/login", body)
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
Response
string
Session token. Pass this as the
x-auth-token header when managing API keys.string
Device identifier. Pass this as the
x-device-id header when managing API keys.string
Your Bayse user ID.
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"deviceId": "d_abc123",
"userId": "usr_456def"
}
Errors
| Status | Description |
|---|---|
| 400 | Invalid request body (missing or malformed email/password). |
| 401 | Invalid credentials. |
| 429 | Rate limited. Retry after the number of seconds in retryAfter. |
429 Too Many Requests
{
"message": "Too many login attempts. Please try again later.",
"retryAfter": 120
}
Next steps
Use thetoken and deviceId from the response to create an API key programmatically:
curl -X POST https://relay.bayse.markets/v1/user/me/api-keys \
-H "x-auth-token: YOUR_TOKEN" \
-H "x-device-id: YOUR_DEVICE_ID" \
-H "Content-Type: application/json" \
-d '{"name": "My API Key"}'
⌘I