Skip to main content

Device Certificate Authorization

Devices, services, and headless workloads cannot complete a two-factor challenge. Device certificate authorization gives them a first-class path to an XQ access token: the device presents an X.509 certificate that was issued to it, and XQ returns an access token bound to that device.

There is no email, no PIN, and no human in the loop — the certificate is the credential.

When to use this​

MethodCredential2FATypical caller
/authorizeEmail address or phone numberYes — PIN or validation linkA person
/authorize/certificate/{cert_id}X.509 certificate + private keyNo — the certificate is the second factorAn edge device, sensor, gateway, or service

Use device certificate authorization when:

  • The workload runs unattended and cannot receive or enter a PIN.
  • You want each device to hold a distinct, individually revocable credential.
  • You need the device to appear as a named member of your team in the XQ Dashboard.

The resulting token is a full access token. The device can store key packets, retrieve keys, grant and revoke recipients, and manage user groups exactly like an authorized user.

What you need before you start​

Certificate issuance and API key provisioning happen in the management portal and are outside the scope of this section. By the time you make your first call, your device should already hold:

ItemDescription
General API keyCreated in the XQ Dashboard
Dashboard API keyOnly needed for the optional announce and user group calls
Certificate IDThe integer id of the certificate, used in the request path
CertificateThe client certificate, PEM text
Private keyThe RSA private key matching the certificate
Transport keyThe transport secret issued alongside the certificate

Certificates are long-lived. Provision them once per device and re-use them for every authorization.

How the exchange is protected​

The certificate exchange is wrapped in two layers of encryption, so neither secret alone is sufficient to obtain a token.

  1. Transport layer. The request payload — and the response — are encrypted with AES-256-GCM under a key derived from the transport key. A device without the transport key cannot form a valid request.
  2. Device layer. The access token inside the response is additionally encrypted with the certificate's public key. Only the holder of the matching private key can read it.

An attacker who obtains the transport key still cannot recover a token, because the token is sealed to the device's private key.

Replay protection

The encrypted payload carries a timestamp taken from XQ's own clock, not the device's. Fetch it immediately before each authorization — a stale or locally generated timestamp is rejected.

Which API key goes with which call​

The api-key header is determined by the subdomain you are calling, not by the operation. Getting this wrong is the most common source of unexpected 401 responses.

Subdomainapi-key headerauthorization header
subscriptionGeneral API keyBearer device token — except the two authorization calls
validationGeneral API keyBearer device token
quantumGeneral API keyBearer device token
dashboardDashboard API keyBearer device token

The device token is valid on all four subdomains. One token, two API keys — switch the api-key header per call and keep the same bearer.

Token lifecycle​

There is no refresh endpoint. When the device token expires, repeat the two authorization calls with the same certificate. Do not re-issue a certificate in order to refresh a token — certificates are expected to outlive many tokens.

Continue to the tutorial for the call-by-call walkthrough.