# Add an external provider

`POST /v1/sign-b2e/providers`

Registers an external signature provider. Can be called by an administrator via OAuth.

**Scopes:** `sign.b2e`.

Available only to an OAuth application key with a user session. An incoming webhook receives `422 BITRIX_ERROR` with the native `WRONG_AUTH_TYPE` code in `error.b24Code`.

## Request body fields

| Parameter | Type | Required | Description |
|---|---|---|---|
| `fields` | object | yes | External provider fields; values are passed to Bitrix24. |
| `fields.title` | string \| null | no | Provider name. The field accepts null; on update, passing null or omitting the field keeps the previous value. |
| `fields.description` | string \| null | no | Provider description. The field accepts null; on update, passing null or omitting the field keeps the previous value. |
| `fields.iconUri` | string \| null | no | Provider icon URL. The field accepts null; on update, passing null or omitting the field keeps the previous value. |
| `fields.companyRegUri` | string \| null | no | Company registration URL; optional on create. The field accepts null; on update, passing null or omitting the field keeps the previous value. |
| `fields.documentSignUri` | string \| null | no | Document signing URL. The field accepts null; on update, passing null or omitting the field keeps the previous value. |
| `fields.publicKeyUri` | string \| null | no | Provider public key URL. The field accepts null; on update, passing null or omitting the field keeps the previous value. |

## Examples

### curl — OAuth application

```bash
curl -X POST 'https://vibecode.bitrix24.com/v1/sign-b2e/providers' \
  -H 'X-Api-Key: YOUR_APP_KEY' \
  -H 'Authorization: Bearer USER_SESSION_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"fields": {"title": "VIBE-PROBE", "description": "VIBE-PROBE test provider", "iconUri": "https://example.com/icon.png", "documentSignUri": "https://example.com/sign", "publicKeyUri": "https://example.com/public-key"}}'
```

### JavaScript — OAuth application

```javascript
const response = await fetch('https://vibecode.bitrix24.com/v1/sign-b2e/providers', {
  "method": "POST",
  "headers": {
    "X-Api-Key": "YOUR_APP_KEY",
    "Authorization": "Bearer USER_SESSION_TOKEN",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({"fields": {"title": "VIBE-PROBE", "description": "VIBE-PROBE test provider", "iconUri": "https://example.com/icon.png", "documentSignUri": "https://example.com/sign", "publicKeyUri": "https://example.com/public-key"}})
});
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.id` | integer | Object 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": {
    "id": 7
  }
}
```

## 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. |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only. |
| 422 | `BITRIX_ERROR` | An incoming webhook was used instead of OAuth. The native `WRONG_AUTH_TYPE` code is in `error.b24Code`. |

[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.

The operation is not retried automatically. If the outcome is unknown, check the state in the Bitrix24 account first; a repeated call can perform the operation again.

## See also

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