Credentials
Update a broker credential
Replaces the encrypted broker credential payload in WorkOS Vault and touches the credential metadata timestamp. Only organization admins can update credentials. Paper credentials are allowed for admins; live credentials additionally require the Trading Live entitlement. The trading-account id must match the credential’s trading account.
PATCH
/
v1
/
trading-accounts
/
{trading_account_id}
/
credentials
/
{credential_id}
Update a broker credential
curl --request PATCH \
--url https://api.anthid.com/v1/trading-accounts/{trading_account_id}/credentials/{credential_id} \
--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/trading-accounts/{trading_account_id}/credentials/{credential_id}"
payload = { "Lightspeed": {
"account_id": "LS-123456",
"api_key": "lightspeed-api-key",
"environment": "paper"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
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/trading-accounts/{trading_account_id}/credentials/{credential_id}', 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/trading-accounts/{trading_account_id}/credentials/{credential_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
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/trading-accounts/{trading_account_id}/credentials/{credential_id}"
payload := strings.NewReader("{\n \"Lightspeed\": {\n \"account_id\": \"LS-123456\",\n \"api_key\": \"lightspeed-api-key\",\n \"environment\": \"paper\"\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.anthid.com/v1/trading-accounts/{trading_account_id}/credentials/{credential_id}")
.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/trading-accounts/{trading_account_id}/credentials/{credential_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.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{
"EncryptionError": "<string>"
}{
"EncryptionError": "<string>"
}{
"EncryptionError": "<string>"
}{
"EncryptionError": "<string>"
}{
"EncryptionError": "<string>"
}{
"EncryptionError": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Trading account id that owns the credential
Broker credential id to update
Body
application/json
Replacement broker-specific credential payload. Lightspeed and Alpaca credentials are currently supported.
Show child attributes
Show child attributes
Response
Credential updated
Previous
Delete a broker credentialDeletes a broker credential and soft-deleted its trading account, then attempts to delete the backing Vault object. Only organization admins can delete credentials. The trading-account id must match the credential's trading account.
Next
⌘I
Update a broker credential
curl --request PATCH \
--url https://api.anthid.com/v1/trading-accounts/{trading_account_id}/credentials/{credential_id} \
--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/trading-accounts/{trading_account_id}/credentials/{credential_id}"
payload = { "Lightspeed": {
"account_id": "LS-123456",
"api_key": "lightspeed-api-key",
"environment": "paper"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
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/trading-accounts/{trading_account_id}/credentials/{credential_id}', 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/trading-accounts/{trading_account_id}/credentials/{credential_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
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/trading-accounts/{trading_account_id}/credentials/{credential_id}"
payload := strings.NewReader("{\n \"Lightspeed\": {\n \"account_id\": \"LS-123456\",\n \"api_key\": \"lightspeed-api-key\",\n \"environment\": \"paper\"\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.anthid.com/v1/trading-accounts/{trading_account_id}/credentials/{credential_id}")
.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/trading-accounts/{trading_account_id}/credentials/{credential_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.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{
"EncryptionError": "<string>"
}{
"EncryptionError": "<string>"
}{
"EncryptionError": "<string>"
}{
"EncryptionError": "<string>"
}{
"EncryptionError": "<string>"
}{
"EncryptionError": "<string>"
}