Create a MULTI-PROJECT cycle (PT-938) — the third scope arm
POST/api/cycles
Create a MULTI-PROJECT cycle (PT-938) — the third scope arm. This is the ONE cycle-create route whose scope owner travels in the BODY rather than the URL, and that is the reason the other arms take it from the URL rather than an exception to it: they address an owner that already exists, while this one's owner is DERIVED from projectIds and may not exist yet, so there is no id to put in a path. The server resolves it: the project set covering exactly that combination is reused if one exists, and created otherwise, so picking the same projects again yields Sprint 2 of that combination rather than a fresh owner at sequence 1 — which is what keeps one-active-per-scope, recurring rollover (PT-800) and auto-close (PT-844) meaningful on this arm. Two callers picking the same projects concurrently converge on ONE owner. projectIds needs at least TWO distinct projects: one project is an ordinary project-scoped cycle, created at /api/projects/{id}/cycles — no single-member set is ever made. Every project must belong to the active organisation. Requires tasks.create in that organisation; the cycle is born planned and is activated / completed / edited through the /api/cycle-sets/{id}/cycles/{cycleId} routes below.
PT-1104: the same route creates an ORGANISATION cycle when the body carries organisationScope: true instead of projectIds — owned by the active organisation itself and admitting every task of it; edited through /api/organisation-cycles/{cycleId}. Every create is subject to the organisation’s cycle mode (see /api/cycle-settings): a single-mode organisation accepts only organisation cycles and a multi-mode one refuses them, and no dated cycle may share a UTC day with another planned or active cycle of the same track. An organisation cycle must carry a start and an end date.
Request
Responses
- 201
- 400
- 401
- 403
- 409
Successful response
Validation error — fewer than two projects, a malformed project id, a project outside the active organisation (reported without naming which, so this is not a project-existence oracle), or an invalid cycle field
Unauthenticated, or no active organisation
Forbidden — requires 'tasks.create', full-scope 'projects.read', AND an ACTIVE INTERNAL membership in the active organisation. The last two are stricter than the other two arms' create gate on purpose: every READ of this arm requires them, so a projects.read.own caller — or a GUEST, who is project-scoped by policy however their role reads — would otherwise create a cycle it could never open.
Sequence conflict — an explicit sequence already exists for the resolved project set, or (when sequence is omitted) server allocation could not find a free value; or (PT-1104) the organisation’s cycle mode does not admit this scope, or a planned or active cycle of the same track already covers part of the window (the message names it)