> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openpayload.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Add a device

> Add a device to a public DID record.

Add a device to a public DID record.

A device ID lets compatible services distinguish installations or endpoints controlled under one DID. It is public metadata, not a secret or authentication token.

This is a DID-key authorized update. Include `action: "add_device"`, `control_nonce`, `valid_until`,
`signer_key_id`, the SCALE `canonical_payload`, and `signature` as described in
[Authorize a Directory update](/guides/authorization). The JSON field name for `control_nonce` is `nonce`.

## Request

<ParamField path="did" type="string" required>
  The DID to update.
</ParamField>

<ParamField body="did" type="string" required>
  The DID to update. It must match the path.
</ParamField>

<ParamField body="device_id" type="string" required>
  The device identifier.
</ParamField>

<RequestExample>
  ```bash Request theme={null}
  curl --request POST \
    --url "https://directory.example.com/dids/did%3Aopenpayload%3A1111111111111111111111/devices" \
    --header "Content-Type: application/json" \
    --data '{
    "did": "did:openpayload:1111111111111111111111",
    "device_id": "mobile-01",
    "action": "add_device",
    "nonce": "<control_nonce>",
    "valid_until": "<epoch-millis>",
    "signer_key_id": "<authorized-key-id>",
    "canonical_payload": "<base64-or-hex-scale-payload>",
    "signature": "<base64-ed25519-signature>"
  }'
  ```
</RequestExample>

## Response

<ResponseField name="status" type="string" required>
  The submission status.
</ResponseField>

<ResponseField name="did" type="string" required>
  The DID affected by the request.
</ResponseField>

<ResponseField name="extrinsic" type="string" required>
  The public operation name.
</ResponseField>

<ResponseField name="tx_hash" type="string" required>
  The submitted transaction hash.
</ResponseField>

<ResponseField name="message" type="string" required>
  A human-readable submission result.
</ResponseField>

<ResponseExample>
  ```json 202 Response theme={null}
  {
    "status": "accepted",
    "did": "did:openpayload:1111111111111111111111",
    "extrinsic": "apply_control_with_proof",
    "tx_hash": "<transaction-hash>",
    "message": "Chain extrinsic submitted"
  }
  ```
</ResponseExample>

<Note>
  `202 Accepted` means the Directory accepted the request for processing. It does not confirm final settlement.
</Note>

## Straight to the point

```http theme={null}
POST /dids/{did}/devices
{"did":"<same-did>","device_id":"mobile-01"}
```

* Accepted: `202`
* Device ID is public
* Adding a device does not add encryption keys to the DID document


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.