Skip to content

Scan and selection API examples

This guide shows how to request a device scan, read RFID results, and create or manage a pick-to-light selection through the SmartTrackerCloud API. The examples use an SC Board; use the serial number of a compatible connected device in your installation.

Base URL:

https://api.diamondtracker.org

Replace this sample URL with the backend URL supplied for your installation. The Node.js examples use built-in fetch and top-level await in Node.js 20+ ES modules (.mjs). The Python examples use requests (pip install requests).

Authenticate

Generate an API key from SmartTrackerCloud and send it on every API request with the x-api-key header. For key creation, expiration, and revocation details, see the API basics.

curl "https://api.diamondtracker.org/v3/users/me" \
  -H "x-api-key: YOUR_API_KEY"
import requests

response = requests.get(
    "https://api.diamondtracker.org/v3/users/me",
    headers={"x-api-key": "YOUR_API_KEY"},
    timeout=30,
)
response.raise_for_status()
print(response.json())
const response = await fetch("https://api.diamondtracker.org/v3/users/me", {
  headers: { "x-api-key": "YOUR_API_KEY" },
});

if (!response.ok) {
  throw new Error(`API request failed: ${response.status}`);
}

console.log(await response.json());

Note

Keep API keys private. Do not expose them in browser code, public repositories, mobile applications, or customer-visible logs.

RFID scan workflow

This example uses an SC Board. Other compatible RFID devices use the same API flow. A scan integration has two steps:

  1. Request a scan from a connected RFID device.
  2. Retrieve the scan result from RFID tracking history by using the returned historyId as the filters[parent_id] value.

1. Request a scan

Call POST /v3/devices/action/{serialNumber} with the device serial number and the Scan action.

curl -X POST "https://api.diamondtracker.org/v3/devices/action/SBRv3-0110" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"action":"Scan"}'
import requests

response = requests.post(
    "https://api.diamondtracker.org/v3/devices/action/SBRv3-0110",
    headers={
        "x-api-key": "YOUR_API_KEY",
        "Content-Type": "application/json",
    },
    json={"action": "Scan"},
    timeout=30,
)
response.raise_for_status()
action = response.json()
print(action["historyId"])
const response = await fetch(
  "https://api.diamondtracker.org/v3/devices/action/SBRv3-0110",
  {
    method: "POST",
    headers: {
      "x-api-key": "YOUR_API_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ action: "Scan" }),
  }
);

if (!response.ok) {
  throw new Error(`Scan request failed: ${response.status}`);
}

const action = await response.json();
console.log(action.historyId);

Successful responses include the tracking identifier to use in the next step:

{
  "message": "Action requested",
  "historyId": "69fb43a9e11e30bb9308e23c"
}

The device must be online and connected to the server when the request is sent. If it is not connected, the API returns a 400 response.

2. Retrieve scan results

After requesting the scan, call GET /v3/history/rfid-tracking with the parent_id filter set to the historyId returned by the action call.

curl --globoff "https://api.diamondtracker.org/v3/history/rfid-tracking?filters[parent_id]=69fb43a9e11e30bb9308e23c&size=10" \
  -H "x-api-key: YOUR_API_KEY"
import requests

history_id = "69fb43a9e11e30bb9308e23c"
response = requests.get(
    "https://api.diamondtracker.org/v3/history/rfid-tracking",
    headers={"x-api-key": "YOUR_API_KEY"},
    params={"filters[parent_id]": history_id, "size": 10},
    timeout=30,
)
response.raise_for_status()
print(response.json())
const historyId = "69fb43a9e11e30bb9308e23c";
const url = new URL("https://api.diamondtracker.org/v3/history/rfid-tracking");
url.searchParams.set("filters[parent_id]", historyId);
url.searchParams.set("size", "10");

const response = await fetch(url, {
  headers: { "x-api-key": "YOUR_API_KEY" },
});

if (!response.ok) {
  throw new Error(`History request failed: ${response.status}`);
}

console.log(await response.json());

The response is an array of RFID tracking events. The most important fields are:

Field Description
id Unique identifier of the resulting RFID tracking event.
parent_id The historyId from the scan request.
serial_number Serial number of the RFID device.
created Timestamp of the event.
tagsAdded RFIDs detected as added during the scan.
tagsRemoved RFIDs detected as removed during the scan.
tagsPresent RFIDs present after the scan, when available.

Example response:

[
  {
    "id": "69fb43b7e11e30bb9308e23d",
    "parent_id": "69fb43a9e11e30bb9308e23c",
    "serial_number": "SBRv3-0110",
    "created": "2026-05-06T10:15:30.000Z",
    "tagsAdded": ["3025467532"],
    "tagsRemoved": [],
    "tagsPresent": ["3025467532"]
  }
]

Tip

Scan execution is asynchronous. If the first history request returns an empty array, retry the same request after a short delay.

Pick-to-light workflow

This example uses an SC Board. Other compatible RFID devices use the same API flow. Pick-to-light starts from the scan result: use the tagsPresent values returned by GET /v3/history/rfid-tracking as the process tags, and set deviceSerialNumbers to the SC Board serial number that should light the tags. The deviceSerialNumbers field is an array, even when only one device is used.

1. Create the process

Create a TAKE process with POST /v3/processes.

curl -X POST "https://api.diamondtracker.org/v3/processes" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Pick-to-light from API quickstart",
    "type": "TAKE",
    "tags": ["3025467532"],
    "deviceSerialNumbers": ["SBRv3-0110"]
  }'
