{
  "openapi": "3.1.0",
  "info": {
    "title": "Leanmote API",
    "version": "1.0",
    "description": "Read and manage your organization's engineering data: headline metrics, people, teams, org chart, boards and tasks, Git activity, calendars, alerts, insights and agents. The **Metrics API** group reads every metric set of the app (DORA, flow, AI adoption, cost…) with explicit filters.\n\n**Authenticate** with your API token in the `Authorization` header (the `Bearer ` prefix is optional). Create it in Leanmote, **Integrations → Leanmote API**. Check it with `GET /users/me`.\n\n**Responses** are an envelope: `{\"status\": \"success\", \"data\": ..., \"meta\": ...}`, or `{\"status\": \"failed\", \"code\": ..., \"data\": {\"message\": ...}}` when the request is refused; the `code` is stable. A missing or invalid token gets `401`. Lists paginate with `page` and `per_page`."
  },
  "servers": [
    {
      "url": "https://api.leanmote.com/v1"
    }
  ],
  "security": [
    {
      "token": []
    }
  ],
  "components": {
    "securitySchemes": {
      "token": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "description": "Your Leanmote API token, from Integrations → Leanmote API, sent as the header's value with or without the `Bearer ` prefix."
      }
    },
    "parameters": {
      "Organization": {
        "name": "Organization",
        "in": "header",
        "required": false,
        "description": "Numeric organization id. Optional: without it a token works on its owner's first organization.",
        "schema": {
          "type": "integer"
        }
      }
    }
  },
  "tags": [
    {
      "name": "Executive summary",
      "description": "Headline metrics for a period — DORA, time to market, AI adoption, availability — globally and per segment, each with its previous period."
    },
    {
      "name": "Bottleneck insights",
      "description": "The bottlenecks Leanmote detected in your views, with the items and people they affect."
    },
    {
      "name": "Cell runs",
      "description": "What each problem cell of a view found and recovered, and its report."
    },
    {
      "name": "Dashboard views",
      "description": "Your dashboards, the widget catalogue and the organization's custom filters."
    },
    {
      "name": "Organizations",
      "description": "Your organization, its members, teams and connected apps."
    },
    {
      "name": "Teams",
      "description": "Teams, their members, leads, tasks and interactions."
    },
    {
      "name": "Users",
      "description": "People, the teams they belong to and their tools. `GET /users/me` says who a token belongs to."
    },
    {
      "name": "Org chart",
      "description": "The resolved team hierarchy, and the import that proposes one from team names."
    },
    {
      "name": "API credentials (Admin)",
      "description": "Issue, list and revoke API tokens for a user of your organization."
    },
    {
      "name": "Boards",
      "description": "Boards (Jira, Azure Boards, Linear…) and their tasks."
    },
    {
      "name": "Tasks",
      "description": "Tasks across boards, with their status history."
    },
    {
      "name": "Git",
      "description": "Repositories, commits, pull requests and deployments of your Git apps."
    },
    {
      "name": "Interactions",
      "description": "Commits, pull requests, reviews and comments, filterable by app, team and date."
    },
    {
      "name": "Calendar",
      "description": "Connected calendars and their events."
    },
    {
      "name": "Connected apps",
      "description": "The tools your organization connected to Leanmote, and the interactions each one produced."
    },
    {
      "name": "Alert rules",
      "description": "Create, edit and disable alerts on your metrics."
    },
    {
      "name": "Agents",
      "description": "Your Leanmote agents and their state; pause or resume one."
    },
    {
      "name": "Agent proposals",
      "description": "What your agents propose to do, pending your decision."
    },
    {
      "name": "Health",
      "description": "Check that your token and organization are accepted."
    },
    {
      "name": "Delivery",
      "description": "How work flows from start to production: DORA, flow, sprints, progress and capacity."
    },
    {
      "name": "Teams and collaboration",
      "description": "How people work together: reviews, meetings, chat and activity."
    },
    {
      "name": "Quality and operations",
      "description": "Bugs and tests, support, and how production behaves."
    },
    {
      "name": "AI adoption",
      "description": "How your teams use AI tools and agents, and what it changes."
    },
    {
      "name": "Cost and investment",
      "description": "Engineering cost by project and investment category, and capitalization."
    },
    {
      "name": "Strategy",
      "description": "Your organization's goals and the progress against them."
    }
  ],
  "x-tagGroups": [
    {
      "name": "Metrics and insights",
      "tags": [
        "Executive summary",
        "Bottleneck insights",
        "Cell runs",
        "Dashboard views"
      ]
    },
    {
      "name": "Organization and people",
      "tags": [
        "Organizations",
        "Teams",
        "Users",
        "Org chart",
        "API credentials (Admin)"
      ]
    },
    {
      "name": "Work and code",
      "tags": [
        "Boards",
        "Tasks",
        "Git",
        "Interactions",
        "Calendar",
        "Connected apps"
      ]
    },
    {
      "name": "Automation",
      "tags": [
        "Alert rules",
        "Agents",
        "Agent proposals"
      ]
    },
    {
      "name": "Status",
      "tags": [
        "Health"
      ]
    },
    {
      "name": "Metrics API",
      "tags": [
        "Delivery",
        "Teams and collaboration",
        "Quality and operations",
        "AI adoption",
        "Cost and investment",
        "Strategy"
      ]
    }
  ],
  "paths": {
    "/admin/users/{user_id}/api-credentials": {
      "get": {
        "operationId": "admin_list_api_credentials",
        "tags": [
          "API credentials (Admin)"
        ],
        "summary": "Returns credentials stored in `api_tokens`.",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "id": 15,
                      "name": "Nightly export",
                      "created_via": "admin",
                      "preview": "lm_ap",
                      "status": "active",
                      "last_used_at": null,
                      "expires_at": "2025-01-31T23:59:59",
                      "created_at": "2024-09-12T10:00:00"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "timestamps": "datetime"
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter Invalid pagination parameters."
          },
          "403": {
            "description": "forbidden Requester is not an admin."
          },
          "404": {
            "description": "user_not_found User does not belong to the organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns credentials stored in `api_tokens`. Only administrators may access this endpoint."
      },
      "post": {
        "operationId": "admin_create_api_credential",
        "tags": [
          "API credentials (Admin)"
        ],
        "summary": "Issues a new credential and returns the plaintext key once.",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "user_id": 42,
                    "api_key": "lm_api_F3k8...",
                    "preview": "lm_api_***",
                    "expires_at": "2025-01-31T23:59:59",
                    "scopes": [
                      "read:tasks"
                    ],
                    "label": "Read-only key"
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_payload Invalid body format, `label`, `scopes`, or `expires_at`."
          },
          "403": {
            "description": "forbidden Requester is not an admin."
          },
          "404": {
            "description": "user_not_found User does not belong to the organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Issues a new credential and returns the plaintext key once. Only administrators may call this endpoint."
      }
    },
    "/admin/users/{user_id}/api-credentials/{credential_id}": {
      "delete": {
        "operationId": "admin_revoke_api_credential",
        "tags": [
          "API credentials (Admin)"
        ],
        "summary": "Revokes one of the user's credentials: `is_active = 0` and `revoked_at` set, so the gateway stops accepting it at once.",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "credential_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "user_id": 42,
                    "credential_id": 15,
                    "revoked": true
                  }
                }
              }
            }
          },
          "403": {
            "description": "forbidden Requester is not Leanmote staff."
          },
          "404": {
            "description": "user_not_found User does not belong to the organization. · credential_not_found No credential with that id belongs to that user."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Revokes one of the user's credentials: `is_active = 0` and `revoked_at` set, so the gateway stops accepting it at once. The row stays, so it still lists as `revoked`. Same gate as the other two endpoints: Leanmote staff only. Revoking a credential that is already revoked answers the same and writes nothing."
      }
    },
    "/agents": {
      "get": {
        "operationId": "agents_list_agents",
        "tags": [
          "Agents"
        ],
        "summary": "Lists the agents the caller manages: each activation's state, autonomy and the proposals waiting for them.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`)."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Lists the agents the caller manages: each activation's state, autonomy and the proposals waiting for them."
      }
    },
    "/agents/pause": {
      "post": {
        "operationId": "agents_pause_agent",
        "tags": [
          "Agents"
        ],
        "summary": "Pauses or resumes one agent on one view column.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`)."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Pauses or resumes one agent on one view column. Owners and admins only."
      }
    },
    "/agents/proposals": {
      "get": {
        "operationId": "agent_proposals_list_agent_proposals",
        "tags": [
          "Agent proposals"
        ],
        "summary": "Returns the brief of the Agents screen for the caller: the pending proposals of the cells they reach (oldest first...",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "pending": [
                      {
                        "id": 812,
                        "agent": "queue",
                        "action": "comment_pr",
                        "platform": "github",
                        "recommendation": false,
                        "title": "PR #340 · api",
                        "why": "Waiting for review for 9 days, three times the usual.",
                        "body": "Hi @ana, could you take a look?",
                        "recipient": null,
                        "item": {
                          "key": "PR #340",
                          "title": "Add cache",
                          "url": "https://github.com/acme/api/pull/340"
                        },
                        "repository": "api",
                        "items": [],
                        "status": "pending",
                        "created_at": "2026-10-20 12:00:00",
                        "age_days": 7,
                        "decided_at": null,
                        "decision_reason": null,
                        "outcome": null,
                        "cluster": "flow",
                        "view": {
                          "id": 1,
                          "name": "Backend",
                          "is_general": false
                        }
                      }
                    ],
                    "pending_total": 1,
                    "recent": [],
                    "counts": {
                      "pending": 1,
                      "approved": 0,
                      "executed": 0,
                      "rejected": 0,
                      "needs_review": 0,
                      "failed": 0,
                      "blocked": 0,
                      "expired": 0,
                      "not_executed": 0
                    },
                    "executed_30d": 0,
                    "agents_url": "https://app.leanmote.com/bottleneck-insights?section=agents"
                  }
                }
              }
            }
          },
          "403": {
            "description": "forbidden The token carries no user. · no_organization The token has no organization and the user belongs to none. · agents_forbidden The caller lacks the `view:bottleneck-insights` permission (or the permission bundle is degraded)."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns the brief of the Agents screen for the caller: the pending proposals of the cells they reach (oldest first, up to 60), the last 6 decided, the counts by display status and the executions of the last 30 days. Callers need the `view:bottleneck-insights` permission; see [Who sees what](#who-sees-what). Read-only: nothing is expired or refreshed here (see [Read-only](#read-only)). Takes no query parameters."
      }
    },
    "/agents/proposals/{id}": {
      "get": {
        "operationId": "agent_proposals_get_agent_proposal",
        "tags": [
          "Agent proposals"
        ],
        "summary": "Returns one proposal of the caller's cells, in any status, with the same card as the list plus the agent's full...",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "proposal": {
                      "id": 812,
                      "agent": "queue",
                      "action": "comment_pr",
                      "platform": "github",
                      "recommendation": false,
                      "title": "PR #340 · api",
                      "why": "Waiting for review for 9 days, three times the usual.",
                      "body": "Hi @ana, could you take a look?",
                      "recipient": null,
                      "item": {
                        "key": "PR #340",
                        "title": "Add cache",
                        "url": "https://github.com/acme/api/pull/340"
                      },
                      "repository": "api",
                      "items": [],
                      "status": "pending",
                      "created_at": "2026-10-20 12:00:00",
                      "age_days": 7,
                      "decided_at": null,
                      "decision_reason": null,
                      "outcome": null,
                      "cluster": "flow",
                      "view": {
                        "id": 1,
                        "name": "Backend",
                        "is_general": false
                      },
                      "reasoning": {
                        "why_now": "Waiting for review for 9 days, three times the usual.",
                        "evidence": [
                          "3x the usual"
                        ]
                      },
                      "agents_url": "https://app.leanmote.com/bottleneck-insights?section=agents"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "forbidden The token carries no user. · no_organization The token has no organization and the user belongs to none. · agents_forbidden The caller lacks the `view:bottleneck-insights` permission (or the permission bundle is degraded)."
          },
          "404": {
            "description": "not_found id` is not a positive integer, or the proposal is not among the ones the caller sees."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns one proposal of the caller's cells, in any status, with the same card as the list plus the agent's full `reasoning` and `agents_url` (RD-3940). The same visibility rules as `GET /agents/proposals` apply (see [Who sees what](#who-sees-what)): a proposal outside the caller's cells, or a notice addressed to the caller, answers `404`. A pending proposal whose PR is already closed or merged reads `expired`, as PHP shows it; nothing is written."
      }
    },
    "/alert-rules": {
      "get": {
        "operationId": "alerts_list_alert_rules",
        "tags": [
          "Alert rules"
        ],
        "summary": "Lists the alert rules the caller created in the active organization, newest first (`id` descending), paginated.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page to return. Optional. Positive integer. Defaults to `1`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Number of records per page. Optional. Positive integer. Defaults to `50`; values above `500` are capped to `500`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "id": 12,
                      "id_organization": 101,
                      "id_user": 784,
                      "metric_key": "cycle_time",
                      "module": "performance-delivery",
                      "scope_type": "dashboard",
                      "scope_id": null,
                      "condition_type": "absolute",
                      "comparator": "gt",
                      "threshold": 12.5,
                      "channel": "email",
                      "notify_user_id": 784,
                      "source_insight_id": null,
                      "enabled": 1,
                      "created_at": "2026-10-20 12:00:00",
                      "updated_at": "2026-10-21 09:30:00"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "timestamps": "datetime"
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_pagination page` or `per_page` is not a positive integer."
          },
          "403": {
            "description": "forbidden The token carries no user, or no organization can be resolved."
          },
          "404": {
            "description": "organization_not_found The caller is not a member of the resolved organization (non-staff)."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Lists the alert rules the caller created in the active organization, newest first (`id` descending), paginated. Only rules whose owner (`id_user`) is the caller are returned, whoever they notify. Any authenticated member of the organization may call it; no module role gate applies. The organization is resolved as on every read: Leanmote staff may point it at another organization with the `Organization` header, everyone else always gets their own."
      },
      "post": {
        "operationId": "alerts_create_alert_rule",
        "tags": [
          "Alert rules"
        ],
        "summary": "Creates an alert rule owned by the caller in the caller's own organization (the staff `Organization` header is...",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "id": 12,
                    "id_organization": 101,
                    "id_user": 784,
                    "metric_key": "cycle_time",
                    "module": "performance-delivery",
                    "scope_type": "dashboard",
                    "scope_id": 34,
                    "condition_type": "absolute",
                    "comparator": "gt",
                    "threshold": 12.5,
                    "channel": "email",
                    "notify_user_id": 784,
                    "source_insight_id": null,
                    "enabled": 1
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_payload The body is not a JSON object."
          },
          "403": {
            "description": "forbidden The token carries no user, or no organization can be resolved. · module_forbidden The caller's effective role cannot manage alerts for the rule's module. · recipient_module_forbidden notify_user_id` is another user whose effective role cannot receive alerts for the module."
          },
          "404": {
            "description": "organization_not_found The caller is not a member of their identity's organization (non-staff). · user_not_found notify_user_id` is another user who is not a member of the organization."
          },
          "409": {
            "description": "suggestion_unavailable suggestion_token` was sent and its verdict is not `ok`; `data.verdict` is `not_found`, `forbidden`, `spent`, `covered` or `stale`."
          },
          "422": {
            "description": "invalid_alert_rule Any [Validation](#validation) failure: unknown `module` or `metric_key`, bad `condition_type` / `comparator` / `threshold` / `channel`, a `target` rule without an active org target, a missing or wrong view (`scope_id`), or a view the caller neither owns nor has shared with them. · channel_unreachable The recipient cannot be reached on the final channel; `data.message_key` is `Alerts.err.slack_not_connected`, `Alerts.err.email_missing` or, on a Lean channel, `Alerts.err.lean_not_connected` («This recipient hasn't connected that channel.»: only a recipient Lean can write to now — `lean_state` `ready` — saves)."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Creates an alert rule owned by the caller in the caller's own organization (the staff `Organization` header is ignored for writes). The caller's effective role must be allowed to use the rule's module (see [Permission model](#permission-model)), and so must the recipient when `notify_user_id` is someone else. The body goes through the checks in [Validation](#validation), an omitted channel is chosen for the recipient, and the final channel must reach them. With `suggestion_token` it activates an emailed suggestion (see [below](#post-alert-rules-with-suggestion_token-rd-2403-piece-12)). Nothing is sent: the evaluator is the only sender. Answers `200`, not `201`.",
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "module": "performance-delivery",
                "metric_key": "cycle_time",
                "condition_type": "absolute",
                "comparator": "gt",
                "threshold": 12.5,
                "scope_type": "dashboard",
                "scope_id": 34,
                "channel": "email",
                "notify_user_id": 784,
                "enabled": true
              }
            }
          }
        }
      }
    },
    "/alert-rules/{alert_rule_id}": {
      "patch": {
        "operationId": "alerts_update_alert_rule",
        "tags": [
          "Alert rules"
        ],
        "summary": "Partially updates a rule the caller owns in the caller's own organization: only the fields present in the body are...",
        "parameters": [
          {
            "name": "alert_rule_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "id": 12,
                    "id_organization": 101,
                    "id_user": 784,
                    "metric_key": "cycle_time",
                    "module": "performance-delivery",
                    "scope_type": "dashboard",
                    "scope_id": 34,
                    "condition_type": "absolute",
                    "comparator": "gt",
                    "threshold": 15.0,
                    "channel": "slack",
                    "notify_user_id": 784,
                    "source_insight_id": null,
                    "enabled": 1
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_path_parameter alert_rule_id` is not a numeric identifier. · invalid_payload The body is not a JSON object."
          },
          "403": {
            "description": "forbidden The token carries no user, or no organization can be resolved. · module_forbidden The caller's effective role cannot manage alerts for the merged rule's module. · recipient_module_forbidden The recipient is another user whose effective role cannot receive alerts for the module."
          },
          "404": {
            "description": "organization_not_found The caller is not a member of their identity's organization (non-staff). · alert_rule_not_found No rule with that id owned by the caller in their organization. · user_not_found notify_user_id` is another user who is not a member of the organization."
          },
          "422": {
            "description": "invalid_alert_rule The merged rule fails [Validation](#validation) (same cases as `POST /alert-rules`). · channel_unreachable The recipient cannot be reached on the final channel; `data.message_key` as on create."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Partially updates a rule the caller owns in the caller's own organization: only the fields present in the body are merged onto the stored rule, and the merged rule is validated again as on create, including the module role gate for the caller and the recipient (see [PATCH semantics](#patch-semantics-partial-update)). A rule of another user or organization answers `404`. Nothing is sent.",
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "threshold": 15,
                "channel": "slack"
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "alerts_delete_alert_rule",
        "tags": [
          "Alert rules"
        ],
        "summary": "Hard-deletes a rule the caller owns in the caller's own organization.",
        "parameters": [
          {
            "name": "alert_rule_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "id": 12,
                    "deleted": true
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_path_parameter alert_rule_id` is not a numeric identifier."
          },
          "403": {
            "description": "forbidden The token carries no user, or no organization can be resolved."
          },
          "404": {
            "description": "organization_not_found The caller is not a member of their identity's organization (non-staff). · alert_rule_not_found No rule with that id owned by the caller in their organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Hard-deletes a rule the caller owns in the caller's own organization. Only ownership is checked (no module role gate). The rule's `alert_events` history is left in place. Takes no body."
      }
    },
    "/alert-rules/{alert_rule_id}/disable": {
      "post": {
        "operationId": "alerts_disable_alert_rule",
        "tags": [
          "Alert rules"
        ],
        "summary": "Soft-disables a rule the caller owns (`enabled = 0`) in the caller's own organization.",
        "parameters": [
          {
            "name": "alert_rule_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "id": 12,
                    "enabled": 0
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_path_parameter alert_rule_id` is not a numeric identifier."
          },
          "403": {
            "description": "forbidden The token carries no user, or no organization can be resolved."
          },
          "404": {
            "description": "organization_not_found The caller is not a member of their identity's organization (non-staff). · alert_rule_not_found No rule with that id owned by the caller in their organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Soft-disables a rule the caller owns (`enabled = 0`) in the caller's own organization. Only ownership is checked: unlike `enable`, no module role gate applies, so a caller can always switch off a rule they created. The rule and its history are kept. Takes no body."
      }
    },
    "/alert-rules/{alert_rule_id}/enable": {
      "post": {
        "operationId": "alerts_enable_alert_rule",
        "tags": [
          "Alert rules"
        ],
        "summary": "Owned rule (triple-pinned) or `404 alert_rule_not_found`; the rule's module must pass the caller's role gate (`403...",
        "parameters": [
          {
            "name": "alert_rule_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`)."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Owned rule (triple-pinned) or `404 alert_rule_not_found`; the rule's module must pass the caller's role gate (`403 module_forbidden`). Sets `enabled = 1`."
      }
    },
    "/alert-suggestions/{token}/proposal": {
      "get": {
        "operationId": "alerts_get_alert_suggestion_proposal",
        "tags": [
          "Alert rules"
        ],
        "summary": "Port of `AlertSuggestionsController::proposal`.",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`)."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Port of `AlertSuggestionsController::proposal`. Read-only. A non-`ok` verdict is a **200** with only the verdict (`forbidden`/`not_found` say nothing about the row):"
      }
    },
    "/apps": {
      "get": {
        "operationId": "apps_list_apps",
        "tags": [
          "Connected apps"
        ],
        "summary": "Lists the organization's applications: those someone of the organization is mapped to (`user_apps_mapping`) or holds...",
        "parameters": [
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "description": "Selects specific attributes to return. Comma-separated list that supports dotted paths (for example, `app.app_name`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Sorting attribute. Optional. Allowed values: `name`, `id`. Defaults to `name`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "description": "Sorting direction. Optional. Allowed values: `asc`, `desc`. Defaults to `asc`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page to return. Optional. Defaults to `1`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Number of records per page. Optional. Defaults to `50`. Maximum `200`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "timestamps",
            "in": "query",
            "required": false,
            "description": "Controls timestamp formatting. Optional. Allowed values: `datetime` (default), `int`, `none` (deprecated).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "query",
            "required": false,
            "description": "Filters applications by a partial name match. Optional. Case-insensitive substring search applied to the app name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "app_id": 15,
                      "app_name": "Jira",
                      "extraction": "live"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "name",
                    "order": "asc",
                    "timestamps": "none"
                  },
                  "applied_filters": {
                    "fields": [
                      "app_id",
                      "app_name"
                    ],
                    "organization_id": 101
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter Invalid `fields` or `name` filter. · invalid_pagination Invalid pagination parameters. · invalid_sort_attribute Unsupported `sort` (`id`, `name`). · invalid_order_value order` is not `asc`/`desc`."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Lists the organization's applications: those someone of the organization is mapped to (`user_apps_mapping`) or holds a credential for (`user_apps_credentials`). Before, only mapped ones counted, so Freshdesk with unmapped agents and Outlook Calendar (which maps nobody) did not show. `GET /apps/{app_id}` and `GET /apps/{app_id}/interactions` read the same rule."
      }
    },
    "/apps/{app_id}": {
      "get": {
        "operationId": "apps_get_app",
        "tags": [
          "Connected apps"
        ],
        "summary": "Returns a single application entry.",
        "parameters": [
          {
            "name": "app_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "description": "Selects specific attributes to return. Comma-separated list that supports dotted paths.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timestamps",
            "in": "query",
            "required": false,
            "description": "Controls timestamp formatting. Optional. Allowed values: `datetime` (default), `int`, `none` (deprecated).",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "app_id": 15,
                    "app_name": "Jira"
                  }
                }
              }
            }
          },
          "404": {
            "description": "app_not_found Application not found."
          },
          "400": {
            "description": "invalid_path_parameter app_id` is invalid."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns a single application entry."
      }
    },
    "/apps/{app_id}/interactions": {
      "get": {
        "operationId": "interactions_list_app_interactions",
        "tags": [
          "Connected apps"
        ],
        "summary": "Lists the interactions that belong to the specified application.",
        "parameters": [
          {
            "name": "app_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Restricts interactions to a data source type. Optional. Matches `data_source.type_id`; see integrations catalogue for identifiers.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "user_id",
            "in": "query",
            "required": false,
            "description": "Limits results to interactions where the user is the sender or a participant. Optional. Must reference a user within the organization scope.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "interaction_timestamp[operator]",
            "in": "query",
            "required": false,
            "description": "Applies range filters over the interaction timestamp. Supports `eq`, `gt`, `gte`, `lt`, `lte`. Value must be ISO-8601 (`YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "created_at[operator]",
            "in": "query",
            "required": false,
            "description": "Applies range filters over the creation timestamp. Same operators and ISO-8601 requirement as `interaction_timestamp[operator]`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "description": "Selects specific fields to return. Comma-separated list that supports dotted paths (for example, `app.app_name`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Sorting attribute. Optional. Allowed values: `interaction_timestamp`, `created_at`. Defaults to `interaction_timestamp`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "description": "Sorting direction. Optional. Allowed values: `asc`, `desc`. Defaults to `asc`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page to return. Optional. Defaults to `1`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Number of records per page. Optional. Defaults to `50`. Maximum `200`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "timestamps",
            "in": "query",
            "required": false,
            "description": "Controls timestamp formatting. Optional. Allowed values: `datetime` (default), `int`, `none` (deprecated).",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "interaction_id": 301,
                      "app": {
                        "app_id": 11,
                        "app_name": "Slack"
                      },
                      "sender": {
                        "user_id": 42,
                        "user_name": "Alex Leanmote",
                        "user_email": "alex.leanmote@example.com"
                      },
                      "receivers": [
                        {
                          "user_id": 56,
                          "user_name": "Jamie Receiver",
                          "user_email": "jamie.receiver@example.com"
                        }
                      ],
                      "data_source": {
                        "type_id": 2,
                        "type_name": "messages",
                        "source_id": 999
                      },
                      "interaction_timestamp": "2024-09-14T10:30:00",
                      "created_at": "2024-09-14T10:31:10"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "interaction_timestamp",
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "app_id": 11,
                    "type": 2,
                    "user_id": 42,
                    "interaction_timestamp": {
                      "gte": "2024-09-01T00:00:00",
                      "lte": "2024-09-30T23:59:59"
                    },
                    "fields": [
                      "interaction_id",
                      "app.app_id",
                      "app.app_name",
                      "sender",
                      "receivers",
                      "data_source"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter Invalid `type` or `user_id` filter, or mismatched `app_id` query/path values. · invalid_date_filter Date comparison does not contain a valid ISO-8601 value. · invalid_date_filter_operator Unsupported comparison operator in the date filter. · invalid_sort_attribute Unsupported `sort` (allowed: `interaction_timestamp`, `created_at`). · invalid_order_value order` is not `asc`/`desc`."
          },
          "403": {
            "description": "forbidden The requester does not have access to the organization scope."
          },
          "404": {
            "description": "app_not_found Application not found for the organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Lists the interactions that belong to the specified application. The `app_id` path parameter must reference an application visible to the tenant; when provided, optional query parameters behave identically to the organization-wide `GET /interactions` endpoint."
      }
    },
    "/boards": {
      "get": {
        "operationId": "boards_list_boards",
        "tags": [
          "Boards"
        ],
        "summary": "Lists agile boards that have been synchronized for the organization.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "board_id": 22,
                      "board_key": "ENG",
                      "board_external_id": "jira-board-22",
                      "board_name": "Engineering",
                      "app": {
                        "app_id": 11,
                        "app_name": "Jira"
                      },
                      "board_active": true,
                      "board_columns": [
                        {
                          "id": "todo",
                          "name": "To Do"
                        }
                      ],
                      "board_custom_columns": {
                        "story_points": "customfield_10016"
                      },
                      "board_status_column_id": "status",
                      "board_task_owner_column_id": "assignee",
                      "board_last_synced_at": "2024-01-20T10:30:00Z",
                      "created_at": "2023-06-01T12:00:00Z",
                      "updated_at": "2024-01-20T10:30:00Z"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "board_name",
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "fields": [
                      "board_id",
                      "board_key",
                      "board_name",
                      "app.app_id",
                      "app.app_name",
                      "board_active",
                      "board_last_synced_at"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter Invalid `app_id`, `active`, or date filter. · invalid_sort_attribute Unsupported `sort` attribute. · invalid_order_value order` is not `asc`/`desc`."
          },
          "403": {
            "description": "forbidden Organization scope missing or unauthorized."
          },
          "404": {
            "description": "organization_not_found Organization not visible to the requester."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Lists agile boards that have been synchronized for the organization."
      }
    },
    "/boards/{board_id}/tasks": {
      "get": {
        "operationId": "boards_list_board_tasks",
        "tags": [
          "Boards"
        ],
        "summary": "Returns the tasks that belong to the specified board, reusing the task payload structure exposed by the...",
        "parameters": [
          {
            "name": "board_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "task_id": 501,
                      "board": {
                        "board_id": 22,
                        "board_key": "ENG"
                      },
                      "app": {
                        "app_id": 11,
                        "app_name": "Jira"
                      },
                      "task_key": "ENG-123",
                      "task_name": "Implement authentication",
                      "task_owner": {
                        "user_id": 42,
                        "user_name": "Alex Leanmote",
                        "user_email": "alex.leanmote@example.com"
                      },
                      "task_status": "In Progress",
                      "created_at": "2024-01-19T09:00:00Z",
                      "updated_at": "2024-01-20T10:30:00Z"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "date_created",
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "fields": [
                      "task_id",
                      "task_name",
                      "task_status",
                      "board.board_id",
                      "app.app_id",
                      "task_owner.user_id"
                    ],
                    "board_id": 22
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter Invalid pagination, filter, or sort parameter."
          },
          "404": {
            "description": "board_not_found Board does not belong to the organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns the tasks that belong to the specified board, reusing the task payload structure exposed by the organization-wide tasks endpoint. Tasks without a mapped Leanmote owner are omitted."
      }
    },
    "/boards/{board_id}/tasks/{task_id}": {
      "get": {
        "operationId": "boards_get_board_task",
        "tags": [
          "Boards"
        ],
        "summary": "Returns the detailed payload for a task while ensuring it is linked to the requested board.",
        "parameters": [
          {
            "name": "board_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "task_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "task_id": 501,
                    "board": {
                      "board_id": 22,
                      "board_key": "ENG"
                    },
                    "app": {
                      "app_id": 11,
                      "app_name": "Jira"
                    },
                    "task_key": "ENG-123",
                    "task_name": "Implement authentication",
                    "task_url": "https://jira.example.com/browse/ENG-123",
                    "task_owner": {
                      "user_id": 42,
                      "user_name": "Alex Leanmote",
                      "user_email": "alex.leanmote@example.com"
                    },
                    "task_status": "In Progress",
                    "task_last_existence_check": "2024-01-20T10:20:00Z",
                    "task_parent_id": null,
                    "task_synced_at": "2024-01-19T08:55:00Z",
                    "task_status_history": [
                      {
                        "task_status": "To Do",
                        "task_previous_status": null,
                        "task_status_changed_at": "2024-01-18T12:00:00Z"
                      },
                      {
                        "task_status": "In Progress",
                        "task_previous_status": "To Do",
                        "task_status_changed_at": "2024-01-19T09:15:00Z"
                      }
                    ],
                    "task_custom_parameters": [
                      {
                        "task_parameter_key": "priority",
                        "task_parameter_value": "High",
                        "created_at": "2024-01-19T09:00:00Z",
                        "updated_at": "2024-01-19T09:00:00Z"
                      }
                    ],
                    "task_sub_tasks": [],
                    "created_at": "2024-01-19T09:00:00Z",
                    "updated_at": "2024-01-20T10:30:00Z"
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_path_parameter Non-numeric `task_id` or `board_id`."
          },
          "404": {
            "description": "board_not_found Board does not belong to the organization. · task_not_found Task not found under the specified board."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns the detailed payload for a task while ensuring it is linked to the requested board."
      }
    },
    "/calendar-events": {
      "get": {
        "operationId": "calendar_list_calendar_events",
        "tags": [
          "Calendar"
        ],
        "summary": "Returns events for the organization with optional filters for calendar, creator, and time range using the...",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`)."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns events for the organization with optional filters for calendar, creator, and time range using the `field[operator]=value` comparison format (`eq`, `gt`, `gte`, `lt`, `lte`)."
      }
    },
    "/calendar-events/{event_id}": {
      "get": {
        "operationId": "calendar_get_calendar_event",
        "tags": [
          "Calendar"
        ],
        "summary": "Returns the full payload for an event.",
        "parameters": [
          {
            "name": "event_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`)."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns the full payload for an event."
      }
    },
    "/calendars": {
      "get": {
        "operationId": "calendar_list_calendars",
        "tags": [
          "Calendar"
        ],
        "summary": "Returns the calendars synchronized for the authenticated organization.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "calendar_id": 3,
                      "calendar_name": "Engineering",
                      "app": {
                        "app_name": "Google Workspace"
                      },
                      "owner": {
                        "user_id": 91,
                        "user_name": "Alex Doe",
                        "user_email": "alex@example.com"
                      }
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "name",
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "name": "engineering",
                    "active": true,
                    "fields": [
                      "calendar_id",
                      "calendar_name",
                      "app.app_name",
                      "owner.user_id",
                      "owner.user_name",
                      "owner.user_email"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter Invalid `app_id`, `owner_id`, or pagination parameter. · invalid_sort_attribute Unsupported `sort` (allowed: `name`, `created_at`, `updated_at`, `last_update`). · invalid_order_value order` is not `asc`/`desc`. · invalid_query_parameter active` is not a boolean value."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns the calendars synchronized for the authenticated organization. Supports filtering by calendar name, application, owner, and activity status."
      }
    },
    "/calendars/{calendar_id}": {
      "get": {
        "operationId": "calendar_get_calendar",
        "tags": [
          "Calendar"
        ],
        "summary": "Returns a single calendar by identifier, including metadata about the integration and owner.",
        "parameters": [
          {
            "name": "calendar_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "calendar_id": 3,
                    "calendar_name": "Engineering",
                    "calendar_timezone": "America/New_York",
                    "active": true,
                    "last_update": "2024-09-18T09:30:00",
                    "app": {
                      "app_id": 11,
                      "app_name": "Google Workspace"
                    },
                    "owner": {
                      "user_id": 91,
                      "user_name": "Alex Doe",
                      "user_email": "alex@example.com"
                    },
                    "created_at": "2024-08-01T12:00:00",
                    "updated_at": "2024-09-18T09:30:00"
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_path_parameter calendar_id` is not numeric."
          },
          "404": {
            "description": "calendar_not_found Calendar does not exist for the organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns a single calendar by identifier, including metadata about the integration and owner."
      }
    },
    "/calendars/{calendar_id}/events": {
      "get": {
        "operationId": "calendar_list_calendar_events_by_calendar",
        "tags": [
          "Calendar"
        ],
        "summary": "Returns the meetings belonging to the specified calendar.",
        "parameters": [
          {
            "name": "calendar_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "event_id": 880,
                      "event_title": "Sprint review",
                      "event_start_at": "2024-09-18T15:00:00",
                      "event_end_at": "2024-09-18T16:00:00",
                      "event_organizer": {
                        "user_id": 42,
                        "user_name": "Alex Doe",
                        "user_email": "alex@example.com",
                        "organizer_participation": {
                          "organizer_actual_duration_minutes": 59,
                          "organizer_joined_at": "2024-09-18T15:01:00",
                          "organizer_left_at": "2024-09-18T16:00:30",
                          "organizer_attended": true
                        },
                        "organizer_metadata": {
                          "email": "alex@example.com",
                          "actual_duration_minutes": 59,
                          "join_time": "2024-09-18T15:01:00",
                          "leave_time": "2024-09-18T16:00:30",
                          "attended": true
                        }
                      },
                      "event_attendees": [
                        {
                          "user_id": 42,
                          "user_name": "Alex Doe",
                          "user_email": "alex@example.com",
                          "attendee_response_status": "accepted",
                          "attendee_participation": {
                            "attendee_actual_duration_minutes": 59,
                            "attendee_joined_at": "2024-09-18T15:01:00",
                            "attendee_left_at": "2024-09-18T16:00:30",
                            "attendee_attended": true
                          }
                        }
                      ]
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "start_at",
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "calendar": {
                      "calendar_id": 3,
                      "calendar_name": "Engineering"
                    },
                    "start_time": {
                      "gte": "2024-09-01T00:00:00",
                      "lte": "2024-09-30T23:59:59"
                    },
                    "fields": [
                      "event_id",
                      "event_title",
                      "event_start_at",
                      "event_end_at",
                      "event_organizer.user_id",
                      "event_organizer.user_name"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_calendar_scope Query `calendar_id` does not match the path parameter. · invalid_date_filter Date comparison does not contain a valid ISO-8601 value. · invalid_date_filter_operator Unsupported comparison operator in the date filter. · invalid_sort_attribute Unsupported `sort` (allowed: `start_at`, `created_at`). · invalid_order_value order` is not `asc`/`desc`."
          },
          "404": {
            "description": "calendar_not_found Calendar does not exist for the organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns the meetings belonging to the specified calendar. Supports the same filters as the legacy listing endpoint, including creator and the range comparisons on event timestamps (`eq`, `gt`, `gte`, `lt`, `lte`). Each attendee and the organizer are resolved against `user_apps_mapping` to expose the Leanmote `user_id` and profile name whenever a match exists; unmatched profiles keep the best available identifier with `event_attendees[].user_id`/`event_organizer.user_id` set to `false`. Participant telemetry from `participants_data` is surfaced under `attendee_participation` and `organizer_participation` together with the raw metadata for productivity insights."
      }
    },
    "/calendars/{calendar_id}/events/{event_id}": {
      "get": {
        "operationId": "calendar_get_calendar_event_by_calendar",
        "tags": [
          "Calendar"
        ],
        "summary": "Returns the details for a single meeting ensuring it belongs to the provided calendar.",
        "parameters": [
          {
            "name": "calendar_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "event_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "event_id": 880,
                    "event_app_id": "CAL-123",
                    "event_title": "Sprint review",
                    "event_start_at": "2024-09-18T15:00:00",
                    "event_end_at": "2024-09-18T16:00:00",
                    "calendar": {
                      "calendar_id": 3,
                      "calendar_name": "Engineering"
                    },
                    "event_organizer": {
                      "user_id": 42,
                      "user_name": "Alex Doe",
                      "user_email": "alex@example.com"
                    },
                    "event_attendees": [
                      {
                        "user_id": 42,
                        "user_name": "Alex Doe",
                        "user_email": "alex@example.com",
                        "attendee_response_status": "accepted",
                        "attendee_participation": {
                          "attendee_actual_duration_minutes": 59,
                          "attendee_joined_at": "2024-09-18T15:01:00",
                          "attendee_left_at": "2024-09-18T16:00:30",
                          "attendee_attended": true
                        },
                        "attendee_source": {
                          "displayName": "Alex Doe",
                          "email": "alex@example.com",
                          "responseStatus": "accepted"
                        },
                        "attendee_metadata": {
                          "email": "alex@example.com",
                          "actual_duration_minutes": 59,
                          "join_time": "2024-09-18T15:01:00",
                          "leave_time": "2024-09-18T16:00:30",
                          "attended": true
                        }
                      }
                    ],
                    "event_actuals": {
                      "event_actual_start_at": "2024-09-18T15:02:00",
                      "event_actual_end_at": "2024-09-18T16:01:00",
                      "event_actual_duration_minutes": 59
                    },
                    "created_at": "2024-09-10T09:00:00",
                    "updated_at": "2024-09-18T16:05:00"
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_path_parameter calendar_id` or `event_id` is not numeric."
          },
          "404": {
            "description": "calendar_not_found Calendar does not exist for the organization. · event_not_found Event does not belong to the organization/calendar."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns the details for a single meeting ensuring it belongs to the provided calendar."
      }
    },
    "/cells/attribution": {
      "get": {
        "operationId": "cells_get_attribution",
        "tags": [
          "Cell runs"
        ],
        "summary": "Recovered by attribution (T7): Detected, Recovered by agents and Resolved without agent, in USD **per day**, per...",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "as_of": "2026-10-19 18:00:00",
                    "window_days": 30,
                    "detection_window_days": 90,
                    "cells": {
                      "stalled_work|10": {
                        "cluster": "stalled_work",
                        "view": 10,
                        "state": "active",
                        "money": true,
                        "as_of": "2026-10-19 18:00:00",
                        "detected_per_day": 10.5,
                        "recovered_per_day": 4.25,
                        "resolved_without_agent_per_day": 1.0,
                        "ai_spend_30d_usd": null,
                        "return_30d_usd": null,
                        "counts": {
                          "open": 2,
                          "closed": 1,
                          "acted": 1,
                          "closed_acted": 1
                        }
                      },
                      "ai_no_return|10": {
                        "cluster": "ai_no_return",
                        "view": 10,
                        "state": "ai_return",
                        "money": true,
                        "as_of": "2026-10-03 07:00:00",
                        "detected_per_day": null,
                        "recovered_per_day": 2.01,
                        "resolved_without_agent_per_day": null,
                        "ai_spend_30d_usd": null,
                        "return_30d_usd": null,
                        "counts": {
                          "acted": 2
                        }
                      }
                    },
                    "by_cluster": {
                      "stalled_work": {
                        "detected_per_day": 10.5,
                        "recovered_per_day": 4.25,
                        "resolved_without_agent_per_day": 1.0,
                        "ai_spend_30d_usd": null,
                        "return_30d_usd": null,
                        "cells": 1
                      },
                      "ai_no_return": {
                        "detected_per_day": null,
                        "recovered_per_day": 2.01,
                        "resolved_without_agent_per_day": null,
                        "ai_spend_30d_usd": null,
                        "return_30d_usd": null,
                        "cells": 1
                      }
                    },
                    "org": {
                      "detected_per_day": 10.5,
                      "recovered_per_day": 6.26,
                      "resolved_without_agent_per_day": 1.0,
                      "ai_spend_30d_usd": null,
                      "return_30d_usd": null,
                      "cells": 2
                    },
                    "series": [
                      {
                        "run": "2026-10-19",
                        "detected": 10.5,
                        "recovered": 4.25,
                        "resolved": 1.0
                      }
                    ],
                    "cluster_series": {
                      "stalled_work": [
                        {
                          "run": "2026-10-19",
                          "detected": 10.5,
                          "recovered": 4.25,
                          "resolved": 1.0
                        }
                      ]
                    },
                    "cell_series": {
                      "stalled_work|10": [
                        {
                          "run": "2026-10-19",
                          "detected": 10.5,
                          "recovered": 4.25,
                          "resolved": 1.0
                        }
                      ]
                    },
                    "scope": {
                      "views": [
                        10,
                        11,
                        12
                      ],
                      "with_ai_return": true,
                      "ai_spend_known": false
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_view view` is not a positive id. · invalid_series series` is not `1`/`0` (or `true`/`false`, `yes`/`no`)."
          },
          "403": {
            "description": "insights_forbidden The caller has neither the permission nor a shared view. · view_forbidden view` is not one the caller reaches."
          },
          "404": {
            "description": "cells_not_available The flag is off, the tables do not exist, or `cell_runs.attribution` does not exist."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Recovered by attribution (T7): Detected, Recovered by agents and Resolved without agent, in USD **per day**, per cell, per row (`by_cluster`) and for the organization. It ports `CellAttributionService::forScope() ?? emptyPayload()`:"
      }
    },
    "/cells/items": {
      "get": {
        "operationId": "cells_list_items",
        "tags": [
          "Cell runs"
        ],
        "summary": "The items each problem **claims** in a view: `claimed = 1` items of the latest **active** run of each cell of the view.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "ref": "task:88123",
                      "item_type": "task",
                      "item_id": "88123",
                      "problem_key": "pe1:TE1:v1421:in_review",
                      "row": "stalled_work"
                    },
                    {
                      "ref": "pr:5521",
                      "item_type": "pr",
                      "item_id": "5521",
                      "problem_key": "pe1:RV1:v1421:repo_x",
                      "row": "stalled_work"
                    }
                  ],
                  "meta": {
                    "view": 1421,
                    "row": null,
                    "limit": 1000,
                    "count": 2,
                    "truncated": false
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_view view` is missing or not a positive id. · invalid_row row` is not an engine row. · invalid_limit limit` is not a positive integer."
          },
          "403": {
            "description": "insights_forbidden The caller has neither the permission nor a shared view. · view_forbidden The caller does not reach the view."
          },
          "404": {
            "description": "cells_not_available The flag is off for the organization, or the tables do not exist."
          },
          "422": {
            "description": "view_analysis_off The caller reaches the view, but its analysis is off: its cells are retired."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "The items each problem **claims** in a view: `claimed = 1` items of the latest **active** run of each cell of the view. This is the engine's `store.item_map` narrowed to one view. An item is claimed by a single problem across the whole organization. Hygiene touches items but never claims them, and a retired cell claims nothing."
      }
    },
    "/cells/{view}/{row}/latest": {
      "get": {
        "operationId": "cells_get_latest",
        "tags": [
          "Cell runs"
        ],
        "summary": "The latest run of the cell, whatever its state: the active run, or the retirement that closed the cell (`state =...",
        "parameters": [
          {
            "name": "view",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "row",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "view": 1421,
                    "row": "stalled_work",
                    "run_key": "87:1421:stalled_work:2026-10-19",
                    "run_at": "2026-10-19 06:00:00",
                    "state": "active",
                    "state_reason": null,
                    "mode": "shadow",
                    "engine_version": "1",
                    "catalog_version": 1,
                    "period_days": 30,
                    "analysis_state": {
                      "measurable": true,
                      "reason": null,
                      "blocking": [],
                      "shares": {}
                    },
                    "metrics": {
                      "age_in_status": {
                        "actual": 9.5,
                        "median": 6.0,
                        "mad": 1.2
                      }
                    },
                    "hygiene": {},
                    "org_effects": [],
                    "diff": {
                      "new": [
                        "pe1:TE1:v1421:in_review"
                      ],
                      "closed": [],
                      "kept": []
                    },
                    "cost": {
                      "payroll_usd": 120000.0,
                      "loss_per_delivery_usd": 310.0,
                      "formula_inputs": {}
                    },
                    "attribution": {
                      "v": 1,
                      "state": "active",
                      "money": true,
                      "detected_per_day": 10.5,
                      "recovered_per_day": 4.25,
                      "resolved_without_agent_per_day": 1.0,
                      "counts": {
                        "open": 2,
                        "closed": 1,
                        "acted": 1,
                        "closed_acted": 1
                      }
                    },
                    "problems": [
                      {
                        "problem_key": "pe1:TE1:v1421:in_review",
                        "pattern": "TE1",
                        "anchor": "In Review",
                        "status": "problem",
                        "status_reason": null,
                        "confidence": 0.82,
                        "change_point": true,
                        "since": "2026-10-01 00:00:00",
                        "first_run_key": "87:1421:stalled_work:2026-10-12",
                        "items_count": 3,
                        "items_truncated": false,
                        "cost_usd": 1234.5,
                        "severity": "high",
                        "severity_pct": 9.1234,
                        "evidence_required": {
                          "TE1": [
                            "age_in_status"
                          ]
                        },
                        "evidence_support": [
                          "age_in_status"
                        ],
                        "evidence": {
                          "age_in_status": {
                            "p90_days": 12.5
                          }
                        },
                        "hygiene": {
                          "HG1": 0.1
                        },
                        "cost": {
                          "usd": 1234.5,
                          "kind": "delivery_share",
                          "items": 3
                        }
                      }
                    ],
                    "problems_truncated": false,
                    "items": {
                      "pe1:TE1:v1421:in_review": [
                        "task:88123",
                        "task:88130",
                        "pr:5521"
                      ]
                    },
                    "items_truncated": false,
                    "status_filter": "problem"
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_row row` is not an engine row. · invalid_view view` is not a positive id. · invalid_status status` is not `problem` or `all`."
          },
          "403": {
            "description": "insights_forbidden The caller has neither the permission nor a shared view. · view_forbidden The caller does not reach the view."
          },
          "404": {
            "description": "cells_not_available The flag is off for the organization, or the tables do not exist. · cell_not_found The cell has no run."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "The latest run of the cell, whatever its state: the active run, or the retirement that closed the cell (`state = retired`). This mirrors the engine's `store.latest_run`. By default only the **born** problems are returned (`status = problem`). `?status=all` adds the candidates and the discarded ones."
      }
    },
    "/cells/{view}/{row}/report": {
      "get": {
        "operationId": "cells_get_report",
        "tags": [
          "Cell runs"
        ],
        "summary": "The cell report (T5) as the app's cell window reads it (`BottleneckInsightsController::ajaxGetCellReport`...",
        "parameters": [
          {
            "name": "view",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "row",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "view": 1421,
                    "row": "stalled_work",
                    "column": "1421",
                    "row_key": "stalled_work",
                    "status": "ready",
                    "updating": false,
                    "viewer_can_act": true,
                    "id": 311,
                    "version": 3,
                    "generated_at": "2026-10-19 06:12:40",
                    "language": {
                      "pending": true,
                      "requested": false,
                      "shown": "es"
                    },
                    "report": {
                      "headline": "…",
                      "whats_going_on": {
                        "problem": "…"
                      },
                      "findings": [],
                      "levers": []
                    },
                    "links": [
                      {
                        "label": "PROJ-123",
                        "url": "https://acme.atlassian.net/browse/PROJ-123"
                      }
                    ],
                    "headline": "Review waits four days",
                    "lead": "PRs wait for a first review…",
                    "levers": null,
                    "versions": [
                      {
                        "id": 311,
                        "version": 3,
                        "created_at": "2026-10-19 06:12:40"
                      },
                      {
                        "id": 280,
                        "version": 2,
                        "created_at": "2026-10-12 06:10:02"
                      }
                    ],
                    "request": null,
                    "fallback": false,
                    "fallback_of": null,
                    "stale": false
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_row row` is neither an engine row nor an AI Return row. · invalid_view view` is neither a positive id nor `general`, or `general` has no cell for this row and caller."
          },
          "403": {
            "description": "insights_forbidden The caller has neither the permission nor a shared view. · cell_forbidden An AI Return row, and the caller is not owner or admin. · view_forbidden The caller does not reach the view, or `general` is not offered to them."
          },
          "404": {
            "description": "cells_not_available The flag is off, or the run or report tables do not exist."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "The cell report (T5) as the app's cell window reads it (`BottleneckInsightsController::ajaxGetCellReport`, leanmote-app 1f84e2d21), as data. The SPA renders `report` itself, so there is no `html`. RD-4081: the cell's live public link travels as `share` to who acts on the view, as PHP; sharing, revoking and restoring a version are the three POSTs below. The answer is pinned to PHP by `tests/fixtures/cell_report_parity.json` (written by `cell_report_parity_regenerate.php` from the app's own controller and services)."
      }
    },
    "/cells/{view}/{row}/report/generate": {
      "post": {
        "operationId": "cells_generate_report",
        "tags": [
          "Cell runs"
        ],
        "summary": "Asks for the cell's report (`ajaxGenerateCellReport`).",
        "parameters": [
          {
            "name": "view",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "row",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "view": 1421,
                    "row": "stalled_work",
                    "column": "1421",
                    "row_key": "stalled_work",
                    "status": "pending",
                    "id": 9811
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_row` / `invalid_view As in the GET."
          },
          "403": {
            "description": "insights_forbidden` / `cell_forbidden` / `view_forbidden As in the GET. · cell_report_reader A Reader, and the cell already has a fresh report in their language."
          },
          "404": {
            "description": "cells_not_available As in the GET."
          },
          "409": {
            "description": "cell_report_fallback Refresh on open: asking again would not help. Read the GET with `?fallback=1`."
          },
          "422": {
            "description": "view_analysis_off The view is reachable but its analysis is off."
          },
          "429": {
            "description": "cell_report_daily_cap The organization reached 50 requests today (UTC)."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Asks for the cell's report (`ajaxGenerateCellReport`). The cell window calls it by itself when a cell has no report (or none in the reader's language), Readers included. **It writes.**"
      }
    },
    "/commits": {
      "get": {
        "operationId": "code_search_search_commits",
        "tags": [
          "Git"
        ],
        "summary": "Searches commits across the whole organization — every connected app and repository — by text, repository, author...",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Words in the title or message, or the commit SHA. Optional. Substring match on title and message, or exact match on the full SHA; first 200 characters.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "author",
            "in": "query",
            "required": false,
            "description": "Work authored by this Leanmote user (matched through the user's mapped provider handles). Optional.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "mine",
            "in": "query",
            "required": false,
            "description": "Work authored by the caller, from their own credential. Optional. `true`/`1`/`yes` or `false`/`0`/`no`. When true it overrides `author`.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "team_id",
            "in": "query",
            "required": false,
            "description": "Work authored by the members of this team. Optional. The caller must manage the team, belong to it, or be unrestricted.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "repository_id",
            "in": "query",
            "required": false,
            "description": "Filters by repository. Optional.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "repository",
            "in": "query",
            "required": false,
            "description": "Filters by repository name. Optional. Substring match; first 200 characters.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "committed_at[operator]",
            "in": "query",
            "required": false,
            "description": "Range filter on the commit date. Supports `eq`, `gt`, `gte`, `lt`, `lte`, with `field[op]`, `field__op` or `field_op` syntax and ISO-8601 values.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page to return. Optional. Defaults to `1`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Number of records per page. Optional. Defaults to `50`. Maximum `500`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "commit_id": 551200,
                      "sha": "3f9c2a7d1e4b8c0a6f5e2d1c9b8a7f6e5d4c3b2a",
                      "title": "Retry chat delivery on 5xx",
                      "repository": {
                        "repository_id": 310,
                        "name": "api"
                      },
                      "author": {
                        "user_id": 42,
                        "name": "Alex Leanmote",
                        "login": "alexl"
                      },
                      "committed_at": "2026-11-12T15:02:44",
                      "pull_request_id": 90211,
                      "lines_added": 80,
                      "lines_deleted": 6
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "q": "retry",
                    "author": 42,
                    "committed_at": {
                      "gte": "2026-11-01T00:00:00Z"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter author`, `team_id` or `repository_id` is not an integer, or `mine` is not a boolean. · invalid_mine mine=true` with no signed-in user behind the credential. · invalid_pagination page` or `per_page` is not a positive integer. · invalid_date_filter_operator A date filter uses an operator other than `eq`, `gt`, `gte`, `lt`, `lte`. · invalid_date_filter A date filter value is not a single ISO-8601 string."
          },
          "403": {
            "description": "forbidden No organization scope or authenticated user. · team_forbidden team_id` is outside the caller's scope."
          },
          "404": {
            "description": "organization_not_found The caller does not belong to the organization. · team_not_found team_id` does not exist in the organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Searches commits across the whole organization — every connected app and repository — by text, repository, author, team and date, newest first. It keeps the platform's visibility: owners, admins, staff and holders of the \"all team metrics\" grant see everything; a team leader sees the work of the people in the teams they see plus their own; a collaborator only their own; a caller with no scope sees nothing. Work whose author is mapped to no Leanmote user is visible only to the unrestricted."
      }
    },
    "/dashboard-views": {
      "get": {
        "operationId": "dashboard_views_list_my_dashboard_views",
        "tags": [
          "Dashboard views"
        ],
        "summary": "Lists the base view (always present) and all custom dashboards owned by the authenticated user.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "dashboard_view_id": null,
                      "dashboard_view_kind": "base",
                      "dashboard_view_name": "Base",
                      "dashboard_view_description": "Master view",
                      "created_by": {
                        "user_id": 529,
                        "user_name": "Rocio Alvarez",
                        "user_email": "rocio@example.com"
                      },
                      "created_at": null,
                      "updated_at": null
                    },
                    {
                      "dashboard_view_id": 38,
                      "dashboard_view_kind": "custom",
                      "dashboard_view_name": "APD",
                      "dashboard_view_description": "Quiero obtener las principales métricas...",
                      "created_by": {
                        "user_id": 529,
                        "user_name": "Rocio Alvarez",
                        "user_email": "rocio@example.com"
                      },
                      "created_at": "2025-10-06T17:58:48Z",
                      "updated_at": "2025-10-06T18:02:32Z",
                      "personalization": {
                        "filters": [
                          {
                            "filter_name": "teams",
                            "filter_values": [
                              "Platform"
                            ],
                            "created_at": "2025-10-06T18:02:32Z"
                          }
                        ],
                        "sections": [
                          {
                            "section_key": "dashboard_section",
                            "section_type": "default",
                            "created_at": "2025-10-06T18:02:32Z"
                          }
                        ],
                        "sections_mode": "explicit_whitelist",
                        "updated_at": "2025-10-06T18:02:32Z"
                      }
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 2,
                    "total_pages": 1,
                    "sort": "name",
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "page": 1,
                    "per_page": 50,
                    "sort": "name",
                    "order": "asc"
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter Malformed pagination or unknown query parameter. · invalid_timestamps_value timestamps` must be `datetime`, `int`, or `none`. · invalid_order_value order` is not `asc` or `desc`."
          },
          "403": {
            "description": "forbidden Requester is not part of the organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Lists the base view (always present) and all custom dashboards owned by the authenticated user. The endpoint honours `fields=` and the optional `timestamps` override, and supports the same pagination contract defined in `AGENTS.md`. Responses always include the full summary payload; provide `fields=` to project only specific attributes when needed."
      }
    },
    "/dashboard-views/catalog": {
      "get": {
        "operationId": "dashboard_views_get_dashboard_view_catalog",
        "tags": [
          "Dashboard views"
        ],
        "summary": "Returns the static widget catalogue together with the default classic filters.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "sections": [
                      {
                        "section_group": "dashboard_section",
                        "enabled_widgets": [
                          {
                            "widget_key": "dora-lead-time",
                            "widget_label": "Lead Time"
                          },
                          {
                            "widget_key": "dora-deployment-frequency",
                            "widget_label": "Deployment Frequency"
                          },
                          {
                            "widget_key": "dora-mean-time-to-recover",
                            "widget_label": "MTTR"
                          },
                          {
                            "widget_key": "dora-change-failure-rate",
                            "widget_label": "Change Failure Rate"
                          }
                        ]
                      },
                      {
                        "section_group": "team_activity",
                        "enabled_widgets": [
                          {
                            "widget_key": "q-tasks",
                            "widget_label": "Queued Tasks"
                          },
                          {
                            "widget_key": "wip",
                            "widget_label": "Work In Progress"
                          },
                          {
                            "widget_key": "avg-cycle-time",
                            "widget_label": "Average Cycle Time"
                          },
                          {
                            "widget_key": "avg-wip-age",
                            "widget_label": "Average WIP Age"
                          },
                          {
                            "widget_key": "waiting-time",
                            "widget_label": "Waiting Time"
                          },
                          {
                            "widget_key": "active-time",
                            "widget_label": "Active Time"
                          }
                        ]
                      }
                    ],
                    "filters": {
                      "classic": [
                        {
                          "filter_name": "teams",
                          "filter_type": "string[]"
                        },
                        {
                          "filter_name": "projects",
                          "filter_type": "string[]"
                        },
                        {
                          "filter_name": "repositories",
                          "filter_type": "string[]"
                        },
                        {
                          "filter_name": "issue_types",
                          "filter_type": "string[]"
                        },
                        {
                          "filter_name": "compare_with",
                          "filter_type": "string[]"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "forbidden Requester lacks access to the organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns the static widget catalogue together with the default classic filters. The payload does not depend on query parameters beyond the organization header."
      }
    },
    "/dashboard-views/custom-filters": {
      "get": {
        "operationId": "dashboard_views_list_dashboard_custom_filters",
        "tags": [
          "Dashboard views"
        ],
        "summary": "Lists custom dashboard filters configured for the organization/app combination.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "dashboard_custom_filter_id": 14,
                      "dashboard_custom_filter_name": "Priority",
                      "mapping_id": "priority",
                      "raw_values": [
                        "Medium",
                        "Highest",
                        "High",
                        "Low",
                        null
                      ],
                      "normalized_values": [
                        {
                          "label": "High",
                          "value": "High"
                        },
                        {
                          "label": "Highest",
                          "value": "Highest"
                        },
                        {
                          "label": "Low",
                          "value": "Low"
                        },
                        {
                          "label": "Medium",
                          "value": "Medium"
                        },
                        {
                          "label": "Unassigned",
                          "value": null
                        }
                      ],
                      "active": true,
                      "created_at": "2025-10-01T11:16:00Z",
                      "updated_at": "2025-10-06T13:45:00Z"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 20,
                    "total": 1,
                    "total_pages": 1,
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "app_id": 7,
                    "active": true,
                    "page": 1,
                    "per_page": 20
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter Missing or invalid `app_id`, invalid `active` value, or malformed pagination."
          },
          "403": {
            "description": "forbidden Requester lacks access to the organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Lists custom dashboard filters configured for the organization/app combination. `app_id` is required and `active=` filters by status. The endpoint follows the list contract with pagination support."
      }
    },
    "/dashboard-views/{view_id}": {
      "get": {
        "operationId": "dashboard_views_get_my_dashboard_view",
        "tags": [
          "Dashboard views"
        ],
        "summary": "Returns the detailed payload for the authenticated user's base view (`view_id_or_base=base`) or for a specific...",
        "parameters": [
          {
            "name": "view_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "dashboard_view_id": 38,
                    "dashboard_view_kind": "custom",
                    "dashboard_view_name": "APD",
                    "dashboard_view_description": "Quiero obtener las principales métricas...",
                    "created_by": {
                      "user_id": 529,
                      "user_name": "Rocio Alvarez",
                      "user_email": "rocio@example.com"
                    },
                    "created_at": "2025-10-06T17:58:48Z",
                    "updated_at": "2025-10-06T18:02:32Z",
                    "available": {
                      "sections": [
                        {
                          "section_group": "dashboard_section",
                          "widgets": [
                            {
                              "widget_key": "dora-lead-time",
                              "widget_label": "Lead Time"
                            },
                            {
                              "widget_key": "dora-deployment-frequency",
                              "widget_label": "Deployment Frequency"
                            },
                            {
                              "widget_key": "dora-mean-time-to-recover",
                              "widget_label": "MTTR"
                            },
                            {
                              "widget_key": "dora-change-failure-rate",
                              "widget_label": "Change Failure Rate"
                            }
                          ]
                        },
                        {
                          "section_group": "team_activity",
                          "widgets": [
                            {
                              "widget_key": "q-tasks",
                              "widget_label": "Queued Tasks"
                            },
                            {
                              "widget_key": "wip",
                              "widget_label": "Work In Progress"
                            },
                            {
                              "widget_key": "avg-cycle-time",
                              "widget_label": "Average Cycle Time"
                            },
                            {
                              "widget_key": "avg-wip-age",
                              "widget_label": "Average WIP Age"
                            },
                            {
                              "widget_key": "waiting-time",
                              "widget_label": "Waiting Time"
                            },
                            {
                              "widget_key": "active-time",
                              "widget_label": "Active Time"
                            }
                          ]
                        }
                      ],
                      "filters": {
                        "classic": [
                          {
                            "filter_name": "teams",
                            "filter_type": "string[]"
                          },
                          {
                            "filter_name": "projects",
                            "filter_type": "string[]"
                          },
                          {
                            "filter_name": "repositories",
                            "filter_type": "string[]"
                          },
                          {
                            "filter_name": "issue_types",
                            "filter_type": "string[]"
                          },
                          {
                            "filter_name": "compare_with",
                            "filter_type": "string[]"
                          }
                        ],
                        "custom": [
                          {
                            "dashboard_custom_filter_id": 9,
                            "filter_name": "priority",
                            "mapping_id": "priority",
                            "raw_values": [
                              "Medium",
                              "Highest",
                              "High",
                              "Low",
                              null
                            ],
                            "normalized_values": [
                              {
                                "label": "High",
                                "value": "High"
                              },
                              {
                                "label": "Highest",
                                "value": "Highest"
                              },
                              {
                                "label": "Low",
                                "value": "Low"
                              },
                              {
                                "label": "Medium",
                                "value": "Medium"
                              },
                              {
                                "label": "Unassigned",
                                "value": null
                              }
                            ],
                            "active": true,
                            "created_at": "2025-10-01T11:16:00Z",
                            "updated_at": "2025-10-06T13:45:00Z"
                          }
                        ]
                      }
                    },
                    "preferences": {
                      "filters": [
                        {
                          "filter_name": "projects",
                          "filter_values": [
                            "845"
                          ],
                          "created_at": "2025-10-06T17:58:48Z"
                        },
                        {
                          "filter_name": "compare_with",
                          "filter_values": [
                            "1"
                          ],
                          "created_at": "2025-10-06T18:02:32Z"
                        }
                      ],
                      "sections": {
                        "selection_mode": "implicit_all_on",
                        "enabled_widgets": []
                      }
                    },
                    "effective": {
                      "filters": {
                        "projects": [
                          "845"
                        ],
                        "compare_with": [
                          "1"
                        ]
                      },
                      "enabled_widgets": [
                        "dora-lead-time",
                        "dora-deployment-frequency",
                        "dora-mean-time-to-recover",
                        "dora-change-failure-rate",
                        "q-tasks",
                        "wip",
                        "avg-cycle-time",
                        "avg-wip-age",
                        "waiting-time",
                        "active-time"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_view_id view_id_or_base` is neither `base` nor a numeric identifier. · invalid_query_parameter Unknown query parameter or malformed pagination."
          },
          "403": {
            "description": "forbidden Requester lacks access to the user or organization."
          },
          "404": {
            "description": "view_not_found The dashboard does not belong to the user."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns the detailed payload for the authenticated user's base view (`view_id_or_base=base`) or for a specific custom dashboard id. Responses always include metadata, catalogue information, saved preferences, and the effective configuration. Use `fields=` to project selected paths. The `app_id` query parameter narrows custom filter discovery for the `available.filters.custom` array."
      }
    },
    "/deployments": {
      "get": {
        "operationId": "code_search_list_deployments",
        "tags": [
          "Git"
        ],
        "summary": "Lists the organization's deployments, newest first: GitHub deployment events, GitLab releases (one per pipeline that...",
        "parameters": [
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "description": "Filters by environment name. Optional. Substring match.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "production",
            "in": "query",
            "required": false,
            "description": "Only production (`true`) or non-production (`false`) deployments. Optional. `true`/`1`/`yes` or `false`/`0`/`no`. For Datadog, production means one of the environments the organization marked as production when connecting; with none marked, no Datadog deployment is production.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "Filters by state. Optional. Case-insensitive exact match on the GitHub state. Datadog rows only match `success` or `failure` (change failure).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repository_id",
            "in": "query",
            "required": false,
            "description": "Filters by repository. Optional.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "repository",
            "in": "query",
            "required": false,
            "description": "Filters by repository name. Optional. Substring match; first 200 characters.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "created_at[operator]",
            "in": "query",
            "required": false,
            "description": "Range filter on the deployment date (GitHub's creation date; for Datadog, when it finished, else when it started). Supports `eq`, `gt`, `gte`, `lt`, `lte`, with `field[op]`, `field__op` or `field_op` syntax and ISO-8601 values.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page to return. Optional. Defaults to `1`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Number of records per page. Optional. Defaults to `50`. Maximum `500`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "deployment_id": 7710,
                      "source": "datadog",
                      "repository": {
                        "repository_id": 310,
                        "name": "api"
                      },
                      "environment": "prod",
                      "production": true,
                      "state": "success",
                      "ref": null,
                      "sha": "3f9c2a7d1e4b8c0a6f5e2d1c9b8a7f6e5d4c3b2a",
                      "url": null,
                      "created_at": "2026-11-13T10:20:00",
                      "state_updated_at": "2026-11-13T10:20:00",
                      "service": "api",
                      "version": "v518",
                      "change_failure": false,
                      "recovery_seconds": null
                    },
                    {
                      "deployment_id": 4402,
                      "source": "github",
                      "repository": {
                        "repository_id": 310,
                        "name": "api"
                      },
                      "environment": "production",
                      "production": true,
                      "state": "success",
                      "ref": "main",
                      "sha": "3f9c2a7d1e4b8c0a6f5e2d1c9b8a7f6e5d4c3b2a",
                      "url": "https://api.example.com",
                      "created_at": "2026-11-13T10:12:31",
                      "state_updated_at": "2026-11-13T10:14:02"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 2,
                    "total_pages": 1,
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "production": true,
                    "created_at": {
                      "gte": "2026-11-01T00:00:00Z"
                    }
                  },
                  "dora_source": "datadog",
                  "dora_counts": "Datadog deployments to the environments marked as production — the 'datadog' rows of this list."
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter production` is not a boolean, or `repository_id` is not an integer. · invalid_pagination page` or `per_page` is not a positive integer. · invalid_date_filter_operator A date filter uses an operator other than `eq`, `gt`, `gte`, `lt`, `lte`. · invalid_date_filter A date filter value is not a single ISO-8601 string."
          },
          "403": {
            "description": "forbidden No organization scope or authenticated user."
          },
          "404": {
            "description": "organization_not_found The caller does not belong to the organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Lists the organization's deployments, newest first: GitHub deployment events, GitLab releases (one per pipeline that reached production, derived by the GitLab extractor while GitLab is the DORA source, RD-4206), Bitbucket deployments (one per successful Bitbucket Pipelines deployment to a Production environment, derived by the Bitbucket extractor while Bitbucket is the DORA source, RD-4296), Jenkins deployments (one per Jenkins build that deployed to production, derived by the Jenkins extractor while the organization adds Jenkins to DORA, RD-4356) and, when Datadog is connected, Datadog deployments next to them, each row saying its `source`. Deployments have no author, so they are not filtered by person: anyone with a team scope in the organization sees them all; a caller with no scope gets an empty list. The response also says what DORA's Deployment Frequency counts for this organization (`dora_source`), because without the `dora_metrics_from_deployments` flag DORA counts merged pull requests, which this list does not hold."
      }
    },
    "/git/apps": {
      "get": {
        "operationId": "git_list_git_apps",
        "tags": [
          "Git"
        ],
        "summary": "Returns the Git-enabled apps discovered from `repositories`.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "app_id": 5,
                      "app_name": "GitLab"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 1,
                    "total": 1,
                    "total_pages": 1,
                    "timestamps": "none"
                  }
                }
              }
            }
          },
          "403": {
            "description": "forbidden Requester lacks organization access."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns the Git-enabled apps discovered from `repositories`. The endpoint is not paginated but still uses the success envelope."
      }
    },
    "/git/apps/{app_id}/repositories": {
      "get": {
        "operationId": "git_list_repositories",
        "tags": [
          "Git"
        ],
        "summary": "Lists repositories for the selected app with optional filters for name and activity.",
        "parameters": [
          {
            "name": "app_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "repository_id": 12,
                      "repository_app_id": "123456",
                      "repository_name": "platform-backend",
                      "owner": "leanmote",
                      "active": true,
                      "created_at": "2024-05-12T09:00:00Z"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "name",
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "active": 1,
                    "fields": [
                      "repository_id",
                      "repository_name",
                      "active"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter Invalid `active` flag or pagination parameter. · invalid_sort_attribute Unsupported `sort` (allowed: `name`, `last_updated`, `created_at`). · invalid_order_value order` is not `asc`/`desc`."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Lists repositories for the selected app with optional filters for name and activity."
      }
    },
    "/git/apps/{app_id}/repositories/all/commits": {
      "get": {
        "operationId": "git_list_all_commits",
        "tags": [
          "Git"
        ],
        "summary": "Lists commits across every repository synchronized for the selected app within the organization scope.",
        "parameters": [
          {
            "name": "app_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "commit_id": 901,
                      "commit_app_id": "abc123",
                      "title": "Fix login",
                      "message": "refactor: improve auth flow",
                      "author": {
                        "user_id": 42,
                        "user_name": "Alex Leanmote",
                        "user_email": "alex@leanmote.com"
                      },
                      "repository": {
                        "repository_id": 12,
                        "repository_name": "platform-backend"
                      },
                      "commit_creation_date": "2024-09-20T09:15:00Z"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "commit_creation_date",
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "author": "alex",
                    "commit_creation_date": {
                      "gte": "2024-09-01"
                    },
                    "fields": [
                      "commit_id",
                      "title",
                      "author",
                      "repository"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_path_parameter app_id` is not numeric. · invalid_query_parameter Invalid `author` filter or pagination. · invalid_sort_attribute Unsupported `sort` (allowed: `commit_creation_date`, `created_at`). · invalid_date_filter Date comparison does not contain a valid ISO-8601 value. · invalid_date_filter_operator Unsupported comparison operator in the date filter."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Lists commits across every repository synchronized for the selected app within the organization scope. It supports the same filtering, sorting, and date comparison contract as the repository-specific commits endpoint and also caps `per_page` at `2000`."
      }
    },
    "/git/apps/{app_id}/repositories/all/pull-requests": {
      "get": {
        "operationId": "git_list_all_pull_requests",
        "tags": [
          "Git"
        ],
        "summary": "Lists pull requests across every repository synchronized for the selected app within the organization scope.",
        "parameters": [
          {
            "name": "app_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "pull_request_id": 77,
                      "pull_request_app_id": "MR-45",
                      "title": "Add analytics",
                      "state": "opened",
                      "author": {
                        "user_id": 42,
                        "user_name": "Alex Leanmote",
                        "user_email": "alex@leanmote.com"
                      },
                      "repository": {
                        "repository_id": 12,
                        "repository_name": "platform-backend"
                      },
                      "created_at": "2024-09-22T10:00:00Z"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "creation_date",
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "state": "opened",
                    "creation_date": {
                      "gte": "2024-09-01T00:00:00Z"
                    },
                    "fields": [
                      "pull_request_id",
                      "title",
                      "state",
                      "author",
                      "repository"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_path_parameter app_id` is not numeric. · invalid_query_parameter Invalid `state` filter or pagination parameter. · invalid_sort_attribute Unsupported `sort` (allowed: `creation_date`, `merged_at`, `closed_at`). · invalid_date_filter Date comparison does not contain a valid ISO-8601 value. · invalid_date_filter_operator Unsupported comparison operator in the date filter."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Lists pull requests across every repository synchronized for the selected app within the organization scope. It supports the same state/date filters and sorting contract as the repository-specific pull request endpoint and includes repository context in every item. The endpoint caps `per_page` at `2000`."
      }
    },
    "/git/apps/{app_id}/repositories/{repository_id}": {
      "get": {
        "operationId": "git_get_repository",
        "tags": [
          "Git"
        ],
        "summary": "Returns metadata for a repository scoped to the organization.",
        "parameters": [
          {
            "name": "app_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "repository_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "repository_id": 12,
                    "repository_name": "platform-backend",
                    "app": {
                      "app_id": 5,
                      "app_name": "GitLab"
                    },
                    "created_at": "2024-05-12T09:00:00Z"
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_path_parameter app_id` or `repository_id` is not numeric."
          },
          "404": {
            "description": "repository_not_found Repository does not belong to the organization scope."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns metadata for a repository scoped to the organization."
      }
    },
    "/git/apps/{app_id}/repositories/{repository_id}/commits": {
      "get": {
        "operationId": "git_list_commits",
        "tags": [
          "Git"
        ],
        "summary": "Lists commits for the repository with pagination and optional author filtering.",
        "parameters": [
          {
            "name": "app_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "repository_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "commit_id": 901,
                      "commit_app_id": "abc123",
                      "title": "Fix login",
                      "message": "refactor: improve auth flow",
                      "author": {
                        "user_id": 42,
                        "user_name": "Alex Leanmote",
                        "user_email": "alex@leanmote.com"
                      },
                      "commit_creation_date": "2024-09-20T09:15:00Z"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "commit_creation_date",
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "author": "alex@leanmote.com",
                    "commit_creation_date": {
                      "gte": "2024-09-01",
                      "lte": "2024-09-30"
                    },
                    "fields": [
                      "commit_id",
                      "title",
                      "author"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter Invalid `author` filter or pagination. · invalid_sort_attribute Unsupported `sort` (allowed: `commit_creation_date`, `created_at`). · invalid_date_filter Date comparison does not contain a valid ISO-8601 value. · invalid_date_filter_operator Unsupported comparison operator in the date filter."
          },
          "404": {
            "description": "repository_not_found Repository does not belong to the organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Lists commits for the repository with pagination and optional author filtering. The endpoint also supports ISO-8601 comparisons on `commit_creation_date`, `created_at`, and `updated_at` using the bracket syntax. Append operators as `commit_creation_date[gte]=2024-09-01` or `created_at[lte]=2024-09-30T23:59:59Z`. Accepted operators are `eq`, `gt`, `gte`, `lt`, and `lte`. Commit listings cap `per_page` at `2000`."
      }
    },
    "/git/apps/{app_id}/repositories/{repository_id}/pull-requests": {
      "get": {
        "operationId": "git_list_pull_requests",
        "tags": [
          "Git"
        ],
        "summary": "Lists pull requests with optional state filtering.",
        "parameters": [
          {
            "name": "app_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "repository_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "pull_request_id": 77,
                      "pull_request_app_id": "MR-45",
                      "title": "Add analytics",
                      "state": "opened",
                      "author": {
                        "user_id": 42,
                        "user_name": "Alex Leanmote",
                        "user_email": "alex@leanmote.com"
                      },
                      "created_at": "2024-09-22T10:00:00Z"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "creation_date",
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "state": "opened",
                    "creation_date": {
                      "gte": "2024-09-01T00:00:00Z"
                    },
                    "fields": [
                      "pull_request_id",
                      "title",
                      "state",
                      "author"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter Invalid `state` filter or pagination parameter. · invalid_sort_attribute Unsupported `sort` (allowed: `creation_date`, `merged_at`, `closed_at`). · invalid_date_filter Date comparison does not contain a valid ISO-8601 value. · invalid_date_filter_operator Unsupported comparison operator in the date filter."
          },
          "404": {
            "description": "repository_not_found Repository not accessible to the organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Lists pull requests with optional state filtering. Date comparisons can be applied to `creation_date`, `merged_at`, `closed_at`, `first_approval_at`, `created_at`, and `updated_at` using the same `field[operator]=value` syntax described above. Operators `eq`, `gt`, `gte`, `lt`, and `lte` are accepted with ISO-8601 values."
      }
    },
    "/git/apps/{app_id}/repositories/{repository_id}/pull-requests/{pull_request_id}/notes": {
      "get": {
        "operationId": "git_list_pull_request_notes",
        "tags": [
          "Git"
        ],
        "summary": "Lists pull request notes tied to a specific merge request.",
        "parameters": [
          {
            "name": "app_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "repository_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "pull_request_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "note_id": 901,
                      "note_content": "Please update the changelog before merging.",
                      "author": {
                        "user_id": 42,
                        "user_name": "Alex Leanmote",
                        "user_email": "alex@leanmote.com"
                      },
                      "created_at": "2024-09-22T12:00:00Z"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "creation_date",
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "author": "alex",
                    "creation_date": {
                      "gte": "2024-09-01T00:00:00Z"
                    },
                    "fields": [
                      "note_id",
                      "note_content",
                      "author"
                    ],
                    "pull_request": {
                      "pull_request_id": 77,
                      "pull_request_app_id": "MR-45",
                      "title": "Add analytics"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter Invalid `author` filter or pagination parameter. · invalid_sort_attribute Unsupported `sort` (allowed: `creation_date`, `created_at`, `updated_at`). · invalid_date_filter Date comparison does not contain a valid ISO-8601 value. · invalid_date_filter_operator Unsupported comparison operator in the date filter."
          },
          "404": {
            "description": "pull_request_not_found Pull request does not belong to the organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Lists pull request notes tied to a specific merge request. Notes are returned only when the author can be mapped to a Leanmote user. Filters support author matching and date comparisons over `creation_date`, `created_at`, and `updated_at` using the `field[operator]`, `field__operator`, or `field_operator` syntax."
      }
    },
    "/git/apps/{app_id}/repositories/{repository_id}/pull-requests/{pull_request_id}/notes/{note_id}": {
      "get": {
        "operationId": "git_get_pull_request_note",
        "tags": [
          "Git"
        ],
        "summary": "Returns a single note ensuring it belongs to the pull request and the organization.",
        "parameters": [
          {
            "name": "app_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "repository_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "pull_request_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "note_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "note_id": 901,
                    "note_app_id": "N-789",
                    "note_content": "Please update the changelog before merging.",
                    "author": {
                      "user_id": 42,
                      "user_name": "Alex Leanmote",
                      "user_email": "alex@leanmote.com"
                    },
                    "creation_date": "2024-09-22T12:00:00Z",
                    "created_at": "2024-09-22T12:00:00Z",
                    "updated_at": "2024-09-22T12:05:00Z",
                    "pull_request": {
                      "pull_request_id": 77,
                      "pull_request_app_id": "MR-45",
                      "title": "Add analytics"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_path_parameter note_id` is not numeric."
          },
          "404": {
            "description": "pull_request_not_found Pull request does not belong to the organization. · pull_request_note_not_found Note not found for the repository and pull request. · pull_request_note_author_not_found Note author is not mapped to a Leanmote user."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns a single note ensuring it belongs to the pull request and the organization."
      }
    },
    "/health": {
      "get": {
        "operationId": "meta_health",
        "tags": [
          "Health"
        ],
        "summary": "Headers must include a valid token that exists in the `api_tokens` table and an `Organization` value equal to the...",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`)."
          },
          "500": {
            "description": "internal_server_error Unexpected failure while assembling the health payload."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Headers must include a valid token that exists in the `api_tokens` table and an `Organization` value equal to the numeric `id_organization`. Header names are case-insensitive, but API Gateway treats missing or blank values as absent and returns `missing_organization_header`."
      }
    },
    "/insights": {
      "get": {
        "operationId": "insights_list_insights",
        "tags": [
          "Bottleneck insights"
        ],
        "summary": "Open Bottleneck Insights of the views offered to the caller, highest drag cost first, each with its evidence.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "id": 78706,
                      "type": "early_warning",
                      "source_type": "ai_return",
                      "insight_key": "EARLY_WARNING_AGENT_RUN_COST",
                      "severity": "high",
                      "title": "Unattended agent runs off the scale (44) — cap the runner",
                      "summary": "44 unattended runs each consumed more than $19.1 in 30 days (this organization's typical run costs $0.2). Estimated avoidable consumption: $2,166, at list price.",
                      "view": {
                        "id": "1421",
                        "name": "Q4 delivery",
                        "is_general": false
                      },
                      "from_date": "2026-09-08",
                      "to_date": "2026-10-08",
                      "detected_at": "2026-10-08 07:15:02",
                      "drag_cost_usd": 72.2,
                      "drag_cost_is_per_day": true,
                      "evidence": {
                        "narrative": "44 unattended runs cost more than $19.1 each...",
                        "bullets": [
                          "3 runners account for 80% of the excess"
                        ],
                        "projected_impact": "Avoidable spend keeps growing while the runner has no cap.",
                        "metric": null,
                        "related_metrics": [],
                        "item_type": "Runs",
                        "items": [
                          {
                            "id": "run:8812",
                            "url": "https://github.com/acme/api/actions/runs/8812",
                            "owner": "Ana Pérez",
                            "title": "nightly-refactor",
                            "cost_usd": 61.4
                          }
                        ],
                        "items_total": 44,
                        "items_available": 44,
                        "items_truncated": true,
                        "top_tasks": [],
                        "contributors": []
                      },
                      "resolution": {
                        "title": "Cap the runner",
                        "steps": [
                          "Set a per-run budget of $5 on the nightly runner."
                        ],
                        "links": [
                          {
                            "url": "https://github.com/acme/api/actions/runs/8812",
                            "label": "nightly-refactor"
                          }
                        ]
                      },
                      "drag_cost_basis": {
                        "strategy": "avoidable_spend",
                        "estimated_cost_usd": 2166,
                        "estimated_cost_per_day_usd": 72.2,
                        "affected_items": 44,
                        "formula_inputs": {
                          "typical_run_usd": 0.2
                        }
                      }
                    }
                  ],
                  "meta": {
                    "total": 7,
                    "limit": 20,
                    "truncated": false,
                    "views": [
                      {
                        "id": "general",
                        "name": null,
                        "is_shared": false
                      },
                      {
                        "id": "1421",
                        "name": "Q4 delivery",
                        "is_shared": true
                      }
                    ]
                  },
                  "applied_filters": {
                    "view": "1421",
                    "type": "early_warning"
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_view view` is neither a positive id nor `general`. · invalid_type type` is not `anomaly`, `early_warning` or `all`. · invalid_severity severity` is not `high`, `medium`, `low` or `all`. · invalid_limit limit` is not a positive integer. · invalid_evidence_items evidence_items` is not a non-negative integer."
          },
          "403": {
            "description": "insights_forbidden The caller has neither the permission nor a shared view. · view_forbidden The view is not one the caller reaches, or General is not offered."
          },
          "422": {
            "description": "view_analysis_off The caller reaches the view, but its analysis is off."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Open Bottleneck Insights of the views offered to the caller, highest drag cost first, each with its evidence."
      }
    },
    "/insights/{id}": {
      "get": {
        "operationId": "insights_get_insight",
        "tags": [
          "Bottleneck insights"
        ],
        "summary": "One insight, with up to 500 affected items, top tasks and contributors.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "id": 78706,
                    "type": "early_warning",
                    "title": "...",
                    "evidence": {
                      "items": [
                        "... all 44 ..."
                      ],
                      "items_total": 44,
                      "items_available": 44,
                      "items_truncated": false
                    },
                    "resolution": {
                      "...": "..."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_id id` is not a positive integer."
          },
          "403": {
            "description": "insights_forbidden The caller has neither the permission nor a shared view."
          },
          "404": {
            "description": "insight_not_found The row is closed, belongs to a view the caller is not offered, is hidden or gated, or does not exist."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "One insight, with up to 500 affected items, top tasks and contributors. It is for a caller that got `evidence.items_truncated` from the list. The scope is the list's: open rows of the offered views and the caller's General, with the AI Return gate and the dismiss verdicts applied. Any other id is a 404. The endpoint does not say whether the row exists in another view."
      }
    },
    "/interactions": {
      "get": {
        "operationId": "interactions_list_interactions",
        "tags": [
          "Interactions"
        ],
        "summary": "Returns interactions with optional filtering by integration (`app_id`), data source type, date range, and user...",
        "parameters": [
          {
            "name": "app_id",
            "in": "query",
            "required": false,
            "description": "Filters interactions to a specific integration. Optional. Must reference an application available to the organization.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Restricts interactions to a data source type. Optional. Matches `data_source.type_id`; see integrations catalogue for identifiers.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "user_id",
            "in": "query",
            "required": false,
            "description": "Limits results to interactions where the user is the sender or a participant. Optional. Must reference a user within the organization scope.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "interaction_timestamp[operator]",
            "in": "query",
            "required": false,
            "description": "Applies range filters over the interaction timestamp. Supports `eq`, `gt`, `gte`, `lt`, `lte`. Value must be ISO-8601 (`YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "created_at[operator]",
            "in": "query",
            "required": false,
            "description": "Applies range filters over the creation timestamp. Same operators and ISO-8601 requirement as `interaction_timestamp[operator]`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "description": "Selects specific fields to return. Comma-separated list that supports dotted paths (for example, `app.app_name`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Sorting attribute. Optional. Allowed values: `interaction_timestamp`, `created_at`. Defaults to `interaction_timestamp`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "description": "Sorting direction. Optional. Allowed values: `asc`, `desc`. Defaults to `asc`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page to return. Optional. Defaults to `1`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Number of records per page. Optional. Defaults to `50`. Maximum `200`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "timestamps",
            "in": "query",
            "required": false,
            "description": "Controls timestamp formatting. Optional. Allowed values: `datetime` (default), `int`, `none` (deprecated).",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "interaction_id": 301,
                      "app": {
                        "app_id": 11,
                        "app_name": "Slack"
                      },
                      "sender": {
                        "user_id": 42,
                        "user_name": "Alex Leanmote",
                        "user_email": "alex.leanmote@example.com"
                      },
                      "receivers": [
                        {
                          "user_id": 56,
                          "user_name": "Jamie Receiver",
                          "user_email": "jamie.receiver@example.com"
                        }
                      ],
                      "data_source": {
                        "type_id": 2,
                        "type_name": "messages",
                        "source_id": 999
                      },
                      "interaction_timestamp": "2024-09-14T10:30:00",
                      "created_at": "2024-09-14T10:31:10"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "interaction_timestamp",
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "app_id": 11,
                    "type": 2,
                    "user_id": 42,
                    "interaction_timestamp": {
                      "gte": "2024-09-01T00:00:00",
                      "lte": "2024-09-30T23:59:59"
                    },
                    "fields": [
                      "interaction_id",
                      "app.app_id",
                      "app.app_name",
                      "sender",
                      "receivers",
                      "data_source"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter Invalid `app_id`, `type`, or `user_id`. · invalid_sort_attribute Unsupported `sort` (allowed: `interaction_timestamp`, `created_at`). · invalid_order_value order` is not `asc`/`desc`. · invalid_date_filter Date comparison does not contain a valid ISO-8601 value. · invalid_date_filter_operator Unsupported comparison operator in the date filter."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns interactions with optional filtering by integration (`app_id`), data source type, date range, and user involvement. Date filters support `field[operator]=value`, `field__operator=value`, or `field_operator=value` comparisons (`eq`, `gt`, `gte`, `lt`, `lte`) on `interaction_timestamp` or `created_at`."
      }
    },
    "/interactions/{interaction_id}": {
      "get": {
        "operationId": "interactions_get_interaction",
        "tags": [
          "Interactions"
        ],
        "summary": "Returns a single interaction.",
        "parameters": [
          {
            "name": "interaction_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "interaction_id": 301,
                    "app": {
                      "app_id": 11,
                      "app_name": "Slack"
                    },
                    "sender": {
                      "user_id": 42,
                      "user_name": "Alex Leanmote",
                      "user_email": "alex.leanmote@example.com"
                    },
                    "receivers": [
                      {
                        "user_id": 56,
                        "user_name": "Jamie Receiver",
                        "user_email": "jamie.receiver@example.com"
                      }
                    ],
                    "data_source": {
                      "type_id": 2,
                      "type_name": "messages",
                      "source_id": 999
                    },
                    "interaction_timestamp": "2024-09-14T10:30:00",
                    "created_at": "2024-09-14T10:31:10"
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_path_parameter interaction_id` is not numeric."
          },
          "404": {
            "description": "interaction_not_found Interaction not found for the organization scope."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns a single interaction."
      }
    },
    "/metrics-summary": {
      "post": {
        "operationId": "metrics_summary_summary",
        "tags": [
          "Executive summary"
        ],
        "summary": "Measures the requested metrics for each segment over the period and, unless `compare` is `false`, over the same...",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "from": "2026-10-01",
                  "to": "2026-10-31",
                  "previous": {
                    "from": "2026-08-31",
                    "to": "2026-09-30"
                  },
                  "data_as_of": "2026-11-26 10:00:00",
                  "segments": [
                    {
                      "name": "Colombia",
                      "filters": {
                        "teams": [
                          220,
                          299
                        ],
                        "include_subteams": true,
                        "repositories": [
                          1201,
                          1202
                        ]
                      },
                      "metrics": {
                        "deployment_frequency": {
                          "value": 2.0,
                          "unit": "deployments_per_day",
                          "previous_value": 1.0,
                          "change_pct": 100.0,
                          "count": 62,
                          "benchmark": "Elite",
                          "source": "prs"
                        },
                        "mean_time_to_recover": {
                          "value": 4.5,
                          "unit": "hours",
                          "previous_value": 6.0,
                          "change_pct": -25.0,
                          "count": 3,
                          "benchmark": "Elite",
                          "source": "prs"
                        },
                        "mean_time_to_recover_by_severity": {
                          "value": 3.0,
                          "unit": "hours",
                          "previous_value": 4.0,
                          "change_pct": -25.0,
                          "count": 2,
                          "open": 1,
                          "severities": [
                            "SEV-1"
                          ]
                        },
                        "time_to_market": {
                          "value": 120.0,
                          "unit": "hours",
                          "previous_value": 100.0,
                          "change_pct": 20.0,
                          "statistic": "median"
                        },
                        "ai_assisted_prs": {
                          "value": 42.5,
                          "unit": "percent",
                          "previous_value": null,
                          "change_pct": 8.1
                        },
                        "availability": {
                          "value": 99.45,
                          "unit": "percent",
                          "previous_value": null,
                          "change_pct": null,
                          "statistic": "mean_sli",
                          "slos": [
                            {
                              "id": "a1",
                              "name": "API Pagos",
                              "sli": 99.9,
                              "target": 99.5,
                              "met": true
                            }
                          ]
                        },
                        "observability_coverage": {
                          "value": 75.0,
                          "unit": "percent",
                          "previous_value": null,
                          "change_pct": null,
                          "breakdown": {
                            "services": 40,
                            "traces_pct": 90.0,
                            "logs_pct": 80.0,
                            "metrics_pct": 95.0
                          },
                          "as_of": "2026-11-26 09:00:00"
                        },
                        "traffic_outside_monolith": {
                          "value": 40.0,
                          "unit": "percent",
                          "previous_value": 12.5,
                          "change_pct": 220.0,
                          "count": 1000,
                          "monolith_count": 600,
                          "monolith": [
                            "core-monolith"
                          ],
                          "source": "apm"
                        },
                        "change_failure_rate": {
                          "value": null,
                          "unit": "percent",
                          "previous_value": null,
                          "change_pct": null,
                          "error": "metrics_unavailable"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "organization_required The request carries no organization."
          },
          "422": {
            "description": "invalid_body The body is not a JSON object, or `compare` is not a boolean. · invalid_period The dates `from`/`to` are missing, not `YYYY-MM-DD`, reversed, or more than 366 days apart. · invalid_metrics The list `metrics` is empty or has an unknown name (the message lists the valid ones). · invalid_segment A segment without a valid unique `name`, with an unknown key, or with a list that is not ids / names."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Measures the requested metrics for each segment over the period and, unless `compare` is `false`, over the same number of days right before it, returning per segment and metric its value, unit, previous value, relative change and where it came from.",
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "metrics": [
                  "deployment_frequency",
                  "lead_time_for_changes",
                  "change_failure_rate",
                  "mean_time_to_recover",
                  "mean_time_to_recover_by_severity",
                  "time_to_market",
                  "ai_assisted_prs",
                  "availability",
                  "observability_coverage",
                  "traffic_outside_monolith"
                ],
                "segments": [
                  {
                    "name": "Global",
                    "severities": [
                      "SEV-1"
                    ],
                    "monolith": [
                      "core-monolith"
                    ]
                  },
                  {
                    "name": "Colombia",
                    "teams": [
                      220,
                      299
                    ],
                    "repositories": [
                      1201,
                      1202
                    ]
                  },
                  {
                    "name": "México",
                    "teams": [
                      602
                    ],
                    "slos": [
                      "Checkout MX"
                    ],
                    "services": [
                      "pagos-mx"
                    ],
                    "countries": [
                      "mx"
                    ],
                    "monolith": [
                      "core-monolith"
                    ]
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/metrics/query/ai-tools/agents": {
      "post": {
        "operationId": "metrics_query_ai_tools_agents",
        "tags": [
          "AI adoption"
        ],
        "summary": "AI agents",
        "description": "The organization's AI agents and their activity.\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/ai-tools/harness": {
      "post": {
        "operationId": "metrics_query_ai_tools_harness",
        "tags": [
          "AI adoption"
        ],
        "summary": "AI harness",
        "description": "Maturity of each AI agent's harness.\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/ai-tools/impact": {
      "post": {
        "operationId": "metrics_query_ai_tools_impact",
        "tags": [
          "AI adoption"
        ],
        "summary": "AI impact",
        "description": "Delivery differences between work done with and without AI.\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/ai-tools/overview": {
      "post": {
        "operationId": "metrics_query_ai_tools_overview",
        "tags": [
          "AI adoption"
        ],
        "summary": "AI overview",
        "description": "Summary of AI usage, cost and impact.\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/ai-tools/roi": {
      "post": {
        "operationId": "metrics_query_ai_tools_roi",
        "tags": [
          "AI adoption"
        ],
        "summary": "AI ROI",
        "description": "What AI costs against the time it saves.\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/ai-tools/sessions": {
      "post": {
        "operationId": "metrics_query_ai_tools_sessions",
        "tags": [
          "AI adoption"
        ],
        "summary": "AI sessions",
        "description": "Work sessions with AI agents and their outcome.\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/ai-tools/usage": {
      "post": {
        "operationId": "metrics_query_ai_tools_usage",
        "tags": [
          "AI adoption"
        ],
        "summary": "AI usage",
        "description": "Who uses AI tools, how much and which ones.\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/capacity-metrics": {
      "post": {
        "operationId": "metrics_query_capacity_metrics",
        "tags": [
          "Delivery"
        ],
        "summary": "Capacity",
        "description": "The team's available hours against its assigned load.\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/databricks-metrics": {
      "post": {
        "operationId": "metrics_query_databricks_metrics",
        "tags": [
          "Quality and operations"
        ],
        "summary": "Databricks",
        "description": "Databricks usage and cost: jobs, clusters and consumption.\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/dora-metrics": {
      "post": {
        "operationId": "metrics_query_dora_metrics",
        "tags": [
          "Delivery"
        ],
        "summary": "DORA",
        "description": "The four DORA delivery metrics: deployment frequency, lead time, change failure rate and time to recover.\n\n**Metrics**\n\n- **Deployment frequency** (`deployment_frequency`) — DORA metric: merged PRs per day. If the organization measures with deployments (GitHub, GitLab, Bitbucket or Datadog), production deployments per day. (per day, higher is better)\n- **Lead time for changes** (`lead_time_for_changes`) — DORA metric: time from a change until it reaches production. By default each pull request of a change is measured from its first commit (or the branch's creation, if the organization chose it) until the change reaches the repository's production branch (its default branch, or the prod/production branch it is promoted into): its own merge, or that of the pull request that brings it there along the chain dev → testing → main. Promotion and back-merge pull requests do not count, and a change that has not arrived yet counts when it does. With GitLab deployments, a view can measure it to the deployment that took it to production, with the wait from the merge and the certification in QA. (hours, lower is better)\n- **Change failure rate** (`change_failure_rate`) — DORA metric: share of merged PRs whose title points to a fix (fix, hotfix, bug, glitch…). If the organization measures with deployments, share of deployments flagged as a failure. (percentage points (0-100), lower is better)\n- **Mean time to recover** (`mean_time_to_recover`) — DORA metric: average time from the previous merge in the repository to the merge of a hotfix or revert PR. If the organization measures with Datadog, GitLab or Bitbucket deployments, average time from a failed deployment to the deployment that recovers it. (hours, lower is better)\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/flow-metrics": {
      "post": {
        "operationId": "metrics_query_flow_metrics",
        "tags": [
          "Delivery"
        ],
        "summary": "Flow",
        "description": "How work flows through the board: cycle and waiting times, work in progress and deliveries.\n\n**Metrics**\n\n- **Cycle time** (`cycle_time`) — Time from when a work item starts until it is completed. (days, lower is better)\n- **Waiting time** (`waiting_time`) — Time work items spend in waiting statuses, summed over the period's work items. (days, lower is better)\n- **Active time** (`active_time`) — Time work items spend in active work statuses, summed over the period's work items. (days, higher is better)\n- **Flow efficiency** (`flow_efficiency`) — Share of cycle time spent in active work, as a percentage. (percentage points (0-100), higher is better)\n- **Time to market** (`time_to_market`) — Median time from when a work item is created until it is delivered. (days, lower is better)\n- **Work in progress** (`work_in_progress`) — Number of work items in progress. (count, lower is better)\n- **Age of work in progress** (`avg_age_wip`) — Average age of the work items still in progress. (days, lower is better)\n- **Throughput** (`throughput`) — Number of work items completed in the period. (count, higher is better)\n- **Straight to done** (`direct_to_done_rate`) — Share of work items moved to done without going through in progress; high means the board does not reflect the real work. (percentage points (0-100), lower is better)\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/flow/partial_progress": {
      "post": {
        "operationId": "metrics_query_flow_partial_progress",
        "tags": [
          "Delivery"
        ],
        "summary": "Partial progress",
        "description": "Progress of unfinished work items, from their subtasks.\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/flow/progress_by_front": {
      "post": {
        "operationId": "metrics_query_flow_progress_by_front",
        "tags": [
          "Delivery"
        ],
        "summary": "Progress by front",
        "description": "Work progress grouped by front or initiative.\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/flow/sprint_report": {
      "post": {
        "operationId": "metrics_query_flow_sprint_report",
        "tags": [
          "Delivery"
        ],
        "summary": "Sprint report",
        "description": "What was planned, unplanned, discarded and completed in each sprint.\n\n**Metrics**\n\n- **Commitment met** (`sprint_commitment_met`) — Of what the sprints planned at their start, how much was completed: completed ÷ planned. It also counts unplanned work that was completed, so it can pass 100%. (percentage points (0-100), higher is better)\n- **Total completion** (`sprint_total_completion`) — What was completed over everything the sprints held: completed ÷ (planned + unplanned). Never above 100%. (percentage points (0-100), higher is better)\n- **Velocity** (`sprint_velocity`) — Average of what each sprint closed in the period completed, in the view’s unit (story points, work items or hours). (count, higher is better)\n- **Scope changes** (`sprint_scope_changes`) — Unplanned work: what came into the sprints after they started, as a percentage of what was planned. Discarded work (taken out before closing) is reported apart. (percentage points (0-100), lower is better)\n- **Carry-over** (`sprint_carry_over`) — What was in the sprints when they closed and was not completed, as a percentage of what was planned. It also counts unplanned work that was not completed. (percentage points (0-100), lower is better)\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/flow/story_lifecycle": {
      "post": {
        "operationId": "metrics_query_flow_story_lifecycle",
        "tags": [
          "Delivery"
        ],
        "summary": "Work item life cycle",
        "description": "How each story or task moves through the repository rather than the board's statuses: waiting until its first commit, development until its PR opens, review until it merges into the development branch, then on to QA and production. Each PR is linked to its task by the key in its title, branch or description; QA and production are detected through promotion PRs between environment branches (dev → qa → main), so those stages are an approximation. Gives each stage's median and p85, the times per assignee and every item with its current stage.\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/flow/storypoints": {
      "post": {
        "operationId": "metrics_query_flow_storypoints",
        "tags": [
          "Delivery"
        ],
        "summary": "Story points",
        "description": "The story points of the work items completed in the period: the total and the average per estimated work item.\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/investment/allocation": {
      "post": {
        "operationId": "metrics_query_investment_allocation",
        "tags": [
          "Cost and investment"
        ],
        "summary": "Investment allocation",
        "description": "Which kinds of work the team's effort goes to.\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/investment/capitalization": {
      "post": {
        "operationId": "metrics_query_investment_capitalization",
        "tags": [
          "Cost and investment"
        ],
        "summary": "Capitalization",
        "description": "Which part of the effort can be capitalized.\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/noc-metrics": {
      "post": {
        "operationId": "metrics_query_noc_metrics",
        "tags": [
          "Quality and operations"
        ],
        "summary": "Support",
        "description": "Support tickets: volume, response and resolution times.\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/project-financials": {
      "post": {
        "operationId": "metrics_query_project_financials",
        "tags": [
          "Cost and investment"
        ],
        "summary": "Project financials",
        "description": "Each project's or team's cost from hours and role costs.\n\n**Metrics**\n\n- **Team size** (`team_size`) — Active people on the team at the end of the period. (count, higher is better)\n- **Average team size** (`avg_team_size`) — How many people the team had on average over the period, counting joiners and leavers. (count, higher is better)\n- **Throughput per person** (`avg_throughput_per_person`) — Completed items divided by the team's average size. (count, higher is better)\n- **Epics done** (`epics_done`) — Epics completed in the period. (count, higher is better)\n- **Roadmap efficiency** (`roadmap_efficiency`) — Of the completed epics that had a due date, the share delivered on time. (percentage points (0-100), higher is better)\n- **Support done** (`support_done`) — Support tasks completed in the period: work that is not product work. (count, lower is better)\n- **Bug percentage** (`bug_percentage`) — The share of completed items that are bugs. (percentage points (0-100), lower is better)\n- **Sprint efficiency** (`sprint_efficiency`) — Of the work planned when the sprints started, how much was done when they closed. (percentage points (0-100), higher is better)\n- **Invested hours** (`invested_hours`) — Hours recorded on the period's tasks. (hours, lower is better)\n- **Working time** (`working_time`) — Active working hours, measured from each person's activity in their tools. (hours, higher is better)\n- **Active days** (`active_days`) — Days with activity in the work tools, on average per person. (days, higher is better)\n- **Cycle time (sum)** (`cycle_time_sum`) — The sum of the cycle times of the completed items. (hours, lower is better)\n- **Cycle time (average)** (`cycle_time_avg`) — The average cycle time of a completed item. (hours, lower is better)\n- **Estimated vs executed** (`estimated_vs_executed`) — The estimated effort of the completed items relative to what they took. (percentage points (0-100), higher is better)\n- **Cost** (`cost`) — The period's hours multiplied by each person's hourly rate. (usd, lower is better)\n- **Pull request activity** (`pull_request_activity`) — Pull requests created, merged and open in the period. (count, higher is better)\n- **LOC delegated to AI** (`delegated_loc_percentage`) — The share of the classified lines of code that AI wrote in agent mode. (percentage points (0-100), higher is better)\n- **AI cost** (`ai_cost`) — Consumption cost of AI coding tools (tokens times each model's price), per person, summed over the period. Not the same as seats or billing. (usd, lower is better)\n- **AI cost by model** (`ai_cost_by_model`) — How AI cost splits across model families (Opus, Sonnet, Haiku, GPT, Gemini…). (share)\n- **AI cost by tool** (`ai_cost_by_tool`) — How AI cost splits across tools (Claude Code, Cursor…). (share)\n- **AI cost by skill** (`ai_cost_by_skill`) — How AI cost splits across Claude Code skills; cost from tools without skills is grouped by tool. (share)\n- **AI cost by product** (`ai_cost_by_product`) — How AI cost splits across Anthropic products: Claude Code at its estimated cost, the rest at reported spend. (share)\n- **Cost per accepted change** (`cost_per_accepted_change`) — AI cost divided by the pull requests merged to the main branch. Read it with what was delivered, not as something to minimise on its own. (usd, lower is better)\n- **AI cost per deployment** (`ai_cost_per_deployment`) — AI cost divided by the period's deployments, with the same branch filter as deployment frequency. (usd, lower is better)\n- **Investment allocation** (`investment_allocation`) — How the period's tasks split across kinds of work (new work, maintenance, bugs…). (share)\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/qa-metrics": {
      "post": {
        "operationId": "metrics_query_qa_metrics",
        "tags": [
          "Quality and operations"
        ],
        "summary": "QA",
        "description": "Bugs found, where they come from and how long they take to fix.\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/sre-metrics": {
      "post": {
        "operationId": "metrics_query_sre_metrics",
        "tags": [
          "Quality and operations"
        ],
        "summary": "SRE",
        "description": "Incidents and their impact: count, severity and resolution times.\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/strategic-overview": {
      "post": {
        "operationId": "metrics_query_strategic_overview",
        "tags": [
          "Strategy"
        ],
        "summary": "Strategic Overview",
        "description": "Executive summary of the organization's delivery.\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/team-activity": {
      "post": {
        "operationId": "metrics_query_team_activity",
        "tags": [
          "Teams and collaboration"
        ],
        "summary": "Team activity",
        "description": "Each person's activity: commits, PRs, work items and active days.\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/team-collaboration": {
      "post": {
        "operationId": "metrics_query_team_collaboration",
        "tags": [
          "Teams and collaboration"
        ],
        "summary": "Team collaboration",
        "description": "How the team collaborates in code reviews and meetings.\n\n**Metrics**\n\n- **Pickup time** (`pickup_time`) — Time from when a PR is opened until someone other than the author first acts on it: a comment, a commit or an approval. (hours, lower is better)\n- **Reviewer reaction time** (`reaction_time`) — Time a reviewer takes to react, with a comment or a commit, to the PR author's latest action: a commit or a comment. (hours, lower is better)\n- **Time to first approval** (`review_time_to_first_approval`) — Time from when a PR is opened until its first approval. (hours, lower is better)\n- **Author responsiveness** (`responsiveness`) — Time a PR's author takes to answer review comments. (hours, lower is better)\n- **Time to merge** (`time_to_merge`) — Time from when a PR is opened until it is merged. (hours, lower is better)\n- **Iterated PRs** (`iterated_prs`) — Share of PRs that got commits after they were opened, that is, that kept changing once open. (percentage points (0-100), lower is better)\n- **PR iteration time** (`pr_iteration_time`) — For PRs that got commits after the first comment by someone other than the author, average time from that comment to the last commit. (hours, lower is better)\n- **Review sharing index** (`sharing_index`) — How evenly PR reviews are spread across reviewers; low means a few people review almost everything. (percentage points (0-100), higher is better)\n- **Meeting hours** (`total_meeting_hours`) — Total hours in meetings. (hours, lower is better)\n- **Focus time availability** (`avg_focus_time_availability`) — Average meeting-free time available for focus work. (hours, higher is better)\n- **Meeting duration** (`avg_meeting_duration`) — Average duration of a meeting. (hours, lower is better)\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/metrics/query/zephyr-metrics": {
      "post": {
        "operationId": "metrics_query_zephyr_metrics",
        "tags": [
          "Quality and operations"
        ],
        "summary": "Zephyr",
        "description": "Test execution in Zephyr: cases, cycles and results.\n\nMeasured with your own scope: filters narrow what you can see, never widen it. Nothing is saved. Unlike the REST API, an error answers `{\"error\": \"...\"}`, without the envelope.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period (YYYY-MM-DD)."
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period (YYYY-MM-DD)."
                  },
                  "preceding_from": {
                    "type": "string",
                    "format": "date",
                    "description": "First day of the period to compare with (optional)."
                  },
                  "preceding_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Last day of the period to compare with (optional)."
                  },
                  "teams": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team ids (`GET /teams`)."
                  },
                  "include_subteams": {
                    "type": "boolean",
                    "description": "Measure each team with its whole branch."
                  },
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "People's ids (`GET /users`)."
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Repository ids (`GET /git/apps/{app_id}/repositories`)."
                  },
                  "projects": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Board ids (`GET /boards`)."
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task labels."
                  },
                  "issue_type": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Task types."
                  },
                  "organization_id": {
                    "type": "integer",
                    "description": "Optional: with a token the organization is the token's."
                  }
                }
              },
              "example": {
                "from": "2026-10-01",
                "to": "2026-10-31",
                "teams": [
                  15
                ],
                "include_subteams": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The metric set, as the Leanmote tab shows it (JSON)."
          },
          "400": {
            "description": "The body names a saved view (`dashboard`, `dashboard_id`): a query is measured with its own filters."
          },
          "401": {
            "description": "The token is missing or no longer valid."
          },
          "403": {
            "description": "Your role does not reach this data (cost, ROI, investment and Strategic Overview: owners and admins)."
          },
          "404": {
            "description": "Not a metrics route."
          }
        }
      }
    },
    "/org-chart": {
      "get": {
        "operationId": "teams_get_org_chart",
        "tags": [
          "Org chart"
        ],
        "summary": "The organization's team tree, ready to draw, as a flat list in display order.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`)."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "The organization's team tree, ready to draw, as a flat list in display order."
      }
    },
    "/org-chart/import/apply": {
      "post": {
        "operationId": "org_import_apply_org_chart_import",
        "tags": [
          "Org chart"
        ],
        "summary": "Writes the proposal the person confirmed, all or nothing, in one transaction: creates the new teams, reuses (and...",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "import_id": 87,
                    "teams_created": 1,
                    "teams_moved": 0,
                    "teams_renamed": 0,
                    "teams_reused": 1,
                    "members_added": 2,
                    "managers_added": 1,
                    "teams": {
                      "b1": 1254,
                      "b2": 1301
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "forbidden The caller lacks `manage:teams`, or no organization scope / authenticated user."
          },
          "404": {
            "description": "organization_not_found The caller does not belong to the organization."
          },
          "422": {
            "description": "invalid_body The body is not a JSON object. · plan_refused The plan has errors; `data.errors[]` lists all of them (`code`, `key`, `detail`). Codes: `team_name_required`, `two_teams_share_a_name`, `team_not_in_organization`, `user_not_in_organization`, `parent_not_in_plan`, `plan_has_a_cycle`, `nothing_to_apply`. · self`, `descendant`, `not_found`, `unavailable Moving a reused team under its new parent breaks the tree rule (see [Refusal codes](#refusal-codes)). The transaction is rolled back."
          },
          "500": {
            "description": "plan_out_of_order Internal: a team was used before it existed in the plan. The transaction is rolled back."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Writes the proposal the person confirmed, all or nothing, in one transaction: creates the new teams, reuses (and renames, when the name changed) the existing ones, sets parents, and adds leaders and members. Every change is recorded with its previous value so `POST /org-chart/import/{import_id}/undo` can revert it. The body is re-validated from scratch against the organization; any error refuses the whole plan. Only owners and administrators (`manage:teams`) and Leanmote staff may call it.",
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "filename": "org-chart.png",
                "teams": [
                  {
                    "key": "b1",
                    "name": "Engineering",
                    "parent_key": null,
                    "id_team": 1254,
                    "leader_id_user": 2147,
                    "member_ids": []
                  },
                  {
                    "key": "b2",
                    "name": "Platform",
                    "parent_key": "b1",
                    "id_team": null,
                    "leader_id_user": 2148,
                    "member_ids": [
                      2150,
                      2151
                    ]
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/org-chart/import/last": {
      "get": {
        "operationId": "org_import_last_org_chart_import",
        "tags": [
          "Org chart"
        ],
        "summary": "Returns the organization's most recent import that can still be undone (status `applied`), with who made it and what...",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "import": {
                      "import_id": 87,
                      "filename": "org-chart.png",
                      "applied_at": "2026-11-20 14:03:11",
                      "imported_by": "Ana Gómez",
                      "counts": {
                        "teams_created": 1,
                        "teams_moved": 0,
                        "teams_renamed": 0,
                        "members_added": 2,
                        "managers_added": 1
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "forbidden The caller lacks `manage:teams`, or no organization scope / authenticated user."
          },
          "404": {
            "description": "organization_not_found The caller does not belong to the organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns the organization's most recent import that can still be undone (status `applied`), with who made it and what it changed, so the screen can offer \"undo\" after the import modal was closed. It does not undo anything. `data.import` is `null` when there is none. The last import of the organization may have been made by someone else; `imported_by` says who. Same permission as the undo: owners and administrators (`manage:teams`) and Leanmote staff."
      }
    },
    "/org-chart/import/read": {
      "post": {
        "operationId": "org_import_read_org_chart_import",
        "tags": [
          "Org chart"
        ],
        "summary": "Reads an image or a PDF of the organization's chart with a vision model and returns a proposal: the teams the...",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "boxes": [
                      {
                        "id": "b1",
                        "person_name": "Ana Gómez",
                        "team_name": "",
                        "title": "CTO",
                        "email": "",
                        "parent_id": null
                      },
                      {
                        "id": "b2",
                        "person_name": "Juan Pérez",
                        "team_name": "Platform",
                        "title": "EM",
                        "email": "juan@example.com",
                        "parent_id": "b1"
                      },
                      {
                        "id": "b3",
                        "person_name": "Lucía Díaz",
                        "team_name": "",
                        "title": "Backend developer",
                        "email": "",
                        "parent_id": "b2"
                      }
                    ],
                    "notes": "",
                    "teams": [
                      {
                        "key": "b2",
                        "name": "Platform",
                        "name_source": "chart",
                        "id_team": null,
                        "action": "create",
                        "parent_key": "b1",
                        "depth": 1,
                        "leader": {
                          "id_user": 2148,
                          "name": "Juan Pérez",
                          "rule": "email",
                          "confidence": "high",
                          "ambiguous_with": [],
                          "evidence": {
                            "email": "juan@example.com"
                          }
                        },
                        "leader_box": "b2",
                        "leader_name": "Juan Pérez",
                        "leader_title": "EM",
                        "members": [
                          {
                            "box": "b3",
                            "raw_name": "Lucía Díaz",
                            "title": "Backend developer",
                            "drawn_email": "",
                            "match": {
                              "id_user": null,
                              "name": null,
                              "rule": null,
                              "confidence": null,
                              "ambiguous_with": [],
                              "evidence": {
                                "raw_name": "Lucía Díaz"
                              }
                            }
                          }
                        ]
                      }
                    ],
                    "people": [],
                    "conflicts": [
                      {
                        "code": "person_not_in_leanmote",
                        "box": "b3",
                        "detail": {
                          "raw_name": "Lucía Díaz"
                        }
                      }
                    ],
                    "needs_name": [],
                    "needs_email": [
                      "b3"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "empty_file The reader found the file empty. · unsupported_media_type The reader refused the media type."
          },
          "403": {
            "description": "forbidden The caller lacks `manage:teams`, or no organization scope / authenticated user."
          },
          "404": {
            "description": "organization_not_found The caller does not belong to the organization."
          },
          "413": {
            "description": "file_too_large The decoded file is larger than 4 MB."
          },
          "422": {
            "description": "invalid_body The body is not a JSON object. · file_required content_base64` is missing or empty. · unsupported_media_type media_type` is not one of the supported types. · invalid_base64 content_base64` is not valid base64. · refused The model declined to read the file."
          },
          "429": {
            "description": "budget_exceeded The organization's AI budget is spent (the LLM gateway stopped the call before the model)."
          },
          "502": {
            "description": "reader_unavailable No API key could be resolved for the reader. · no_key`, `unparseable_response`, `no_text_block`, `unreachable`, `http_<status> The reader failed; any reader error not listed elsewhere maps to `502`. · reader_failed The reader crashed with an unexpected error."
          },
          "504": {
            "description": "too_slow The model did not answer within the reader's timeout."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Reads an image or a PDF of the organization's chart with a vision model and returns a proposal: the teams the drawing implies, who leads them, who their members are, and the conflicts that block applying it. Nothing is written. Only owners and administrators (`manage:teams`) and Leanmote staff may call it. This is the one endpoint here that leaves the VPC; what the environment must provide for it is in [Reading a chart image](#reading-a-chart-image-what-the-environment-must-provide).",
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "content_base64": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==",
                "media_type": "image/png",
                "filename": "org-chart.png"
              }
            }
          }
        }
      }
    },
    "/org-chart/import/{import_id}/undo": {
      "post": {
        "operationId": "org_import_undo_org_chart_import",
        "tags": [
          "Org chart"
        ],
        "summary": "Reverts a whole import, walking its recorded changes backwards in one transaction: removes the leaders and members...",
        "parameters": [
          {
            "name": "import_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "import_id": 87,
                    "reparented": [
                      {
                        "id_team": 1320,
                        "name": "Mobile",
                        "parent_team_id": 1254
                      }
                    ],
                    "teams_deleted": 1,
                    "teams_moved_back": 0,
                    "teams_renamed_back": 0,
                    "members_removed": 2,
                    "managers_removed": 1
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_path_parameter import_id` is not numeric."
          },
          "403": {
            "description": "forbidden The caller lacks `manage:teams`, or no organization scope / authenticated user."
          },
          "404": {
            "description": "organization_not_found The caller does not belong to the organization. · import_not_found No such import, or it belongs to another organization (answered identically)."
          },
          "409": {
            "description": "already_undone The import is no longer `applied`. · nothing_to_undo The import recorded no changes. · edited_after_import A team the import touched has `updated_at` after the import; `data.teams[]` lists them (`id_team`, `name`). · people_added_after_import A team the import created has a member or leader the import did not add; `data` carries `id_team` and `id_user`."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Reverts a whole import, walking its recorded changes backwards in one transaction: removes the leaders and members it added, moves teams back to their previous parent, restores previous names, and deletes the teams it created (their children first move up to the grandparent). It refuses outright when anyone edited on top of the import; there is no partial undo. Only owners and administrators (`manage:teams`) and Leanmote staff may call it. No request body is read."
      }
    },
    "/org-chart/suggestions": {
      "get": {
        "operationId": "teams_get_org_chart_suggestions",
        "tags": [
          "Org chart"
        ],
        "summary": "51 of 53 organizations are flat, and the structure is usually not missing — it was written into the team names, or...",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`)."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "51 of 53 organizations are flat, and the structure is usually not missing — it was written into the team names, or into who ended up in which team, because until now there was nowhere else to put it. This reads it back."
      }
    },
    "/organizations": {
      "get": {
        "operationId": "organizations_list_organizations",
        "tags": [
          "Organizations"
        ],
        "summary": "Returns organizations visible to the authenticated user.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "organization_id": 101,
                      "organization_name": "Acme Corp",
                      "agent_enabled": true,
                      "created_at": "2024-01-10T08:00:00Z",
                      "updated_at": "2024-07-05T16:22:00Z"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 2,
                    "total_pages": 1,
                    "sort": "organization_name",
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "fields": [
                      "organization_id",
                      "organization_name",
                      "agent_enabled",
                      "created_at",
                      "updated_at"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter fields` is not a string or `agent_enabled` cannot be parsed. · invalid_pagination page` or `per_page` is not a positive integer. · invalid_sort_attribute sort` is not in the allowed list (`organization_name`, `organization_created_at`, `organization_updated_at`). · invalid_order_value order` is not `asc` or `desc`."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns organizations visible to the authenticated user."
      }
    },
    "/organizations/{organization_id}": {
      "get": {
        "operationId": "organizations_get_organization",
        "tags": [
          "Organizations"
        ],
        "summary": "Fetches organization metadata by numeric identifier.",
        "parameters": [
          {
            "name": "organization_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "organization_id": 101,
                    "organization_name": "Acme Corp",
                    "organization_industry": "software",
                    "created_at": "2024-01-10T08:00:00Z"
                  }
                }
              }
            }
          },
          "404": {
            "description": "organization_not_found The organization does not exist or the user lacks access."
          },
          "400": {
            "description": "invalid_query_parameter fields` is not a string. · missing_path_parameter organization_id` is absent. · invalid_path_parameter organization_id` is blank or not a valid identifier."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Fetches organization metadata by numeric identifier."
      }
    },
    "/organizations/{organization_id}/apps": {
      "get": {
        "operationId": "organizations_list_organization_apps",
        "tags": [
          "Organizations"
        ],
        "summary": "Aggregates app mappings for users in the organization.",
        "parameters": [
          {
            "name": "organization_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "app_id": 15,
                      "app_name": "Jira",
                      "first_mapped_at": "2023-05-01T12:00:00Z",
                      "last_mapped_at": "2024-06-15T09:45:00Z"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "last_mapped_at",
                    "order": "desc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "fields": [
                      "app_id",
                      "app_name",
                      "first_mapped_at",
                      "last_mapped_at"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter fields` is not a string or `user_id` is not numeric. · invalid_pagination Invalid pagination. · invalid_sort_attribute Unsupported `sort` (`name`, `last_mapped_at` allowed). · invalid_order_value order` is not `asc`/`desc`."
          },
          "404": {
            "description": "organization_not_found Organization not accessible. · user_not_found When `user_id` is provided but the user is not part of the organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Aggregates app mappings for users in the organization. Optional `user_id` filters the dataset to a single member."
      }
    },
    "/organizations/{organization_id}/members": {
      "get": {
        "operationId": "organizations_list_members",
        "tags": [
          "Organizations"
        ],
        "summary": "Returns paginated members associated with the organization.",
        "parameters": [
          {
            "name": "organization_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "user_id": 502,
                      "user_name": "Nina Hayes",
                      "user_email": "nina.hayes@example.com",
                      "role_id": 3,
                      "teams": [
                        {
                          "team_id": 15,
                          "team_name": "Engineering",
                          "team_description": "Product engineering",
                          "joined_at": "2023-12-01T09:00:00Z",
                          "is_manager": true,
                          "manager_since": "2024-02-15T10:15:00Z"
                        }
                      ]
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "user_name",
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "fields": [
                      "user_id",
                      "user_name",
                      "user_email",
                      "role_id",
                      "teams"
                    ],
                    "team_id": 42
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter fields` is not a string or `team_id` is not numeric. · invalid_pagination page` or `per_page` is invalid. · invalid_sort_attribute Unsupported `sort` attribute. · invalid_order_value order` is not `asc`/`desc`."
          },
          "404": {
            "description": "organization_not_found Organization not available for the requester."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns paginated members associated with the organization."
      }
    },
    "/organizations/{organization_id}/teams": {
      "get": {
        "operationId": "organizations_list_organization_teams",
        "tags": [
          "Organizations"
        ],
        "summary": "Lists teams within the organization.",
        "parameters": [
          {
            "name": "organization_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "team_id": 15,
                      "team_name": "Engineering",
                      "team_description": "Product engineering",
                      "objectives": "Deliver platform roadmap",
                      "created_at": "2023-11-15T10:30:00Z"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "created_at",
                    "order": "desc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "fields": [
                      "team_id",
                      "team_name",
                      "team_description",
                      "objectives",
                      "created_at"
                    ],
                    "name": "eng"
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter Invalid `fields` or `name` filter. · invalid_pagination Invalid pagination values. · invalid_sort_attribute Unsupported `sort` (`name`, `created_at`, `updated_at` allowed). · invalid_order_value order` is not `asc`/`desc`."
          },
          "404": {
            "description": "organization_not_found Organization not accessible to the requester."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Lists teams within the organization."
      }
    },
    "/pull-requests": {
      "get": {
        "operationId": "code_search_search_pull_requests",
        "tags": [
          "Git"
        ],
        "summary": "Searches pull requests across the whole organization — every connected app and repository — by text, state...",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Words in the title, or the PR number. Optional. Substring match on the title, or exact match on the provider's number (a leading `#` is ignored); first 200 characters.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "Filters by state, folded across providers. Optional. Case-insensitive. One of `open`, `merged`, `closed` (closed without merging).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "author",
            "in": "query",
            "required": false,
            "description": "Work authored by this Leanmote user (matched through the user's mapped provider handles). Optional.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "mine",
            "in": "query",
            "required": false,
            "description": "Work authored by the caller, from their own credential. Optional. `true`/`1`/`yes` or `false`/`0`/`no`. When true it overrides `author`.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "team_id",
            "in": "query",
            "required": false,
            "description": "Work authored by the members of this team. Optional. The caller must manage the team, belong to it, or be unrestricted.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "repository_id",
            "in": "query",
            "required": false,
            "description": "Filters by repository. Optional.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "repository",
            "in": "query",
            "required": false,
            "description": "Filters by repository name. Optional. Substring match; first 200 characters.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "created_at[operator]",
            "in": "query",
            "required": false,
            "description": "Range filter on the PR creation date. Supports `eq`, `gt`, `gte`, `lt`, `lte`, with `field[op]`, `field__op` or `field_op` syntax and ISO-8601 values.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "merged_at[operator]",
            "in": "query",
            "required": false,
            "description": "Range filter on the merge date. Same operators and syntax.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page to return. Optional. Defaults to `1`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Number of records per page. Optional. Defaults to `50`. Maximum `500`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "pull_request_id": 90211,
                      "number": "1514",
                      "title": "Fix retry on chat delivery",
                      "state": "merged",
                      "url": "https://github.com/acme/api/pull/1514",
                      "repository": {
                        "repository_id": 310,
                        "name": "api"
                      },
                      "author": {
                        "user_id": 42,
                        "name": "Alex Leanmote",
                        "login": "alexl"
                      },
                      "source_branch": "fix/chat-retry",
                      "target_branch": "main",
                      "created_at": "2026-11-12T15:20:11",
                      "first_approval_at": "2026-11-12T18:02:40",
                      "merged_at": "2026-11-13T10:05:09",
                      "closed_at": "2026-11-13T10:05:09",
                      "lines_added": 120,
                      "lines_deleted": 14,
                      "comments_count": 3,
                      "requested_reviewers": [
                        "mlopez",
                        "team:4412"
                      ]
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "q": "fix",
                    "state": "merged",
                    "merged_at": {
                      "gte": "2026-11-01T00:00:00Z"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_state state` is not `open`, `merged` or `closed`. · invalid_query_parameter author`, `team_id` or `repository_id` is not an integer, or `mine` is not a boolean. · invalid_mine mine=true` with no signed-in user behind the credential. · invalid_pagination page` or `per_page` is not a positive integer. · invalid_date_filter_operator A date filter uses an operator other than `eq`, `gt`, `gte`, `lt`, `lte`. · invalid_date_filter A date filter value is not a single ISO-8601 string."
          },
          "403": {
            "description": "forbidden No organization scope or authenticated user. · team_forbidden team_id` is outside the caller's scope."
          },
          "404": {
            "description": "organization_not_found The caller does not belong to the organization. · team_not_found team_id` does not exist in the organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Searches pull requests across the whole organization — every connected app and repository — by text, state, repository, author, team and dates, newest first. It keeps the platform's visibility: owners, admins, staff and holders of the \"all team metrics\" grant see everything; a team leader sees the work of the people in the teams they see plus their own; a collaborator only their own; a caller with no scope sees nothing. Work whose author is mapped to no Leanmote user is visible only to the unrestricted."
      }
    },
    "/pull-requests/task-links": {
      "get": {
        "operationId": "pr_task_links_pull_request_task_links",
        "tags": [
          "Git"
        ],
        "summary": "Crosses a person's (or a team's) pull requests with their work items for a period, in one call: which of their pull...",
        "parameters": [
          {
            "name": "author",
            "in": "query",
            "required": false,
            "description": "The Leanmote user whose pull requests and work items to cross. Optional, but the call needs one of `author`, `mine` or `team_id`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "mine",
            "in": "query",
            "required": false,
            "description": "The caller, from their own credential. Optional. `true`/`1`/`yes` or `false`/`0`/`no`. When true it overrides `author`.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "team_id",
            "in": "query",
            "required": false,
            "description": "The members of this team. Not with `author` / `mine`. The caller must manage the team, belong to it, or be unrestricted.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "First day of the period, `YYYY-MM-DD`. Optional. Defaults to 29 days before `to`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Last day of the period, `YYYY-MM-DD`, included. Optional. Defaults to today (UTC). At most 366 days from `from`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "moved_to_status",
            "in": "query",
            "required": false,
            "description": "Only work items that moved into this status in the period, by its name in the tool (e.g. `Done`). Optional. Exact name; first 200 characters.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Items returned per list. Optional. Defaults to `50`. Maximum `200`. The `summary` counts everything.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "from": "2026-10-01",
                    "to": "2026-10-31",
                    "people": [
                      {
                        "user_id": 42,
                        "name": "Alex Leanmote"
                      }
                    ],
                    "summary": {
                      "pull_requests": 2,
                      "pull_requests_with_task": 1,
                      "pull_requests_without_task": 1,
                      "tasks": 2,
                      "tasks_with_pull_request": 1,
                      "tasks_without_pull_request": 1
                    },
                    "pull_requests_with_task": [
                      {
                        "pull_request_id": 90211,
                        "number": "1514",
                        "title": "Fix retry on chat delivery",
                        "state": "merged",
                        "url": "https://github.com/acme/api/pull/1514",
                        "repository": "api",
                        "author": {
                          "user_id": 42,
                          "name": "Alex Leanmote",
                          "login": "alexl"
                        },
                        "created_at": "2026-10-12T15:20:11",
                        "merged_at": "2026-10-13T10:05:09",
                        "tasks": [
                          {
                            "task_id": 551200,
                            "key": "API-311",
                            "name": "Chat messages are delivered twice",
                            "type": "Bug",
                            "status": "Done",
                            "kind": "done",
                            "status_since": "2026-10-13T11:00:00",
                            "owner": "Alex Leanmote",
                            "url": "https://acme.atlassian.net/browse/API-311"
                          }
                        ]
                      }
                    ],
                    "pull_requests_without_task": [
                      {
                        "pull_request_id": 90388,
                        "number": "1530",
                        "title": "Bump the SDK",
                        "state": "open",
                        "url": "https://github.com/acme/api/pull/1530",
                        "repository": "api",
                        "author": {
                          "user_id": 42,
                          "name": "Alex Leanmote",
                          "login": "alexl"
                        },
                        "created_at": "2026-10-20T09:12:40",
                        "merged_at": null,
                        "unmatched_keys": [
                          "OPS-12"
                        ],
                        "source_branch": "chore/ops-12-sdk"
                      }
                    ],
                    "tasks_with_pull_request": [
                      {
                        "task_id": 551200,
                        "key": "API-311",
                        "name": "Chat messages are delivered twice",
                        "type": "Bug",
                        "status": "Done",
                        "kind": "done",
                        "status_since": "2026-10-13T11:00:00",
                        "owner": "Alex Leanmote",
                        "url": "https://acme.atlassian.net/browse/API-311",
                        "pull_requests": [
                          {
                            "pull_request_id": 90211,
                            "number": "1514",
                            "title": "Fix retry on chat delivery",
                            "state": "merged",
                            "url": "https://github.com/acme/api/pull/1514",
                            "repository": "api",
                            "author": {
                              "user_id": 42,
                              "name": "Alex Leanmote",
                              "login": "alexl"
                            },
                            "created_at": "2026-10-12T15:20:11",
                            "merged_at": "2026-10-13T10:05:09"
                          }
                        ]
                      }
                    ],
                    "tasks_without_pull_request": [
                      {
                        "task_id": 551344,
                        "key": "API-318",
                        "name": "Document the retry policy",
                        "type": "Task",
                        "status": "Done",
                        "kind": "done",
                        "status_since": "2026-10-28T16:41:02",
                        "owner": "Alex Leanmote",
                        "url": "https://acme.atlassian.net/browse/API-318"
                      }
                    ],
                    "limit": 50,
                    "links_complete": true,
                    "applied_filters": {
                      "author": 42,
                      "from": "2026-10-01",
                      "to": "2026-10-31"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "missing_people None of `author`, `mine` or `team_id`. · invalid_people Both `team_id` and `author` / `mine` were sent. · invalid_query_parameter An integer parameter (`author`, `team_id`, `limit`) is not an integer, or `mine` is not a boolean. · invalid_mine Sent `mine=true` with no signed-in user behind the credential. · invalid_date The `from` or `to` value is not a `YYYY-MM-DD` date. · invalid_period The period starts after it ends (`from` after `to`), or spans more than 366 days. · invalid_limit The `limit` is below 1."
          },
          "403": {
            "description": "forbidden No organization scope or authenticated user. · team_forbidden The `team_id` is outside the caller's scope."
          },
          "404": {
            "description": "organization_not_found The caller does not belong to the organization. · team_not_found The `team_id` does not exist in the organization."
          },
          "422": {
            "description": "too_many_pull_requests The people opened or merged more than 3,000 pull requests in the period: narrow the period or the people. · too_many_tasks More than 3,000 of their work items changed status in the period: narrow the period or the people."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Crosses a person's (or a team's) pull requests with their work items for a period, in one call: which of their pull requests name a work item and which name none, and which of their work items have a pull request and which do not."
      }
    },
    "/sprints": {
      "get": {
        "operationId": "sprints_list_sprints",
        "tags": [
          "Tasks"
        ],
        "summary": "Lists the organization's sprints (Jira sprints; Azure iterations are mapped onto the same states) with their board...",
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "Filters by sprint state. Optional. Case-insensitive. One of `active`, `future`, `closed`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "board_id",
            "in": "query",
            "required": false,
            "description": "Filters by board. Optional.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Filters by sprint name. Optional. Substring match; first 200 characters.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page to return. Optional. Defaults to `1`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Number of records per page. Optional. Defaults to `50`. Maximum `500`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "sprint_id": 311,
                      "name": "ENG Sprint 42",
                      "state": "active",
                      "goal": "Ship SSO",
                      "start_date": "2026-11-10T13:00:00",
                      "end_date": "2026-11-24T13:00:00",
                      "complete_date": null,
                      "board": {
                        "board_id": 22,
                        "board_name": "Engineering",
                        "board_key": "ENG"
                      }
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "state": "active",
                    "board_id": 22
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_state state` is not `active`, `future` or `closed`. · invalid_query_parameter board_id` is not an integer. · invalid_pagination page` or `per_page` is not a positive integer."
          },
          "403": {
            "description": "forbidden No organization scope or authenticated user."
          },
          "404": {
            "description": "organization_not_found The caller does not belong to the organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Lists the organization's sprints (Jira sprints; Azure iterations are mapped onto the same states) with their board, ordered active first, then future, then closed, and by start date descending within each state. It carries no tasks: use a `sprint_id` from here with `GET /tasks?sprint_id=` or `GET /tasks/summary?sprint_id=`, which apply the caller's task visibility. Anyone in the organization may call it; a caller with no team scope gets an empty list."
      }
    },
    "/tasks": {
      "get": {
        "operationId": "tasks_list_tasks",
        "tags": [
          "Tasks"
        ],
        "summary": "Returns tasks across the organization with optional filters on status, assignee, board, time range, and specific...",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number (default `1`).",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Page size (default `50`, max `500`).",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "One of `date_created`, `last_existence_check`, `task_name`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "description": "asc` or `desc` (default `asc`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "description": "Comma-separated projection using dotted paths.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timestamps",
            "in": "query",
            "required": false,
            "description": "Optional override. Use `int` for Unix seconds or `none` to hide timestamps temporarily (default `datetime`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "assignee",
            "in": "query",
            "required": false,
            "description": "Filters by Leanmote user identifier of the task owner.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "board_id",
            "in": "query",
            "required": false,
            "description": "Filters by board identifier (`board_tasks.id_board`).",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Matches tasks that ever held the provided status.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "priority",
            "in": "query",
            "required": false,
            "description": "Filters by custom parameter `priority`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "parent_id",
            "in": "query",
            "required": false,
            "description": "Filters by parent task identifier.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "created_at[eq\\",
            "in": "query",
            "required": false,
            "description": "gte\\ lt\\ lte] datetime Filters by creation timestamp (`board_tasks.date_created`). Bracket, double-underscore, and trailing underscore syntaxes are supported (e.g., `created_at[gte]`, `created_at__gte`, `created_at_gte`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "updated_at[eq\\",
            "in": "query",
            "required": false,
            "description": "gte\\ lt\\ lte] datetime Filters by last update timestamp (`board_tasks.updated_at`). Supports `field[op]`, `field__op`, or `field_op` comparisons.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "last_existence_check[eq\\",
            "in": "query",
            "required": false,
            "description": "gte\\ lt\\ lte] datetime Filters by last existence check (`board_tasks.last_existence_check`) using any of the supported syntaxes (`field[op]`, `field__op`, `field_op`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "synced_at[eq\\",
            "in": "query",
            "required": false,
            "description": "gte\\ lt\\ lte] datetime Filters by sync timestamp (`board_tasks.created_at`) using `field[op]`, `field__op`, or `field_op`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status_transition",
            "in": "query",
            "required": false,
            "description": "Filters tasks that entered the given status at least once.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status_transition_previous",
            "in": "query",
            "required": false,
            "description": "Narrows the status transition filter to records whose previous status matches this value.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status_transition_changed_at[eq\\",
            "in": "query",
            "required": false,
            "description": "gte\\ lt\\ lte] datetime Filters tasks by the timestamp when they changed to `status_transition`. The same bracket, double-underscore, or trailing underscore syntaxes apply (`status_transition_changed_at[gte]`, `status_transition_changed_at__gte`, `status_transition_changed_at_gte`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "task_id": 501,
                      "board": {
                        "board_id": 22,
                        "board_key": "ENG"
                      },
                      "app": {
                        "app_id": 11,
                        "app_name": "Jira"
                      },
                      "task_key": "ENG-123",
                      "task_name": "Implement authentication",
                      "task_owner": {
                        "user_id": 42,
                        "user_name": "Alex Leanmote",
                        "user_email": "alex.leanmote@example.com"
                      },
                      "task_status": "In Progress",
                      "task_status_history": [
                        {
                          "task_status": "To Do",
                          "task_previous_status": null,
                          "task_status_changed_at": "2024-08-01T10:05:00Z"
                        },
                        {
                          "task_status": "In Progress",
                          "task_previous_status": "To Do",
                          "task_status_changed_at": "2024-08-06T09:15:00Z"
                        }
                      ],
                      "created_at": "2024-08-01T10:00:00Z"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "date_created",
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "assignee": 42,
                    "board_id": 22,
                    "fields": [
                      "task_id",
                      "board.board_id",
                      "board.board_key",
                      "app.app_id",
                      "app.app_name",
                      "task_key",
                      "task_status",
                      "task_status_history"
                    ],
                    "status_transition": "In Progress",
                    "status_transition_changed_at": {
                      "gte": "2024-08-01T00:00:00Z",
                      "lte": "2024-08-31T23:59:59Z"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter Invalid `board_id`, `assignee`, or date filters. · invalid_sort_attribute Unsupported `sort`. · invalid_order_value order` is not `asc`/`desc`. · invalid_status_transition_operator status_transition_changed_at` uses an unsupported operator. · invalid_status_transition_filter status_transition` filters contain invalid ISO-8601 values."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns tasks across the organization with optional filters on status, assignee, board, time range, and specific status transitions. Tasks are returned only when their assignee can be mapped to a Leanmote user. Each task includes its full status history so consumers can analyse lifecycle changes without an additional request."
      }
    },
    "/tasks/summary": {
      "get": {
        "operationId": "tasks_summarize_tasks",
        "tags": [
          "Tasks"
        ],
        "summary": "Counts the tasks the requester sees, grouped by `group_by` (default `board,status`), with the oldest creation date...",
        "parameters": [
          {
            "name": "group_by",
            "in": "query",
            "required": false,
            "description": "Dimensions to group by. Comma-separated, no repeats. One or more of `board`, `status`, `kind`, `assignee`. Defaults to `board,status`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "description": "Filters by the kind of the current status. Comma-separated. `open` (= `backlog`, `active`, `waiting` and statuses with no kind) or any of `backlog`, `active`, `waiting`, `done`, `cancelled`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "board_id",
            "in": "query",
            "required": false,
            "description": "Filters by board. Optional.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "team_id",
            "in": "query",
            "required": false,
            "description": "Tasks owned by the members of this team. Optional. The caller must manage the team, belong to it, or be unrestricted.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "assignee",
            "in": "query",
            "required": false,
            "description": "Tasks owned by this Leanmote user. Optional.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "reporter",
            "in": "query",
            "required": false,
            "description": "Tasks reported by this Leanmote user. Optional.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "sprint_id",
            "in": "query",
            "required": false,
            "description": "Tasks currently in this sprint (their last membership event there is `added`). Optional. See `GET /sprints`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "label",
            "in": "query",
            "required": false,
            "description": "Tasks carrying this label. Optional. Exact match, case-insensitive; first 255 characters.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Words in the task name, or the task key. Optional. Substring match on the name or exact match on the key; first 200 characters.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "created_at[operator]",
            "in": "query",
            "required": false,
            "description": "Range filter on the task creation date (`board_tasks.date_created`). Supports `eq`, `gt`, `gte`, `lt`, `lte`, with `field[op]`, `field__op` or `field_op` syntax and ISO-8601 values.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "updated_at[operator]",
            "in": "query",
            "required": false,
            "description": "Range filter on `board_tasks.updated_at`. Same operators and syntax.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "last_existence_check[operator]",
            "in": "query",
            "required": false,
            "description": "Range filter on `board_tasks.last_existence_check`. Same operators and syntax.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "synced_at[operator]",
            "in": "query",
            "required": false,
            "description": "Range filter on `board_tasks.created_at`. Same operators and syntax.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "groups": [
                      {
                        "count": 42,
                        "board_id": 22,
                        "board_name": "Engineering",
                        "status": "In Progress",
                        "kind": "active",
                        "oldest_created": "2026-08-03T14:12:00"
                      },
                      {
                        "count": 17,
                        "board_id": 22,
                        "board_name": "Engineering",
                        "status": "To Do",
                        "kind": "backlog",
                        "oldest_created": "2026-06-19T09:40:00"
                      }
                    ],
                    "total": 59,
                    "truncated": false,
                    "applied_filters": {
                      "group_by": [
                        "board",
                        "status"
                      ],
                      "team_id": "15",
                      "kind": "open"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_group_by group_by` is empty, repeats a value, or names an unknown dimension. · invalid_kind kind` holds a value other than `open` or a known kind. · invalid_query_parameter board_id`, `team_id`, `assignee`, `reporter` or `sprint_id` is not an integer. · invalid_date_filter_operator A date filter uses an operator other than `eq`, `gt`, `gte`, `lt`, `lte`. · invalid_date_filter A date filter value is not a single ISO-8601 string."
          },
          "403": {
            "description": "forbidden No organization scope or authenticated user. · team_forbidden team_id` is outside the caller's scope."
          },
          "404": {
            "description": "organization_not_found The caller does not belong to the organization. · team_not_found team_id` does not exist in the organization."
          },
          "422": {
            "description": "too_many_to_count Counting exceeded 8 seconds; narrow with `board_id`, `team_id` or `sprint_id`."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Counts the tasks the requester sees, grouped by `group_by` (default `board,status`), with the oldest creation date of each group. The current status of a task is the last row of its status log. It applies the same visibility as `GET /tasks`: owners, admins, staff and holders of the \"all team metrics\" grant count every task of the organization; a team leader counts the tasks of the people in the teams they see plus their own; a collaborator only their own; a caller with no scope gets nothing. Soft-deleted tasks are excluded. Groups are ordered by count, descending, and capped at 100."
      }
    },
    "/tasks/{task_id}": {
      "get": {
        "operationId": "tasks_get_task",
        "tags": [
          "Tasks"
        ],
        "summary": "Returns the task detail, including recent status history, custom parameters, and subtasks.",
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "task_id": 501,
                    "board": {
                      "board_id": 22,
                      "board_key": "ENG"
                    },
                    "task_name": "Implement authentication",
                    "app": {
                      "app_id": 11,
                      "app_name": "Jira"
                    },
                    "task_key": "ENG-123",
                    "task_owner": {
                      "user_id": 42,
                      "user_name": "Alex Leanmote",
                      "user_email": "alex.leanmote@example.com"
                    },
                    "task_status": "In Progress",
                    "task_status_history": [
                      {
                        "task_status": "To Do",
                        "task_previous_status": null,
                        "task_status_changed_at": "2024-09-01T10:05:00"
                      },
                      {
                        "task_status": "In Progress",
                        "task_previous_status": "To Do",
                        "task_status_changed_at": "2024-09-02T08:30:00"
                      }
                    ],
                    "task_custom_parameters": [
                      {
                        "task_parameter_key": "team_id",
                        "task_parameter_value": "10",
                        "created_at": "2024-09-01T10:05:00",
                        "updated_at": "2024-09-02T08:30:00"
                      }
                    ],
                    "task_sub_tasks": [],
                    "created_at": "2024-09-01T10:05:00"
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_path_parameter task_id` is not numeric."
          },
          "404": {
            "description": "task_not_found Task not found for the organization scope."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns the task detail, including recent status history, custom parameters, and subtasks."
      }
    },
    "/teams": {
      "get": {
        "operationId": "teams_list_teams",
        "tags": [
          "Teams"
        ],
        "summary": "Lists teams for the organization identified by the `Organization` header.",
        "parameters": [
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "description": "Selects specific attributes to return. Comma-separated list that supports dotted paths.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Sorting attribute. Optional. Allowed values: `team_name`, `team_created_at`, `team_updated_at`, `name`, `created_at`, `updated_at`. Defaults to `team_name`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "description": "Sorting direction. Optional. Allowed values: `asc`, `desc`. Defaults to `asc`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page to return. Optional. Defaults to `1`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Number of records per page. Optional. Defaults to `50`. Maximum `200`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "timestamps",
            "in": "query",
            "required": false,
            "description": "Controls timestamp formatting. Optional. Allowed values: `datetime` (default), `int`, `none` (deprecated).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "organization_id",
            "in": "query",
            "required": false,
            "description": "Validates that the requested organization matches the tenant scope. Optional. Must equal the `Organization` header; otherwise returns `404`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "name",
            "in": "query",
            "required": false,
            "description": "Filters by team name. Optional. Case-insensitive substring match.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "manager_id",
            "in": "query",
            "required": false,
            "description": "Filters teams managed by the specified user. Optional. Must reference a visible user identifier.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "created_at[operator]",
            "in": "query",
            "required": false,
            "description": "Applies range filters on the team creation timestamp. Supports `eq`, `gt`, `gte`, `lt`, `lte`. Accepts bracket (`field[op]`), double-underscore (`field__op`), or trailing underscore (`field_op`) syntaxes with ISO-8601 values.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "updated_at[operator]",
            "in": "query",
            "required": false,
            "description": "Applies range filters on the last update timestamp. Same operators and syntax as `created_at[operator]`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "team_id": 15,
                      "team_name": "Engineering",
                      "team_description": "Product engineering"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "team_name",
                    "order": "asc",
                    "timestamps": "none"
                  },
                  "applied_filters": {
                    "fields": [
                      "team_id",
                      "team_name",
                      "team_description"
                    ],
                    "organization_id": 101
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter Invalid `fields`, `organization_id`, `manager_id`, or `name`. · invalid_pagination Invalid pagination parameters. · invalid_sort_attribute Unsupported `sort` (allowed: `team_name`, `team_created_at`, `team_updated_at`). · invalid_order_value order` is not `asc`/`desc`."
          },
          "404": {
            "description": "organization_not_found When filtering by `organization_id` that is not accessible."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Lists teams for the organization identified by the `Organization` header."
      },
      "post": {
        "operationId": "teams_create_team",
        "tags": [
          "Org chart"
        ],
        "summary": "`parent_team_id` is optional (absent or `null` creates a first-level team) and is validated with the same rules as a...",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`)."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "`parent_team_id` is optional (absent or `null` creates a first-level team) and is validated with the same rules as a move. A team being created has nothing below it and cannot be its own ancestor, so the only thing left to refuse it is a parent that is not in this organization's chart (RD-2771 took the depth cap out; there is no limit on how deep the structure goes)."
      }
    },
    "/teams/{team_id}": {
      "get": {
        "operationId": "teams_get_team",
        "tags": [
          "Teams"
        ],
        "summary": "Retrieves full details for a team.",
        "parameters": [
          {
            "name": "team_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "description": "Selects specific attributes to return. Comma-separated list that supports dotted paths.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timestamps",
            "in": "query",
            "required": false,
            "description": "Controls timestamp formatting. Optional. Allowed values: `datetime` (default), `int`, `none` (deprecated).",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "team_id": 15,
                    "team_name": "Engineering",
                    "team_description": "Product engineering",
                    "objectives": "Deliver platform roadmap"
                  }
                }
              }
            }
          },
          "404": {
            "description": "team_not_found Team does not exist or is inaccessible."
          },
          "400": {
            "description": "invalid_path_parameter team_id` is blank or invalid."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Retrieves full details for a team."
      },
      "patch": {
        "operationId": "teams_update_team",
        "tags": [
          "Org chart"
        ],
        "summary": "Accepts `team_name`, `team_description`, `objectives`, `parent_team_id`, `members` and `managers`.",
        "parameters": [
          {
            "name": "team_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`)."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Accepts `team_name`, `team_description`, `objectives`, `parent_team_id`, `members` and `managers`. Send `\"parent_team_id\": null` to promote a team to first level. A refused move returns `422` with the refusal `code`, and nothing is written."
      },
      "delete": {
        "operationId": "teams_delete_team",
        "tags": [
          "Org chart"
        ],
        "summary": "The children move up to the grandparent — or to first level when there is none — **before** the row is removed...",
        "parameters": [
          {
            "name": "team_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`)."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "The children move up to the grandparent — or to first level when there is none — **before** the row is removed, since the FK's `ON DELETE SET NULL` would otherwise promote them all the way to the top. No person and no history is deleted: the children keep their own rosters."
      }
    },
    "/teams/{team_id}/branch-members": {
      "get": {
        "operationId": "teams_list_team_branch_members",
        "tags": [
          "Org chart"
        ],
        "summary": "The people of the branch, deduplicated: someone in two sub-teams appears once.",
        "parameters": [
          {
            "name": "team_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Optional. Defaults to `1`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Optional. Defaults to `50`. Maximum `200`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "timestamps",
            "in": "query",
            "required": false,
            "description": "Optional. `datetime` (default), `int`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`)."
          },
          "404": {
            "description": "The team does not exist, or belongs to another organization."
          },
          "403": {
            "description": "The caller has no teams in this organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "The people of the branch, deduplicated: someone in two sub-teams appears once. 30% of people belong to two or more teams, so this differs from the sum of the children's rosters by design."
      }
    },
    "/teams/{team_id}/interactions": {
      "get": {
        "operationId": "interactions_list_team_interactions",
        "tags": [
          "Teams"
        ],
        "summary": "Returns interactions where either the sender or the receivers belong to the specified team.",
        "parameters": [
          {
            "name": "team_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "app_id",
            "in": "query",
            "required": false,
            "description": "Filters interactions to a specific integration. Optional. Must match an app visible to the organization.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Restricts interactions to a data source type. Optional. Matches `data_source.type_id`; see integrations catalogue for identifiers.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "interaction_timestamp[operator]",
            "in": "query",
            "required": false,
            "description": "Applies range filters over the interaction timestamp. Supports `eq`, `gt`, `gte`, `lt`, `lte`. Value must be ISO-8601 (`YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "created_at[operator]",
            "in": "query",
            "required": false,
            "description": "Applies range filters over the creation timestamp. Same operators and ISO-8601 requirement as `interaction_timestamp[operator]`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "description": "Selects specific fields to return. Comma-separated list that supports dotted paths (for example, `app.app_name`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Sorting attribute. Optional. Allowed values: `interaction_timestamp`, `created_at`. Defaults to `interaction_timestamp`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "description": "Sorting direction. Optional. Allowed values: `asc`, `desc`. Defaults to `asc`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page to return. Optional. Defaults to `1`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Number of records per page. Optional. Defaults to `50`. Maximum `200`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "timestamps",
            "in": "query",
            "required": false,
            "description": "Controls timestamp formatting. Optional. Allowed values: `datetime` (default), `int`, `none` (deprecated).",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "interaction_id": 301,
                      "app": {
                        "app_id": 11,
                        "app_name": "Slack"
                      },
                      "sender": {
                        "user_id": 42,
                        "user_name": "Alex Leanmote",
                        "user_email": "alex.leanmote@example.com"
                      },
                      "receivers": [
                        {
                          "user_id": 56,
                          "user_name": "Jamie Receiver",
                          "user_email": "jamie.receiver@example.com"
                        }
                      ],
                      "data_source": {
                        "type_id": 2,
                        "type_name": "messages",
                        "source_id": 999
                      },
                      "interaction_timestamp": "2024-09-14T10:30:00",
                      "created_at": "2024-09-14T10:31:10"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "interaction_timestamp",
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "app_id": 11,
                    "type": 2,
                    "team_id": 10,
                    "interaction_timestamp": {
                      "gte": "2024-09-01T00:00:00Z",
                      "lte": "2024-09-30T23:59:59Z"
                    },
                    "fields": [
                      "interaction_id",
                      "app.app_id",
                      "app.app_name",
                      "sender",
                      "receivers",
                      "data_source"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter Invalid `app_id`, `type`, or date range filters. · invalid_sort_attribute Unsupported `sort` (allowed: `interaction_timestamp`, `created_at`). · invalid_order_value order` is not `asc`/`desc`."
          },
          "403": {
            "description": "forbidden Requester lacks access to the team."
          },
          "404": {
            "description": "team_not_found Team not available in the organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns interactions where either the sender or the receivers belong to the specified team. Membership resolution uses `team_users` combined with integration mappings. Date filters support the same operator syntax (`eq`, `gt`, `gte`, `lt`, `lte`) accepted by the interactions domain."
      }
    },
    "/teams/{team_id}/managers": {
      "get": {
        "operationId": "teams_list_team_managers",
        "tags": [
          "Teams"
        ],
        "summary": "Lists managers assigned to the team.",
        "parameters": [
          {
            "name": "team_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "description": "Selects specific attributes to return. Comma-separated list that supports dotted paths.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Sorting attribute. Optional. Allowed values: `user_name`, `user_email`, `role_id`, `assigned_at`, `user_id`, `name`, `email`, `role`. Defaults to `user_name`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "description": "Sorting direction. Optional. Allowed values: `asc`, `desc`. Defaults to `asc`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page to return. Optional. Defaults to `1`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Number of records per page. Optional. Defaults to `50`. Maximum `200`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "timestamps",
            "in": "query",
            "required": false,
            "description": "Controls timestamp formatting. Optional. Allowed values: `datetime` (default), `int`, `none` (deprecated).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "assigned_at[operator]",
            "in": "query",
            "required": false,
            "description": "Filters by the manager assignment timestamp. Supports `eq`, `gt`, `gte`, `lt`, `lte` with bracket, double-underscore, or trailing underscore syntax using ISO-8601 values.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "user_id": 301,
                      "user_name": "Jacob Lee",
                      "user_email": "jacob.lee@example.com",
                      "role_id": 2,
                      "assigned_at": "2023-10-01T08:00:00Z"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 1,
                    "total": 1,
                    "total_pages": 1,
                    "timestamps": "datetime"
                  },
                  "team": {
                    "team_id": 15,
                    "team_name": "Engineering"
                  }
                }
              }
            }
          },
          "404": {
            "description": "team_not_found Team is inaccessible."
          },
          "400": {
            "description": "invalid_path_parameter team_id` is invalid."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Lists managers assigned to the team."
      }
    },
    "/teams/{team_id}/members": {
      "get": {
        "operationId": "teams_list_team_members",
        "tags": [
          "Teams"
        ],
        "summary": "Returns paginated members of the team.",
        "parameters": [
          {
            "name": "team_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "description": "Selects specific attributes to return. Comma-separated list that supports dotted paths (for example, `apps.app_name`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Sorting attribute. Optional. Allowed values: `user_name`, `user_email`, `role_id`, `joined_at`, `name`, `email`, `role`. Defaults to `user_name`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "description": "Sorting direction. Optional. Allowed values: `asc`, `desc`. Defaults to `asc`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page to return. Optional. Defaults to `1`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Number of records per page. Optional. Defaults to `50`. Maximum `200`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "timestamps",
            "in": "query",
            "required": false,
            "description": "Controls timestamp formatting. Optional. Allowed values: `datetime` (default), `int`, `none` (deprecated).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "role",
            "in": "query",
            "required": false,
            "description": "Filters members by platform role. Optional. Must reference a valid role identifier.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "created_at[operator]",
            "in": "query",
            "required": false,
            "description": "Applies range filters on the user creation timestamp. Supports `eq`, `gt`, `gte`, `lt`, `lte` with bracket, double-underscore, or trailing underscore syntax.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "joined_at[operator]",
            "in": "query",
            "required": false,
            "description": "Filters by the membership start timestamp. Same operators and syntax as `created_at[operator]`; values must be ISO-8601.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "manager_since[operator]",
            "in": "query",
            "required": false,
            "description": "Filters by the manager assignment timestamp. Same operators and syntax as `created_at[operator]`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "user_id": 502,
                      "user_name": "Nina Hayes",
                      "user_email": "nina.hayes@example.com",
                      "role_id": 2,
                      "organization_role": "employee",
                      "apps": [
                        {
                          "user_app_mapping_id": 901,
                          "app_id": 15,
                          "app_name": "Jira",
                          "app_user": "nina.hayes@tools.example",
                          "created_at": "2024-06-01T12:30:00Z"
                        }
                      ],
                      "joined_at": "2023-12-01T09:00:00Z",
                      "is_manager": true,
                      "manager_since": "2024-02-15T10:15:00Z"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "user_name",
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "fields": [
                      "user_id",
                      "user_name",
                      "user_email",
                      "role_id",
                      "organization_role",
                      "apps",
                      "joined_at",
                      "is_manager",
                      "manager_since"
                    ],
                    "role": 2
                  },
                  "team": {
                    "team_id": 15,
                    "team_name": "Engineering"
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter Invalid `fields` or non-numeric `role`. · invalid_pagination Invalid pagination parameters. · invalid_sort_attribute Unsupported `sort` (`user_name`, `user_email`, `role_id`, `joined_at`). · invalid_order_value order` is not `asc`/`desc`."
          },
          "404": {
            "description": "team_not_found Team not accessible to the requester."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns paginated members of the team. Supports filtering by `role`."
      },
      "post": {
        "operationId": "teams_add_team_member",
        "tags": [
          "Org chart"
        ],
        "summary": "Puts one person into one team.",
        "parameters": [
          {
            "name": "team_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`)."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Puts one person into one team. The body names them; the path names the team."
      }
    },
    "/teams/{team_id}/members/{user_id}": {
      "get": {
        "operationId": "teams_get_team_member",
        "tags": [
          "Teams"
        ],
        "summary": "Fetches a single team membership.",
        "parameters": [
          {
            "name": "team_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "description": "Selects specific attributes to return. Comma-separated list that supports dotted paths.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timestamps",
            "in": "query",
            "required": false,
            "description": "Controls timestamp formatting. Optional. Allowed values: `datetime` (default), `int`, `none` (deprecated).",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "user_id": 502,
                    "user_name": "Nina Hayes",
                    "user_email": "nina.hayes@example.com",
                    "joined_at": "2023-12-01T09:00:00Z",
                    "is_manager": true,
                    "manager_since": "2024-02-15T10:15:00Z",
                    "team": {
                      "team_id": 15,
                      "team_name": "Engineering"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "team_membership_not_found User does not belong to the team. · team_not_found Team is inaccessible. · user_not_found User is not visible to the requester."
          },
          "400": {
            "description": "invalid_path_parameter team_id` or `user_id` is invalid."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Fetches a single team membership."
      },
      "delete": {
        "operationId": "teams_remove_team_member",
        "tags": [
          "Org chart"
        ],
        "summary": "Takes one person out of one team.",
        "parameters": [
          {
            "name": "team_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`)."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Takes one person out of one team. Responds with the pair it removed and the size the team is left at:"
      }
    },
    "/teams/{team_id}/tasks": {
      "get": {
        "operationId": "tasks_list_team_tasks",
        "tags": [
          "Teams"
        ],
        "summary": "Retrieves the tasks associated with the team.",
        "parameters": [
          {
            "name": "team_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "description": "Selects specific attributes to return. Comma-separated list that supports dotted paths.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Sorting attribute. Optional. Allowed values: `date_created`, `last_existence_check`, `task_name`. Defaults to `date_created`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "description": "Sorting direction. Optional. Allowed values: `asc`, `desc`. Defaults to `asc`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page to return. Optional. Defaults to `1`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Number of records per page. Optional. Defaults to `50`. Maximum `200`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "timestamps",
            "in": "query",
            "required": false,
            "description": "Controls timestamp formatting. Optional. Allowed values: `datetime` (default), `int`, `none` (deprecated).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Filters tasks that currently hold or historically reached the provided status. Optional. Case-sensitive to the stored status names.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "priority",
            "in": "query",
            "required": false,
            "description": "Filters by the `priority` custom parameter. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "parent_id",
            "in": "query",
            "required": false,
            "description": "Filters by the parent task identifier. Optional.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "assignee",
            "in": "query",
            "required": false,
            "description": "Limits results to tasks owned by the specified user (`task_owner.user_id`). Optional. Must reference a mapped Leanmote user.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "include_unmapped",
            "in": "query",
            "required": false,
            "description": "Includes tasks whose owners cannot be mapped to Leanmote users. Optional. Defaults to `false`; set to `true` to keep unmapped owners.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "created_at[operator]",
            "in": "query",
            "required": false,
            "description": "Applies range filters on the task creation timestamp. Supports `eq`, `gt`, `gte`, `lt`, `lte` with bracket, double-underscore, or trailing underscore syntax using ISO-8601 values.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "updated_at[operator]",
            "in": "query",
            "required": false,
            "description": "Filters by the last update timestamp. Same operators and syntax as `created_at[operator]`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "last_existence_check[operator]",
            "in": "query",
            "required": false,
            "description": "Filters by the last existence check timestamp. Same operators and syntax as `created_at[operator]`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "synced_at[operator]",
            "in": "query",
            "required": false,
            "description": "Filters by the synchronization timestamp (`created_at` in storage). Same operators and syntax as `created_at[operator]`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status_transition",
            "in": "query",
            "required": false,
            "description": "Filters tasks that entered the specified status at least once. Optional. Combined with `status_transition_previous` to narrow the previous status.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status_transition_previous",
            "in": "query",
            "required": false,
            "description": "Restricts the transition filter to tasks whose previous status matches this value. Optional.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status_transition_changed_at[operator]",
            "in": "query",
            "required": false,
            "description": "Filters by the timestamp when the transition occurred. Supports `eq`, `gt`, `gte`, `lt`, `lte` with the same operator syntaxes as other date filters.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "task_id": 501,
                      "board": {
                        "board_id": 22,
                        "board_key": "ENG"
                      },
                      "app": {
                        "app_id": 11,
                        "app_name": "Jira"
                      },
                      "task_key": "ENG-123",
                      "task_name": "Implement authentication",
                      "task_owner": {
                        "user_id": 42,
                        "user_name": "Alex Leanmote",
                        "user_email": "alex.leanmote@example.com"
                      },
                      "task_status": "In Progress"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "date_created",
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "team_id": 10,
                    "status": "In Progress",
                    "created_from": "2024-09-01",
                    "fields": [
                      "task_id",
                      "board.board_id",
                      "board.board_key",
                      "task_key",
                      "app.app_id",
                      "app.app_name",
                      "task_name",
                      "task_owner",
                      "task_status"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter Invalid filters (status, priority, date range, etc.). · invalid_sort_attribute Unsupported `sort` (allowed: `date_created`, `last_existence_check`, `task_name`). · invalid_order_value order` is not `asc`/`desc`."
          },
          "403": {
            "description": "forbidden Requester lacks access to the team."
          },
          "404": {
            "description": "team_not_found Team not available in the organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Retrieves the tasks associated with the team. Tasks are resolved through the board mappings configured for the team and honour pagination, sorting, and the optional `timestamps` override for alternate timestamp formats. Use `GET /tasks` from the Tasks domain when an organization-wide listing is required."
      }
    },
    "/users": {
      "get": {
        "operationId": "users_list_users",
        "tags": [
          "Users"
        ],
        "summary": "Returns users for the organization defined by the `Organization` header.",
        "parameters": [
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "description": "Selects specific attributes to return. Comma-separated list that supports dotted paths (for example, `teams.team_name`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Sorting attribute. Optional. Allowed values: `user_name`, `user_email`, `role_id`, `created_at`, `name`, `email`, `role`. Defaults to `user_name`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "description": "Sorting direction. Optional. Allowed values: `asc`, `desc`. Defaults to `asc`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page to return. Optional. Defaults to `1`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Number of records per page. Optional. Defaults to `50`. Maximum `200`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "timestamps",
            "in": "query",
            "required": false,
            "description": "Controls timestamp formatting. Optional. Allowed values: `datetime` (default), `int`, `none` (deprecated).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "organization_id",
            "in": "query",
            "required": false,
            "description": "Ensures the requested organization matches the tenant scope. Optional. Must equal the `Organization` header; otherwise returns `404`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "team_id",
            "in": "query",
            "required": false,
            "description": "Filters users that belong to the specified team. Optional. Must reference a team visible to the requester.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "email",
            "in": "query",
            "required": false,
            "description": "Filters by user email. Optional. Case-insensitive substring match.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "role",
            "in": "query",
            "required": false,
            "description": "Filters by platform role identifier. Optional.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "created_at[operator]",
            "in": "query",
            "required": false,
            "description": "Applies range filters on the user creation timestamp. Supports `eq`, `gt`, `gte`, `lt`, `lte` with bracket (`field[op]`), double-underscore (`field__op`), or trailing underscore (`field_op`) syntaxes using ISO-8601 values.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "user_id": 502,
                      "user_name": "Nina Hayes",
                      "user_email": "nina.hayes@example.com",
                      "role_id": 2,
                      "organizations": [
                        {
                          "organization_id": 101,
                          "organization_name": "Acme Corp",
                          "organization_industry": "software",
                          "created_at": "2024-01-10T08:00:00Z"
                        }
                      ],
                      "teams": [
                        {
                          "team_id": 15,
                          "team_name": "Engineering",
                          "team_description": "Product engineering",
                          "joined_at": "2023-12-01T09:00:00Z"
                        }
                      ]
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "user_name",
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "fields": [
                      "user_id",
                      "user_name",
                      "user_email",
                      "role_id",
                      "organizations",
                      "teams"
                    ],
                    "organization_id": 101
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter Invalid `fields`, `organization_id`, `team_id`, `role`, or `email`. · invalid_pagination Invalid pagination parameters. · invalid_sort_attribute Unsupported `sort` (`user_name`, `user_email`, `role_id`, `created_at`). · invalid_order_value order` is not `asc`/`desc`."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns users for the organization defined by the `Organization` header."
      }
    },
    "/users/me": {
      "get": {
        "operationId": "users_get_current_user",
        "tags": [
          "Users"
        ],
        "summary": "Returns the identity, role label and read scope of the caller behind the token — one round trip, so a consumer can...",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "user": {
                      "id": 502,
                      "name": "Nina Hayes",
                      "email": "nina.hayes@example.com"
                    },
                    "organization": {
                      "id": 101,
                      "name": "Acme Corp"
                    },
                    "role": "team_leader",
                    "is_leanmote_staff": false,
                    "managed_team_ids": [
                      15
                    ],
                    "member_team_ids": [
                      15,
                      22
                    ],
                    "visible_team_ids": [
                      15,
                      16,
                      17
                    ],
                    "self_only_team_ids": [
                      22
                    ],
                    "all_team_metrics": false
                  }
                }
              }
            }
          },
          "403": {
            "description": "forbidden The token resolves to no user. · no_organization The caller belongs to no organization."
          },
          "404": {
            "description": "user_not_found The user row behind the token is gone."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns the identity, role label and read scope of the caller behind the token — one round trip, so a consumer can tell what it may ask for before asking. The Leanmote MCP exposes it as the `current_user()` tool and passes the payload through untouched."
      }
    },
    "/users/{user_id}": {
      "get": {
        "operationId": "users_get_user",
        "tags": [
          "Users"
        ],
        "summary": "Returns full details for a single user.",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "description": "Selects specific attributes to return. Comma-separated list that supports dotted paths.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timestamps",
            "in": "query",
            "required": false,
            "description": "Controls timestamp formatting. Optional. Allowed values: `datetime` (default), `int`, `none` (deprecated).",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "user_id": 502,
                    "user_name": "Nina Hayes",
                    "user_email": "nina.hayes@example.com",
                    "role_id": 2,
                    "organizations": [
                      {
                        "organization_id": 101,
                        "organization_name": "Acme Corp",
                        "organization_industry": "software",
                        "created_at": "2024-01-10T08:00:00Z"
                      }
                    ],
                    "teams": [
                      {
                        "team_id": 15,
                        "team_name": "Engineering",
                        "team_description": "Product engineering",
                        "joined_at": "2023-12-01T09:00:00Z",
                        "is_manager": true,
                        "manager_since": "2024-02-15T10:15:00Z"
                      }
                    ],
                    "apps": [
                      {
                        "user_app_mapping_id": 901,
                        "app": {
                          "app_id": 15,
                          "app_name": "Jira"
                        },
                        "app_user": "nina.hayes@tools.example",
                        "created_at": "2024-06-01T12:30:00Z"
                      }
                    ]
                  }
                }
              }
            }
          },
          "404": {
            "description": "user_not_found User is not visible or does not exist."
          },
          "400": {
            "description": "invalid_path_parameter user_id` is invalid."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns full details for a single user."
      }
    },
    "/users/{user_id}/apps": {
      "get": {
        "operationId": "users_list_user_apps",
        "tags": [
          "Users"
        ],
        "summary": "Lists app mappings for the user.",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "description": "Selects specific attributes to return. Comma-separated list that supports dotted paths (for example, `app.app_name`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Sorting attribute. Optional. Allowed values: `app_name`, `created_at`, `name`. Defaults to `app_name`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "description": "Sorting direction. Optional. Allowed values: `asc`, `desc`. Defaults to `asc`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page to return. Optional. Defaults to `1`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Number of records per page. Optional. Defaults to `50`. Maximum `200`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "timestamps",
            "in": "query",
            "required": false,
            "description": "Controls timestamp formatting. Optional. Allowed values: `datetime` (default), `int`, `none` (deprecated).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "app_id",
            "in": "query",
            "required": false,
            "description": "Filters mappings to a specific application. Optional. Must reference an app visible to the organization.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "created_at[operator]",
            "in": "query",
            "required": false,
            "description": "Applies range filters on when the mapping was created. Supports `eq`, `gt`, `gte`, `lt`, `lte` with bracket, double-underscore, or trailing underscore syntax using ISO-8601 values.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "user_app_mapping_id": 901,
                      "app": {
                        "app_id": 15,
                        "app_name": "Jira"
                      },
                      "app_user": "nina.hayes@tools.example",
                      "created_at": "2024-06-01T12:30:00Z"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "app_name",
                    "order": "asc",
                    "timestamps": "datetime"
                  }
                }
              }
            }
          },
          "404": {
            "description": "user_not_found User is not visible."
          },
          "400": {
            "description": "invalid_query_parameter Invalid `fields` or `app_id`. · invalid_sort_attribute Unsupported `sort` (`app_name`, `created_at`). · invalid_order_value order` is not `asc`/`desc`."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Lists app mappings for the user. Supports optional `app_id` filter."
      }
    },
    "/users/{user_id}/apps/{app_id}": {
      "get": {
        "operationId": "users_get_user_app",
        "tags": [
          "Users"
        ],
        "summary": "Returns a single app mapping for the user.",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "app_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "description": "Selects specific attributes to return. Comma-separated list that supports dotted paths.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timestamps",
            "in": "query",
            "required": false,
            "description": "Controls timestamp formatting. Optional. Allowed values: `datetime` (default), `int`, `none` (deprecated).",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "user_app_mapping_id": 901,
                    "app": {
                      "app_id": 15,
                      "app_name": "Jira"
                    },
                    "app_user": "nina.hayes@tools.example",
                    "created_at": "2024-06-01T12:30:00Z"
                  }
                }
              }
            }
          },
          "404": {
            "description": "user_app_not_found Mapping does not exist. · user_not_found User not visible."
          },
          "400": {
            "description": "invalid_path_parameter Invalid identifiers."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns a single app mapping for the user. The `{app_id}` path parameter refers to the mapping identifier (`user_app_mapping_id`) returned by `GET /users/{user_id}/apps`."
      }
    },
    "/users/{user_id}/dashboard-views": {
      "get": {
        "operationId": "dashboard_views_list_user_dashboard_views",
        "tags": [
          "Users"
        ],
        "summary": "Returns the base view and custom dashboards stored for `{user_id}`.",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "dashboard_view_id": null,
                      "dashboard_view_kind": "base",
                      "dashboard_view_name": "Base",
                      "dashboard_view_description": "Master view",
                      "created_by": {
                        "user_id": 529,
                        "user_name": "Rocio Alvarez",
                        "user_email": "rocio@example.com"
                      },
                      "created_at": null,
                      "updated_at": null
                    },
                    {
                      "dashboard_view_id": 38,
                      "dashboard_view_kind": "custom",
                      "dashboard_view_name": "APD",
                      "dashboard_view_description": "Quiero obtener las principales métricas...",
                      "created_by": {
                        "user_id": 529,
                        "user_name": "Rocio Alvarez",
                        "user_email": "rocio@example.com"
                      },
                      "created_at": "2025-10-06T17:58:48Z",
                      "updated_at": "2025-10-06T18:02:32Z",
                      "personalization": {
                        "filters": [
                          {
                            "filter_name": "projects",
                            "filter_values": [
                              "845"
                            ],
                            "created_at": "2025-10-06T17:58:48Z"
                          }
                        ],
                        "sections": [
                          {
                            "section_key": "dashboard_section",
                            "section_type": "widget",
                            "created_at": "2025-10-06T17:58:48Z"
                          }
                        ],
                        "sections_mode": "implicit_all_on",
                        "updated_at": "2025-10-06T17:58:48Z"
                      }
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 2,
                    "total_pages": 1,
                    "sort": "name",
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "user_id": 529,
                    "page": 1,
                    "per_page": 50,
                    "sort": "name",
                    "order": "asc"
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter Malformed pagination or unknown query parameter."
          },
          "403": {
            "description": "forbidden Caller lacks permission to view the member's dashboard views."
          },
          "404": {
            "description": "user_not_found {user_id}` is not visible within the organization scope."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns the base view and custom dashboards stored for `{user_id}`. Regular users can only retrieve their own views (or other members that share an organization according to visibility rules); administrators can request any member."
      }
    },
    "/users/{user_id}/dashboard-views/{view_id}": {
      "get": {
        "operationId": "dashboard_views_get_user_dashboard_view",
        "tags": [
          "Users"
        ],
        "summary": "Returns the detailed payload for `{user_id}`.",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "view_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "dashboard_view_id": 38,
                    "dashboard_view_kind": "custom",
                    "dashboard_view_name": "APD",
                    "dashboard_view_description": "Quiero obtener las principales métricas...",
                    "created_by": {
                      "user_id": 529,
                      "user_name": "Rocio Alvarez",
                      "user_email": "rocio@example.com"
                    },
                    "created_at": "2025-10-06T17:58:48Z",
                    "updated_at": "2025-10-06T18:02:32Z",
                    "available": {
                      "sections": [
                        {
                          "section_group": "dashboard_section",
                          "widgets": [
                            {
                              "widget_key": "dora-lead-time",
                              "widget_label": "Lead Time"
                            },
                            {
                              "widget_key": "dora-deployment-frequency",
                              "widget_label": "Deployment Frequency"
                            },
                            {
                              "widget_key": "dora-mean-time-to-recover",
                              "widget_label": "MTTR"
                            },
                            {
                              "widget_key": "dora-change-failure-rate",
                              "widget_label": "Change Failure Rate"
                            }
                          ]
                        }
                      ],
                      "filters": {
                        "classic": [
                          {
                            "filter_name": "teams",
                            "filter_type": "string[]"
                          },
                          {
                            "filter_name": "projects",
                            "filter_type": "string[]"
                          }
                        ],
                        "custom": [
                          {
                            "dashboard_custom_filter_id": 9,
                            "filter_name": "priority",
                            "mapping_id": "priority",
                            "raw_values": [
                              "Medium",
                              "Highest",
                              "High",
                              "Low",
                              null
                            ],
                            "normalized_values": [
                              {
                                "label": "High",
                                "value": "High"
                              },
                              {
                                "label": "Highest",
                                "value": "Highest"
                              },
                              {
                                "label": "Low",
                                "value": "Low"
                              },
                              {
                                "label": "Medium",
                                "value": "Medium"
                              },
                              {
                                "label": "Unassigned",
                                "value": null
                              }
                            ],
                            "active": true,
                            "created_at": "2025-10-01T11:16:00Z",
                            "updated_at": "2025-10-06T13:45:00Z"
                          }
                        ]
                      }
                    },
                    "preferences": {
                      "filters": [
                        {
                          "filter_name": "projects",
                          "filter_values": [
                            "845"
                          ],
                          "created_at": "2025-10-06T17:58:48Z"
                        },
                        {
                          "filter_name": "compare_with",
                          "filter_values": [
                            "1"
                          ],
                          "created_at": "2025-10-06T18:02:32Z"
                        }
                      ],
                      "sections": {
                        "selection_mode": "implicit_all_on",
                        "enabled_widgets": []
                      }
                    },
                    "effective": {
                      "filters": {
                        "projects": [
                          "845"
                        ],
                        "compare_with": [
                          "1"
                        ]
                      },
                      "enabled_widgets": [
                        "dora-lead-time",
                        "dora-deployment-frequency",
                        "dora-mean-time-to-recover",
                        "dora-change-failure-rate",
                        "q-tasks",
                        "wip",
                        "avg-cycle-time",
                        "avg-wip-age",
                        "waiting-time",
                        "active-time"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_view_id view_id` is neither `base` nor a numeric identifier."
          },
          "403": {
            "description": "forbidden Caller lacks permission to view the dashboard view."
          },
          "404": {
            "description": "view_not_found No matching view for the user within the organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Returns the detailed payload for `{user_id}`. `view_id` accepts the keyword `base` (or `default`/`main`) to retrieve the base view or a numeric dashboard identifier for custom views."
      }
    },
    "/users/{user_id}/git/apps": {
      "get": {
        "operationId": "git_list_user_git_apps",
        "tags": [
          "Users"
        ],
        "summary": "Lists Git apps where the user has recorded contributions (commits or pull requests).",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "app_id": 4,
                      "app_name": "GitLab"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "user_id": 42
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter Invalid pagination or `timestamps` value."
          },
          "403": {
            "description": "forbidden Caller lacks permission to inspect the user."
          },
          "404": {
            "description": "user_not_found {user_id}` is not visible within the organization scope."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Lists Git apps where the user has recorded contributions (commits or pull requests). Results are aggregated per app and already scoped to the organization derived from the `Organization` header."
      }
    },
    "/users/{user_id}/interactions": {
      "get": {
        "operationId": "interactions_list_user_interactions",
        "tags": [
          "Users"
        ],
        "summary": "Lists interactions centred on the user.",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "app_id",
            "in": "query",
            "required": false,
            "description": "Filters interactions to a specific integration. Optional. Must reference an application available to the organization.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Restricts interactions to a data source type. Optional. Matches `data_source.type_id`; see integrations catalogue for identifiers.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "interaction_timestamp[operator]",
            "in": "query",
            "required": false,
            "description": "Applies range filters over the interaction timestamp. Supports `eq`, `gt`, `gte`, `lt`, `lte`. Value must be ISO-8601 (`YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "created_at[operator]",
            "in": "query",
            "required": false,
            "description": "Applies range filters over the creation timestamp. Same operators and ISO-8601 requirement as `interaction_timestamp[operator]`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "description": "Selects specific fields to return. Comma-separated list that supports dotted paths (for example, `app.app_name`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Sorting attribute. Optional. Allowed values: `interaction_timestamp`, `created_at`. Defaults to `interaction_timestamp`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "description": "Sorting direction. Optional. Allowed values: `asc`, `desc`. Defaults to `asc`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page to return. Optional. Defaults to `1`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Number of records per page. Optional. Defaults to `50`. Maximum `200`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "timestamps",
            "in": "query",
            "required": false,
            "description": "Controls timestamp formatting. Optional. Allowed values: `datetime` (default), `int`, `none` (deprecated).",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "interaction_id": 301,
                      "app": {
                        "app_id": 11,
                        "app_name": "Slack"
                      },
                      "sender": {
                        "user_id": 42,
                        "user_name": "Alex Leanmote",
                        "user_email": "alex.leanmote@example.com"
                      },
                      "receivers": [
                        {
                          "user_id": 56,
                          "user_name": "Jamie Receiver",
                          "user_email": "jamie.receiver@example.com"
                        }
                      ],
                      "is_owner": true,
                      "is_participant": true,
                      "data_source": {
                        "type_id": 2,
                        "type_name": "messages",
                        "source_id": 999
                      },
                      "interaction_timestamp": "2024-09-14T10:30:00",
                      "created_at": "2024-09-14T10:31:10"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "interaction_timestamp",
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "app_id": 11,
                    "type": 2,
                    "user_id": 42,
                    "interaction_timestamp": {
                      "gte": "2024-09-01T00:00:00",
                      "lte": "2024-09-30T23:59:59"
                    },
                    "fields": [
                      "interaction_id",
                      "app.app_id",
                      "app.app_name",
                      "sender",
                      "receivers",
                      "is_owner",
                      "is_participant",
                      "data_source"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_query_parameter Invalid `fields` value. · invalid_date_filter Date comparison does not contain a valid ISO-8601 value. · invalid_date_filter_operator Unsupported comparison operator in the date filter. · invalid_sort_attribute Unsupported `sort` (allowed: `interaction_timestamp`, `created_at`). · invalid_order_value order` is not `asc`/`desc`."
          },
          "403": {
            "description": "forbidden Caller lacks access to the user's interactions."
          },
          "404": {
            "description": "user_not_found {user_id}` is not accessible within the organization."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Lists interactions centred on the user. Either the sender or one of the receivers must match `{user_id}` after resolving integration identifiers through the user-app mappings."
      }
    },
    "/users/{user_id}/organizations": {
      "get": {
        "operationId": "users_list_user_organizations",
        "tags": [
          "Users"
        ],
        "summary": "Lists organizations associated with the user.",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "description": "Selects specific attributes to return. Comma-separated list that supports dotted paths.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Sorting attribute. Optional. Allowed values: `organization_name`, `organization_created_at`, `name`, `created_at`. Defaults to `organization_name`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "description": "Sorting direction. Optional. Allowed values: `asc`, `desc`. Defaults to `asc`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page to return. Optional. Defaults to `1`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Number of records per page. Optional. Defaults to `50`. Maximum `200`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "timestamps",
            "in": "query",
            "required": false,
            "description": "Controls timestamp formatting. Optional. Allowed values: `datetime` (default), `int`, `none` (deprecated).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "created_at[operator]",
            "in": "query",
            "required": false,
            "description": "Applies range filters on when the user joined the organization. Supports `eq`, `gt`, `gte`, `lt`, `lte` with bracket, double-underscore, or trailing underscore syntax.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "updated_at[operator]",
            "in": "query",
            "required": false,
            "description": "Filters by the last organization update timestamp. Same operators and syntax as `created_at[operator]`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "organization_id": 101,
                      "organization_name": "Acme Corp",
                      "organization_industry": "software",
                      "created_at": "2024-01-10T08:00:00Z"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "organization_name",
                    "order": "asc",
                    "timestamps": "datetime"
                  }
                }
              }
            }
          },
          "404": {
            "description": "user_not_found User is not visible to the requester."
          },
          "400": {
            "description": "invalid_path_parameter user_id` is invalid."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Lists organizations associated with the user."
      }
    },
    "/users/{user_id}/teams": {
      "get": {
        "operationId": "users_list_user_teams",
        "tags": [
          "Users"
        ],
        "summary": "Lists teams for the user.",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "description": "Selects specific attributes to return. Comma-separated list that supports dotted paths.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Sorting attribute. Optional. Allowed values: `team_name`, `joined_at`, `name`. Defaults to `team_name`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "description": "Sorting direction. Optional. Allowed values: `asc`, `desc`. Defaults to `asc`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page to return. Optional. Defaults to `1`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Number of records per page. Optional. Defaults to `50`. Maximum `200`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "timestamps",
            "in": "query",
            "required": false,
            "description": "Controls timestamp formatting. Optional. Allowed values: `datetime` (default), `int`, `none` (deprecated).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "organization_id",
            "in": "query",
            "required": false,
            "description": "Ensures the team belongs to the scoped organization. Optional. Must match the `Organization` header; otherwise returns `404`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "joined_at[operator]",
            "in": "query",
            "required": false,
            "description": "Applies range filters on the membership creation timestamp. Supports `eq`, `gt`, `gte`, `lt`, `lte` with bracket, double-underscore, or trailing underscore syntax using ISO-8601 values.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "team_id": 15,
                      "team_name": "Engineering",
                      "team_description": "Product engineering",
                      "joined_at": "2023-12-01T09:00:00Z"
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "per_page": 50,
                    "total": 1,
                    "total_pages": 1,
                    "sort": "team_name",
                    "order": "asc",
                    "timestamps": "datetime"
                  },
                  "applied_filters": {
                    "fields": [
                      "team_id",
                      "team_name",
                      "team_description",
                      "joined_at"
                    ],
                    "organization_id": 101
                  }
                }
              }
            }
          },
          "404": {
            "description": "user_not_found User is not visible."
          },
          "400": {
            "description": "invalid_query_parameter organization_id` or `fields` invalid."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Lists teams for the user. Supports optional `organization_id` filter."
      }
    },
    "/users/{user_id}/teams/{team_id}": {
      "get": {
        "operationId": "users_get_user_team",
        "tags": [
          "Users"
        ],
        "summary": "Validates a specific team membership.",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "team_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "description": "Selects specific attributes to return. Comma-separated list that supports dotted paths.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timestamps",
            "in": "query",
            "required": false,
            "description": "Controls timestamp formatting. Optional. Allowed values: `datetime` (default), `int`, `none` (deprecated).",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Body: the standard envelope (`status`, `data`, `meta`).",
            "content": {
              "application/json": {
                "example": {
                  "status": "success",
                  "data": {
                    "team_membership_id": 1801,
                    "team": {
                      "team_id": 15,
                      "team_name": "Engineering"
                    },
                    "joined_at": "2023-12-01T09:00:00Z"
                  }
                }
              }
            }
          },
          "404": {
            "description": "team_membership_not_found User is not a member of the team. · team_not_found Team inaccessible."
          },
          "400": {
            "description": "invalid_path_parameter Invalid identifiers."
          },
          "401": {
            "description": "Missing or invalid token."
          }
        },
        "description": "Validates a specific team membership."
      }
    }
  }
}
