
## Update activity

`PATCH /v1/activities/:id`

Updates fields of an existing activity. Pass only the fields you want to change. For the full list, see the [field reference](/docs/entities/activities/fields).

The activity type `typeId` is set at creation only — a request that includes it returns `400 READONLY_FIELD`. To change the type, create a new activity via [`POST /v1/activities`](/docs/entities/activities/create) and delete the previous one.

The deadline `deadline` is not sent in the body — a request that includes it returns `400 READONLY_FIELD`. To change the activity deadline, use [`POST /v1/activities/:id/deadline`](/docs/entities/activities/deadline). To shift it by a given amount of time, use [`POST /v1/activities/:id/postpone`](/docs/entities/activities/postpone).

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `id` (path) | number | yes | Activity ID. List: [`GET /v1/activities`](/docs/entities/activities/list) |

## Request fields (body)

All body fields are optional.

| Field | Type | Description |
|------|-----|---------|
| `completed` | boolean | Mark as completed |
| `subject` | string | Subject |
| `responsibleId` | number | Responsible person. List: [`GET /v1/users`](/docs/entities/users/list) |
| `priority` | number | Priority: `1` — low, `2` — medium, `3` — high |
| `description` | string | Description |

## Examples

### curl — personal key

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/activities/3894" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "completed": true,
    "subject": "Project meeting (completed)"
  }'
```

### curl — OAuth application

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/activities/3894" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "completed": true,
    "subject": "Project meeting (completed)"
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/activities/3894', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    completed: true,
    subject: 'Project meeting (completed)',
  }),
})

const { success, data } = await res.json()
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/activities/3894', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    completed: true,
    subject: 'Project meeting (completed)',
  }),
})

const { success, data } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | object | Updated activity object with all fields — see [Activity fields](/docs/entities/activities/fields) |

## Response example

The main fields are shown. Full list: [Activity fields](/docs/entities/activities/fields).

```json
{
  "success": true,
  "data": {
    "id": 3894,
    "typeId": 1,
    "ownerTypeId": 3,
    "ownerId": 17,
    "subject": "Project meeting (completed)",
    "completed": true,
    "status": 2,
    "responsibleId": 1,
    "startTime": "2026-10-21T07:00:00.000Z",
    "endTime": "2026-10-21T08:00:00.000Z",
    "updatedAt": "2026-10-19T13:36:49.000Z"
  }
}
```

## Error response example

404 — activity not found:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Activity is not found."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 404 | `ENTITY_NOT_FOUND` | Activity not found |
| 403 | `BITRIX_ACCESS_DENIED` | The key's user has no permission for this activity in Bitrix24 |
| 400 | `READONLY_FIELD` | The body contains a field this request cannot change: `typeId` is set at creation only, the deadline `deadline` is changed by [`POST /v1/activities/:id/deadline`](/docs/entities/activities/deadline), and `id`, `authorId`, `editorId`, `associatedEntityId` are read-only |
| 400 | `INVALID_PARAMS` | A field value does not match its declared type — for example, a string instead of a number in `priority` |
| 400 | `INVALID_PARAMS` | `id` is not a non-negative integer. Message: `id must be a non-negative integer` |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only — see [access rights](/docs/access-rights) |
| 403 | `SCOPE_DENIED` | The API key lacks the `crm` scope |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |

Full list of common API errors — [Errors](/docs/errors).

## See also

- [Get activity](/docs/entities/activities/get)
- [Activity fields](/docs/entities/activities/fields)
- [Batch](/docs/batch)
- [Limits and optimization](/docs/optimization)