import requests

tags_present = ["3025467532"]
response = requests.post(
    "https://api.diamondtracker.org/v3/processes",
    headers={
        "x-api-key": "YOUR_API_KEY",
        "Content-Type": "application/json",
    },
    json={
        "description": "Pick-to-light from API quickstart",
        "type": "TAKE",
        "tags": tags_present,
        "deviceSerialNumbers": ["SBRv3-0110"],
    },
    timeout=30,
)
response.raise_for_status()
process = response.json()
print(process["id"])
const tagsPresent = ["3025467532"];
const response = await fetch("https://api.diamondtracker.org/v3/processes", {
  method: "POST",
  headers: {
    "x-api-key": "YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    description: "Pick-to-light from API quickstart",
    type: "TAKE",
    tags: tagsPresent,
    deviceSerialNumbers: ["SBRv3-0110"],
  }),
});

if (!response.ok) {
  throw new Error(`Process create request failed: ${response.status}`);
}

const createdProcess = await response.json();
console.log(createdProcess.id);

Successful responses include the process id:

{
  "message": "Item created",
  "id": "69f4b1ee7dcc388e262c47a9"
}

The device must be connected, and each RFID in tags must exist in the inventory.

2. Inspect and update the process

Use the id returned by the create request to find the process. A PUT request can change its description or replace its tags array while it is active.

curl "https://api.diamondtracker.org/v3/processes?id=69f4b1ee7dcc388e262c47a9" \
  -H "x-api-key: YOUR_API_KEY"

curl -X PUT "https://api.diamondtracker.org/v3/processes/69f4b1ee7dcc388e262c47a9" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"description":"Updated pick request"}'
import requests

process_id = "69f4b1ee7dcc388e262c47a9"
headers = {"x-api-key": "YOUR_API_KEY"}
response = requests.get(
    "https://api.diamondtracker.org/v3/processes",
    headers=headers,
    params={"id": process_id},
    timeout=30,
)
response.raise_for_status()
print(response.json())

response = requests.put(
    f"https://api.diamondtracker.org/v3/processes/{process_id}",
    headers=headers,
    json={"description": "Updated pick request"},
    timeout=30,
)
response.raise_for_status()
const processId = "69f4b1ee7dcc388e262c47a9";
const url = new URL("https://api.diamondtracker.org/v3/processes");
url.searchParams.set("id", processId);

const current = await fetch(url, {
  headers: { "x-api-key": "YOUR_API_KEY" },
});
if (!current.ok) throw new Error(`Process lookup failed: ${current.status}`);
console.log(await current.json());

const updated = await fetch(`https://api.diamondtracker.org/v3/processes/${processId}`, {
  method: "PUT",
  headers: { "x-api-key": "YOUR_API_KEY", "Content-Type": "application/json" },
  body: JSON.stringify({ description: "Updated pick request" }),
});
if (!updated.ok) throw new Error(`Process update failed: ${updated.status}`);

3. Cancel the process

Stop the pick-to-light process by calling DELETE /v3/processes/{id} with the id returned by the create call.

curl -X DELETE "https://api.diamondtracker.org/v3/processes/69f4b1ee7dcc388e262c47a9" \
  -H "x-api-key: YOUR_API_KEY"
import requests

process_id = "69f4b1ee7dcc388e262c47a9"
response = requests.delete(
    f"https://api.diamondtracker.org/v3/processes/{process_id}",
    headers={"x-api-key": "YOUR_API_KEY"},
    timeout=30,
)
response.raise_for_status()
const processId = "69f4b1ee7dcc388e262c47a9";
const response = await fetch(`https://api.diamondtracker.org/v3/processes/${processId}`, {
  method: "DELETE",
  headers: { "x-api-key": "YOUR_API_KEY" },
});

if (!response.ok) {
  throw new Error(`Process cancel request failed: ${response.status}`);
}

More API Details

For base URL, authentication, pagination, and inventory customization details, see the API basics. The complete endpoint definitions are in the full OpenAPI reference.