> 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/register-a-device-presence.md).

# Register a Device - Presence

This API endpoint enables you to register a device with the option of user presence. When making a request to register a device, set the presence property to "ENFORCE\_USER\_PRESENCE" to indicate that a user presence check is not required during the signing process.

Once the registration is complete, the response will contain a new credentialId, accessible through the `credential_id` property

## API  Description

## API to register a device - Presence

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

#### 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

<table><thead><tr><th width="295">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>presence<mark style="color:red;">*</mark></td><td>String</td><td>Presence type <code>ENFORCE_USER_PRESENCE</code></td></tr></tbody></table>

#### API Response

### Device Registered Successfully

The device registered successfully and `credential_id` is generated.

**`credential_id`** : unique identifier assigned to a device upon successful registration.

HTTP Status Code: `200`

**JSON Response**

```json
{
    "credential_id": "21e14436-893e-4254-b00f-fbbdd5fa6066"
}
```

### 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/regist
er'\
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <bearer token>' \
-d '{
"presence": "ENFORCE_USER_PRESENCE"
}'
```

{% endtab %}
{% endtabs %}
