> For the complete documentation index, see [llms.txt](https://docs.vida.id/identity-stack/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vida.id/identity-stack/authentication/authentication-factors/cryptographic-token-pki/integration-methods/api/unregister-wipe-device.md).

# Unregister/Wipe Device

This API endpoint allows you to disable a registered credential ID, effectively wiping the associated device. The response provides the status of the disabling process (SUCCESS or FAILURE), along with a explanation in the reason field.

When a device is wiped, the status query on the credential ID will report an inactive credential. However, the public key can be queried from the fetch-public-keys call

## API  Description

## API to unregister a device

<mark style="color:green;">`POST`</mark> `https://{{environment_url}}/api/v1/device/unregister-device`

#### Headers

| Name                                            | Type   | Description      |
| ----------------------------------------------- | ------ | ---------------- |
| Content-Type<mark style="color:red;">\*</mark>  |        | application/json |
| accept<mark style="color:red;">\*</mark>        | String | \*/\*            |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer \<Token>  |

#### Request Body

| Name                                             | Type   | Description              |
| ------------------------------------------------ | ------ | ------------------------ |
| credential\_id<mark style="color:red;">\*</mark> | String | registered credential id |

#### API Response

### Device Un Registered Successfully

The device unregistered successfully and `credential_id` is made inactive

* **`status`** : Indicates "SUCCESS" if the credential Id was disabled.
* **`reason`** : Provides a detailed explanation of the status.
* **state** : When used to send opaque data during registration, can be retrieved from the un-registration API for tracking the process.

HTTP Status Code: `200`

**JSON Response**

```json
{
    "status": "SUCCESS",
    "reason": "Credential id is inactive"
}
```

### Invalid Bearer Token

HTTP Status Code: `401`

**JSON Response**

```json
{
    "status": "FAILED",
    "reason": "Invalid bearer token"
}
```

### Invalid Request Body

HTTP Status Code: `400`

**JSON Response**

```json
{
    "status": "FAILED",
    "reason": "Failed to read request body"
}
```

### Integration Code Snippets

{% tabs %}
{% tab title="Curl" %}

```groovy
curl -X 'POST' \
'https://{{environment_url}}/api/v1/device/unregist
er-device'\
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <bearer token>' \
-d '{
"credential_id": "21e14436-893e-4254-b00f-fbbdd5fa6066"
}'
```

{% endtab %}
{% endtabs %}
