# Get a document

`GET /v1/sign-b2e/documents/:uid`

Returns the state of a document and its members. Requires permission to read documents and access to the specific document.

**Scopes:** `sign.b2e`, `crm`.

## Path parameters

| Parameter | Type | Required | Description |
|---|---|---|---|
| `uid` | string | yes | Document ID returned when the document was sent. |

## Query parameters

| Parameter | Type | Required | Description |
|---|---|---|---|
| `language` | string | no | Language of state names, en by default; an unknown language falls back to en. |

## Examples

### curl — personal key

```bash
curl -X GET 'https://vibecode.bitrix24.com/v1/sign-b2e/documents/DUMMY_DOCUMENT_UID' \
  -H 'X-Api-Key: YOUR_API_KEY'
```

### curl — OAuth application

```bash
curl -X GET 'https://vibecode.bitrix24.com/v1/sign-b2e/documents/DUMMY_DOCUMENT_UID' \
  -H 'X-Api-Key: YOUR_APP_KEY' \
  -H 'Authorization: Bearer USER_SESSION_TOKEN'
```

### JavaScript — personal key

```javascript
const response = await fetch('https://vibecode.bitrix24.com/v1/sign-b2e/documents/DUMMY_DOCUMENT_UID', {
  "method": "GET",
  "headers": {
    "X-Api-Key": "YOUR_API_KEY"
  }
});
const result = await response.json();
if (!response.ok || !result.success) throw new Error(result.error?.message);
console.log(result.data);
```

### JavaScript — OAuth application

```javascript
const response = await fetch('https://vibecode.bitrix24.com/v1/sign-b2e/documents/DUMMY_DOCUMENT_UID', {
  "method": "GET",
  "headers": {
    "X-Api-Key": "YOUR_APP_KEY",
    "Authorization": "Bearer USER_SESSION_TOKEN"
  }
});
const result = await response.json();
if (!response.ok || !result.success) throw new Error(result.error?.message);
console.log(result.data);
```

## Response fields

| Field | Type | Description |
|---|---|---|
| `success` | boolean | Whether the request succeeded. |
| `data` | object | Operation data. |
| `data.uid` | string \| null | Document UID. |
| `data.state` | object \| null | Object state. |
| `data.state.code` | string \| null | Machine-readable code. |
| `data.state.name` | string \| null | Localized signing state name. |
| `data.members` | array | Document members. |
| `data.members[].uid` | string \| null | Signing member UID. |
| `data.members[].role` | string \| null | Member role. |
| `data.members[].state` | object \| null | Object state. |
| `data.members[].state.code` | string \| null | Machine-readable code. |
| `data.members[].state.name` | string \| null | Localized signing state name. |
| `data.members[].user` | object \| null | User linked to the member. |
| `data.members[].party` | integer \| null | Signing party number of the member. |
| `data.members[].user.employeeCode` | string \| null | HCM Link employee code; null for a regular user. |
| `data.members[].user.employeeId` | integer \| null | Numeric HCM Link employee ID; null for a regular user. |
| `data.members[].user.userId` | integer \| null | User ID. |
| `meta.redacted` | array<string> | Present when credentials are hidden; contains the paths of the replaced values. |

## Response example

Shape of a successful response; the data depends on the Bitrix24 account and the request.

```json
{
  "success": true,
  "data": {
    "uid": "DUMMY_DOCUMENT_UID",
    "state": {
      "code": "ready",
      "name": "Ready"
    },
    "members": []
  }
}
```

## Error response example

403 — the key lacks a required scope:

```json
{
  "success": false,
  "error": {
    "code": "SCOPE_DENIED",
    "message": "This endpoint requires 'sign.b2e' scope"
  }
}
```

## Errors

| HTTP | Code | Reason |
|---|---|---|
| 400 | `INVALID_PARAMS` | Invalid request shape: types, required fields or an unknown query string parameter. |
| 401 | `TOKEN_MISSING` | No credentials for the Bitrix24 connection. |
| 403 | `SCOPE_DENIED` | One of the required scopes is not granted. |
| 422 | `BITRIX_ERROR` | Bitrix24 rejected the operation; the code is in error.b24Code, the text in error.message. |

[Common API errors](/docs/errors).

## Known specifics

Bitrix24 checks user permissions, HR e-signature availability, business rules, page sizes and field contents. Values are passed through without local correction. Response text is JSON-encoded; credential-bearing links are hidden.

## See also

- [Employee signatures](/docs/sign-b2e)
- [API errors](/docs/errors)
