## Create a sprint

`POST /v1/scrum/sprints`

Creates a sprint in a scrum project. The request body is flat, with no `fields` wrapper.

## Request fields (body)

| Field | Type | Required | Description |
|------|-----|:-----:|---------|
| `groupId` | number | yes | Scrum project ID. List of groups: [`GET /v1/workgroups`](/docs/entities/workgroups/list) |
| `name` | string | yes | Sprint name |
| `dateStart` | string \| number | yes | Sprint start: a date `2026-11-02` or a Unix timestamp |
| `dateEnd` | string \| number | yes | Sprint end: a date `2026-11-16` or a Unix timestamp |
| `status` | string | yes | `planned`, `active` or `completed` |
| `createdBy` | number | yes | ID of the sprint author. List: [`GET /v1/users`](/docs/entities/users/list) |
| `modifiedBy` | number | no | ID of the user who changed the sprint. If omitted, it equals `createdBy`. List: [`GET /v1/users`](/docs/entities/users/list) |
| `sort` | number | no | Sprint order within the project. Defaults to `0` |

If `name` or `createdBy` is missing, the sprint is not created and the response is `422 BITRIX_ERROR` with the message `Unable to add sprint`.

## Examples

### curl — personal key

```bash
curl -X POST https://vibecode.bitrix24.com/v1/scrum/sprints \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "groupId": 211,
    "name": "Sprint 12",
    "dateStart": "2026-11-02",
    "dateEnd": "2026-11-16",
    "status": "planned",
    "createdBy": 1317
  }'
```

### curl — OAuth application

```bash
curl -X POST https://vibecode.bitrix24.com/v1/scrum/sprints \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "groupId": 211,
    "name": "Sprint 12",
    "dateStart": "2026-11-02",
    "dateEnd": "2026-11-16",
    "status": "planned",
    "createdBy": 1317
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/scrum/sprints', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    groupId: 211,
    name: 'Sprint 12',
    dateStart: '2026-11-02',
    dateEnd: '2026-11-16',
    status: 'planned',
    createdBy: 1317,
  }),
})

const { data } = await res.json()
console.log('Sprint ID:', data.id)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/scrum/sprints', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    groupId: 211,
    name: 'Sprint 12',
    dateStart: '2026-11-02',
    dateEnd: '2026-11-16',
    status: 'planned',
    createdBy: 1317,
  }),
})

const { data } = await res.json()
console.log('Sprint ID:', data.id)
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | `true` on successful creation, HTTP status `201` |
| `data` | object | The created 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. An empty string until a goal is set |
| `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 | Sprint end in ISO 8601 format |
| `data.status` | string | `planned`, `active` or `completed` |

## Response example

```json
{
  "success": true,
  "data": {
    "id": 53,
    "groupId": 211,
    "entityType": "sprint",
    "name": "Sprint 12",
    "goal": "",
    "sort": 0,
    "createdBy": 1317,
    "modifiedBy": 1317,
    "dateStart": "2026-11-02T00:00:00+00:00",
    "dateEnd": "2026-11-16T00:00:00+00:00",
    "status": "planned"
  }
}
```

## Error response example

422 — `name` or `createdBy` is missing:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "Unable to add sprint",
    "b24Code": "0"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_PARAMS` | `groupId`, `dateStart`, `dateEnd` or `status` is missing, a field not listed in the table is passed, `status` is outside the allowed values, or an ID is not a positive integer |
| 422 | `BITRIX_ERROR` | `Unable to add sprint` — `name` or `createdBy` is missing |
| 422 | `BITRIX_ERROR` | `Access denied` — no group with this ID exists, it is not a scrum project, or there is no access to it |
| 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).

## See also

- [Update a sprint](/docs/scrum/sprints/update)
- [Delete a sprint](/docs/scrum/sprints/delete)
- [Complete the active sprint](/docs/scrum/sprints/complete)
- [Sprints](/docs/scrum/sprints)
