---
title: "Enroll device"
url: https://hexelstudio.com/docs/api/titan-user/person/enroll-device
---

# Enroll device

**POST** `/titan/user/devices`

Enroll a phone: proof is a compact JWS with header exactly {alg: ES256, kid: the key's thumbprint, typ: titan-device-enrollment+jwt}, signed by the key being enrolled, over {aud: the challenge's audience, sub: the caller, challenge, push_provider, push_token, app_id (optional), apns_environment (optional), iat, exp} (the push target equal to this request's: provider and token both empty for none, app_id and apns_environment left out when empty and only with a token, apns_environment only for apns; exp - iat at most 120 s; the signature low-S). At most five active devices (DEVICE_LIMIT); a key already active is DEVICE_EXISTS; an unused challenge of the caller's own is required (CHALLENGE_INVALID). When the caller has a trusted phone (past its 24 hour waiting period), endorsement is required (ENDORSEMENT_REQUIRED): a JWS {alg: ES256, kid: that phone's device_id, typ: titan-device-endorsement+jwt} over {aud, sub, challenge, thumbprint (of the new key), iat, exp}; without one, a step-up. The new phone signs only its push updates until trusted_at. A step-up is a user token whose auth_time is within the deployment session profile's device_step_up_max_age_seconds (default 300) and whose amr, when present, names a second factor; without one, 401 STEP_UP_REQUIRED with WWW-Authenticate: Bearer error="insufficient_user_authentication". Key attestation: where the deployment requires one (its challenge response says attestation_required), attestation is required (ATTESTATION_REQUIRED) and must verify (ATTESTATION_INVALID) against Apple's or Google's published roots for one of the deployment's apps: android-key (platform android), the attested key's certificate chain, leaf first, each DER in base64url without padding; the leaf's key must be public_key, generated in a TEE or StrongBox on a device with a locked bootloader and a verified boot, no certificate on Google's attestation status list, and its attestation challenge the binding below; apple-app-attest (platform ios), the attestation object from DCAppAttestService.attestKey in base64url without padding, made with the binding below as clientDataHash. The binding is SHA-256 of the UTF-8 string "titan-device-attestation-v1\n" + audience + "\n" + challenge + "\n" + the key's thumbprint (lowercase hex). The body may then be up to 96 KiB. With the deployment's status list refresh on, an Android attestation while the list held is older than its maximum age is 503 ATTESTATION_STATUS_STALE (retry later). Where the deployment refuses unattested phones (unattested_phones refuse_signatures), an endorsement from a phone without an attestation is DEVICE_ATTESTATION_REQUIRED, and such phones do not count as trusted (a step-up enrolls). Elsewhere attestation is accepted and not read. Authorized by the caller's own user-route token; a device belongs to the token's subject and another person's is NOT_FOUND; NOT_FOUND unless phone enrollment is on.

## Headers

- `Authorization: string`

  `Bearer <token>`. The person's user-route token: a user access token from the deployment's identity provider for an audience only the person routes accept, carrying their use claim. The Gateway verifies it; the edge does not. A session's token is refused here, and a user-route token is refused as a session's. Served only while the deployment turns the person routes on; NOT_FOUND otherwise.

## Body parameters

- `apns_environment: optional string`

  The APNs environment the token was issued for (apns only)

  One of: `"sandbox"`, `"production"`

- `app_id: optional string`

  The app the push token belongs to: an iOS bundle id or an Android package name

- `attestation: optional object`

  The phone's key attestation, bound to this enrollment; read only where the deployment requires one. android-key carries only certificate_chain, apple-app-attest only attestation_object

  - `attestation_object: optional string`

  - `certificate_chain: optional array of string`

  - `format: string`

    One of: `"apple-app-attest"`, `"android-key"`

- `endorsement: optional string`

- `label: string`

- `platform: string`

  One of: `"ios"`, `"android"`

- `proof: string`

- `public_key: string`

  Uncompressed SEC 1 P-256 point, base64url without padding

- `push_provider: optional string`

  One of: `"apns"`, `"fcm"`

- `push_token: optional string`

## Returns

`201` Successful response; exact status varies by operation. (`object`)

- `attestation: optional object`

  What the phone's key attestation said at enrollment; present for a phone enrolled where the deployment required one at the time. null (with attestation_missing) for a phone without one where the deployment now requires attestation; absent elsewhere

  - `app_id: string`

    The attested app: TEAMID.bundle.id, or the Android package name

  - `environment: optional string`

    apple-app-attest: the App Attest environment

    One of: `"production"`, `"development"`

  - `format: string`

    One of: `"apple-app-attest"`, `"android-key"`

  - `key_attested: boolean`

    true when the enrolled signing key itself was attested (android-key); false for apple-app-attest, which attests the app instance (its own App Attest key), never the enrolled Secure Enclave key

  - `security_level: optional string`

    android-key: the attested key's KeyMint security level

    One of: `"trusted_environment"`, `"strongbox"`

- `attestation_missing: optional boolean`

  present (true) only where the deployment requires attestation and this phone has none (enrolled before): under the deployment's unattested_phones allow it is still trusted; under refuse_signatures its decisions, endorsements, logins and revocations of another trusted phone are refused (DEVICE_ATTESTATION_REQUIRED) until it is re-enrolled with an attestation

  One of: `true`

- `created_at: string`

- `device_id: string`

- `label: string`

- `last_seen_at: optional string`

- `platform: string`

  One of: `"ios"`, `"android"`

- `public_key_thumbprint: string`

- `push_apns_environment: optional string`

  One of: `"sandbox"`, `"production"`

- `push_app_id: optional string`

- `push_delivery_error: optional string`

  The last push delivery failure to this phone: a status or transport error, never a response body

- `push_delivery_error_at: optional string`

- `push_registered: boolean`

- `revoked_at: optional string`

- `state: string`

  One of: `"active"`, `"revoked"`

- `trusted_at: string`

## Errors

- `default` Rejected request.

## Example

```bash
curl --request POST \
  --url 'https://api.hexelstudio.com/v1/titan/user/devices' \
  --header "Authorization: Bearer $ACCESS_TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{
  "apns_environment": "sandbox",
  "app_id": "string",
  "attestation": {
    "attestation_object": "string",
    "certificate_chain": [
      "string"
    ],
    "format": "apple-app-attest"
  },
  "endorsement": "string",
  "label": "string",
  "platform": "ios",
  "proof": "string",
  "public_key": "string",
  "push_provider": "apns",
  "push_token": "string"
}'
```

### Response (201)

```json
{
  "attestation": {
    "app_id": "string",
    "environment": "production",
    "format": "apple-app-attest",
    "key_attested": true,
    "security_level": "trusted_environment"
  },
  "attestation_missing": true,
  "created_at": "2026-01-01T00:00:00Z",
  "device_id": "string",
  "label": "string",
  "last_seen_at": "2026-01-01T00:00:00Z",
  "platform": "ios",
  "public_key_thumbprint": "string",
  "push_apns_environment": "sandbox",
  "push_app_id": "string",
  "push_delivery_error": "string",
  "push_delivery_error_at": "2026-01-01T00:00:00Z",
  "push_registered": true,
  "revoked_at": "2026-01-01T00:00:00Z",
  "state": "active",
  "trusted_at": "2026-01-01T00:00:00Z"
}
```

### Response (default)

```json
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
```
