cURL
curl --request POST \
--url https://app.spotdx.com/api/v2/tokens/patient_registration/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"patient_id": "<string>",
"kit_type": "health_kit_1"
}
'import requests
url = "https://app.spotdx.com/api/v2/tokens/patient_registration/"
payload = {
"patient_id": "<string>",
"kit_type": "health_kit_1"
}
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({patient_id: '<string>', kit_type: 'health_kit_1'})
};
fetch('https://app.spotdx.com/api/v2/tokens/patient_registration/', 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/tokens/patient_registration/",
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([
'patient_id' => '<string>',
'kit_type' => 'health_kit_1'
]),
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/tokens/patient_registration/"
payload := strings.NewReader("{\n \"patient_id\": \"<string>\",\n \"kit_type\": \"health_kit_1\"\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/tokens/patient_registration/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"patient_id\": \"<string>\",\n \"kit_type\": \"health_kit_1\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.spotdx.com/api/v2/tokens/patient_registration/")
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 \"patient_id\": \"<string>\",\n \"kit_type\": \"health_kit_1\"\n}"
response = http.request(request)
puts response.read_body{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJtYXgiOjEsInN1YiI6InBhdGllbnRfcmVnaXN0cmF0aW9uIiwibW9kIjoibiIsImp0aSI6MzYsImV4cCI6MTY2MTg4NjgzOCwiaWF0IjoxNjYxODg2MjM4fQ.byD8FThgvNGm3csx_QzrpZQUrsfFW3rmBU3mLQQlL2I"
}
API Reference - Registration
Generate registration token
Generate a one-time-use registration token for a patient with a lifetime of 10 minutes.
POST
/
api
/
v2
/
tokens
/
patient_registration
/
cURL
curl --request POST \
--url https://app.spotdx.com/api/v2/tokens/patient_registration/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"patient_id": "<string>",
"kit_type": "health_kit_1"
}
'import requests
url = "https://app.spotdx.com/api/v2/tokens/patient_registration/"
payload = {
"patient_id": "<string>",
"kit_type": "health_kit_1"
}
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({patient_id: '<string>', kit_type: 'health_kit_1'})
};
fetch('https://app.spotdx.com/api/v2/tokens/patient_registration/', 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/tokens/patient_registration/",
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([
'patient_id' => '<string>',
'kit_type' => 'health_kit_1'
]),
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/tokens/patient_registration/"
payload := strings.NewReader("{\n \"patient_id\": \"<string>\",\n \"kit_type\": \"health_kit_1\"\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/tokens/patient_registration/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"patient_id\": \"<string>\",\n \"kit_type\": \"health_kit_1\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.spotdx.com/api/v2/tokens/patient_registration/")
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 \"patient_id\": \"<string>\",\n \"kit_type\": \"health_kit_1\"\n}"
response = http.request(request)
puts response.read_body{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJtYXgiOjEsInN1YiI6InBhdGllbnRfcmVnaXN0cmF0aW9uIiwibW9kIjoibiIsImp0aSI6MzYsImV4cCI6MTY2MTg4NjgzOCwiaWF0IjoxNjYxODg2MjM4fQ.byD8FThgvNGm3csx_QzrpZQUrsfFW3rmBU3mLQQlL2I"
}
This endpoint is only needed if you want to use your own authentication system to manage kit registration. It’s
not needed in most cases. Speak to us if you want to build your registration flow this way.
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJtYXgiOjEsInN1YiI6InBhdGllbnRfcmVnaXN0cmF0aW9uIiwibW9kIjoibiIsImp0aSI6MzYsImV4cCI6MTY2MTg4NjgzOCwiaWF0IjoxNjYxODg2MjM4fQ.byD8FThgvNGm3csx_QzrpZQUrsfFW3rmBU3mLQQlL2I"
}
Authorizations
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data