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

# Create Deprovision Grant

> Create a nonce-bound BLE grant for clearing device pairing state

Create the short-lived authorization blob used by the mobile SDK to clear a
device's local pairing state and stored device token. This operation is
non-destructive: it does not erase recordings and is not a factory reset.

## Authentication

Requires an [API key](/authentication) with `devices:write` scope. Call this
endpoint from your backend, never directly from a mobile app.

## Prerequisites

* The device was bound with `pk_d`.
* The app is connected over BLE and has subscribed to the current auth nonce.
* For nonce-bound firmware, send that nonce as `nonce_d`.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.bota.dev/v1/devices/dev_abc123/deprovision-grant \
    -H "Authorization: Bearer sk_test_..." \
    -H "Content-Type: application/json" \
    -d '{"nonce_d":"0123456789abcdef0123456789abcdef"}'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://api.bota.dev/v1/devices/dev_abc123/deprovision-grant',
    {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.BOTA_API_KEY}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({ nonce_d: deviceNonce }),
    },
  );
  const grant = await response.json();
  ```
</RequestExample>

## Request Body

<ParamField body="nonce_d" type="string">
  Current device auth nonce as 16 bytes encoded as 32 lowercase hexadecimal
  characters. Required by current nonce-bound firmware; omission exists only
  for legacy compatibility.
</ParamField>

## Response

<ResponseExample>
  ```json 201 theme={null}
  {
    "grant_blob": "AQIDBA...",
    "expires_at": "2026-08-19T06:15:00.000Z"
  }
  ```
</ResponseExample>

Pass `grant_blob` to the SDK deprovision operation immediately. Only after the
device confirms success should your backend call
[`POST /devices/{id}/unbind`](/api-reference/devices/unbind).

<Warning>
  For a factory reset, use [`POST /devices/{id}/reset`](/api-reference/devices/reset)
  and acknowledge the exact command after the physical wipe. Do not substitute
  deprovision plus unbind for factory reset.
</Warning>
