## Complete the active sprint

`POST /v1/scrum/groups/:groupId/sprints/active/complete`

Completes the current active sprint of a scrum project. No sprint ID is passed: the method finds the active sprint by the group ID.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `groupId` (path) | number | yes | Scrum project ID. List of groups: [`GET /v1/workgroups`](/docs/entities/workgroups/list) |

No request body is passed. If the request does send the `Content-Type: application/json` header, pass an empty object `{}`.

## Examples

### curl — personal key

```bash
curl -X POST https://vibecode.bitrix24.com/v1/scrum/groups/211/sprints/active/complete \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X POST https://vibecode.bitrix24.com/v1/scrum/groups/211/sprints/active/complete \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/scrum/groups/211/sprints/active/complete', {
  method: 'POST',
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})

const { data: sprint } = await res.json()
console.log(sprint.id, sprint.status)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/scrum/groups/211/sprints/active/complete', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { data: sprint } = await res.json()
console.log(sprint.id, sprint.status)
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | `true` on successful completion |
| `data` | object | The completed sprint |
| `data.id` | number | Sprint ID |
| `data.groupId` | number | Scrum project ID |
| `data.entityType` | string | Record type, `sprint` |
| `data.name` | string | Sprint name |
| `data.goal` | string | Sprint goal |
| `data.sort` | number | Sprint order within the project |
| `data.createdBy` | number | ID of the sprint author |
| `data.modifiedBy` | number | ID of the user who last changed the sprint |
| `data.dateStart` | string | Sprint start in ISO 8601 format |
| `data.dateEnd` | string | Completion time in ISO 8601 format |
| `data.status` | string | `completed` |

## Response example

```json
{
  "success": true,
  "data": {
    "id": 45,
    "groupId": 211,
    "entityType": "sprint",
    "name": "Sprint 11",
    "goal": "",
    "sort": 0,
    "createdBy": 1317,
    "modifiedBy": 1317,
    "dateStart": "2026-11-02T00:00:00+00:00",
    "dateEnd": "2026-10-29T14:09:01+00:00",
    "status": "completed"
  }
}
```

## Error response example

404 — the project has no active sprint, including when completion is called again:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Sprint not found"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_PARAMS` | `groupId` is not a positive integer |
| 400 | `FST_ERR_CTP_EMPTY_JSON_BODY` | The `Content-Type: application/json` header is passed with an empty body |
| 404 | `ENTITY_NOT_FOUND` | The project has no active sprint, or no group with this `groupId` exists |
| 403 | `SCOPE_DENIED` | The key lacks the `task` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only |
| 401 | `TOKEN_MISSING` | The key has no tokens configured |

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

## Known specifics

- **Completion rewrites the dates and order.** `dateEnd` is set to the completion time even if the planned end date has not yet arrived, and `sort` resets to `0`.

## See also

- [Active sprint](/docs/scrum/sprints/active)
- [Update a sprint](/docs/scrum/sprints/update)
- [Sprints](/docs/scrum/sprints)
