> 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/device-status-check.md).

# Device Status Check

This API endpoint allows you to inquire about the status of a device using its associated credential ID.  The response will provide information on the device's current status, indicating whether it is active or inactive.

## API  Description

## API to check device status

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

#### 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 Status Check - If the Device is Active

The API response will have the details about the device

* **`reason`** provides information about the state of the credentialId. Its purpose is to communicate the status or specific details to the user.
* **`status`** property indicates the overall outcome of the credentialId retrieval process. If the `credential_id` is successfully found, the status will be labeled as "SUCCESS." if the `credential_id` is not found, the status will be marked as "FAILURE." In both cases, the **`reason`** property can be consulted for additional user-facing information about the state.
* **`state`** property to transmit opaque data during the registration process, it can be subsequently retrieved by querying the status. This facilitates the tracking and maintenance of the same state information throughout your workflow.

HTTP Status Code: `200`

**JSON Response**

```json
{
    "status": "SUCCESS",
    "reason": "The credential generated successfully",
}
```

### Device Status Check - If the Device is Inactive

The device is un registered successfully and `credential_id` is made inactive

* **`status`** : Indicates "SUCCESS" if the credential Id was disabled.
* **`reason`** : Provides a detailed explanation of the status.

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/status
er-device'\
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <bearer token>' \
-d '{
"credential_id": "21e14436-893e-4254-b00f-fbbdd5fa6066"
}'
```

{% endtab %}
{% endtabs %}
