cURL
curl --request POST \
--url https://app.spotdx.com/api/v2/orders/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"kit_types": [
"health_kit_1"
],
"recipient": {
"first_name": "Alice",
"last_name": "Smith",
"email": "alice123@gmail.com",
"phone": "1234567890",
"address": {
"street1": "123 Main St",
"city": "San Francisco",
"state": "CA",
"country": "US",
"zip": "94105",
"street2": "Apt 1"
}
},
"metadata": {
"some_key": "some_value"
}
}
'import requests
url = "https://app.spotdx.com/api/v2/orders/"
payload = {
"kit_types": ["health_kit_1"],
"recipient": {
"first_name": "Alice",
"last_name": "Smith",
"email": "alice123@gmail.com",
"phone": "1234567890",
"address": {
"street1": "123 Main St",
"city": "San Francisco",
"state": "CA",
"country": "US",
"zip": "94105",
"street2": "Apt 1"
}
},
"metadata": { "some_key": "some_value" }
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
kit_types: ['health_kit_1'],
recipient: {
first_name: 'Alice',
last_name: 'Smith',
email: 'alice123@gmail.com',
phone: '1234567890',
address: {
street1: '123 Main St',
city: 'San Francisco',
state: 'CA',
country: 'US',
zip: '94105',
street2: 'Apt 1'
}
},
metadata: {some_key: 'some_value'}
})
};
fetch('https://app.spotdx.com/api/v2/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://app.spotdx.com/api/v2/orders/",
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([
'kit_types' => [
'health_kit_1'
],
'recipient' => [
'first_name' => 'Alice',
'last_name' => 'Smith',
'email' => 'alice123@gmail.com',
'phone' => '1234567890',
'address' => [
'street1' => '123 Main St',
'city' => 'San Francisco',
'state' => 'CA',
'country' => 'US',
'zip' => '94105',
'street2' => 'Apt 1'
]
],
'metadata' => [
'some_key' => 'some_value'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://app.spotdx.com/api/v2/orders/"
payload := strings.NewReader("{\n \"kit_types\": [\n \"health_kit_1\"\n ],\n \"recipient\": {\n \"first_name\": \"Alice\",\n \"last_name\": \"Smith\",\n \"email\": \"alice123@gmail.com\",\n \"phone\": \"1234567890\",\n \"address\": {\n \"street1\": \"123 Main St\",\n \"city\": \"San Francisco\",\n \"state\": \"CA\",\n \"country\": \"US\",\n \"zip\": \"94105\",\n \"street2\": \"Apt 1\"\n }\n },\n \"metadata\": {\n \"some_key\": \"some_value\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://app.spotdx.com/api/v2/orders/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"kit_types\": [\n \"health_kit_1\"\n ],\n \"recipient\": {\n \"first_name\": \"Alice\",\n \"last_name\": \"Smith\",\n \"email\": \"alice123@gmail.com\",\n \"phone\": \"1234567890\",\n \"address\": {\n \"street1\": \"123 Main St\",\n \"city\": \"San Francisco\",\n \"state\": \"CA\",\n \"country\": \"US\",\n \"zip\": \"94105\",\n \"street2\": \"Apt 1\"\n }\n },\n \"metadata\": {\n \"some_key\": \"some_value\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.spotdx.com/api/v2/orders/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"kit_types\": [\n \"health_kit_1\"\n ],\n \"recipient\": {\n \"first_name\": \"Alice\",\n \"last_name\": \"Smith\",\n \"email\": \"alice123@gmail.com\",\n \"phone\": \"1234567890\",\n \"address\": {\n \"street1\": \"123 Main St\",\n \"city\": \"San Francisco\",\n \"state\": \"CA\",\n \"country\": \"US\",\n \"zip\": \"94105\",\n \"street2\": \"Apt 1\"\n }\n },\n \"metadata\": {\n \"some_key\": \"some_value\"\n }\n}"
response = http.request(request)
puts response.read_body{
"order_id": "O1234567",
"status": "pending",
"recipient": {
"first_name": "Alice",
"last_name": "Smith",
"email": "alice123@gmail.com",
"phone": "1234567890",
"address": {
"street1": "123 Main St",
"street2": "Apt 1",
"city": "San Francisco",
"state": "CA",
"country": "US",
"zip": "94105"
}
},
"kit_types": ["health_kit_1"],
"kits": [],
"created": "2023-01-01T04:30:11.222Z",
"updated": "2023-01-01T04:30:11.222Z",
"metadata": {
"some_key": "some_value"
}
}
API Reference - Orders
Create order
Create an order for delivering kits to a client, which will be created with a status of ‘pending’.The order will be created with the user making the request as the ‘placed_by’ user.
POST
/
api
/
v2
/
orders
/
cURL
curl --request POST \
--url https://app.spotdx.com/api/v2/orders/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"kit_types": [
"health_kit_1"
],
"recipient": {
"first_name": "Alice",
"last_name": "Smith",
"email": "alice123@gmail.com",
"phone": "1234567890",
"address": {
"street1": "123 Main St",
"city": "San Francisco",
"state": "CA",
"country": "US",
"zip": "94105",
"street2": "Apt 1"
}
},
"metadata": {
"some_key": "some_value"
}
}
'import requests
url = "https://app.spotdx.com/api/v2/orders/"
payload = {
"kit_types": ["health_kit_1"],
"recipient": {
"first_name": "Alice",
"last_name": "Smith",
"email": "alice123@gmail.com",
"phone": "1234567890",
"address": {
"street1": "123 Main St",
"city": "San Francisco",
"state": "CA",
"country": "US",
"zip": "94105",
"street2": "Apt 1"
}
},
"metadata": { "some_key": "some_value" }
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
kit_types: ['health_kit_1'],
recipient: {
first_name: 'Alice',
last_name: 'Smith',
email: 'alice123@gmail.com',
phone: '1234567890',
address: {
street1: '123 Main St',
city: 'San Francisco',
state: 'CA',
country: 'US',
zip: '94105',
street2: 'Apt 1'
}
},
metadata: {some_key: 'some_value'}
})
};
fetch('https://app.spotdx.com/api/v2/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://app.spotdx.com/api/v2/orders/",
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([
'kit_types' => [
'health_kit_1'
],
'recipient' => [
'first_name' => 'Alice',
'last_name' => 'Smith',
'email' => 'alice123@gmail.com',
'phone' => '1234567890',
'address' => [
'street1' => '123 Main St',
'city' => 'San Francisco',
'state' => 'CA',
'country' => 'US',
'zip' => '94105',
'street2' => 'Apt 1'
]
],
'metadata' => [
'some_key' => 'some_value'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://app.spotdx.com/api/v2/orders/"
payload := strings.NewReader("{\n \"kit_types\": [\n \"health_kit_1\"\n ],\n \"recipient\": {\n \"first_name\": \"Alice\",\n \"last_name\": \"Smith\",\n \"email\": \"alice123@gmail.com\",\n \"phone\": \"1234567890\",\n \"address\": {\n \"street1\": \"123 Main St\",\n \"city\": \"San Francisco\",\n \"state\": \"CA\",\n \"country\": \"US\",\n \"zip\": \"94105\",\n \"street2\": \"Apt 1\"\n }\n },\n \"metadata\": {\n \"some_key\": \"some_value\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://app.spotdx.com/api/v2/orders/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"kit_types\": [\n \"health_kit_1\"\n ],\n \"recipient\": {\n \"first_name\": \"Alice\",\n \"last_name\": \"Smith\",\n \"email\": \"alice123@gmail.com\",\n \"phone\": \"1234567890\",\n \"address\": {\n \"street1\": \"123 Main St\",\n \"city\": \"San Francisco\",\n \"state\": \"CA\",\n \"country\": \"US\",\n \"zip\": \"94105\",\n \"street2\": \"Apt 1\"\n }\n },\n \"metadata\": {\n \"some_key\": \"some_value\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.spotdx.com/api/v2/orders/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"kit_types\": [\n \"health_kit_1\"\n ],\n \"recipient\": {\n \"first_name\": \"Alice\",\n \"last_name\": \"Smith\",\n \"email\": \"alice123@gmail.com\",\n \"phone\": \"1234567890\",\n \"address\": {\n \"street1\": \"123 Main St\",\n \"city\": \"San Francisco\",\n \"state\": \"CA\",\n \"country\": \"US\",\n \"zip\": \"94105\",\n \"street2\": \"Apt 1\"\n }\n },\n \"metadata\": {\n \"some_key\": \"some_value\"\n }\n}"
response = http.request(request)
puts response.read_body{
"order_id": "O1234567",
"status": "pending",
"recipient": {
"first_name": "Alice",
"last_name": "Smith",
"email": "alice123@gmail.com",
"phone": "1234567890",
"address": {
"street1": "123 Main St",
"street2": "Apt 1",
"city": "San Francisco",
"state": "CA",
"country": "US",
"zip": "94105"
}
},
"kit_types": ["health_kit_1"],
"kits": [],
"created": "2023-01-01T04:30:11.222Z",
"updated": "2023-01-01T04:30:11.222Z",
"metadata": {
"some_key": "some_value"
}
}
{
"order_id": "O1234567",
"status": "pending",
"recipient": {
"first_name": "Alice",
"last_name": "Smith",
"email": "alice123@gmail.com",
"phone": "1234567890",
"address": {
"street1": "123 Main St",
"street2": "Apt 1",
"city": "San Francisco",
"state": "CA",
"country": "US",
"zip": "94105"
}
},
"kit_types": ["health_kit_1"],
"kits": [],
"created": "2023-01-01T04:30:11.222Z",
"updated": "2023-01-01T04:30:11.222Z",
"metadata": {
"some_key": "some_value"
}
}
Authorizations
Token-based authentication with required prefix "Token"
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
Response
The unique identifier of the order.
Example:
"O1234567"
Example:
"2023-01-01T04:30:11.222Z"
Available options:
pending, in_progress, completed, canceled Show child attributes
Show child attributes
A list of the kit types that are included in this order.
Example:
["health_kit_1"]
Show child attributes
Show child attributes
Example:
[]
An optional dictionary of key-value pairs stored with the order.
Example:
{ "some_key": "some_value" }
⌘I