openapi: 3.1.0
info:
  title: Nucleo Operations API
  version: v1
  summary: Read and manage the projects of Nucleo Operations, their budget and margin, Slack channels and calls, the Slack thread of a task and its coding agent, and the requests to move a task's dates.
  description: |
    The REST API behind **Operations** in Nucleo Brain: client, supplier and internal projects with their
    budget, the project's financial forecast, and *schedule shifts* — a person asks to move a task's dates
    with a reason, the project manager approves or rejects.

    **Authentication.** A Nucleo access token (`Authorization: Bearer <access_token>`) of a person, from
    Nucleo sign-in (`auth.nucleoplatform.com`, OpenID Connect) with a client that Nucleo registered for you.
    Every call runs with that person's permissions. Tokens of self-registered AI clients (scope
    `nucleo.ai_tools`) work only on the AI Tools API and are refused here with `401`.

    **Company.** Every call runs inside one company. Send `X-Nucleo-Company` with the company's public id
    (or numeric id). It can be left out when the token already names a company or the person belongs to only
    one; otherwise the answer is `400`. A company the person cannot enter answers `403`.

    **Conventions**

    - Send `Accept: application/json`: without it, validation errors are not returned as JSON.
    - JSON in UTF-8, `snake_case` field names. Dates are `YYYY-MM-DD`; timestamps are ISO 8601.
    - Money is in cents (`budget_cents`, integer) with a three-letter `currency`.
    - Errors: `{"message": "..."}`. Validation errors (`422`) add `errors`, the messages per field.
    - Permissions are named per call (`projects.view`, `finance.view`, `tasks.manage`…). A missing permission
      answers `403`.
  contact:
    name: Nucleo support
    url: https://nucleoplatform.com
x-nucleo:
  product: operations
  module: brain
  audience: [server]
  stability: stable
  format: json
  order: 30
servers:
  - url: https://api-brain.nucleoplatform.com/api/v1
    description: Production
security:
  - nucleoOidc: []
tags:
  - name: Projects
    description: |
      A project of the company: with a client (`kind: client`, the default), with a supplier (`supplier`) or
      internal (`internal`).

      | Status | Meaning |
      | --- | --- |
      | `proposed` | A draft to approve, for example from a signed contract (`is_proposed: true`). |
      | `planned` | Approved, it starts later. |
      | `active` | Running. Default for a new project. |
      | `completed` | Done. |
      | `cancelled` | Cancelled. |

      A project on hold stays `active`: its `health` says how it is going.

      **Locked projects.** A project can be locked after a date (`locked_after`, for example after a
      cancelled contract). Once locked (`is_locked: true`) an update may only change `status`,
      `actual_end_date` and `color`; anything else answers `422` with the reason.

      **Color.** `color` is the project's colour in the plan, `#RRGGBB`. `null` means automatic: Nucleo picks
      one from its palette.

      **Budget.** `budget_cents` is the budget in cents, `budget` the same amount in units (read-only),
      `currency` its currency (default `EUR`). The forecast against it is in `GET /projects/{project}/financials`.

      **Type and hours budget.** `project_type` is the kind of work: `setup`, `maintenance` or `null`. A maintenance
      project can include a number of hours per period (`hours_budget`, per `hours_period`: `month`, `quarter` or
      `year`). The period starts again every month, quarter or year from `hours_renews_on`; with `hours_carry_over`
      the hours left at the renewal are added to the next period. `hours_usage` is the counter of the current
      period (`null` without a maintenance type or a budget): hours used are the actual hours (`actual_hours`) of
      the tasks completed in the period, or their estimate when the actual hours are missing (`estimated_hours`
      says how many). When the hours used reach `hours_alert_percent` (default 80) and again when they go over the
      budget, the project manager gets a notification, once per period. At the renewal the closed period is kept
      in Nucleo with its hours and the tasks done.

      **Slack and calls.** A project collects its Slack channels (`/projects/{project}/slack-channels`) and its
      recorded calls (`/projects/{project}/calls`). A new private channel can be created from the project
      (`/projects/{project}/slack-channels/create`), with the project's people invited.
  - name: Backlog
    description: Incoming requests waiting to be sorted into tasks, with Atomo's proposals (Operations → Backlog; the API keeps the `/triage` paths).
  - name: Tasks
    description: |
      **Slack thread of a task.** A task created from Slack (by mentioning `@Nucleo` or with *Create task in
      Nucleo* on a message), or linked to a thread, carries that thread in `slack_threads` of
      `GET /tasks/{task}`: channel, author of the first message, link to the thread and a two-to-three-line
      summary written by Atomo. The messages of the thread are never stored in Nucleo, only the summary.
      Tasks created in Nucleo have an empty list.

      **Coding agent.** A task can be sent to a coding agent (`POST /tasks/{task}/agent`), which writes the code and
      opens a pull request in the project's `repository`. A developer merges it, unless the request explicitly asks
      the agent to publish (`auto_merge: true`): then the agent merges it by itself, and publishing is up to the
      repository's own deploy. The person assigned to the task stays responsible.
      Sending is always an explicit action. The latest run is in `agent_run` of `GET /tasks/{task}` (`null` if
      the task was never sent). If the task came from a Slack thread, the agent's progress is posted in that
      thread.

      A run has no time limit: it fails only when the agent stops giving signs of life (with GitHub, no workflow
      queued or running for its issue for 30 minutes), or after 3 days as a safety limit. `message` says which.
      While a run is `queued` or `working`, a new comment on the task written by a person, or a reply in the
      Slack thread the run came from, reaches the agent: comments that arrive together are forwarded once, when
      the agent's current step ends, and the agent keeps working on the same pull request. Messages of Nucleo
      itself never reach the agent.

      | Status | Meaning |
      | --- | --- |
      | `queued` | Sent, waiting for the agent. |
      | `working` | The agent is working on it. |
      | `pr_open` | The pull request is in `pr_url` and waits for a developer to merge it. |
      | `merged` | Done: the agent merged the pull request in `pr_url`. |
      | `needs_review` | The agent stopped and needs a person, for example the task has no description. `message` says why. |
      | `failed` | The agent could not finish. `message` says why. |
  - name: Schedule shifts
    description: |
      A request to move a task's dates, with a reason. The request is made for the person assigned to the task
      and waits for a decision; the history stays after the decision.

      | Status | Meaning |
      | --- | --- |
      | `pending` | Waiting for the project manager. |
      | `approved` | Approved: the task now has the new dates, and the reason is kept in the task's history. |
      | `rejected` | Rejected, with a note. The task's dates do not change. |

      **Who decides.** The project manager of the task's project. A company admin can decide any shift, and
      is the only one who can decide a shift without a project or whose project has no manager.

      Only tasks can be shifted (`shiftable_type: task`).
