curl --request GET \
--url https://api.cnaught.com/v1/orders \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.cnaught.com/v1/orders"
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/orders', 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/orders",
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/orders"
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/orders")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cnaught.com/v1/orders")
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": "Gre28Fc35bt3",
"order_number": "47726-53238-46633-33562-7433",
"created_on": "2022-08-01T18:00:00.000000Z",
"metadata": "Customer metadata",
"description": "On behalf of Jane Smith",
"amount_kg": 10.5,
"state": "fulfilled",
"price_usd_cents": 2350,
"certificate_public_url": "https://registry.cnaught.com/orders/Gre28Fc35bt3",
"certificate_download_public_url": "https://registry.cnaught.com/api/certificates/Gre28Fc35bt3/pdf"
}
]
}{
"status": 400,
"type": "https://api.cnaught.com/v1/errors/invalid-parameters",
"title": "Invalid value for parameter starting_after was specified",
"detail": "The order id specified by starting_after does not exist."
}{
"title": "Authorization has been denied for this request",
"status": 401
}Get List of Orders
Gets a list of orders in reverse chronological order up to the provided limit number of orders per call.
Pagination is supported by passing the first order id from a previous call into ending_before to retrieve the
previous page, or the last order id from a previous call into starting_after to retrieve the next page.
curl --request GET \
--url https://api.cnaught.com/v1/orders \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.cnaught.com/v1/orders"
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/orders', 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/orders",
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/orders"
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/orders")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cnaught.com/v1/orders")
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": "Gre28Fc35bt3",
"order_number": "47726-53238-46633-33562-7433",
"created_on": "2022-08-01T18:00:00.000000Z",
"metadata": "Customer metadata",
"description": "On behalf of Jane Smith",
"amount_kg": 10.5,
"state": "fulfilled",
"price_usd_cents": 2350,
"certificate_public_url": "https://registry.cnaught.com/orders/Gre28Fc35bt3",
"certificate_download_public_url": "https://registry.cnaught.com/api/certificates/Gre28Fc35bt3/pdf"
}
]
}{
"status": 400,
"type": "https://api.cnaught.com/v1/errors/invalid-parameters",
"title": "Invalid value for parameter starting_after was specified",
"detail": "The order 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.
Headers
If present, only returns orders belonging to the subaccount with given id.
Query Parameters
Limits the number of orders returned, default is 20, max is 100
1 <= x <= 100If specified, returns orders submitted before (earlier than) the order with this id, exclusive (order with this id is not included). Only one of starting_after and ending_before can be specified.
If specified, returns orders submitted after (later than) the order with this id, exclusive (order with this id is not included). Only one of starting_after and ending_before can be specified.
Response
List of orders
Show child attributes
Show child attributes