APIs & Integrations

Request Examples

Copy-ready cURL and SDK snippets for the most common Optra API operations.

All examples below assume your API key is stored in the environment variable OPTRA_API_KEY.

List Devices

curl -X GET https://api.optraiot.lexmark.com/v1/devices \
  -H "Authorization: Bearer $OPTRA_API_KEY" \
  -H "Accept: application/json"

Get a Single Device

curl -X GET https://api.optraiot.lexmark.com/v1/devices/dev_abc123 \
  -H "Authorization: Bearer $OPTRA_API_KEY"

Register a Device

curl -X POST https://api.optraiot.lexmark.com/v1/devices \
  -H "Authorization: Bearer $OPTRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Printer Floor-3",
    "serial": "SN-00123",
    "model": "CX730de",
    "tags": ["floor-3", "building-a"]
  }'

Query Telemetry

curl -X GET "https://api.optraiot.lexmark.com/v1/devices/dev_abc123/telemetry?from=2026-01-01T00:00:00Z&to=2026-01-02T00:00:00Z&limit=100" \
  -H "Authorization: Bearer $OPTRA_API_KEY"

Create a Rule

curl -X POST https://api.optraiot.lexmark.com/v1/rules \
  -H "Authorization: Bearer $OPTRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "High temperature alert",
    "condition": "telemetry.temperature > 80",
    "action": {
      "type": "webhook",
      "url": "https://your-system.example.com/alerts"
    }
  }'