Create a trading account
Creates a trading account and securely stores its broker credentials. The caller must be an organization admin. A credential naming a live environment requires the live-trading entitlement, for every broker alike. Organization broker-connection limits apply.
curl --request POST \
--url https://api.anthid.com/v1/accounts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"Lightspeed": {
"account_id": "LS-123456",
"api_key": "lightspeed-api-key",
"environment": "paper"
}
}
'import requests
url = "https://api.anthid.com/v1/accounts"
payload = { "Lightspeed": {
"account_id": "LS-123456",
"api_key": "lightspeed-api-key",
"environment": "paper"
} }
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({
Lightspeed: {account_id: 'LS-123456', api_key: 'lightspeed-api-key', environment: 'paper'}
})
};
fetch('https://api.anthid.com/v1/accounts', 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.anthid.com/v1/accounts",
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([
'Lightspeed' => [
'account_id' => 'LS-123456',
'api_key' => 'lightspeed-api-key',
'environment' => 'paper'
]
]),
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.anthid.com/v1/accounts"
payload := strings.NewReader("{\n \"Lightspeed\": {\n \"account_id\": \"LS-123456\",\n \"api_key\": \"lightspeed-api-key\",\n \"environment\": \"paper\"\n }\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.anthid.com/v1/accounts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"Lightspeed\": {\n \"account_id\": \"LS-123456\",\n \"api_key\": \"lightspeed-api-key\",\n \"environment\": \"paper\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.anthid.com/v1/accounts")
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 \"Lightspeed\": {\n \"account_id\": \"LS-123456\",\n \"api_key\": \"lightspeed-api-key\",\n \"environment\": \"paper\"\n }\n}"
response = http.request(request)
puts response.read_body{
"broker_credential_id": "550e8400-e29b-41d4-a716-446655440111",
"trading_account_id": "550e8400-e29b-41d4-a716-446655440000"
}"<string>""<string>""<string>""<string>""<string>""<string>"Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Credentials for a supported broker. All values shown are placeholders.
The brokers a credential can name.
ibkr is a module above but deliberately not a variant here. The IBKR
integration was dropped on commercial grounds, not technical ones, so the
adapter still compiles and its tests still pass while the code is unwound.
Adding the variant back is what would make an IBKR credential storable
again, and nothing downstream can route one: clients_manager has no
builder for it. Leave it off.
Show child attributes
Show child attributes
curl --request POST \
--url https://api.anthid.com/v1/accounts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"Lightspeed": {
"account_id": "LS-123456",
"api_key": "lightspeed-api-key",
"environment": "paper"
}
}
'import requests
url = "https://api.anthid.com/v1/accounts"
payload = { "Lightspeed": {
"account_id": "LS-123456",
"api_key": "lightspeed-api-key",
"environment": "paper"
} }
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({
Lightspeed: {account_id: 'LS-123456', api_key: 'lightspeed-api-key', environment: 'paper'}
})
};
fetch('https://api.anthid.com/v1/accounts', 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.anthid.com/v1/accounts",
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([
'Lightspeed' => [
'account_id' => 'LS-123456',
'api_key' => 'lightspeed-api-key',
'environment' => 'paper'
]
]),
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.anthid.com/v1/accounts"
payload := strings.NewReader("{\n \"Lightspeed\": {\n \"account_id\": \"LS-123456\",\n \"api_key\": \"lightspeed-api-key\",\n \"environment\": \"paper\"\n }\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.anthid.com/v1/accounts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"Lightspeed\": {\n \"account_id\": \"LS-123456\",\n \"api_key\": \"lightspeed-api-key\",\n \"environment\": \"paper\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.anthid.com/v1/accounts")
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 \"Lightspeed\": {\n \"account_id\": \"LS-123456\",\n \"api_key\": \"lightspeed-api-key\",\n \"environment\": \"paper\"\n }\n}"
response = http.request(request)
puts response.read_body{
"broker_credential_id": "550e8400-e29b-41d4-a716-446655440111",
"trading_account_id": "550e8400-e29b-41d4-a716-446655440000"
}"<string>""<string>""<string>""<string>""<string>""<string>"