curl --request GET \
--url https://api.cnaught.com/v1/subaccounts \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.cnaught.com/v1/subaccounts"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.cnaught.com/v1/subaccounts', 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.cnaught.com/v1/subaccounts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.cnaught.com/v1/subaccounts"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.cnaught.com/v1/subaccounts")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cnaught.com/v1/subaccounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "5nubL0NS",
"name": "Marketing Department",
"email": "jane.doe@example.com",
"default_portfolio_id": "mHvNvWbq",
"created_on": "2023-08-01T18:00:00.000000Z"
}
]
}{
"status": 400,
"type": "https://api.cnaught.com/v1/errors/invalid-parameters",
"title": "Invalid value for parameter starting_after was specified",
"detail": "The subaccount id specified by starting_after does not exist."
}{
"title": "Authorization has been denied for this request",
"status": 401
}Get List of Subaccounts
Gets a list of subaccounts in reverse chronological order up to the provided limit number of subaccounts per call.
Pagination is supported by passing the first subaccount id from a previous call into ending_before to retrieve
the previous page, or the last subaccount id from a previous call into starting_after to retrieve the next page.
curl --request GET \
--url https://api.cnaught.com/v1/subaccounts \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.cnaught.com/v1/subaccounts"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.cnaught.com/v1/subaccounts', 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.cnaught.com/v1/subaccounts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.cnaught.com/v1/subaccounts"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.cnaught.com/v1/subaccounts")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cnaught.com/v1/subaccounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "5nubL0NS",
"name": "Marketing Department",
"email": "jane.doe@example.com",
"default_portfolio_id": "mHvNvWbq",
"created_on": "2023-08-01T18:00:00.000000Z"
}
]
}{
"status": 400,
"type": "https://api.cnaught.com/v1/errors/invalid-parameters",
"title": "Invalid value for parameter starting_after was specified",
"detail": "The subaccount id specified by starting_after does not exist."
}{
"title": "Authorization has been denied for this request",
"status": 401
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Limits the number of subaccounts returned, default is 20, max is 100
1 <= x <= 100If specified, returns subaccounts created before (earlier than) the subaccount with this id, exclusive (subaccount with this id is not included). Only one of starting_after and ending_before can be specified.
If specified, returns subaccounts created after (later than) the order with this id, exclusive (subaccount with this id is not included). Only one of starting_after and ending_before can be specified.
Response
List of Subaccounts
Show child attributes
Show child attributes