paths:
  /projects:
    get:
      operationId: listProjects
      summary: List projects
      tags: [Projects]
      description: |
        Projects of the company, newest first (by `id`), paginated. Permission `projects.view`.

        In this list `has_active_contract` is always `true` or `false`; in the other answers it is `null`.
      parameters:
        - name: search
          in: query
          description: Part of the project name, case-insensitive.
          schema: { type: string }
        - name: status
          in: query
          description: One or more statuses, comma-separated.
          schema: { type: string }
          example: active,planned
        - name: kind
          in: query
          description: One or more kinds (`client`, `supplier`, `internal`), comma-separated.
          schema: { type: string }
        - name: project_manager_id
          in: query
          description: One or more project manager user ids, comma-separated.
          schema: { type: string }
          example: '12,15'
        - name: company_id
          in: query
          description: Only projects of this client company (the `company_id` of the project).
          schema: { type: integer }
        - name: contract
          in: query
          description: |
            `active` = only projects with an active contract. `none` = client projects without an active
            contract; without `status` it also keeps only `active` projects.
          schema:
            type: string
            enum: [active, none]
        - name: sort
          in: query
          description: Sort field. Any other value sorts by `id`.
          schema:
            type: string
            enum: [id, name, status, start_date, expected_end_date, budget_cents, created_at, updated_at]
            default: id
        - name: direction
          in: query
          schema:
            type: string
            enum: [asc, desc]
            default: desc
        - name: per_page
          in: query
          description: Projects per page (at most 100).
          schema: { type: integer, maximum: 100, default: 25 }
        - name: page
          in: query
          schema: { type: integer, minimum: 1, default: 1 }
        - $ref: '#/components/parameters/Company'
      responses:
        '200':
          description: A page of projects.
          content:
            application/json:
              schema:
                type: object
                required: [data, links, meta]
                properties:
                  data:
                    type: array
                    items: { $ref: '#/components/schemas/Project' }
                  links: { $ref: '#/components/schemas/PageLinks' }
                  meta: { $ref: '#/components/schemas/PageMeta' }
        '400': { $ref: '#/components/responses/NoCompany' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
    post:
      operationId: createProject
      summary: Create a project
      tags: [Projects]
      description: |
        Permission `projects.create` or `projects.edit`. `status` defaults to `active`, `currency` to `EUR`.
        `client_approval_days` and `plan_summary` can only be set with an update.
      parameters:
        - $ref: '#/components/parameters/Company'
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/ProjectCreate' }
            example:
              name: Acme — new website
              company_id: 418
              start_date: '2026-12-01'
              expected_end_date: '2027-03-31'
              project_manager_id: 12
              budget_cents: 4500000
              currency: EUR
              color: '#2563EB'
      responses:
        '201':
          description: The project, created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data: { $ref: '#/components/schemas/Project' }
        '400': { $ref: '#/components/responses/NoCompany' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '422': { $ref: '#/components/responses/ValidationError' }
  /projects/{project}:
    parameters:
      - $ref: '#/components/parameters/ProjectId'
      - $ref: '#/components/parameters/Company'
    get:
      operationId: getProject
      summary: Get a project
      tags: [Projects]
      description: |
        Permission `projects.view`. Also returns `service_instances` (services active on the project),
        `partners` (partners credited with a share) and `slas`.
      responses:
        '200':
          description: The project.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data: { $ref: '#/components/schemas/Project' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
    patch:
      operationId: updateProject
      summary: Update a project
      tags: [Projects]
      description: |
        Send only the fields to change (`PUT` works the same way). Permission `projects.edit`.
        On a locked project only `status`, `actual_end_date` and `color` can change.
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/ProjectUpdate' }
            example:
              color: null
              budget_cents: 5000000
      responses:
        '200':
          description: The project, updated.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data: { $ref: '#/components/schemas/Project' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '422':
          description: Invalid fields, or a locked project (`message` says since when and why).
          content:
            application/json:
              schema: { $ref: '#/components/schemas/ValidationError' }
    delete:
      operationId: deleteProject
      summary: Delete a project
      tags: [Projects]
      description: |
        Permission `projects.delete`. The project is removed from the API and the app (soft delete:
        Nucleo support can restore it).
      responses:
        '204':
          description: Deleted.
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
  /projects/{project}/financials:
    get:
      operationId: getProjectFinancials
      summary: Get a project's budget and margin
      tags: [Projects]
      description: |
        Budget, cost so far and forecast of the project. Permissions `projects.view` and `finance.view`.

        - **Spent**: hours of the project's tasks × the hourly cost of the person who did them. A closed task
          without actual hours counts its estimate. Hours already logged on an open task count too.
        - **Remaining**: estimates of the open tasks, corrected by how long the assignee usually takes compared
          to the estimate (per area when known), minus hours already logged, × the hourly cost.
        - **Forecast** = spent + remaining. **Margin** = budget − forecast.

        Hours of people without an hourly cost are not priced: they are only counted in `hours.without_cost`,
        so `spent_cents` and `remaining_cents` leave them out.
      parameters:
        - $ref: '#/components/parameters/ProjectId'
        - $ref: '#/components/parameters/Company'
      responses:
        '200':
          description: The project's financials.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data: { $ref: '#/components/schemas/ProjectFinancials' }
              example:
                data:
                  currency: EUR
                  budget_cents: 4500000
                  spent_cents: 1830000
                  remaining_cents: 2140000
                  forecast_cents: 3970000
                  margin_cents: 530000
                  burn_percent: 41
                  hours:
                    actual: 296.5
                    assumed: 8
                    remaining: 341.2
                    without_cost: 12
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
  /projects/{project}/status:
    get:
      operationId: getProjectStatus
      summary: Get a project's status summary
      tags: [Projects]
      description: |
        Permission `projects.view`. What the Overview tab of the project shows: how many tasks are done, overdue
        and still to plan, the milestones with their progress, how far the end slips and the next deadlines.
        Cancelled tasks are not counted.

        - `tasks.total`: tasks of the project (cancelled excluded); `tasks.done`: the completed ones.
        - `tasks.overdue`: open tasks whose due date is before today.
        - `tasks.unplanned`: open tasks in `backlog` (without a person or a due date).
        - `milestones`: the project's milestones in order, each with `done` and `total` tasks.
        - `forecast_end`: the latest due date among open tasks, or `null`.
        - `slip_days`: days beyond `expected_end_date`, counting the latest open due date and, while the project
          is not completed or cancelled, today. `0` when there is no end date or nothing slips.
        - `upcoming`: the next 5 open tasks with a due date from today, earliest first.
      parameters:
        - $ref: '#/components/parameters/ProjectId'
        - $ref: '#/components/parameters/Company'
      responses:
        '200':
          description: The summary.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      tasks:
                        type: object
                        properties:
                          total: { type: integer }
                          done: { type: integer }
                          overdue: { type: integer }
                          unplanned: { type: integer }
                      milestones:
                        type: array
                        items:
                          type: object
                          properties:
                            id: { type: integer }
                            name: { type: string }
                            status: { type: [string, 'null'] }
                            due_date: { type: [string, 'null'], format: date }
                            done: { type: integer }
                            total: { type: integer }
                      forecast_end: { type: [string, 'null'], format: date }
                      slip_days: { type: integer }
                      upcoming:
                        type: array
                        items:
                          type: object
                          properties:
                            id: { type: integer }
                            title: { type: string }
                            due_date: { type: string, format: date }
                            status: { type: string }
                            assignee:
                              type: [object, 'null']
                              properties:
                                id: { type: integer }
                                name: { type: string }
              example:
                data:
                  tasks: { total: 24, done: 15, overdue: 2, unplanned: 3 }
                  milestones:
                    - { id: 41, name: Launch, status: active, due_date: '2026-12-20', done: 6, total: 10 }
                  forecast_end: '2026-12-22'
                  slip_days: 2
                  upcoming:
                    - { id: 30612, title: Checkout review, due_date: '2026-12-05', status: planned, assignee: { id: 7, name: Irene } }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
  /projects/{project}/slack-channels:
    get:
      operationId: listProjectSlackChannels
      summary: List a project's Slack channels
      tags: [Projects]
      description: |
        The Slack channels linked to the project, oldest first, each with `url`, a link that opens the channel
        in Slack. A project starts with the channel of the deal it comes from; channels are then added and
        removed by hand. A project can have several channels. Permission `projects.view`.

        `meta.configured` says whether the company has connected Slack to Nucleo: without it no channel can
        be added, and the channels already linked keep their link.
      parameters:
        - $ref: '#/components/parameters/ProjectId'
        - $ref: '#/components/parameters/Company'
      responses:
        '200':
          description: The project's channels.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items: { $ref: '#/components/schemas/ProjectSlackChannel' }
                  meta:
                    type: object
                    properties:
                      configured: { type: boolean }
              example:
                data:
                  - id: 12
                    slack_channel_id: C0CDQT5ENJC
                    slack_channel_name: deal_acme
                    url: https://slack.com/app_redirect?channel=C0CDQT5ENJC&team=T0123ABCD
                    notify_events: [task_completed]
                meta:
                  configured: true
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
    post:
      operationId: addProjectSlackChannel
      summary: Add a Slack channel to a project
      tags: [Projects]
      description: |
        Links an existing channel of the company's Slack workspace, by id (`C…`, `G…`) or by name
        (`#acme_site`). Nucleo checks it on Slack: private channels are found only if the Nucleo Slack app is a
        member. Adding a channel that is already linked updates its name. Permission `projects.edit`.

        Errors (`422`, code in `error.code`): `slack_not_configured`, `channel_not_found`, `channel_archived`,
        `slack_failed` (Slack could not be reached, or answered with an error while searching by name; when
        searching by id, a Slack error shows as `channel_not_found`). A missing or too long `channel` answers the
        standard validation error.
      parameters:
        - $ref: '#/components/parameters/ProjectId'
        - $ref: '#/components/parameters/Company'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [channel]
              properties:
                channel: { type: string, maxLength: 100, description: 'Channel id (`C0CDQT5ENJC`) or name (`#acme_site`).' }
            example:
              channel: C0CDQT5ENJC
      responses:
        '201':
          description: Added. The answer lists all the project's channels.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items: { $ref: '#/components/schemas/ProjectSlackChannel' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '422':
          description: Invalid input (`ValidationError`), or the channel cannot be linked (`CodedError`).
          content:
            application/json:
              schema:
                oneOf:
                  - { $ref: '#/components/schemas/ValidationError' }
                  - { $ref: '#/components/schemas/CodedError' }
              example:
                message: Channel «#acme_site» not found. Private channels are visible only if the Nucleo Slack app is a member.
                error:
                  code: channel_not_found
                  message: Channel «#acme_site» not found. Private channels are visible only if the Nucleo Slack app is a member.
  /projects/{project}/slack-channels/options:
    get:
      operationId: listSlackChannelOptions
      summary: List the Slack channels that can be added to a project
      tags: [Projects]
      description: |
        The channels of the company's Slack workspace that are not archived and not yet linked to the project,
        by name. Private channels appear only if the Nucleo Slack app is a member. Without a Slack connection
        the list is empty and `meta.configured` is `false`. Permission `projects.view`.
      parameters:
        - $ref: '#/components/parameters/ProjectId'
        - $ref: '#/components/parameters/Company'
      responses:
        '200':
          description: Channels that can be added.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id: { type: string, description: Slack channel id. }
                        name: { type: string, description: Channel name without `#`. }
                        is_private: { type: boolean }
                        is_archived: { type: boolean, description: Always `false` here. }
                  meta:
                    type: object
                    properties:
                      configured: { type: boolean }
              example:
                data:
                  - { id: C0SITE00001, name: acme_site, is_private: false, is_archived: false }
                meta:
                  configured: true
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '502':
          description: Slack answered with an error.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Error' }
  /projects/{project}/slack-channels/suggest:
    get:
      operationId: suggestProjectSlackChannel
      summary: Suggest a name and the people for a new project channel
      tags: [Projects]
      description: |
        What «Create channel» starts from. `name` follows the usual Slack naming, `<area>_<client>[_<topic>]`:
        the area comes from the project's services (or its deal's): `app`, `web`, `marketing`, `design`, or `prj`
        when there are none; the client is the project's company; the topic is a word of the project name, added
        only when the client already has other project channels. `-2`, `-3`… are added when a channel the
        Nucleo Slack app can see already has the name. `people` are the project manager, the four project owners and
        the assignees of open tasks (active users only), with `reasons`: `pm`, `owner`, `assignee`. The project
        has no member list of its own. Permission `projects.view`.
      parameters:
        - $ref: '#/components/parameters/ProjectId'
        - $ref: '#/components/parameters/Company'
      responses:
        '200':
          description: Suggested name and people.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      name: { type: string, description: Empty when Slack is not connected. }
                      people:
                        type: array
                        items:
                          type: object
                          properties:
                            id: { type: integer }
                            name: { type: string }
                            email: { type: string }
                            reasons: { type: array, items: { type: string, enum: [pm, owner, assignee] } }
                  meta:
                    type: object
                    properties:
                      configured: { type: boolean }
              example:
                data:
                  name: app_acme
                  people:
                    - { id: 12, name: Giulia Rossi, email: g.rossi@example.com, reasons: [pm] }
                    - { id: 31, name: Marco Bianchi, email: m.bianchi@example.com, reasons: [owner, assignee] }
                meta:
                  configured: true
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
  /projects/{project}/slack-channels/create:
    post:
      operationId: createProjectSlackChannel
      summary: Create a Slack channel for a project
      tags: [Projects]
      description: |
        Creates a private channel in the company's Slack workspace, invites the chosen people and the person
        who creates it, links the channel to the project and puts a link to the project at the top of the
        channel. Permission `projects.edit`.

        - People are matched to Slack by email. Who has no Slack user with the same email is not invited and is
          listed in `meta.skipped`; the others are invited anyway.
        - `meta.bookmark` is `false` when Slack refuses the link at the top (for example the app lacks the
          `bookmarks:write` scope); the channel is created and linked anyway.
        - `meta.invite_error` is set when the channel was created and linked but Slack refused the invitations.
        - A name already used on Slack returns `422` with `error.code: name_taken` and a free variant in
          `suggested`.
      parameters:
        - $ref: '#/components/parameters/ProjectId'
        - $ref: '#/components/parameters/Company'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [name]
              properties:
                name: { type: string, maxLength: 80, pattern: '^[a-z0-9_-]+$', description: "Lowercase letters, numbers, `-` and `_`." }
                user_ids: { type: array, maxItems: 200, items: { type: integer }, description: Nucleo users to invite. }
            example:
              name: app_acme
              user_ids: [12, 31]
      responses:
        '201':
          description: Channel created and linked. `data` is the project's channel list.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id: { type: integer }
                        slack_channel_id: { type: string }
                        slack_channel_name: { type: string }
                        url: { type: string }
                  meta:
                    type: object
                    properties:
                      channel_id: { type: integer, description: The `id` of the new link in `data`. }
                      invited: { type: array, items: { type: string }, description: Names of the people invited. }
                      skipped:
                        type: array
                        items:
                          type: object
                          properties:
                            name: { type: string }
                            email: { type: string }
                      bookmark: { type: boolean }
                      invite_error: { type: string, nullable: true }
              example:
                data:
                  - { id: 7, slack_channel_id: C0NEW000001, slack_channel_name: app_acme, url: 'https://slack.com/app_redirect?channel=C0NEW000001&team=T0TEAM' }
                meta:
                  channel_id: 7
                  invited: [Giulia Rossi, Marco Bianchi]
                  skipped: [{ name: Luca Verdi, email: l.verdi@example.com }]
                  bookmark: true
                  invite_error: null
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '422':
          description: Invalid or taken name, or Slack not connected.
          content:
            application/json:
              schema:
                oneOf:
                  - { $ref: '#/components/schemas/ValidationError' }
                  - { $ref: '#/components/schemas/CodedError' }
              example:
                message: '#app_acme already exists on Slack. Try #app_acme-2.'
                error:
                  code: name_taken
                  message: '#app_acme already exists on Slack. Try #app_acme-2.'
                suggested: app_acme-2
  /projects/{project}/slack-channels/{channel}/members:
    post:
      operationId: inviteToProjectSlackChannel
      summary: Add people to a project's Slack channel
      tags: [Projects]
      description: |
        Invites Nucleo users into a channel linked to the project, matched to Slack by email. Who has no Slack
        user with the same email is listed in `skipped`; people already in the channel count as invited. The
        Nucleo Slack app must be a member of the channel (it is, for channels created from the project).
        Permission `projects.edit`.
      parameters:
        - $ref: '#/components/parameters/ProjectId'
        - name: channel
          in: path
          required: true
          description: The `id` of the link (from the list), not the Slack channel id.
          schema: { type: integer }
        - $ref: '#/components/parameters/Company'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [user_ids]
              properties:
                user_ids: { type: array, minItems: 1, maxItems: 200, items: { type: integer } }
            example:
              user_ids: [44]
      responses:
        '200':
          description: Outcome of the invitations.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      invited: { type: array, items: { type: string } }
                      skipped:
                        type: array
                        items:
                          type: object
                          properties:
                            name: { type: string }
                            email: { type: string }
              example:
                data:
                  invited: [Anna Neri]
                  skipped: []
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '422':
          description: Slack not connected, or Slack refused the invitation (for example the app is not in the channel).
          content:
            application/json:
              schema: { $ref: '#/components/schemas/CodedError' }
  /projects/{project}/slack-channels/{channel}:
    patch:
      operationId: setProjectSlackChannelNotifications
      summary: Choose the task notifications a project channel gets
      tags: [Projects]
      description: |
        Nucleo posts one line in the channel when a task of the project is created, completed or assigned —
        only the events listed here. Off by default; an empty list turns them off. Only one channel of a project
        gets them: turning them on here turns them off on the project's other channels. Permission
        `projects.edit`.

        What never posts: imports (Asana, project plans), bulk edits from the task list, automatic reminders and
        anything done without a person behind it (queues, scheduled jobs). A task created from a Slack thread
        also gets a line in that thread when it is completed or reopened.
      parameters:
        - $ref: '#/components/parameters/ProjectId'
        - name: channel
          in: path
          required: true
          description: The `id` of the link (from the list), not the Slack channel id.
          schema: { type: integer }
        - $ref: '#/components/parameters/Company'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [notify_events]
              properties:
                notify_events:
                  type: array
                  items: { type: string, enum: [task_created, task_completed, task_assigned] }
            example:
              notify_events: [task_completed, task_assigned]
      responses:
        '200':
          description: Saved. The answer lists all the project's channels.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items: { $ref: '#/components/schemas/ProjectSlackChannel' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '422': { $ref: '#/components/responses/ValidationError' }
    delete:
      operationId: removeProjectSlackChannel
      summary: Remove a Slack channel from a project
      tags: [Projects]
      description: The channel stays on Slack; only the link to the project goes. Permission `projects.edit`.
      parameters:
        - $ref: '#/components/parameters/ProjectId'
        - name: channel
          in: path
          required: true
          description: The `id` of the link (from the list), not the Slack channel id.
          schema: { type: integer }
        - $ref: '#/components/parameters/Company'
      responses:
        '204':
          description: Removed.
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
  /projects/{project}/calls:
    get:
      operationId: listProjectCalls
      summary: List a project's calls
      tags: [Projects]
      description: |
        The recorded calls of the project (Google Meet, Gemini notes, Fireflies), oldest first. Permission
        `projects.view`.

        A call belongs to the project when:

        - it was **assigned by hand** to the project (`link: manual`), whatever its company or date; or
        - it is not assigned and it is a call **of the project's deal or company** that falls **within the
          project period**, from `start_date` to `actual_end_date` (an empty date leaves that end open;
          cancelled projects do not count) — `link: auto`. A call of a deal goes to that deal's project when it
          falls within its period.

        When a company call could belong to more than one project, Nucleo does not guess: the call is listed in
        `meta.to_assign` of each of those projects, with the projects in `candidates`. Assign it with
        `PUT /projects/{project}/calls/{call}`.

        **Recap.** Title, date, duration, organiser and participants are shown to whoever sees the project. The
        AI title, `summary`, `ai_summary` and `transcript_url` follow the call visibility rules: `title` is then the
        provider's title, the others are `null` and `recap_hidden` is `true`, unless the person organised or joined the call, can see its deal (`deals.view`) or company
        (`companies.view`), or is an Owner, Admin, sales manager or project manager.
      parameters:
        - $ref: '#/components/parameters/ProjectId'
        - $ref: '#/components/parameters/Company'
      responses:
        '200':
          description: The project's calls and the calls to assign.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items: { $ref: '#/components/schemas/ProjectCall' }
                  meta:
                    type: object
                    properties:
                      to_assign:
                        type: array
                        description: Calls of the company that could belong to more than one project, with `candidates`.
                        items: { $ref: '#/components/schemas/ProjectCall' }
              example:
                data:
                  - id: 501
                    title: Kickoff of the new website
                    provider: google_meet
                    started_at: '2026-10-15T09:30:00+00:00'
                    duration_seconds: 2700
                    organizer_email: anna@example.com
                    participants:
                      - { email: anna@example.com, name: Anna Rossi, kind: team, contact_id: null, company_name: null }
                      - { email: giulia@acme.example, name: Giulia Bianchi, kind: contact, contact_id: 88, company_name: Acme }
                    link: auto
                    deal_id: null
                    company_id: 14
                    recap_hidden: false
                    summary: 'Goals: online catalogue by January. Photos by the end of the month.'
                    ai_summary: Goals and timing of the new website.
                    transcript_url: https://meet.google.com/abc-defg-hij
                    candidates: null
                meta:
                  to_assign: []
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
  /projects/{project}/calls/{call}:
    put:
      operationId: assignCallToProject
      summary: Assign a call to a project
      tags: [Projects]
      description: |
        Assigns the call to the project by hand: from now on it shows in this project only, also when it was in
        another project, automatically or by hand. The person needs `projects.edit` and must be able to open the call, or
        the call must be of the project's deal or company; otherwise `404`. No body.
      parameters:
        - $ref: '#/components/parameters/ProjectId'
        - $ref: '#/components/parameters/CallId'
        - $ref: '#/components/parameters/Company'
      responses:
        '200':
          description: 'Assigned. The call as in the list, with `link: manual`.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  data: { $ref: '#/components/schemas/ProjectCall' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
    delete:
      operationId: unassignCallFromProject
      summary: Remove a call's assignment
      tags: [Projects]
      description: |
        Removes the hand assignment: the call goes back to the automatic rules, so it may still show in the
        project if it is of its deal or company and within its period. `404` if the call is not assigned by hand
        to this project. Permission `projects.edit`.
      parameters:
        - $ref: '#/components/parameters/ProjectId'
        - $ref: '#/components/parameters/CallId'
        - $ref: '#/components/parameters/Company'
      responses:
        '200':
          description: Assignment removed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id: { type: integer }
                      project_id: { type: 'null' }
              example:
                data: { id: 501, project_id: null }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
  /triage:
    get:
      operationId: listTriageRequests
      summary: List the requests of the Backlog queue
      tags: [Backlog]
      description: |
        Incoming requests from clients and colleagues (created in Nucleo, sent from Slack with «Send to triage» or
        `@Nucleo`), kept apart from the tasks until someone handles them. Each has Atomo's `proposal`. Permission
        `tasks.view`. `meta.counts.waiting`: requests waiting to be sorted (the menu number is `to_sort` of `/triage/count`).
      parameters:
        - name: view
          in: query
          description: '`waiting` (default: to triage now), `snoozed`, `done` (accepted, declined, merged).'
          schema: { type: string, enum: [waiting, snoozed, done] }
        - name: source
          in: query
          schema: { type: string, enum: [manual, slack, email] }
        - name: search
          in: query
          description: Title or requester.
          schema: { type: string }
        - name: per_page
          in: query
          schema: { type: integer, minimum: 10, maximum: 100, default: 50 }
        - $ref: '#/components/parameters/Company'
      responses:
        '200':
          description: One page of requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data: { type: array, items: { $ref: '#/components/schemas/TriageRequest' } }
                  meta:
                    type: object
                    properties:
                      total: { type: integer }
                      current_page: { type: integer }
                      last_page: { type: integer }
                      counts: { type: object, properties: { waiting: { type: integer }, snoozed: { type: integer } } }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
    post:
      operationId: createTriageRequest
      summary: Add a request to the Backlog queue
      tags: [Backlog]
      description: |
        Creates a request (source `manual`) and Atomo's proposal at once. Nothing is assigned and no task is created.
        Permission `tasks.manage`; at most 20 a minute per person.
      parameters:
        - $ref: '#/components/parameters/Company'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [title]
              properties:
                title: { type: string, maxLength: 500 }
                description: { type: [string, 'null'], maxLength: 20000 }
                author_name: { type: [string, 'null'], description: Who asked (client or colleague); default the user. }
                company_id: { type: [integer, 'null'], description: The client, if known. }
      responses:
        '201':
          description: The new request (status 201).
          content:
            application/json:
              schema:
                type: object
                properties:
                  data: { $ref: '#/components/schemas/TriageRequest' }
                  task: { type: object, properties: { id: { type: integer }, title: { type: string } }, description: 'accept and merge: the task.' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '422': { $ref: '#/components/responses/ValidationError' }
  /triage/count:
    get:
      operationId: countTriageRequests
      summary: Requests waiting to be triaged, and the whole queue to sort
      tags: [Backlog]
      description: |
        Permission `tasks.view`. `waiting`: requests waiting to be triaged (snoozed ones excluded). `to_sort`: the
        number shown next to Intake in the Operations menu, the whole queue to sort: `waiting` + tasks in `backlog`
        (open tasks without a person or without a due date, except those whose proposal was ignored) + the date
        changes the caller can approve (`pending` schedule shifts of the projects they manage, or all of them for a
        company admin). A task leaves the queue when it has both a person and a due date: it becomes `planned`.
        Draft tasks that still have their placeholder title are not counted.
        `by_label`: the totals of the Intake tabs: `request` (= `waiting`), `assignee` (backlog tasks without a
        person), `due` (backlog tasks without a due date) and `shift` (date changes to approve). A task missing both
        a person and a due date counts in both.
      parameters:
        - $ref: '#/components/parameters/Company'
      responses:
        '200':
          description: The count.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      waiting: { type: integer }
                      to_sort: { type: integer }
                      by_label:
                        type: object
                        properties:
                          request: { type: integer }
                          assignee: { type: integer }
                          due: { type: integer }
                          shift: { type: integer }
        '401': { $ref: '#/components/responses/Unauthorized' }
  /triage/{request}/accept:
    post:
      operationId: acceptTriageRequest
      summary: 'Accept a request: it becomes a task'
      tags: [Backlog]
      description: |
        Creates the task from Atomo's proposal (project, person, priority, estimate); any field in the body overrides it.
        With a person and no `due_date`, the task gets the person's first free slot (the same calculation as Plan):
        with a person and a date it is created `planned` and leaves Intake; otherwise it stays in `backlog`.
        The task keeps the request's source in `sources`; a request from Slack is linked to its thread like «Create task in Nucleo».
        A request already handled returns `422`.
      parameters:
        - name: request
          in: path
          required: true
          schema: { type: integer }
        - $ref: '#/components/parameters/Company'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                title: { type: string }
                description: { type: [string, 'null'] }
                project_id: { type: [integer, 'null'] }
                assignee_id: { type: [integer, 'null'] }
                estimate_hours: { type: [number, 'null'], exclusiveMinimum: 0 }
                priority: { type: string, enum: [low, medium, high] }
                due_date: { type: [string, 'null'], format: date }
      responses:
        '200':
          description: The request, updated.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data: { $ref: '#/components/schemas/TriageRequest' }
                  task: { type: object, properties: { id: { type: integer }, title: { type: string } }, description: 'accept and merge: the task.' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '422': { $ref: '#/components/responses/ValidationError' }
  /triage/{request}/decline:
    post:
      operationId: declineTriageRequest
      summary: Decline a request
      tags: [Backlog]
      description: |
        No task is created; the reason is kept with the request.
      parameters:
        - name: request
          in: path
          required: true
          schema: { type: integer }
        - $ref: '#/components/parameters/Company'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [reason]
              properties:
                reason: { type: string, maxLength: 2000 }
      responses:
        '200':
          description: The request, updated.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data: { $ref: '#/components/schemas/TriageRequest' }
                  task: { type: object, properties: { id: { type: integer }, title: { type: string } }, description: 'accept and merge: the task.' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '422': { $ref: '#/components/responses/ValidationError' }
  /triage/{request}/merge:
    post:
      operationId: mergeTriageRequest
      summary: Merge a request into an open task
      tags: [Backlog]
      description: |
        The request is a duplicate: the open task gets a comment with the request and its link, its source in `sources`
        and one more occurrence. Followers are notified.
      parameters:
        - name: request
          in: path
          required: true
          schema: { type: integer }
        - $ref: '#/components/parameters/Company'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [task_id]
              properties:
                task_id: { type: integer, description: An open task. }
      responses:
        '200':
          description: The request, updated.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data: { $ref: '#/components/schemas/TriageRequest' }
                  task: { type: object, properties: { id: { type: integer }, title: { type: string } }, description: 'accept and merge: the task.' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '422': { $ref: '#/components/responses/ValidationError' }
  /triage/{request}/snooze:
    post:
      operationId: snoozeTriageRequest
      summary: Snooze a request
      tags: [Backlog]
      description: |
        The request leaves the queue and comes back on its own on `until`.
      parameters:
        - name: request
          in: path
          required: true
          schema: { type: integer }
        - $ref: '#/components/parameters/Company'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [until]
              properties:
                until: { type: string, format: date, description: After today. }
      responses:
        '200':
          description: The request, updated.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data: { $ref: '#/components/schemas/TriageRequest' }
                  task: { type: object, properties: { id: { type: integer }, title: { type: string } }, description: 'accept and merge: the task.' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '422': { $ref: '#/components/responses/ValidationError' }
  /triage/{request}/propose:
    post:
      operationId: proposeTriageRequest
      summary: Ask Atomo for a new proposal
      tags: [Backlog]
      description: |
        Recomputes project, person, priority, estimate, duplicates and reason. At most 10 a minute per person.
      parameters:
        - name: request
          in: path
          required: true
          schema: { type: integer }
        - $ref: '#/components/parameters/Company'
      responses:
        '200':
          description: The request, updated.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data: { $ref: '#/components/schemas/TriageRequest' }
                  task: { type: object, properties: { id: { type: integer }, title: { type: string } }, description: 'accept and merge: the task.' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '422': { $ref: '#/components/responses/ValidationError' }
  /tasks/{task}/slack-threads/{thread}/summary:
    post:
      operationId: refreshTaskSlackThreadSummary
      summary: Rewrite the summary of a task's Slack thread
      tags: [Tasks]
      description: |
        Nucleo reads the Slack thread linked to the task and Atomo writes a new summary of two or three lines.
        The thread is read, not stored. Nucleo also rewrites it on its own whenever `@Nucleo` is mentioned in
        that thread. Permission `tasks.manage`; at most 10 calls a minute per person.

        If Slack does not answer (for example Nucleo was removed from a private channel) or the AI is not
        available, the answer is `422` and the previous summary stays.
      parameters:
        - name: task
          in: path
          required: true
          schema: { type: integer }
        - name: thread
          in: path
          required: true
          description: The `id` of the thread in the task's `slack_threads`, not the Slack timestamp.
          schema: { type: integer }
        - $ref: '#/components/parameters/Company'
      responses:
        '200':
          description: The thread with its new summary.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data: { $ref: '#/components/schemas/TaskSlackThread' }
              example:
                data:
                  id: 12
                  channel_id: C0123ABCD
                  channel_name: web_acme
                  author_name: Marco Rossi
                  thread_ts: '1732183200.001900'
                  permalink: https://acme.slack.com/archives/C0123ABCD/p1732183200001900
                  summary: The PayPal checkout fails on mobile. Giulia takes it and will fix it by Friday.
                  summary_at: '2026-11-21T17:40:00+00:00'
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '422':
          description: Slack or the AI did not answer; nothing changed.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Error' }
  /tasks/{task}/agent:
    post:
      operationId: sendTaskToAgent
      summary: Send a task to the coding agent
      tags: [Tasks]
      description: |
        Starts a run of the coding agent on the task. The answer comes right away with the run `queued`; follow it
        in `agent_run` of `GET /tasks/{task}`. Permission `tasks.manage`; at most 10 calls a minute per person.

        A task that is done, or that the agent is already working on (`queued` or `working`), answers `422`.
      parameters:
        - name: task
          in: path
          required: true
          schema: { type: integer }
        - $ref: '#/components/parameters/Company'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                agent:
                  type: string
                  enum: [claude_code]
                  default: claude_code
                  description: The coding agent. Only `claude_code` (Claude Code) for now.
                auto_merge:
                  type: boolean
                  default: false
                  description: '`false`: the agent stops at the pull request (`pr_open`) and a developer merges it. `true`: explicit request to publish, the agent merges it by itself (`merged`).'
      responses:
        '201':
          description: The run, queued.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data: { $ref: '#/components/schemas/TaskAgentRun' }
              example:
                data:
                  id: 7
                  agent: claude_code
                  agent_name: Claude Code
                  driver: fake
                  status: queued
                  repository: acme/shop
                  issue_url: null
                  pr_url: null
                  auto_merge: false
                  message: null
                  requested_by: 3
                  created_at: '2026-11-22T10:00:00+00:00'
                  updated_at: '2026-11-22T10:00:00+00:00'
                  finished_at: null
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404': { $ref: '#/components/responses/NotFound' }
        '422':
          description: The task is done, the agent is already working on it, or the agent is not available.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Error' }
  /tasks/{task}/draft:
    delete:
      operationId: discardTaskDraft
      summary: Discard an untouched new task
      tags: [Tasks]
      description: |
        «Add task» creates a task with a placeholder title and opens it. If the person closes it without writing
        anything, this call moves it to the trash, only if it is still an empty draft of the caller: placeholder title,
        no description, no subtasks and no comments. Otherwise nothing changes and `discarded` is `false`. Permission
        `tasks.manage`. A trashed task can be restored from the trash for 30 days.
      parameters:
        - name: task
          in: path
          required: true
          schema: { type: integer }
        - $ref: '#/components/parameters/Company'
      responses:
        '200':
          description: Whether the draft was discarded.
          content:
            application/json:
              schema:
                type: object
                properties:
                  discarded: { type: boolean }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
  /schedule-shifts:
    get:
      operationId: listScheduleShifts
      summary: List schedule shifts
      tags: [Schedule shifts]
      description: |
        The latest 200 shifts, newest first (not paginated). Permission `tasks.view`.

        Each shift adds `can_decide` (the caller can approve or reject it now), `task` (title and priority of
        the shifted task) and `user_name` (the person whose task moves).
      parameters:
        - name: status
          in: query
          schema: { $ref: '#/components/schemas/ShiftStatus' }
        - name: user_id
          in: query
          description: Only shifts of this person.
          schema: { type: integer }
        - name: project_id
          in: query
          description: Only shifts of this project.
          schema: { type: integer }
        - name: mine_to_decide
          in: query
          description: |
            `1` = only `pending` shifts the caller can decide: of the projects they manage, or all of them for
            a company admin. Use `1` or `0` (`true` is refused with `422`).
          schema:
            type: integer
            enum: [0, 1]
        - $ref: '#/components/parameters/Company'
      responses:
        '200':
          description: The shifts.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items: { $ref: '#/components/schemas/ScheduleShiftListItem' }
              example:
                data:
                  - id: 87
                    user_id: 15
                    project_id: 230
                    shiftable_type: task
                    shiftable_id: 5120
                    from_starts_on: '2026-11-23'
                    from_ends_on: '2026-11-25'
                    to_starts_on: '2026-11-26'
                    to_ends_on: '2026-11-30'
                    reason: Waiting for the client's copy.
                    caused_by_allocation_id: null
                    status: pending
                    requested_by: 15
                    decided_by: null
                    decided_at: null
                    decision_note: null
                    created_at: '2026-11-20T09:12:44.000000Z'
                    updated_at: '2026-11-20T09:12:44.000000Z'
                    project: { id: 230, name: Acme — new website, project_manager_id: 12 }
                    can_decide: true
                    task: { id: 5120, title: Homepage layout, priority: high }
                    user_name: Giulia Rossi
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '422': { $ref: '#/components/responses/ValidationError' }
    post:
      operationId: createScheduleShift
      summary: Request a schedule shift
      tags: [Schedule shifts]
      description: |
        Asks to move a task's dates. The shift is created `pending` for the person assigned to the task and the
        task's project; the current dates are kept in `from_starts_on` and `from_ends_on`. Permission
        `tasks.manage`.

        A task without a start date keeps none: only its due date moves and `to_starts_on` is ignored. Without
        `to_starts_on`, the start stays the same.
      parameters:
        - $ref: '#/components/parameters/Company'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [shiftable_type, shiftable_id, to_ends_on, reason]
              properties:
                shiftable_type:
                  type: string
                  enum: [task]
                shiftable_id:
                  type: integer
                  description: The task id.
                to_starts_on:
                  type: [string, 'null']
                  format: date
                  description: New start date (`YYYY-MM-DD`).
                to_ends_on:
                  type: string
                  format: date
                  description: New due date (`YYYY-MM-DD`), not before `to_starts_on`.
                reason:
                  type: string
                  minLength: 3
                  maxLength: 2000
            example:
              shiftable_type: task
              shiftable_id: 5120
              to_starts_on: '2026-11-26'
              to_ends_on: '2026-11-30'
              reason: Waiting for the client's copy.
      responses:
        '201':
          description: |
            The shift, `pending`. Only the stored fields are returned: no `project`, `can_decide`, `task` or
            `user_name`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data: { $ref: '#/components/schemas/ScheduleShift' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '404':
          description: '`Item not found.` — no task with this id.'
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Error' }
        '409':
          description: '`A shift for this item is already waiting for approval.`'
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Error' }
        '422':
          description: |
            Invalid fields, or `The item has no person assigned.`, or `The new end is before the start: pass the
            new start too.` (the task's current start is after `to_ends_on`).
          content:
            application/json:
              schema: { $ref: '#/components/schemas/ValidationError' }
  /schedule-shifts/{shift}/approve:
    post:
      operationId: approveScheduleShift
      summary: Approve a schedule shift
      tags: [Schedule shifts]
      description: |
        Only the project manager of the shift's project or a company admin. The task gets the new dates, and the
        reason (with the note, if any) is added to the task's schedule history.
      parameters:
        - $ref: '#/components/parameters/ShiftId'
        - $ref: '#/components/parameters/Company'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                note:
                  type: [string, 'null']
                  maxLength: 2000
      responses:
        '200': { $ref: '#/components/responses/DecidedShift' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403':
          description: '`Only the project manager can decide on this shift.`'
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Error' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409':
          description: |
            Not applied: `This shift has already been decided.`, `The item no longer exists.` or `The item dates
            changed after the shift was proposed: propose it again.`
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Error' }
        '422': { $ref: '#/components/responses/ValidationError' }
  /schedule-shifts/{shift}/reject:
    post:
      operationId: rejectScheduleShift
      summary: Reject a schedule shift
      tags: [Schedule shifts]
      description: Only the project manager of the shift's project or a company admin. A note is required.
      parameters:
        - $ref: '#/components/parameters/ShiftId'
        - $ref: '#/components/parameters/Company'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [note]
              properties:
                note:
                  type: string
                  maxLength: 2000
            example:
              note: The launch date cannot move.
      responses:
        '200': { $ref: '#/components/responses/DecidedShift' }
        '401': { $ref: '#/components/responses/Unauthorized' }
        '403':
          description: '`Only the project manager can decide on this shift.`'
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Error' }
        '404': { $ref: '#/components/responses/NotFound' }
        '409':
          description: '`This shift has already been decided.`'
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Error' }
        '422':
          description: '`note` is missing or too long.'
          content:
            application/json:
              schema: { $ref: '#/components/schemas/ValidationError' }
components:
  securitySchemes:
    nucleoOidc:
      type: http
      scheme: bearer
      description: |
        A person's access token from Nucleo sign-in (`auth.nucleoplatform.com`), issued to a client that Nucleo
        registered: `Authorization: Bearer <access_token>`. Tokens of self-registered AI clients are refused.
  parameters:
    Company:
      name: X-Nucleo-Company
      in: header
      required: false
      description: |
        The company's public id (or numeric id). Needed when the token does not name a company and the person
        belongs to more than one.
      schema: { type: string }
    ProjectId:
      name: project
      in: path
      required: true
      description: The project `id`.
      schema: { type: integer }
    CallId:
      name: call
      in: path
      required: true
      description: The call `id`.
      schema: { type: integer }
    ShiftId:
      name: shift
      in: path
      required: true
      description: The shift `id`.
      schema: { type: integer }
  responses:
    Unauthorized:
      description: Missing, expired or refused token.
      content:
        application/json:
          schema: { $ref: '#/components/schemas/Error' }
          example: { message: Unauthenticated. }
    Forbidden:
      description: The person lacks the permission, or cannot enter the company.
      content:
        application/json:
          schema: { $ref: '#/components/schemas/Error' }
    NoCompany:
      description: No `X-Nucleo-Company` and the company cannot be inferred from the token.
      content:
        application/json:
          schema: { $ref: '#/components/schemas/Error' }
    NotFound:
      description: Not found in this company.
      content:
        application/json:
          schema: { $ref: '#/components/schemas/Error' }
    ValidationError:
      description: Invalid fields.
      content:
        application/json:
          schema: { $ref: '#/components/schemas/ValidationError' }
    DecidedShift:
      description: The shift after the decision, with `project` (`id`, `name`).
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                allOf:
                  - $ref: '#/components/schemas/ScheduleShift'
                  - type: object
                    properties:
                      project:
                        type: [object, 'null']
                        properties:
                          id: { type: integer }
                          name: { type: string }
  schemas:
    Error:
      type: object
      required: [message]
      properties:
        message: { type: string }
    ValidationError:
      type: object
      required: [message]
      properties:
        message: { type: string }
        errors:
          type: object
          description: Messages per field.
          additionalProperties:
            type: array
            items: { type: string }
      example:
        message: The color field format is invalid.
        errors:
          color: [The color field format is invalid.]
    CodedError:
      type: object
      required: [message, error]
      properties:
        message: { type: string }
        error:
          type: object
          properties:
            code: { type: string }
            message: { type: string }
    ProjectSlackChannel:
      type: object
      properties:
        id: { type: integer, description: Id of the link between the project and the channel. }
        slack_channel_id: { type: string, description: 'Slack channel id (`C…` or `G…`).' }
        slack_channel_name: { type: string, description: Channel name without `#`. }
        url: { type: string, format: uri, description: Opens the channel in Slack (app or browser). }
        notify_events:
          type: array
          description: |
            Task notifications Nucleo posts in this channel. Empty = off (the default). Only one channel of a
            project gets them.
          items: { type: string, enum: [task_created, task_completed, task_assigned] }
    TriageRequest:
      type: object
      description: A request of the Operations Backlog queue.
      properties:
        id: { type: integer }
        title: { type: string }
        description: { type: [string, 'null'] }
        source_type: { type: string, enum: [manual, slack, email] }
        source: { type: [object, 'null'], description: 'Where it came from: for Slack `channel`, `ts`, `thread_ts`, `url`, `author_slack_id`.' }
        author_name: { type: [string, 'null'] }
        company: { type: [object, 'null'], properties: { id: { type: integer }, name: { type: [string, 'null'] } } }
        status: { type: string, enum: [pending, accepted, declined, merged] }
        snoozed_until: { type: [string, 'null'], format: date }
        proposal:
          type: [object, 'null']
          description: Atomo's proposal. Nothing is written until the request is accepted.
          properties:
            project_id: { type: [integer, 'null'] }
            project_name: { type: [string, 'null'] }
            company_id: { type: [integer, 'null'] }
            company_name: { type: [string, 'null'] }
            assignee_id: { type: [integer, 'null'], description: Who of the project's area would finish first, as Plan proposes. }
            assignee_name: { type: [string, 'null'] }
            priority: { type: string, enum: [low, medium, high] }
            estimate_hours: { type: [number, 'null'] }
            duplicates: { type: array, items: { type: object, properties: { id: { type: integer }, title: { type: string } } }, description: Open tasks that may ask the same thing. }
            reason: { type: [string, 'null'], description: One line. }
        proposed_at: { type: [string, 'null'], format: date-time }
        task_id: { type: [integer, 'null'], description: The task created (accepted) or merged into. }
        decline_reason: { type: [string, 'null'] }
        decided_at: { type: [string, 'null'], format: date-time }
        created_at: { type: string, format: date-time }
    TaskSlackThread:
      type: object
      description: The Slack thread a task comes from, as listed in `slack_threads` of `GET /tasks/{task}`.
      properties:
        id: { type: integer }
        channel_id: { type: string, description: Slack channel id. }
        channel_name: { type: [string, 'null'], description: Channel name, known after the first summary. }
        author_name: { type: [string, 'null'], description: Author of the thread's first message. }
        thread_ts: { type: string, description: Slack timestamp of the thread. }
        permalink: { type: [string, 'null'], format: uri, description: Opens the thread in Slack. }
        summary: { type: [string, 'null'], description: Two or three lines written by Atomo. }
        summary_at: { type: [string, 'null'], format: date-time, description: When the summary was last written. }
    TaskAgentRun:
      type: object
      description: A run of the coding agent on a task, as in `agent_run` of `GET /tasks/{task}`.
      properties:
        id: { type: integer }
        agent: { type: string, enum: [claude_code] }
        agent_name: { type: string, description: Display name of the agent. }
        driver: { type: string, description: 'How the agent runs. `fake` is a dry run: the states and the pull request link are simulated and nothing is written on GitHub.' }
        status: { type: string, enum: [queued, working, pr_open, merged, needs_review, failed] }
        repository: { type: [string, 'null'], description: The project's repository when the task was sent. }
        issue_url: { type: [string, 'null'], format: uri, description: The issue opened for the agent, when there is one. }
        pr_url: { type: [string, 'null'], format: uri, description: 'The pull request opened by the agent, with `pr_open` or `merged`.' }
        auto_merge: { type: boolean, description: 'Whether the agent merges its pull request by itself.' }
        message: { type: [string, 'null'], description: 'What the agent says about the run, for example why it needs a review.' }
        requested_by: { type: [integer, 'null'], description: The person who sent the task. }
        last_activity_at: { type: [string, 'null'], format: date-time, description: 'Last sign of life of the agent (a workflow queued or running, comments forwarded to it). After 30 minutes without one, the run fails.' }
        created_at: { type: string, format: date-time }
        updated_at: { type: string, format: date-time }
        finished_at: { type: [string, 'null'], format: date-time, description: 'When the run stopped: `pr_open`, `merged`, `needs_review` or `failed`.' }
    CallParticipant:
      type: object
      properties:
        email: { type: string }
        name: { type: string, description: The person's name when known, otherwise the email. }
        kind:
          type: string
          enum: [team, contact, unknown]
          description: '`team` = a Nucleo user (matched by email), `contact` = a CRM contact, `unknown` = only the email.'
        contact_id: { type: [integer, 'null'] }
        company_name: { type: [string, 'null'], description: The contact's company. }
    ProjectCall:
      type: object
      properties:
        id: { type: integer }
        title: { type: string, description: 'The AI title when there is one and the recap is visible, otherwise the title from the provider.' }
        provider: { type: string, description: 'Where the call comes from: `google_meet` (Meet and Gemini notes) or `fireflies`.' }
        started_at: { type: [string, 'null'], format: date-time }
        duration_seconds: { type: [integer, 'null'] }
        organizer_email: { type: [string, 'null'] }
        participants:
          type: array
          items: { $ref: '#/components/schemas/CallParticipant' }
        link:
          type: string
          enum: [manual, auto]
          description: '`manual` = assigned by hand to a project, `auto` = from the deal or company and the period.'
        deal_id: { type: [integer, 'null'] }
        company_id: { type: [integer, 'null'] }
        recap_hidden: { type: boolean, description: '`true` when the person cannot open the call: recap and link are `null`.' }
        summary: { type: [string, 'null'], description: The recap of the call. }
        ai_summary: { type: [string, 'null'], description: A one-line summary. }
        transcript_url: { type: [string, 'null'], description: Link to the recording or the transcript. }
        candidates:
          type: [array, 'null']
          description: Only in `to_assign`, the projects the call could belong to.
          items:
            type: object
            properties:
              id: { type: integer }
              name: { type: string }
    ProjectStatus:
      type: string
      enum: [proposed, planned, active, completed, cancelled]
    ProjectKind:
      type: string
      enum: [client, supplier, internal]
    ProjectType:
      type: [string, 'null']
      enum: [setup, maintenance, null]
      description: Kind of work. `null` = not set.
    HoursPeriod:
      type: [string, 'null']
      enum: [month, quarter, year, null]
      description: Length of the hours budget period (default `month`).
    ProjectHoursUsage:
      type: [object, 'null']
      description: Counter of the current hours period. `null` when the project is not `maintenance` or has no `hours_budget`.
      properties:
        period: { type: string, enum: [month, quarter, year] }
        starts_on: { type: string, format: date }
        renews_on: { type: string, format: date, description: The day the next period starts (excluded from this one). }
        budget_hours: { type: number }
        carried_hours: { type: number, description: Hours carried over from the previous period. }
        available_hours: { type: number, description: '`budget_hours` + `carried_hours`.' }
        used_hours: { type: number, description: Hours of the tasks completed in the period. }
        estimated_hours: { type: number, description: Part of `used_hours` taken from estimates (tasks without actual hours). }
        remaining_hours: { type: number, description: Negative when over the budget. }
        percent: { type: integer }
        alert_percent: { type: integer }
        state: { type: string, enum: [ok, warning, over] }
        tasks_done: { type: integer }
      example: { period: month, starts_on: '2026-11-01', renews_on: '2026-12-01', budget_hours: 20, carried_hours: 0, available_hours: 20, used_hours: 17.5, estimated_hours: 2, remaining_hours: 2.5, percent: 88, alert_percent: 80, state: warning, tasks_done: 9 }
    Color:
      type: [string, 'null']
      pattern: '^#[0-9A-Fa-f]{6}$'
      description: Colour in the plan, `#RRGGBB`. `null` = automatic, from Nucleo's palette.
      example: '#2563EB'
    Project:
      type: object
      properties:
        id: { type: integer }
        name: { type: string }
        color: { $ref: '#/components/schemas/Color' }
        domain: { type: [string, 'null'], description: The project's web domain. Unique among projects. }
        status: { $ref: '#/components/schemas/ProjectStatus' }
        health:
          type: [string, 'null']
          enum: [on_track, at_risk, off_track, null]
          description: Project health, chosen by the project manager on the project's main screen. `null` when not set.
        kind: { $ref: '#/components/schemas/ProjectKind' }
        project_type: { $ref: '#/components/schemas/ProjectType' }
        hours_budget: { type: [number, 'null'], description: Hours included per period (maintenance). }
        hours_period: { $ref: '#/components/schemas/HoursPeriod' }
        hours_renews_on: { type: [string, 'null'], format: date, description: The period starts again from this day. }
        hours_carry_over: { type: boolean, description: Hours left at the renewal go to the next period. }
        hours_alert_percent: { type: [integer, 'null'], description: 'Threshold of the notification to the PM, % of the hours (default 80).' }
        hours_usage: { $ref: '#/components/schemas/ProjectHoursUsage' }
        contract_id: { type: [integer, 'null'] }
        has_active_contract:
          type: [boolean, 'null']
          description: Whether the project has an active contract. Only in the list; `null` elsewhere.
        start_date: { type: [string, 'null'], format: date }
        expected_end_date: { type: [string, 'null'], format: date }
        actual_end_date: { type: [string, 'null'], format: date }
        locked_after: { type: [string, 'null'], format: date, description: After this date the project is locked. }
        is_locked: { type: boolean }
        lock_reason: { type: [string, 'null'] }
        is_proposed: { type: boolean, description: '`status` is `proposed`.' }
        client_approval_days: { type: [integer, 'null'], description: Days the client has to approve a delivery. }
        plan_summary: { type: [string, 'null'] }
        plan_generated_at: { type: [string, 'null'], format: date-time }
        approved_at: { type: [string, 'null'], format: date-time, description: When the project plan was approved. }
        approved_by: { type: [integer, 'null'], description: User id of who approved the plan. }
        asana_gid: { type: [string, 'null'], description: The Asana project it was imported from. }
        budget_cents: { type: [integer, 'null'], description: Budget in cents. }
        budget: { type: [number, 'null'], description: Budget in units (`budget_cents` / 100). Read-only. }
        currency: { type: [string, 'null'], description: Three-letter currency code. }
        description: { type: [string, 'null'], description: 'Rich text as HTML (paragraphs, bold, italic, underline, strike, lists, links), cleaned by the server like a task description; plain text without tags is kept as it is.' }
        company_id: { type: integer, description: The client company. }
        company:
          type: object
          description: The client company (id, name, VAT number, address and more).
          properties:
            id: { type: integer }
            name: { type: string }
        deal_id: { type: [integer, 'null'] }
        deal:
          type: object
          description: The deal the project comes from, when there is one. Not in the list.
          properties:
            id: { type: integer }
            title: { type: string }
        project_manager_id: { type: [integer, 'null'] }
        project_manager: { $ref: '#/components/schemas/UserMinimal' }
        business_owner_id: { type: [integer, 'null'] }
        tech_owner_id: { type: [integer, 'null'] }
        marketing_owner_id: { type: [integer, 'null'] }
        design_owner_id: { type: [integer, 'null'] }
        repository:
          type: [string, 'null']
          maxLength: 200
          pattern: '^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$'
          description: GitHub repository of the project, `owner/name`, where the coding agent opens pull requests. `null` when not set.
        service_instances:
          type: array
          description: Services active on the project. Only in `GET /projects/{project}`.
          items:
            type: object
            properties:
              id: { type: integer }
              service_id: { type: [integer, 'null'] }
              name: { type: string }
              quantity: { type: number }
              unit_price: { type: number }
              total: { type: number }
              currency: { type: string }
              status: { type: string }
              start_date: { type: [string, 'null'], format: date }
              end_date: { type: [string, 'null'], format: date }
        partners:
          type: array
          description: Partners credited with a share of the project. Only in `GET /projects/{project}`.
          items:
            type: object
            properties:
              id: { type: integer }
              name: { type: string }
              brand_name: { type: [string, 'null'] }
              quota_percent: { type: number }
        slas:
          type: array
          description: Service levels of the project. Only in `GET /projects/{project}`.
          items:
            type: object
            properties:
              id: { type: integer }
              name: { type: string }
              metric: { type: string }
              target_value: { type: number }
              target_unit: { type: [string, 'null'] }
              scope: { type: [string, 'null'] }
              source: { type: [string, 'null'] }
              alert_at_percent: { type: [integer, 'null'] }
              is_active: { type: boolean }
        created_at: { type: string, format: date-time }
        updated_at: { type: string, format: date-time }
      example:
        id: 230
        name: Acme — new website
        color: '#2563EB'
        domain: acme.example
        status: active
        kind: client
        contract_id: 77
        has_active_contract: true
        start_date: '2026-12-01'
        expected_end_date: '2027-03-31'
        actual_end_date: null
        locked_after: null
        is_locked: false
        lock_reason: null
        is_proposed: false
        client_approval_days: 5
        plan_summary: null
        plan_generated_at: null
        approved_at: null
        approved_by: null
        asana_gid: null
        budget_cents: 4500000
        budget: 45000
        currency: EUR
        description: null
        company_id: 418
        company: { id: 418, name: Acme S.r.l. }
        deal_id: null
        project_manager_id: 12
        project_manager: { id: 12, name: Marco Bianchi, email: marco@example.com, avatar_url: null }
        business_owner_id: null
        tech_owner_id: 15
        marketing_owner_id: null
        design_owner_id: null
        repository: null
        created_at: '2026-11-20T09:00:00+00:00'
        updated_at: '2026-11-20T09:00:00+00:00'
    UserMinimal:
      type: object
      properties:
        id: { type: integer }
        name: { type: string }
        email: { type: string }
        avatar_url: { type: [string, 'null'] }
    ProjectCreate:
      type: object
      required: [name, company_id, start_date]
      properties:
        name: { type: string, maxLength: 255 }
        company_id: { type: integer, description: The client company. }
        start_date: { type: string, format: date }
        expected_end_date: { type: [string, 'null'], format: date, description: Not before `start_date`. }
        actual_end_date: { type: [string, 'null'], format: date, description: Not before `start_date`. }
        color: { $ref: '#/components/schemas/Color' }
        domain: { type: [string, 'null'], maxLength: 255, description: Unique among projects. }
        status: { $ref: '#/components/schemas/ProjectStatus' }
        kind: { $ref: '#/components/schemas/ProjectKind' }
        project_type: { $ref: '#/components/schemas/ProjectType' }
        hours_budget: { type: [number, 'null'], minimum: 0, maximum: 99999 }
        hours_period: { $ref: '#/components/schemas/HoursPeriod' }
        hours_renews_on: { type: [string, 'null'], format: date }
        hours_carry_over: { type: boolean }
        hours_alert_percent: { type: [integer, 'null'], minimum: 1, maximum: 100 }
        deal_id: { type: [integer, 'null'] }
        contract_id: { type: [integer, 'null'] }
        project_manager_id: { type: [integer, 'null'] }
        business_owner_id: { type: [integer, 'null'] }
        tech_owner_id: { type: [integer, 'null'] }
        marketing_owner_id: { type: [integer, 'null'] }
        design_owner_id: { type: [integer, 'null'] }
        repository:
          type: [string, 'null']
          maxLength: 200
          pattern: '^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$'
          description: GitHub repository of the project, `owner/name`, where the coding agent opens pull requests. `null` when not set.
        budget_cents: { type: [integer, 'null'], minimum: 0 }
        currency: { type: [string, 'null'], minLength: 3, maxLength: 3, default: EUR }
        description: { type: [string, 'null'], description: 'Rich text as HTML (paragraphs, bold, italic, underline, strike, lists, links), cleaned by the server like a task description; plain text without tags is kept as it is.' }
    ProjectUpdate:
      type: object
      description: |
        Same fields as when creating, all optional, plus `client_approval_days` and `plan_summary`. `name`,
        `company_id` and `start_date` cannot be `null`; `status` and `currency` cannot be `null` either.
        Here the end dates are not checked against `start_date`.
      properties:
        name: { type: string, maxLength: 255 }
        company_id: { type: integer }
        start_date: { type: string, format: date }
        expected_end_date: { type: [string, 'null'], format: date }
        actual_end_date: { type: [string, 'null'], format: date }
        color: { $ref: '#/components/schemas/Color' }
        domain: { type: [string, 'null'], maxLength: 255 }
        status: { $ref: '#/components/schemas/ProjectStatus' }
        health:
          type: [string, 'null']
          enum: [on_track, at_risk, off_track, null]
          description: Project health, chosen by the project manager on the project's main screen. `null` when not set.
        kind: { $ref: '#/components/schemas/ProjectKind' }
        project_type: { $ref: '#/components/schemas/ProjectType' }
        hours_budget: { type: [number, 'null'], minimum: 0, maximum: 99999 }
        hours_period: { $ref: '#/components/schemas/HoursPeriod' }
        hours_renews_on: { type: [string, 'null'], format: date }
        hours_carry_over: { type: boolean }
        hours_alert_percent: { type: [integer, 'null'], minimum: 1, maximum: 100 }
        deal_id: { type: [integer, 'null'] }
        contract_id: { type: [integer, 'null'] }
        project_manager_id: { type: [integer, 'null'] }
        business_owner_id: { type: [integer, 'null'] }
        tech_owner_id: { type: [integer, 'null'] }
        marketing_owner_id: { type: [integer, 'null'] }
        design_owner_id: { type: [integer, 'null'] }
        repository:
          type: [string, 'null']
          maxLength: 200
          pattern: '^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$'
          description: GitHub repository of the project, `owner/name`, where the coding agent opens pull requests. `null` when not set.
        budget_cents: { type: [integer, 'null'], minimum: 0 }
        currency: { type: string, minLength: 3, maxLength: 3 }
        description: { type: [string, 'null'], description: 'Rich text as HTML (paragraphs, bold, italic, underline, strike, lists, links), cleaned by the server like a task description; plain text without tags is kept as it is.' }
        client_approval_days: { type: [integer, 'null'], minimum: 1, maximum: 60 }
        plan_summary: { type: [string, 'null'], maxLength: 2000 }
    ProjectFinancials:
      type: object
      properties:
        currency: { type: string, description: The project's currency (`EUR` if not set). }
        budget_cents: { type: [integer, 'null'] }
        spent_cents: { type: integer, description: Cost of the work done so far. }
        remaining_cents: { type: integer, description: Expected cost of the work still open. }
        forecast_cents: { type: integer, description: '`spent_cents` + `remaining_cents`.' }
        margin_cents: { type: [integer, 'null'], description: '`budget_cents` − `forecast_cents`; `null` without a budget.' }
        burn_percent: { type: [integer, 'null'], description: '`spent_cents` as a percentage of the budget; `null` without a budget.' }
        hours:
          type: object
          description: Hours, rounded to one decimal.
          properties:
            actual: { type: number, description: Hours logged on the tasks. }
            assumed: { type: number, description: Estimates of closed tasks without logged hours. }
            remaining: { type: number, description: Corrected estimates of the open tasks. }
            without_cost: { type: number, description: Hours of people without an hourly cost, left out of the amounts. }
    ShiftStatus:
      type: string
      enum: [pending, approved, rejected]
    ScheduleShift:
      type: object
      properties:
        id: { type: integer }
        user_id: { type: integer, description: The person assigned to the task. }
        project_id: { type: [integer, 'null'] }
        shiftable_type: { type: string, enum: [task] }
        shiftable_id: { type: integer, description: The task id. }
        from_starts_on: { type: [string, 'null'], format: date }
        from_ends_on: { type: string, format: date }
        to_starts_on: { type: [string, 'null'], format: date }
        to_ends_on: { type: string, format: date }
        reason: { type: string }
        caused_by_allocation_id: { type: [integer, 'null'], description: Older shifts only. }
        status: { $ref: '#/components/schemas/ShiftStatus' }
        requested_by: { type: [integer, 'null'], description: User id of who asked. }
        decided_by: { type: [integer, 'null'] }
        decided_at: { type: [string, 'null'], format: date-time }
        decision_note: { type: [string, 'null'] }
        created_at: { type: string, format: date-time }
        updated_at: { type: string, format: date-time }
    ScheduleShiftListItem:
      allOf:
        - $ref: '#/components/schemas/ScheduleShift'
        - type: object
          properties:
            project:
              type: [object, 'null']
              properties:
                id: { type: integer }
                name: { type: string }
                project_manager_id: { type: [integer, 'null'] }
            can_decide: { type: boolean, description: The shift is `pending` and the caller can decide it. }
            task:
              type: [object, 'null']
              description: The shifted task; `null` if it no longer exists.
              properties:
                id: { type: integer }
                title: { type: string }
                priority: { type: string, enum: [low, medium, high], description: '`low` when not set.' }
            user_name: { type: [string, 'null'], description: Name of the person whose task moves. }
    PageLinks:
      type: object
      properties:
        first: { type: [string, 'null'] }
        last: { type: [string, 'null'] }
        prev: { type: [string, 'null'] }
        next: { type: [string, 'null'] }
    PageMeta:
      type: object
      properties:
        current_page: { type: integer }
        from: { type: [integer, 'null'] }
        last_page: { type: integer }
        path: { type: string }
        per_page: { type: integer }
        to: { type: [integer, 'null'] }
        total: { type: integer }
