Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

279 KB
Raw Blame
{
  "openapi": "3.1.0",
  "info": {
    "title": "authentication_service",
    "description": "",
    "termsOfService": "https://macro.com/terms",
    "license": {
      "name": ""
    },
    "version": "0.1.0"
  },
  "paths": {
    "/agents/{agent_id}/api-key": {
      "get": {
        "tags": ["crate::api::agent_api_keys"],
        "summary": "The agent's API key, if it has one, and whether its plan allows one.",
        "operationId": "get_agent_api_key",
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentApiKey"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": ["crate::api::agent_api_keys"],
        "summary": "Registers or replaces the agent's API key, for its model's provider.\nOnly in-memory agents on an Anthropic or OpenAI model, on a paid plan.",
        "operationId": "put_agent_api_key",
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutAgentApiKeyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentApiKey"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": ["crate::api::agent_api_keys"],
        "summary": "Forgets the agent's API key. Does not revoke it at the provider; succeeds\nwhen there was none.",
        "operationId": "delete_agent_api_key",
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentApiKey"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/ai-billing/auto-reload": {
      "patch": {
        "tags": ["ai_billing"],
        "summary": "Turn automatic credit reloads on with the given\nthresholds, or off. Payer only. Enabling settles right away, so a balance\nalready under the minimum reloads immediately.",
        "operationId": "update_ai_billing_auto_reload",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAutoReloadRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Updated position",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageSnapshot"
                }
              }
            }
          },
          "400": {
            "description": "Invalid thresholds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiBillingErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "402": {
            "description": "A paid plan is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiBillingErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Only the payer may change billing",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiBillingErrorBody"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiBillingErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/ai-billing/credits/checkout": {
      "post": {
        "tags": ["ai_billing"],
        "summary": "Start a Stripe Checkout for a credit pack. Payer only.",
        "operationId": "create_ai_credit_checkout",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreditCheckoutRequestBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Checkout URL",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreditCheckoutResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid pack, untrusted return URL, or no payment account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiBillingErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "402": {
            "description": "A paid plan is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiBillingErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Only the payer may buy credits",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiBillingErrorBody"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiBillingErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/ai-billing/credits/purchase": {
      "post": {
        "tags": ["ai_billing"],
        "summary": "Buy a credit pack now, charged to the payer's card on file. Any paid team\nmember may buy, within the team's monthly credit limit.",
        "operationId": "purchase_ai_credits",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreditPurchaseRequestBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Purchase outcome and updated position",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreditPurchaseResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid pack or no payment account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiBillingErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "402": {
            "description": "A paid plan is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiBillingErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Over the monthly credit limit, or an earlier purchase is still processing",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiBillingErrorBody"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiBillingErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/ai-billing/overage": {
      "patch": {
        "tags": ["ai_billing"],
        "summary": "Retired direct-usage opt-in. Enabling is rejected; disabling remains supported.",
        "operationId": "update_ai_billing_overage",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateOverageRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Updated position",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageSnapshot"
                }
              }
            }
          },
          "400": {
            "description": "Invalid limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiBillingErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "402": {
            "description": "A paid plan is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiBillingErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Only the payer may change billing",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiBillingErrorBody"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiBillingErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/ai-billing/plans": {
      "get": {
        "tags": ["ai_billing"],
        "summary": "The plan catalog, credit packs, overage cap bounds, and automatic reload\ndefaults and bounds.",
        "operationId": "get_ai_billing_plans",
        "responses": {
          "200": {
            "description": "Plan catalog",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlanCatalogResponse"
                }
              }
            }
          }
        }
      }
    },
    "/ai-billing/summary": {
      "get": {
        "tags": ["ai_billing"],
        "summary": "The caller's current-period AI usage, credits, and overage settings.",
        "description": "Runs a settlement first so the position reflects any credits or overage\nthat were waiting to be booked.",
        "operationId": "get_ai_billing_summary",
        "responses": {
          "200": {
            "description": "Current-period position",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageSnapshot"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiBillingErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/codex": {
      "get": {
        "tags": ["crate::api::codex"],
        "operationId": "get_codex_connection",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CodexConnectionStatus"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": ["crate::api::codex"],
        "operationId": "disconnect_codex",
        "responses": {
          "204": {
            "description": ""
          }
        }
      }
    },
    "/codex/config": {
      "put": {
        "tags": ["crate::api::codex"],
        "operationId": "configure_codex",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CodexConfigRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CodexConnectionStatus"
                }
              }
            }
          }
        }
      }
    },
    "/codex/environments": {
      "get": {
        "tags": ["crate::api::codex"],
        "operationId": "list_codex_environments",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CodexEnvironment"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/codex/login": {
      "post": {
        "tags": ["crate::api::codex"],
        "operationId": "start_codex_login",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CodexLoginStart"
                }
              }
            }
          }
        }
      }
    },
    "/codex/login/{attempt_id}": {
      "get": {
        "tags": ["crate::api::codex"],
        "operationId": "poll_codex_login",
        "parameters": [
          {
            "name": "attempt_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CodexLoginPoll"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": ["crate::api::codex"],
        "operationId": "cancel_codex_login",
        "parameters": [
          {
            "name": "attempt_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": ""
          }
        }
      }
    },
    "/cursor-api-key": {
      "get": {
        "tags": ["crate::api::cursor_api_key::get_cursor_api_key"],
        "summary": "Whether the caller has a Cursor API key registered.",
        "description": "Never returns the key, or any part of it. There is no screen that needs one,\nand a masked key still leaks its length and alphabet.",
        "operationId": "get_cursor_api_key",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CursorApiKeyStatus"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": ["crate::api::cursor_api_key::put_cursor_api_key"],
        "summary": "Registers or replaces the caller's Cursor API key.",
        "description": "The key is validated on shape alone — this cannot distinguish a live key\nfrom forty random characters behind the right prefix. Confirming it against\nCursor's `GET /v1/me` is the obvious improvement, and is what would let this\nreport the connected account rather than only that a key exists.",
        "operationId": "put_cursor_api_key",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutCursorApiKeyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CursorApiKeyStatus"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": ["crate::api::cursor_api_key::delete_cursor_api_key"],
        "summary": "Forgets the caller's Cursor API key.",
        "description": "This does **not** revoke the key at Cursor — it keeps working everywhere\nelse it is used, and only Cursor can revoke it. Any UI offering this has to\nsay so rather than implying otherwise.\n\nDeleting when there is nothing to delete succeeds: the caller's intent is\n\"I should have no key registered\", and that is already true.",
        "operationId": "delete_cursor_api_key",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CursorApiKeyStatus"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/cursor-api-key/default-model": {
      "put": {
        "tags": ["crate::api::cursor_api_key::put_cursor_default_model"],
        "summary": "Choose the model this user's `@cursor` sessions start on.",
        "description": "Stores the id only; its parameters are resolved from Cursor's own default\nvariant at session start. Not validated against the live model list here —\nthe settings dropdown offers only real ids, and a stale id degrades to the\ndeployment default at spawn rather than failing, so a round trip to Cursor\non every save would buy nothing.",
        "operationId": "put_cursor_default_model",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutCursorDefaultModelRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CursorApiKeyStatus"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/cursor-api-key/models": {
      "get": {
        "tags": ["crate::api::cursor_api_key::list_cursor_models"],
        "summary": "List the models the caller's Cursor account offers.",
        "description": "Reached only from the settings dropdown, so it decrypts the user's own key\nand asks Cursor directly — the list is per-account and changes, so there is\nnothing to cache statically. Reuses the harness's Cursor client rather than\nreimplementing the `/v1/models` parse, keeping one source of truth for what\na model is.",
        "operationId": "list_cursor_models",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CursorModelsResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/email/fusionauth/verify/{verification_id}": {
      "get": {
        "tags": ["email::verify_fusionauth_user_email"],
        "summary": "Verifies the user's primary email for FusionAuth",
        "operationId": "verify_fusionauth_user_email",
        "parameters": [
          {
            "name": "verification_id",
            "in": "path",
            "description": "The verification id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/email/fusionauth_resend": {
      "post": {
        "tags": ["email::resend_fusionauth_verify_user_email"],
        "summary": "Resend the user's primary email verification for FusionAuth",
        "operationId": "resend_fusionauth_verify_user_email",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResendFusionauthVerifyUserEmailRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/email/generate/link": {
      "post": {
        "tags": ["email::generate_email_link"],
        "summary": "Generates an email link for the user to verify their email address.",
        "operationId": "generate_email_link",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GenerateEmailLinkRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/email/verify/{verification_id}": {
      "get": {
        "tags": ["email::verify_email_link"],
        "summary": "Verifies the user's email for a user profile",
        "operationId": "verify_email_link",
        "parameters": [
          {
            "name": "verification_id",
            "in": "path",
            "description": "The verification id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/github_pull_requests/draft": {
      "post": {
        "tags": ["github_pull_requests"],
        "summary": "Converts a GitHub pull request to a draft, or marks it ready for review,\nas the authenticated user with their own GitHub grant.",
        "operationId": "set_github_pull_request_draft",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetGithubPullRequestDraftRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SetGithubPullRequestDraftResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The user cannot change the pull request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "No GitHub link, or the pull request is not visible to the user",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "GitHub declined the change",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "428": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpstreamErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpstreamErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/github_pull_requests/enrich": {
      "post": {
        "tags": ["github_pull_requests"],
        "summary": "Enriches GitHub pull request references with live GitHub data for the authenticated user.",
        "operationId": "enrich_github_pull_requests",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnrichGithubPullRequestsProxyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnrichGithubPullRequestsResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "428": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpstreamErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpstreamErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/github_pull_requests/merge": {
      "post": {
        "tags": ["github_pull_requests"],
        "summary": "Merges a GitHub pull request as the authenticated user, with their own\nGitHub grant. GitHub applies the user's permissions and the repository's\nbranch protections; a refusal is returned with GitHub's message.",
        "operationId": "merge_github_pull_request",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MergeGithubPullRequestRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MergeGithubPullRequestResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The user cannot push to the repository",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "No GitHub link, or the pull request is not visible to the user",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "The pull request is not mergeable as it stands, or its head moved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "428": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpstreamErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpstreamErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/github_pull_requests/mergeability": {
      "post": {
        "tags": ["github_pull_requests"],
        "summary": "Reads whether each GitHub pull request merges cleanly into its base, as\nthe authenticated user sees it. Pull requests the user cannot see are\nleft out.",
        "operationId": "get_github_pull_request_mergeability",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GithubPullRequestMergeabilityRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GithubPullRequestMergeabilityResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "No GitHub link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Too many pull requests requested",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "428": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpstreamErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpstreamErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/github_pull_requests/state": {
      "post": {
        "tags": ["github_pull_requests"],
        "summary": "Closes a GitHub pull request, or reopens it, as the authenticated user\nwith their own GitHub grant.",
        "operationId": "set_github_pull_request_state",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetGithubPullRequestStateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SetGithubPullRequestStateResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The user cannot change the pull request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "No GitHub link, or the pull request is not visible to the user",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "GitHub declined the change",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "428": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpstreamErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpstreamErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/gtm-invite/links": {
      "get": {
        "tags": ["gtm_invite"],
        "summary": "Lists invite links, newest first. Macro staff only.",
        "operationId": "list_gtm_invite_links",
        "parameters": [
          {
            "name": "mine",
            "in": "query",
            "description": "Only the caller's own links (default: every staff member's).",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GtmInviteLinkList"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": ["gtm_invite"],
        "summary": "Creates an invite link. Macro staff only.",
        "operationId": "create_gtm_invite_link",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateGtmInviteLinkRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GtmInviteLink"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/gtm-invite/links/{id}": {
      "delete": {
        "tags": ["gtm_invite"],
        "summary": "Revokes an invite link nobody has signed up through. Macro staff only.",
        "operationId": "revoke_gtm_invite_link",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The invite link id",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GtmInviteLink"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/gtm-invite/offer": {
      "get": {
        "tags": ["gtm_invite"],
        "summary": "The promotion the signed-in user's account holds from an invite link, if\nthey redeemed one and have not started a paid subscription yet.",
        "operationId": "get_gtm_invite_offer",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GtmInviteOfferStatus"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/gtm-invite/public/{token}": {
      "get": {
        "tags": ["gtm_invite"],
        "summary": "Resolves an invite link for the public welcome page and counts the open.",
        "description": "Unauthenticated: the recipient has no account yet. Only the first name and\nwhether the link is still usable are exposed.",
        "operationId": "resolve_gtm_invite_link",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "description": "The token from the invite link URL",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicGtmInviteLink"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": ""
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/gtm-invite/redeem": {
      "post": {
        "tags": ["gtm_invite"],
        "summary": "Attributes the signed-in user's account to the invite link they opened and\ngrants them its offer. Idempotent for the same account.",
        "operationId": "redeem_gtm_invite_link",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RedeemGtmInviteLinkRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GtmInviteOffer"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "tags": ["health"],
        "summary": "Health check",
        "operationId": "health_handler",
        "responses": {
          "200": {
            "description": "health",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          }
        }
      }
    },
    "/jwt/macro_api_token": {
      "get": {
        "tags": ["jwt::macro_api_token"],
        "summary": "Generates a macro-api-token using the user's macro-access-token\nYou can either have your access token in the cookies or in the request\nheaders\nAuthorization: Bearer <access_token>\nThis returns a new macro-api-token",
        "operationId": "macro_api_token",
        "parameters": [
          {
            "name": "email",
            "in": "query",
            "description": "The email to generate the macro-api-token for. If not provided, we use your default profile.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MacroApiTokenResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/jwt/refresh": {
      "post": {
        "tags": ["jwt::refresh"],
        "summary": "Refreshes a JWT token\nYou can either have your access token and refresh token in the cookies or in the request\nheaders\nAuthorization: Bearer <access_token>\nx-macro-refresh-token: <refresh_token>\nThis returns the cookies with the new access and refresh token",
        "operationId": "refresh",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserTokensResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Refresh already in progress for this user, or the access token lacks the Macro claims and was issued too recently to refresh",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/link": {
      "post": {
        "tags": ["link::create_in_progress_link"],
        "summary": "Initiates a link for a user",
        "operationId": "create_in_progress_link",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateInProgressLinkResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/link/email/providers": {
      "get": {
        "tags": ["link::outlook"],
        "operationId": "email_connection_providers",
        "parameters": [
          {
            "name": "original_url",
            "in": "query",
            "description": "**OPTIONAL**. Where the admin-consent flow returns to; required for `outlook_admin_consent_url`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailConnectionProviders"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/link/github": {
      "post": {
        "tags": ["link::github"],
        "summary": "Initiates a link for a user",
        "operationId": "init_github_link",
        "parameters": [
          {
            "name": "original_url",
            "in": "query",
            "description": "**OPTIONAL**. The original url to redirect to.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InitGithubLinkResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpstreamErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpstreamErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": ["link::github"],
        "summary": "Deletes a github link for a user",
        "operationId": "delete_github_link",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpstreamErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpstreamErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/link/github/status": {
      "get": {
        "tags": ["link::github"],
        "summary": "Checks whether the authenticated user's GitHub link token is valid.",
        "operationId": "check_github_link_status",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GithubLinkStatusResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "428": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpstreamErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpstreamErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/link/gmail": {
      "post": {
        "tags": ["link::gmail"],
        "summary": "Initiates a Gmail link for a user",
        "operationId": "init_gmail_link",
        "parameters": [
          {
            "name": "original_url",
            "in": "query",
            "description": "**OPTIONAL**. The original url to redirect to.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reconnect_link_id",
            "in": "query",
            "description": "Existing accessible Gmail inbox being reconnected; does not consume an additional inbox slot.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "scopes",
            "in": "query",
            "description": "**OPTIONAL**. Which capabilities to request consent for: `gmail` (default), `gmail_and_calendar`, or `calendar`. The calendar variants are only honored when the deployment allows calendar scope requests.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InitGmailLinkResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/link/gmail/status": {
      "get": {
        "tags": ["link::gmail"],
        "summary": "Checks whether the authenticated user's gmail link is valid.",
        "operationId": "check_gmail_link_status",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GmailLinkStatusResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "428": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/link/outlook": {
      "post": {
        "tags": ["link::outlook"],
        "summary": "Initiates a Microsoft Outlook account link for an authenticated user.",
        "operationId": "init_outlook_link",
        "parameters": [
          {
            "name": "original_url",
            "in": "query",
            "description": "**OPTIONAL**. The original URL to redirect to.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scopes",
            "in": "query",
            "description": "mail (default) or mail_and_calendar. Calendar requests obey the deployment calendar consent switch.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reconnect_link_id",
            "in": "query",
            "description": "Existing accessible inbox being reconnected or granted calendar consent.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InitOutlookLinkResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/login/apple": {
      "post": {
        "tags": ["login::apple"],
        "summary": "Completes the apple login flow",
        "operationId": "apple_login",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppleLoginRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/login/password": {
      "post": {
        "tags": ["login::password"],
        "summary": "Performs a password login",
        "operationId": "password_login",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PasswordRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserTokensResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/login/passwordless": {
      "post": {
        "tags": ["login::passwordless"],
        "summary": "Initiates a passwordless login",
        "operationId": "passwordless_login",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PasswordlessRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PasswordlessStartedResponse"
                }
              }
            }
          },
          "202": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SsoRequiredResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/login/sso": {
      "get": {
        "tags": ["login::sso"],
        "summary": "Initiates an SSO login",
        "operationId": "sso_login",
        "parameters": [
          {
            "name": "idp_name",
            "in": "query",
            "description": "The name of the identity provider to use for login. e.g Google",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "idp_id",
            "in": "query",
            "description": "**OPTIONAL**. The idp id of the identity provider to use for login.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "login_hint",
            "in": "query",
            "description": "**OPTIONAL**. The user's email.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "original_url",
            "in": "query",
            "description": "**OPTIONAL**. The original url you came from.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "is_mobile",
            "in": "query",
            "description": "**OPTIONAL**. If the authentication request is from a mobile device.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "referral_code",
            "in": "query",
            "description": "**OPTIONAL**. If the user opened a link with a referral code.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "is_agent",
            "in": "query",
            "description": "**OPTIONAL**. If the sign-in started on the agent signup page. A new account becomes an agent.",
            "required": true,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/logout": {
      "post": {
        "tags": ["logout"],
        "summary": "Initiates a passwordless login",
        "operationId": "logout",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          }
        }
      }
    },
    "/merge": {
      "post": {
        "tags": ["merge::create_merge_request"],
        "summary": "Creates a merge request used to verify the user's email address in order to merge their\naccounts.\nThis is different than generate_email_link which is used to verify a new email address to add a\nnew profile to a user's account.",
        "operationId": "create_merge_request",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAccountMergeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/merge/verify/{code}": {
      "get": {
        "tags": ["merge::verify_merge_request"],
        "summary": "Verifies the merge request",
        "operationId": "verify_merge_request",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "description": "The code",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/mobile-welcome-email": {
      "post": {
        "tags": ["mobile_welcome_email"],
        "summary": "Emails a mobile lead a link to continue onboarding on desktop and enrolls\nthem in the Loops welcome sequence. No-ops if the address was already\ncaptured, and rejects blocked addresses.",
        "operationId": "send_mobile_welcome_email",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendMobileWelcomeEmailRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendMobileWelcomeEmailResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/oauth/passwordless/{code}": {
      "get": {
        "tags": ["oauth::passwordless_callback"],
        "summary": "Handles oauth redirect",
        "operationId": "passwordless_callback",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "description": "Code",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "email",
            "in": "query",
            "description": "Email",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserTokensResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/oauth/redirect": {
      "get": {
        "tags": ["oauth::oauth_redirect"],
        "summary": "Handles oauth redirect",
        "operationId": "oauth_redirect",
        "responses": {
          "200": {
            "description": ""
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/oauth2/{provider}/callback": {
      "get": {
        "tags": ["oauth2"],
        "summary": "Custom OAuth2 callback",
        "operationId": "oauth2_callback",
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "description": "The provider to use",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          },
          "303": {
            "description": "Back to the app with link identifiers, an `email_link_error`, or an `email_link_notice`"
          },
          "304": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "307": {
            "description": ""
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/permissions": {
      "get": {
        "tags": ["permissions::get_permissions"],
        "summary": "Gets all permissions",
        "operationId": "get_permissions",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Permission"
                  }
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/permissions/me": {
      "get": {
        "tags": ["permissions::get_user_permissions"],
        "summary": "Gets a list of the users permissions",
        "operationId": "get_user_permissions",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/referral/code": {
      "get": {
        "tags": ["referral"],
        "summary": "Handler for `GET /referral-code`.",
        "description": "Returns the authenticated user's referral code.",
        "operationId": "get_referral_code",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/referral/send": {
      "post": {
        "tags": ["referral"],
        "summary": "Handler for `POST /referral/send`.",
        "description": "Sends a referral code via email to a user",
        "operationId": "send_referral_code",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendInviteBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": ""
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/session": {
      "post": {
        "tags": ["session::session_creation"],
        "summary": "Refreshes a JWT token",
        "operationId": "session_creation",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/session/login/{session_code}": {
      "get": {
        "tags": ["session::session_login"],
        "summary": "Performs a login via session code",
        "operationId": "session_login",
        "parameters": [
          {
            "name": "session_code",
            "in": "path",
            "description": "The session code",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserTokensResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/system-status": {
      "get": {
        "tags": ["system_status"],
        "summary": "The status every user sees. Public: the banner shows wherever the app\nruns, signed in or not.",
        "operationId": "get_system_status",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CurrentSystemStatus"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": ["system_status"],
        "summary": "Sets the status every user sees and pushes it to every open app. Macro\nstaff only.",
        "description": "Authenticate with a Macro session, or from a script with a personal API\nkey (Settings → API keys) in the `x-macro-user-api-key` header. The body\nis the new status:\n\n- `{\"status\": \"operational\"}` clears the banner. It takes no message.\n- `{\"status\": \"degraded\", \"message\": \"Search is slow to update.\"}`\n- `{\"status\": \"major_outage\", \"message\": \"Macro is unavailable. We're on it.\"}`\n\nMessages are trimmed and must be 1–500 characters. Every call is kept in\nthe history, even when it repeats the current status.",
        "operationId": "set_system_status",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SystemStatus"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusUpdate"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "The body is not a valid status"
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/system-status/history": {
      "get": {
        "tags": ["system_status"],
        "summary": "Recent status updates, newest first, with who set each. Macro staff only.",
        "operationId": "list_system_status_history",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemStatusHistory"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/team": {
      "get": {
        "tags": ["teams::inbound::axum_router::get_team"],
        "summary": "Gets a team by ID.",
        "operationId": "get_team",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamWithMembers"
                }
              }
            }
          },
          "204": {
            "description": ""
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": ["teams::inbound::axum_router::create_team"],
        "summary": "Creates a new team.",
        "operationId": "create_team",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTeamRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Team"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": ["teams::inbound::axum_router::delete_team"],
        "summary": "Deletes a team.\nThis will update all team members roles and cancel your subscription for the team.\nThis action is **irreversible** and you will not be able to recover the team afterwards.",
        "operationId": "delete_team",
        "responses": {
          "200": {
            "description": ""
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": ["teams::inbound::axum_router::patch_team"],
        "summary": "Updates a team.",
        "operationId": "patch_team",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchTeamRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": ""
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/team/auto-join-domain/toggle": {
      "post": {
        "tags": ["teams::inbound::axum_router::toggle_auto_join_domain"],
        "summary": "Toggles automatic domain joining for the team. When the team has no\nauto-join domain, sets it to the team owner's email domain — rejected\nwith a 400 when that domain is a generic email provider domain (e.g.\ngmail.com). When one is already set, removes it. New users whose email\ndomain matches a team's auto-join domain are added to that team on\nsignup. Requires the caller to be an Admin or Owner of the team.",
        "operationId": "toggle_team_auto_join_domain",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToggleAutoJoinDomainResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/team/crm": {
      "patch": {
        "tags": ["teams::inbound::axum_router::patch_team_crm_settings"],
        "summary": "Enables or disables CRM for the team. On enable with `backfill`\n(the default), kicks off a best-effort backfill that enqueues a\n`PopulateCrmForUser` message per team member (no-op if CRM is\nalready enabled); without `backfill` the CRM starts empty and fills\nfrom new activity only. On disable,\nflips the flag and purges the team's CRM data (cascading through\n`crm_companies` → `crm_domains` / `crm_contacts` /\n`crm_contact_sources`). Requires the caller to be an Admin or\nOwner of the team.",
        "operationId": "patch_team_crm_settings",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchTeamCrmSettingsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatchTeamCrmSettingsResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/team/domain-notice": {
      "post": {
        "tags": ["teams::inbound::axum_router::domain_notice"],
        "summary": "Emails the caller's contacts on the team's auto-join domain that the team\nexists, so they can sign up and join. Contacts already on Macro, on the\nteam, invited, or emailed before are skipped, and a team emails at most 25\npeople in total. Call it after sending the team's invites. Requires the\ncaller to be an Admin or Owner of the team.",
        "operationId": "send_team_domain_notice",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendDomainNoticeResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/team/invite": {
      "post": {
        "tags": ["teams::inbound::axum_router::invite_to_team"],
        "summary": "Invites a user to a team.",
        "operationId": "invite_to_team",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InviteToTeamRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": ""
          },
          "304": {
            "description": ""
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "`team_id` names a team other than the caller's current team",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/team/invite-link": {
      "get": {
        "tags": ["teams::inbound::axum_router::invite_link"],
        "summary": "Gets the team's invite link. Anyone who may invite people to the team may\nsee it.",
        "operationId": "get_team_invite_link",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamInviteLinkResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": ["teams::inbound::axum_router::invite_link"],
        "summary": "Creates the team's invite link, replacing any existing one. Anyone who may\ninvite people may create the first link; replacing one requires a team\nadmin or owner.",
        "operationId": "create_team_invite_link",
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedTeamInviteLinkResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": ["teams::inbound::axum_router::invite_link"],
        "summary": "Turns off the team's invite link. Requires a team admin or owner.",
        "operationId": "delete_team_invite_link",
        "responses": {
          "204": {
            "description": ""
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/team/invite-link/join": {
      "post": {
        "tags": ["teams::inbound::axum_router::invite_link"],
        "summary": "Joins the team an invite link belongs to.",
        "operationId": "join_team_by_invite_link",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamInviteLinkTokenRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JoinTeamByInviteLinkResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/team/invite-link/team": {
      "post": {
        "tags": ["teams::inbound::axum_router::invite_link"],
        "summary": "Gets the team an invite link joins, so the user can see it before joining.",
        "operationId": "get_team_by_invite_link",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamInviteLinkTokenRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamInviteLinkTeam"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/team/invite/{team_invite_id}": {
      "delete": {
        "tags": ["teams::inbound::axum_router::delete_team_invite"],
        "summary": "Deletes a team invite from a team.",
        "operationId": "delete_team_invite_handler",
        "parameters": [
          {
            "name": "team_invite_id",
            "in": "path",
            "description": "The ID of the team invite",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/team/invites": {
      "get": {
        "tags": ["teams::inbound::axum_router::get_team_invites"],
        "summary": "Gets all invites for a team.",
        "operationId": "get_team_invites",
        "parameters": [
          {
            "name": "team_id",
            "in": "query",
            "description": "The team the caller means to list. Invites are always read from the\ncaller's current team; when this names another team, the request\nanswers 409.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamInvitesResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "`team_id` names a team other than the caller's current team",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/team/join/{team_invite_id}": {
      "get": {
        "tags": ["teams::inbound::axum_router::join_team"],
        "summary": "Joins a team by accepting an invite.",
        "operationId": "join_team",
        "parameters": [
          {
            "name": "team_invite_id",
            "in": "path",
            "description": "The team invite id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": ["teams::inbound::axum_router::reject_invitation"],
        "summary": "Rejects an invitation to join a team.",
        "operationId": "reject_invitation",
        "parameters": [
          {
            "name": "team_invite_id",
            "in": "path",
            "description": "The team invite id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/team/members/{member_user_id}/plan": {
      "patch": {
        "tags": ["teams::inbound::axum_router::patch_team_member_plan"],
        "summary": "Moves one team member's seat between paid plans.",
        "description": "Team admins and owners only. The team's subscription is re-billed for\nthe seat at once (prorated); the member's tier role and individual AI\nallowance follow immediately.",
        "operationId": "patch_team_member_plan",
        "parameters": [
          {
            "name": "member_user_id",
            "in": "path",
            "description": "The member whose seat plan changes",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchTeamMemberPlanRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamMember"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "The team has no active subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/team/non-admin-invites/toggle": {
      "post": {
        "tags": ["teams::inbound::axum_router::toggle_non_admin_invites"],
        "summary": "Toggles whether non-admin members may invite users to the team. Teams\nstart with this on (any member can invite); turning it off restricts\ninviting to team admins and owners. Requires the caller to be an Admin\nor Owner of the team.",
        "operationId": "toggle_team_non_admin_invites",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToggleNonAdminInvitesResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/team/remove/{remove_user_id}": {
      "delete": {
        "tags": ["teams::inbound::axum_router::remove_user_from_team"],
        "summary": "Removes a user from a team.",
        "operationId": "remove_user_from_team",
        "parameters": [
          {
            "name": "remove_user_id",
            "in": "path",
            "description": "The ID of the user to remove",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/team/user": {
      "get": {
        "tags": ["teams::inbound::axum_router::get_user_teams"],
        "summary": "Gets all teams for the authenticated user.",
        "operationId": "get_user_teams",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Team"
                  }
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/team/user/invites": {
      "get": {
        "tags": ["teams::inbound::axum_router::get_user_invites"],
        "summary": "Gets all of a user's invitations.",
        "operationId": "get_user_invites",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamInvitesResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/user/agent_setup": {
      "post": {
        "tags": ["user::agent_setup"],
        "summary": "Finishes an agent's signup: joins the team that invited it and mints its\nSDK token.",
        "description": "Safe to repeat until the agent confirms it saved the token: a reload replaces\nthe key, and a failed join stays pending for the next attempt.",
        "operationId": "agent_setup",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentSetupResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "description": "The account is not an agent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Setup is already confirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/user/get_names": {
      "post": {
        "tags": ["user::post_get_names"],
        "summary": "Retrieves user names in bulk",
        "operationId": "get_user_names",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PostGetNamesRequestBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserNames"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/user/get_names_with_email": {
      "post": {
        "tags": ["user::post_get_names_with_email"],
        "summary": "Gets names for passed user profile ids, falling back to the requesting user's email contact names",
        "operationId": "get_user_names_with_email",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GetNamesWithEmailRequestBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserNames"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/user/group": {
      "patch": {
        "tags": ["user::patch_user_group"],
        "summary": "Updates the user's group.",
        "operationId": "patch_user_group",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchUserGroupRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/user/language": {
      "get": {
        "tags": ["user"],
        "summary": "Get the caller's interface language.",
        "operationId": "get_user_language",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserLanguage"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": ["user"],
        "summary": "Set the caller's interface language, or clear it to follow their team's,\nelse their browser's.",
        "operationId": "put_user_language",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserLanguage"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Language updated"
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/user/legacy_user_permissions": {
      "get": {
        "tags": ["user::get_legacy_user_permissions"],
        "summary": "Gets the calling user's info which matches what was given in the **deprecated**\ngetUserPermissions query in our graphql api.\nThis will eventually be removed and optimized to use smaller calls that grab\nwhat is needed for various parts of the UI.",
        "operationId": "get_legacy_user_permissions",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetLegacyUserPermissionsResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/user/link_exists": {
      "get": {
        "tags": ["user::get_user_link_exists"],
        "summary": "Returns whether or not a given idp link exists for a user",
        "operationId": "get_user_link_exists",
        "parameters": [
          {
            "name": "idp_name",
            "in": "query",
            "description": "The idp name to lookup. If not provided, the idp_id must be provided.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "idp_id",
            "in": "query",
            "description": "The idp id to lookup. If not provided, the idp_name must be provided.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserLinkResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/user/me": {
      "get": {
        "tags": ["user::get_user_info"],
        "summary": "Gets the calling user's info",
        "operationId": "get_user_info",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetUserInfo"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": ["user::delete_user"],
        "summary": "Deletes the user who calls this endpoint",
        "operationId": "delete_user",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenericSuccessResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/user/name": {
      "get": {
        "tags": ["user::get_name"],
        "summary": "Retrieves the name of a particular user.",
        "operationId": "get_user_name",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserName"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": ["user::put_name"],
        "summary": "Sets the name of a particular user",
        "operationId": "put_user_name",
        "parameters": [
          {
            "name": "first_name",
            "in": "query",
            "description": "First Name of user",
            "required": false,
            "schema": {
              "type": ["string", "null"]
            }
          },
          {
            "name": "last_name",
            "in": "query",
            "description": "Last Name of user",
            "required": false,
            "schema": {
              "type": ["string", "null"]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/user/onboarding": {
      "patch": {
        "tags": ["user::patch_user_onboarding"],
        "summary": "Updates the user's onboarding.",
        "operationId": "patch_user_onboarding",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchUserOnboardingRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/user/organization": {
      "get": {
        "tags": ["user::get_user_organization"],
        "summary": "Retrieves the users organization if present.\nReturns NO_CONTENT if the user is a not part of an organization.",
        "operationId": "get_user_organization",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserOrganizationResponse"
                }
              }
            }
          },
          "204": {
            "description": ""
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/user/profile_picture": {
      "put": {
        "tags": ["user::put_profile_picture"],
        "summary": "Sets the profile picture URL for a particular user",
        "operationId": "put_profile_picture",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "description": "profile picture URL",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/user/profile_picture/file": {
      "put": {
        "tags": ["user::put_profile_picture_file"],
        "summary": "Sets the caller's profile picture to an image they uploaded.",
        "operationId": "put_profile_picture_file",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutProfilePictureFileRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          },
          "400": {
            "description": "The file is not a supported image",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "The caller has no such file",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": ["user::put_profile_picture_file"],
        "summary": "Reserves storage for a new profile picture. Static file storage has no\nMacroDB, so it cannot check API keys; this route lets key holders upload.",
        "operationId": "create_profile_picture_upload",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateProfilePictureUploadRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfilePictureUpload"
                }
              }
            }
          },
          "400": {
            "description": "Not a supported image type, or empty",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "413": {
            "description": "The image is larger than 16 MB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too many uploads this hour",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/user/profile_pictures": {
      "post": {
        "tags": ["user::post_profile_pictures"],
        "summary": "Retrieves profile picture URLs for a list of users",
        "operationId": "post_profile_pictures",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GetProfilePicturesRequestBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfilePictures"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/user/quota": {
      "get": {
        "tags": ["user::get_user_quota"],
        "summary": "Retrieves the users quota.\nReturns NO_CONTENT if the user is a premium user with no quota.",
        "operationId": "get_user_quota",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserQuota"
                }
              }
            }
          },
          "204": {
            "description": ""
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/user/stripe/checkoutv2": {
      "post": {
        "tags": ["user::stripe::create_checkout_session_v2"],
        "summary": "Creates a Stripe checkout session for the user to subscribe.",
        "operationId": "create_checkout_session_v2",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCheckoutSessionV2Request"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutSessionV2Response"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/user/stripe/plan": {
      "get": {
        "tags": ["user::stripe::subscription_status"],
        "summary": "Read subscription state for the authenticated user's seat.",
        "operationId": "get_subscription_status",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionStatus"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "More than one active subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": ["user::stripe::change_plan"],
        "summary": "Changes the caller's paid plan. Upgrades are prorated immediately;\ndowngrades retain the active plan until renewal. Selecting the active plan\ncancels a pending downgrade without charging or resetting usage.",
        "operationId": "change_plan",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangePlanRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChangePlanResponse"
                }
              }
            }
          },
          "400": {
            "description": "Plan not available",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "The team has no active subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Only team admins change plans on a team",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "No active subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "More than one active subscription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/user/stripe/portal": {
      "post": {
        "tags": ["user::stripe::create_portal_session"],
        "summary": "Creates a Stripe billing portal session.",
        "operationId": "create_portal_session",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePortalSessionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StripeSessionResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/user/stripe/trial_eligibility": {
      "get": {
        "tags": ["user::stripe::trial_eligibility"],
        "summary": "Read the caller's eligibility; checkout revalidates before granting a trial.",
        "operationId": "get_trial_eligibility",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrialEligibility"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/user/tutorial": {
      "patch": {
        "tags": ["user::patch_tutorial"],
        "summary": "Updates the user's tutorialComplete flag.",
        "operationId": "patch_user_tutorial",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchUserTutorialRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ABGroup": {
        "type": "string",
        "enum": ["A", "B"]
      },
      "AgentApiKey": {
        "type": "object",
        "description": "An agent's API key, and whether its turns can run on it.",
        "required": ["planAllows"],
        "properties": {
          "key": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/SavedAgentApiKey",
                "description": "The saved key, if any."
              }
            ]
          },
          "planAllows": {
            "type": "boolean",
            "description": "Whether the agent owner's plan includes API keys. A key saved before a\ndowngrade is still listed, and removable, but unused."
          }
        }
      },
      "AgentApiKeyProvider": {
        "type": "string",
        "description": "A provider an agent can bring its own key for.",
        "enum": ["anthropic", "openai"]
      },
      "AgentSetupResponse": {
        "type": "object",
        "description": "What an agent needs to start using the SDK.",
        "required": ["api_key", "team_join_failed"],
        "properties": {
          "api_key": {
            "type": "string",
            "description": "The agent's API key. Shown only here; repeating setup revokes it."
          },
          "team_join_failed": {
            "type": "boolean",
            "description": "Whether joining the inviting team failed. The invite stays pending:\nrepeating setup tries again, and the invite link works after confirming."
          }
        }
      },
      "AiBillingErrorBody": {
        "type": "object",
        "description": "Error response body.",
        "required": ["error"],
        "properties": {
          "error": {
            "type": "string",
            "description": "Human-readable error description."
          }
        }
      },
      "AppleLoginRequest": {
        "type": "object",
        "required": ["id_token", "code"],
        "properties": {
          "code": {
            "type": "string"
          },
          "id_token": {
            "type": "string"
          }
        }
      },
      "AutoReloadDefaults": {
        "type": "object",
        "description": "The automatic reload thresholds a payer starts from.",
        "required": ["minimum_balance_cents", "target_balance_cents"],
        "properties": {
          "minimum_balance_cents": {
            "type": "integer",
            "format": "int64",
            "description": "Balance below which a reload fires, cents."
          },
          "target_balance_cents": {
            "type": "integer",
            "format": "int64",
            "description": "Balance a reload tops up to, cents."
          }
        }
      },
      "AutoReloadMonthlyBudget": {
        "type": "object",
        "description": "Calendar-month commitments that consume the payer's automatic reload cap.",
        "required": ["committed_cents", "resets_at", "limit_reached"],
        "properties": {
          "committed_cents": {
            "type": "integer",
            "format": "int64",
            "description": "Reloads and one-time card purchases paid, pending, or failed with an\ninvoice that can still collect. Customer cents; Checkout purchases do\nnot count."
          },
          "limit_reached": {
            "type": "boolean",
            "description": "Remaining cap cannot fund the minimum automatic reload charge."
          },
          "resets_at": {
            "type": "string",
            "format": "date-time",
            "description": "Start of the next UTC calendar month, independently of subscription renewal."
          }
        }
      },
      "AutoReloadSnapshot": {
        "type": "object",
        "description": "The payer's automatic reload settings, as shown in Billing settings.",
        "required": [
          "minimum_balance_cents",
          "target_balance_cents",
          "suspended",
          "active"
        ],
        "properties": {
          "active": {
            "type": "boolean",
            "description": "Whether reloads will fire: the payer opted in and reloads are not suspended."
          },
          "minimum_balance_cents": {
            "type": "integer",
            "format": "int64",
            "description": "Reload once the effective balance drops below this, in customer cents."
          },
          "monthly_budget": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AutoReloadMonthlyBudget",
                "description": "Present for paid finite accounts with a configured monthly cap."
              }
            ]
          },
          "monthly_spend_limit_cents": {
            "type": ["integer", "null"],
            "format": "int64",
            "description": "Most reloaded per UTC calendar month, in customer cents. `null` when\nthere is no limit."
          },
          "suspended": {
            "type": "boolean",
            "description": "Whether reloads are paused after a failed reload charge."
          },
          "target_balance_cents": {
            "type": "integer",
            "format": "int64",
            "description": "Reload the balance back up to this, in customer cents."
          }
        }
      },
      "ChangePlanRequest": {
        "type": "object",
        "description": "Request body for switching plans",
        "required": ["plan"],
        "properties": {
          "plan": {
            "$ref": "#/components/schemas/SeatPlan",
            "description": "The plan to move the active subscription to"
          }
        }
      },
      "ChangePlanResponse": {
        "type": "object",
        "description": "Response for a plan change",
        "required": ["plan"],
        "properties": {
          "plan": {
            "$ref": "#/components/schemas/SeatPlan",
            "description": "The plan the subscription is now on"
          }
        }
      },
      "CheckoutSessionMetadata": {
        "type": "object",
        "description": "Tracking metadata for conversion attribution",
        "properties": {
          "fbc": {
            "type": ["string", "null"],
            "description": "Meta (Facebook) click ID from _fbc cookie"
          },
          "fbp": {
            "type": ["string", "null"],
            "description": "Meta (Facebook) browser ID from _fbp cookie"
          },
          "gaClientId": {
            "type": ["string", "null"],
            "description": "Google Analytics client ID for conversion tracking"
          }
        }
      },
      "CheckoutSessionV2Response": {
        "type": "object",
        "description": "Hosted checkout with the billing terms the server actually granted.",
        "required": ["url"],
        "properties": {
          "trialDays": {
            "type": ["integer", "null"],
            "format": "int32",
            "description": "Trial duration, absent for an immediately paid checkout.",
            "minimum": 0
          },
          "url": {
            "type": "string",
            "description": "The opaque URL returned by Stripe."
          }
        }
      },
      "CodexConfigRequest": {
        "type": "object",
        "description": "Explicit remote environment for future Codex sessions.",
        "required": ["environmentId"],
        "properties": {
          "environmentId": {
            "type": "string",
            "description": "An environment currently visible to this account."
          }
        },
        "additionalProperties": false
      },
      "CodexConnectionStatus": {
        "type": "object",
        "description": "Safe connection metadata; no secret or masked token is returned.",
        "required": ["connected"],
        "properties": {
          "accountId": {
            "type": ["string", "null"],
            "description": "Connected provider account identifier."
          },
          "connected": {
            "type": "boolean",
            "description": "Whether the user has completed provider authorization."
          },
          "email": {
            "type": ["string", "null"],
            "description": "Reserved until provider-verified email metadata is available."
          },
          "environmentId": {
            "type": ["string", "null"],
            "description": "Explicitly selected remote environment."
          }
        }
      },
      "CodexEnvironment": {
        "type": "object",
        "description": "A cloud environment visible to the connected provider account.",
        "required": ["id", "repositories"],
        "properties": {
          "id": {
            "type": "string",
            "description": "Provider environment identity."
          },
          "label": {
            "type": ["string", "null"],
            "description": "Human-readable provider label."
          },
          "repositories": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CodexEnvironmentRepository"
            },
            "description": "Ordered safe repository identities from Codex."
          }
        }
      },
      "CodexEnvironmentRepository": {
        "type": "object",
        "description": "Safe repository metadata available to the connected Codex account.",
        "required": ["fullName", "cloneUrl", "defaultBranch"],
        "properties": {
          "cloneUrl": {
            "type": "string",
            "description": "Credential-free HTTPS clone URL."
          },
          "defaultBranch": {
            "type": "string",
            "description": "Provider default branch."
          },
          "fullName": {
            "type": "string",
            "description": "Owner/repository identity."
          }
        }
      },
      "CodexLoginPoll": {
        "type": "object",
        "description": "Outcome of polling one attempt.",
        "required": ["status"],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/CodexLoginState",
            "description": "Current attempt state."
          }
        }
      },
      "CodexLoginStart": {
        "type": "object",
        "description": "Expiring browser authorization instructions.",
        "required": [
          "attemptId",
          "verificationUrl",
          "userCode",
          "expiresAt",
          "pollIntervalSeconds"
        ],
        "properties": {
          "attemptId": {
            "type": "string",
            "format": "uuid",
            "description": "Owner-bound attempt UUID."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "description": "UTC attempt deadline."
          },
          "pollIntervalSeconds": {
            "type": "integer",
            "format": "int64",
            "description": "Minimum browser polling interval.",
            "minimum": 0
          },
          "userCode": {
            "type": "string",
            "description": "Short expiring user code, not an API credential."
          },
          "verificationUrl": {
            "type": "string",
            "description": "Official provider verification URL."
          }
        }
      },
      "CodexLoginState": {
        "type": "string",
        "description": "Device authorization state visible to its initiating user.",
        "enum": ["pending", "connected", "expired", "failed"]
      },
      "CreateAccountMergeRequest": {
        "type": "object",
        "required": ["email"],
        "properties": {
          "email": {
            "type": "string",
            "description": "The email address to generate the merge link for."
          }
        }
      },
      "CreateCheckoutSessionV2Request": {
        "type": "object",
        "description": "Request body for creating a Stripe checkout session",
        "required": ["successUrl", "cancelUrl"],
        "properties": {
          "cancelUrl": {
            "type": "string",
            "description": "The URL to redirect to if checkout is cancelled"
          },
          "discount": {
            "type": ["string", "null"],
            "description": "Optional discount/promo code to apply"
          },
          "metadata": {
            "$ref": "#/components/schemas/CheckoutSessionMetadata",
            "description": "Tracking metadata for conversion attribution"
          },
          "onboardingTrial": {
            "type": "boolean",
            "description": "Request the automatic, first-subscription 30-day Premium trial."
          },
          "plan": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/SeatPlan",
                "description": "The plan to subscribe to. Defaults to Premium."
              }
            ]
          },
          "successUrl": {
            "type": "string",
            "description": "The URL to redirect to on successful checkout"
          }
        }
      },
      "CreateGtmInviteLinkRequest": {
        "type": "object",
        "description": "Request body to create a link.",
        "required": ["firstName"],
        "properties": {
          "firstName": {
            "type": "string",
            "description": "The recipient's first name, shown on the welcome page."
          },
          "note": {
            "type": ["string", "null"],
            "description": "Free-form internal note for the dashboard."
          },
          "recipientEmail": {
            "type": ["string", "null"],
            "description": "The recipient's email, when the sender knows it."
          }
        }
      },
      "CreateInProgressLinkResponse": {
        "type": "object",
        "required": ["link_id"],
        "properties": {
          "link_id": {
            "type": "string",
            "description": "The link id"
          }
        }
      },
      "CreatePortalSessionRequest": {
        "type": "object",
        "description": "Request body for creating a Stripe portal session",
        "required": ["returnUrl"],
        "properties": {
          "returnUrl": {
            "type": "string",
            "description": "The URL to redirect to after leaving the portal"
          }
        }
      },
      "CreateProfilePictureUploadRequest": {
        "type": "object",
        "required": ["file_name", "content_type", "size_bytes"],
        "properties": {
          "content_type": {
            "type": "string",
            "description": "Mime type of the image."
          },
          "file_name": {
            "type": "string",
            "description": "File name, such as `avatar.png`."
          },
          "size_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "Exact size of the image in bytes. Storage rejects a body of any other size.",
            "minimum": 0
          }
        }
      },
      "CreateTeamRequest": {
        "type": "object",
        "description": "The request body to create a new team",
        "required": ["name"],
        "properties": {
          "allow_domain_join": {
            "type": "boolean",
            "description": "Whether colleagues who sign up with the owner's work email domain join\nthe team automatically. Ignored for generic email providers."
          },
          "name": {
            "type": "string",
            "description": "The name of the team"
          }
        }
      },
      "CreatedTeamInviteLinkResponse": {
        "type": "object",
        "description": "A newly created team invite link.",
        "required": ["token"],
        "properties": {
          "token": {
            "$ref": "#/components/schemas/TeamInviteLinkToken",
            "description": "The new link's token. Any previous link stops working."
          }
        }
      },
      "CreditCheckoutRequestBody": {
        "type": "object",
        "description": "Request body for [`create_credit_checkout_handler`].",
        "required": ["amountCents", "successUrl", "cancelUrl"],
        "properties": {
          "amountCents": {
            "type": "integer",
            "format": "int64",
            "description": "Pack size, cents; one of the catalog's `credit_packs_cents`."
          },
          "cancelUrl": {
            "type": "string",
            "description": "Where Stripe returns the user on cancel. Same rules as `success_url`."
          },
          "successUrl": {
            "type": "string",
            "description": "Where Stripe returns the user after paying. Must be an `https` URL\non the origin the request came from."
          }
        }
      },
      "CreditCheckoutResponse": {
        "type": "object",
        "description": "Response for [`create_credit_checkout_handler`].",
        "required": ["url"],
        "properties": {
          "url": {
            "type": "string",
            "description": "The hosted Checkout URL to redirect to."
          }
        }
      },
      "CreditPurchaseRequestBody": {
        "type": "object",
        "description": "Request body for [`purchase_credits_handler`].",
        "required": ["amountCents"],
        "properties": {
          "amountCents": {
            "type": "integer",
            "format": "int64",
            "description": "One of the catalog's credit packs, cents."
          }
        }
      },
      "CreditPurchaseResponse": {
        "type": "object",
        "description": "Response for [`purchase_credits_handler`].",
        "required": ["status", "amountCents"],
        "properties": {
          "amountCents": {
            "type": "integer",
            "format": "int64",
            "description": "Amount charged, cents: the requested pack, unless an earlier declined\npurchase that Stripe collected in the meantime was booked instead."
          },
          "snapshot": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/UsageSnapshot",
                "description": "The caller's position after the purchase. Absent when it could not be\nread; the purchase still happened, so refetch the summary instead."
              }
            ]
          },
          "status": {
            "$ref": "#/components/schemas/CreditPurchaseStatus",
            "description": "Whether the card on file paid."
          }
        }
      },
      "CreditPurchaseSnapshot": {
        "type": "object",
        "description": "The monthly credit limit that applies to this user's one-time purchases.",
        "required": ["committed_cents", "resets_at"],
        "properties": {
          "committed_cents": {
            "type": "integer",
            "format": "int64",
            "description": "Charged this month so far, including charges that may still collect."
          },
          "monthly_limit_cents": {
            "type": ["integer", "null"],
            "format": "int64",
            "description": "Most credits charged to the card on file per UTC calendar month, from\nautomatic reloads and one-time purchases together, in customer cents.\n`null` when the payer set no limit; team members always have one."
          },
          "resets_at": {
            "type": "string",
            "format": "date-time",
            "description": "Start of the next UTC calendar month."
          }
        }
      },
      "CreditPurchaseStatus": {
        "type": "string",
        "description": "How a one-time credit purchase charged to the card on file ended.",
        "enum": [
          "paid",
          "declined",
          "payment_method_required",
          "authentication_required"
        ]
      },
      "CurrentSystemStatus": {
        "allOf": [
          {
            "$ref": "#/components/schemas/SystemStatus",
            "description": "The status and its message."
          },
          {
            "type": "object",
            "properties": {
              "updatedAt": {
                "type": ["string", "null"],
                "format": "date-time",
                "description": "When it was set; absent when no status was ever set. Clients keep the\nnewest status they have seen, whether fetched or pushed."
              }
            }
          }
        ],
        "description": "The status every user sees, without who set it."
      },
      "CursorApiKeyStatus": {
        "type": "object",
        "description": "What settings needs to render the Cursor connection.\n\nDeliberately thin. `registered` drives the whole UI; `updatedAt` lets it say\nwhen the key was last replaced, which is the only thing a user can check\nagainst their own memory when a session starts failing.\n\nDeliberately *not* reporting anything about the deployment itself. That is\noperator information: a user who sees it cannot act on it, and a service\nthat cannot reach KMS does not start.",
        "required": ["registered"],
        "properties": {
          "defaultModelId": {
            "type": ["string", "null"],
            "description": "The Cursor model id this user's sessions start on, when they have\nchosen one. `None` means the deployment default is in effect — the\nsettings dropdown shows that as its resting value."
          },
          "registered": {
            "type": "boolean",
            "description": "Whether this user has a key stored."
          },
          "updatedAt": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "When the stored key was last replaced, if there is one."
          }
        }
      },
      "CursorModelOption": {
        "type": "object",
        "description": "One model the settings dropdown can offer.\n\nId, name and family: the dropdown lists models, not the hundreds of\nparameter variants each carries. The chosen id's parameters are resolved to\nCursor's default variant at session start. The family is the same heading\nthe Cursor ACP agent groups its session model select under, so the settings\npicker and the in-session picker read the same way.",
        "required": ["id", "displayName", "group"],
        "properties": {
          "displayName": {
            "type": "string",
            "description": "The human-readable name, e.g. `Cursor Grok 4.6`."
          },
          "group": {
            "type": "string",
            "description": "The family heading to list this model under, e.g. `Cursor Grok`."
          },
          "id": {
            "type": "string",
            "description": "The id to store and send, e.g. `grok-4.6`."
          }
        }
      },
      "CursorModelsResponse": {
        "type": "object",
        "description": "The models this account may choose from.",
        "required": ["models"],
        "properties": {
          "models": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CursorModelOption"
            },
            "description": "The offered models, in the order Cursor returned them."
          }
        }
      },
      "DenyReason": {
        "type": "string",
        "description": "Why a request was refused.",
        "enum": [
          "allowance_exhausted",
          "free_allowance_exhausted",
          "overage_limit_reached",
          "overage_payment_failed"
        ]
      },
      "EmailConnectionProviders": {
        "type": "object",
        "description": "What the provider selector offers the requesting user.",
        "required": ["gmail", "outlook"],
        "properties": {
          "gmail": {
            "type": "boolean"
          },
          "outlook": {
            "type": "boolean",
            "description": "Whether this user may start a new Outlook connection: the deployment\nswitch and their `enable-outlook` flag."
          },
          "outlook_admin_consent_url": {
            "type": ["string", "null"],
            "description": "Where a Microsoft 365 administrator approves Macro for their whole\ndirectory. Present when Outlook is configured and the request named an\n`original_url` for the administrator's browser to return to."
          }
        }
      },
      "EmptyResponse": {
        "type": "object",
        "description": "Empty response is required due to custom fetch forcing `response.json()`"
      },
      "EnrichGithubPullRequestsProxyRequest": {
        "type": "object",
        "description": "Request body for the authenticated pull request enrichment proxy.",
        "required": ["pullRequests"],
        "properties": {
          "pullRequests": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GithubPullRequestRef"
            },
            "description": "The pull requests to enrich for the authenticated user."
          }
        }
      },
      "EnrichGithubPullRequestsResponse": {
        "type": "object",
        "description": "Response body for pull request enrichment.",
        "required": ["pullRequests"],
        "properties": {
          "pullRequests": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EnrichedGithubPullRequest"
            },
            "description": "Pull requests with enrichment fields populated when GitHub data was available."
          }
        }
      },
      "EnrichedGithubPullRequest": {
        "type": "object",
        "description": "A pull request reference enriched with live GitHub details when available.",
        "required": [
          "githubKey",
          "owner",
          "repo",
          "number",
          "url",
          "displayName"
        ],
        "properties": {
          "additions": {
            "type": ["integer", "null"],
            "format": "int64",
            "description": "The number of added lines reported by GitHub, when enrichment succeeds.",
            "minimum": 0
          },
          "assignees": {
            "type": ["array", "null"],
            "items": {
              "$ref": "#/components/schemas/GithubPullRequestUser"
            },
            "description": "The users assigned to the pull request, when known."
          },
          "authorId": {
            "type": ["integer", "null"],
            "format": "int64",
            "description": "The stable numeric GitHub user id for the pull request author, when available.",
            "minimum": 0
          },
          "authorLogin": {
            "type": ["string", "null"],
            "description": "The GitHub login for the pull request author, when available."
          },
          "checks": {
            "type": ["array", "null"],
            "items": {
              "$ref": "#/components/schemas/GithubPullRequestCheckRun"
            },
            "description": "Check runs collected from the pull request head commit, when enrichment includes them."
          },
          "comments": {
            "type": ["array", "null"],
            "items": {
              "$ref": "#/components/schemas/GithubPullRequestComment"
            },
            "description": "Comments collected from the pull request, when enrichment includes them."
          },
          "deletions": {
            "type": ["integer", "null"],
            "format": "int64",
            "description": "The number of deleted lines reported by GitHub, when enrichment succeeds.",
            "minimum": 0
          },
          "description": {
            "type": ["string", "null"],
            "description": "The pull request description (body), when available."
          },
          "displayName": {
            "type": "string",
            "description": "A compact label suitable for display in the UI."
          },
          "githubKey": {
            "type": "string",
            "description": "The stored GitHub association key, in `owner/repo/pull/number` format."
          },
          "labels": {
            "type": ["array", "null"],
            "items": {
              "$ref": "#/components/schemas/GithubPullRequestLabel"
            },
            "description": "The pull request's labels, when known."
          },
          "name": {
            "type": ["string", "null"],
            "description": "The GitHub pull request title, when enrichment succeeds."
          },
          "number": {
            "type": "integer",
            "format": "int64",
            "description": "The GitHub pull request number.",
            "minimum": 0
          },
          "owner": {
            "type": "string",
            "description": "The GitHub repository owner or organization."
          },
          "participantGithubUserIds": {
            "type": ["array", "null"],
            "items": {
              "type": "string"
            },
            "description": "Stable numeric GitHub user ids (as strings) for everyone involved in the pull request.\nQueried by the foreign entity `includes_me` filter, so stored metadata merges this as a\nunion rather than replacing it (partial write paths must not drop known participants)."
          },
          "repo": {
            "type": "string",
            "description": "The GitHub repository name."
          },
          "reviews": {
            "type": ["array", "null"],
            "items": {
              "$ref": "#/components/schemas/GithubPullRequestReview"
            },
            "description": "Each reviewer's latest submitted review, when known. Stored metadata merges this per\nreviewer, so a write that knows one review keeps the others."
          },
          "status": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/GithubPullRequestStatus",
                "description": "The normalized GitHub pull request status, when enrichment succeeds."
              }
            ]
          },
          "url": {
            "type": "string",
            "description": "The public GitHub URL for the pull request."
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "description": "A plain old json error response for use with axum.\nyup, thats it.",
        "required": ["message"],
        "properties": {
          "message": {
            "type": "string",
            "description": "Message to explain failure"
          }
        }
      },
      "GenerateEmailLinkRequest": {
        "type": "object",
        "required": ["email"],
        "properties": {
          "email": {
            "type": "string",
            "description": "The email address to resend the verification email to"
          }
        }
      },
      "GenericSuccessResponse": {
        "type": "object",
        "required": ["success"],
        "properties": {
          "success": {
            "type": "boolean",
            "description": "Indicates if the request was successful"
          }
        }
      },
      "GetLegacyUserPermissionsResponse": {
        "type": "object",
        "required": [
          "userId",
          "permissions",
          "email",
          "licenseStatus",
          "tutorialComplete",
          "isAgent",
          "hasChromeExt",
          "hasTrialed",
          "aiDataConsent",
          "referralCode"
        ],
        "properties": {
          "aiDataConsent": {
            "type": "boolean",
            "description": "Whether the user has consented to AI data sharing"
          },
          "createdAt": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "When the account was created. Absent for accounts that predate\ncreation-time tracking."
          },
          "email": {
            "type": "string",
            "description": "The user's email"
          },
          "group": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ABGroup",
                "description": "The user's group"
              }
            ]
          },
          "hasChromeExt": {
            "type": "boolean",
            "description": "Whether the user has the chrome extension"
          },
          "hasTrialed": {
            "type": "boolean",
            "description": "Whether the user has trialed through stripe"
          },
          "isAgent": {
            "type": "boolean",
            "description": "Whether this is an agent account rather than a person"
          },
          "licenseStatus": {
            "type": "string",
            "description": "The user's license status"
          },
          "name": {
            "type": ["string", "null"],
            "description": "The user's name"
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The permissions the user has"
          },
          "referralCode": {
            "type": "string",
            "description": "The referral code for the user"
          },
          "tutorialComplete": {
            "type": "boolean",
            "description": "Whether the user has completed the tutorial"
          },
          "userId": {
            "type": "string",
            "description": "The user id"
          }
        }
      },
      "GetNamesWithEmailRequestBody": {
        "type": "object",
        "required": ["user_ids"],
        "properties": {
          "user_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "GetProfilePicturesRequestBody": {
        "type": "object",
        "required": ["user_id_list"],
        "properties": {
          "user_id_list": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "GetUserInfo": {
        "type": "object",
        "required": ["user_id", "permissions"],
        "properties": {
          "organization_id": {
            "type": ["integer", "null"],
            "format": "int32",
            "description": "The user's organization id if there is one associated with the user"
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The user's permissions"
          },
          "user_id": {
            "type": "string",
            "description": "The user id"
          }
        }
      },
      "GithubLinkStatusResponse": {
        "type": "object",
        "required": [
          "reauthentication_required",
          "github_username",
          "github_user_id"
        ],
        "properties": {
          "github_user_id": {
            "type": "string",
            "description": "Stable ID of the authenticated user's linked GitHub account."
          },
          "github_username": {
            "type": "string",
            "description": "Login of the authenticated user's linked GitHub account."
          },
          "reauthentication_required": {
            "type": "boolean",
            "description": "Whether the user must reauthenticate their GitHub link."
          }
        }
      },
      "GithubMergeMethod": {
        "type": "string",
        "description": "How GitHub combines a pull request's commits into its base branch.",
        "enum": ["merge", "squash", "rebase"]
      },
      "GithubPullRequestCheckRun": {
        "type": "object",
        "description": "A check run associated with a GitHub pull request.",
        "required": ["id", "name", "status"],
        "properties": {
          "completedAt": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "When the check run completed, when available."
          },
          "conclusion": {
            "type": ["string", "null"],
            "description": "The raw GitHub check run conclusion, when the run has completed."
          },
          "id": {
            "type": "integer",
            "format": "int64",
            "description": "The unique GitHub identifier for the check run.",
            "minimum": 0
          },
          "name": {
            "type": "string",
            "description": "The check run name."
          },
          "startedAt": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "When the check run started, when available."
          },
          "status": {
            "type": "string",
            "description": "The raw GitHub check run status."
          },
          "url": {
            "type": ["string", "null"],
            "description": "The public GitHub URL for the check run, when available."
          }
        }
      },
      "GithubPullRequestComment": {
        "type": "object",
        "description": "A comment associated with a GitHub pull request.",
        "required": ["id", "body", "source"],
        "properties": {
          "authorAssociation": {
            "type": ["string", "null"],
            "description": "GitHub's relationship label for the author, when available."
          },
          "authorId": {
            "type": ["integer", "null"],
            "format": "int64",
            "description": "The stable numeric GitHub user id for the comment author, when available.",
            "minimum": 0
          },
          "authorLogin": {
            "type": ["string", "null"],
            "description": "The GitHub login for the comment author, when available."
          },
          "body": {
            "type": "string",
            "description": "The comment or review body text."
          },
          "createdAt": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "When the comment was created or the review was submitted."
          },
          "id": {
            "type": "integer",
            "format": "int64",
            "description": "The unique GitHub identifier for the comment or review.",
            "minimum": 0
          },
          "inReplyToId": {
            "type": ["integer", "null"],
            "format": "int64",
            "description": "The id of the comment this one replies to, when it is part of a review\nthread. Only ever present on `review_comment` sources.",
            "minimum": 0
          },
          "line": {
            "type": ["integer", "null"],
            "format": "int64",
            "description": "The line in the current diff the comment is anchored to. Cleared by\nGitHub when later commits outdate the comment's diff.",
            "minimum": 0
          },
          "originalLine": {
            "type": ["integer", "null"],
            "format": "int64",
            "description": "The line the comment was originally anchored to, kept even when the\ndiff has since changed.",
            "minimum": 0
          },
          "path": {
            "type": ["string", "null"],
            "description": "The repository-relative file path the review comment is anchored to.\nOnly ever present on `review_comment` sources."
          },
          "pullRequestReviewId": {
            "type": ["integer", "null"],
            "format": "int64",
            "description": "The id of the pull request review this comment was submitted with.\nOnly ever present on `review_comment` sources.",
            "minimum": 0
          },
          "source": {
            "type": "string",
            "description": "The GitHub source for the comment, such as `issue_comment` or `review_comment`."
          },
          "updatedAt": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "When the comment or review was last updated."
          },
          "url": {
            "type": ["string", "null"],
            "description": "The public GitHub URL for the comment or review, when available."
          }
        }
      },
      "GithubPullRequestLabel": {
        "type": "object",
        "description": "A label on a GitHub pull request.",
        "required": ["name"],
        "properties": {
          "color": {
            "type": ["string", "null"],
            "description": "The label color as six hex digits without a leading `#`, when known."
          },
          "name": {
            "type": "string",
            "description": "The label name, unique within its repository regardless of case."
          }
        }
      },
      "GithubPullRequestMergeability": {
        "type": "string",
        "description": "Whether GitHub can merge a pull request's head into its base without conflicts.",
        "enum": ["mergeable", "conflicting", "unknown"]
      },
      "GithubPullRequestMergeabilityEntry": {
        "type": "object",
        "description": "One pull request's mergeability.",
        "required": ["owner", "repo", "number", "mergeability"],
        "properties": {
          "mergeability": {
            "$ref": "#/components/schemas/GithubPullRequestMergeability",
            "description": "Whether the head merges cleanly into the base."
          },
          "number": {
            "type": "integer",
            "format": "int64",
            "description": "The GitHub pull request number.",
            "minimum": 0
          },
          "owner": {
            "type": "string",
            "description": "The GitHub repository owner or organization."
          },
          "repo": {
            "type": "string",
            "description": "The GitHub repository name."
          }
        }
      },
      "GithubPullRequestMergeabilityRequest": {
        "type": "object",
        "description": "Request body for the mergeability of several pull requests.",
        "required": ["pullRequests"],
        "properties": {
          "pullRequests": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GithubPullRequestNumber"
            },
            "description": "The pull requests to check, at most [`GithubPullRequestMergeabilityRequest::MAX`]."
          }
        }
      },
      "GithubPullRequestMergeabilityResponse": {
        "type": "object",
        "description": "Response body for pull request mergeability. Pull requests the user\ncannot see are left out.",
        "required": ["pullRequests"],
        "properties": {
          "pullRequests": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GithubPullRequestMergeabilityEntry"
            },
            "description": "The mergeability of each visible pull request."
          }
        }
      },
      "GithubPullRequestNumber": {
        "type": "object",
        "description": "One pull request, by repository and number.",
        "required": ["owner", "repo", "number"],
        "properties": {
          "number": {
            "type": "integer",
            "format": "int64",
            "description": "The GitHub pull request number.",
            "minimum": 0
          },
          "owner": {
            "type": "string",
            "description": "The GitHub repository owner or organization."
          },
          "repo": {
            "type": "string",
            "description": "The GitHub repository name."
          }
        }
      },
      "GithubPullRequestRef": {
        "type": "object",
        "description": "A pull request reference that can be enriched with live GitHub data.",
        "required": [
          "githubKey",
          "owner",
          "repo",
          "number",
          "url",
          "displayName"
        ],
        "properties": {
          "displayName": {
            "type": "string",
            "description": "A compact label suitable for display in the UI."
          },
          "githubKey": {
            "type": "string",
            "description": "The stored GitHub association key, in `owner/repo/pull/number` format."
          },
          "number": {
            "type": "integer",
            "format": "int64",
            "description": "The GitHub pull request number.",
            "minimum": 0
          },
          "owner": {
            "type": "string",
            "description": "The GitHub repository owner or organization."
          },
          "repo": {
            "type": "string",
            "description": "The GitHub repository name."
          },
          "url": {
            "type": "string",
            "description": "The public GitHub URL for the pull request."
          }
        }
      },
      "GithubPullRequestReview": {
        "type": "object",
        "description": "A reviewer's latest submitted review on a pull request.",
        "required": ["reviewerGithubUserId", "state"],
        "properties": {
          "reviewerGithubUserId": {
            "type": "string",
            "description": "The stable numeric GitHub user id of the reviewer, as a string."
          },
          "reviewerLogin": {
            "type": ["string", "null"],
            "description": "The reviewer's GitHub login, when known."
          },
          "state": {
            "$ref": "#/components/schemas/GithubPullRequestReviewState",
            "description": "What the review said."
          },
          "submittedAt": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "When the review was submitted, when known."
          }
        }
      },
      "GithubPullRequestReviewState": {
        "type": "string",
        "description": "What a reviewer's latest review on a pull request said.",
        "enum": ["approved", "changes_requested", "commented", "dismissed"]
      },
      "GithubPullRequestState": {
        "type": "string",
        "description": "Whether a pull request is open or closed, as a user sets it. Merging is a\nseparate action, so unlike `GithubPullRequestStatus` there is no merged\nstate.",
        "enum": ["open", "closed"]
      },
      "GithubPullRequestStatus": {
        "type": "string",
        "description": "The normalized lifecycle status for a GitHub pull request.",
        "enum": ["open", "closed", "merged"]
      },
      "GithubPullRequestUser": {
        "type": "object",
        "description": "A GitHub user named on a pull request, such as an assignee.",
        "required": ["githubUserId"],
        "properties": {
          "githubUserId": {
            "type": "string",
            "description": "The stable numeric GitHub user id, as a string."
          },
          "login": {
            "type": ["string", "null"],
            "description": "The user's GitHub login, when known."
          }
        }
      },
      "GmailLinkStatusResponse": {
        "type": "object",
        "required": ["reauthentication_required"],
        "properties": {
          "reauthentication_required": {
            "type": "boolean",
            "description": "Whether the user must reauthenticate their Gmail link."
          }
        }
      },
      "GtmInviteLink": {
        "type": "object",
        "description": "A link as shown on the staff dashboard.",
        "required": [
          "id",
          "token",
          "firstName",
          "promoCode",
          "freeMonths",
          "status",
          "createdBy",
          "createdAt",
          "expiresAt",
          "openCount"
        ],
        "properties": {
          "convertedAt": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "When the account started a paid subscription."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the link was created."
          },
          "createdBy": {
            "type": "string",
            "description": "The Macro user id of the staff member who created the link."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the link stops being openable."
          },
          "firstName": {
            "type": "string",
            "description": "The recipient's first name."
          },
          "firstOpenedAt": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "When the welcome page first loaded."
          },
          "freeMonths": {
            "type": "integer",
            "format": "int32",
            "description": "Free months the promotion grants.",
            "minimum": 0
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Primary key."
          },
          "note": {
            "type": ["string", "null"],
            "description": "Internal note."
          },
          "openCount": {
            "type": "integer",
            "format": "int32",
            "description": "How many times the welcome page loaded."
          },
          "promoCode": {
            "type": "string",
            "description": "The Stripe promotion code applied at checkout."
          },
          "recipientEmail": {
            "type": ["string", "null"],
            "description": "The recipient's email, when known."
          },
          "redeemedAt": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "When that account redeemed the link."
          },
          "redeemedBy": {
            "type": ["string", "null"],
            "description": "The Macro user id of the account that signed up through the link."
          },
          "revokedAt": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "When staff revoked the link."
          },
          "status": {
            "$ref": "#/components/schemas/GtmInviteLinkStatus",
            "description": "Lifecycle status."
          },
          "stripeSubscriptionId": {
            "type": ["string", "null"],
            "description": "The Stripe subscription id of that subscription."
          },
          "token": {
            "type": "string",
            "description": "The secret to embed in the link URL."
          }
        }
      },
      "GtmInviteLinkList": {
        "type": "object",
        "description": "Links for the dashboard.",
        "required": ["links"],
        "properties": {
          "links": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GtmInviteLink"
            },
            "description": "Newest first."
          }
        }
      },
      "GtmInviteLinkStatus": {
        "type": "string",
        "description": "Where a link is in its lifecycle.",
        "enum": ["active", "expired", "revoked", "redeemed", "converted"]
      },
      "GtmInviteOffer": {
        "type": "object",
        "description": "The promotion a signed-in user's account holds.",
        "required": [
          "linkId",
          "firstName",
          "promoCode",
          "freeMonths",
          "redeemedAt"
        ],
        "properties": {
          "firstName": {
            "type": "string",
            "description": "The first name the link was made out to."
          },
          "freeMonths": {
            "type": "integer",
            "format": "int32",
            "description": "Free months the promotion grants.",
            "minimum": 0
          },
          "linkId": {
            "type": "string",
            "format": "uuid",
            "description": "The redeemed link."
          },
          "promoCode": {
            "type": "string",
            "description": "The Stripe promotion code checkout applies."
          },
          "redeemedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the account redeemed the link."
          }
        }
      },
      "GtmInviteOfferStatus": {
        "type": "object",
        "description": "Whether the signed-in user holds an unused offer.",
        "properties": {
          "offer": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/GtmInviteOffer",
                "description": "The offer, when the account redeemed a link and has not subscribed yet."
              }
            ]
          }
        }
      },
      "InitGithubLinkResponse": {
        "type": "object",
        "required": ["authorization_url", "link_id"],
        "properties": {
          "authorization_url": {
            "type": "string",
            "description": "The OAuth authorization URL to redirect the user to"
          },
          "link_id": {
            "type": "string",
            "format": "uuid",
            "description": "The link ID for tracking the OAuth flow"
          }
        }
      },
      "InitGmailLinkResponse": {
        "type": "object",
        "required": ["authorization_url", "link_id"],
        "properties": {
          "authorization_url": {
            "type": "string",
            "description": "The OAuth authorization URL to redirect the user to"
          },
          "link_id": {
            "type": "string",
            "format": "uuid",
            "description": "The link ID for tracking the OAuth flow"
          }
        }
      },
      "InitOutlookLinkResponse": {
        "type": "object",
        "description": "Response returned when a Microsoft Outlook link is initiated.",
        "required": ["authorization_url", "link_id"],
        "properties": {
          "authorization_url": {
            "type": "string",
            "description": "The OAuth authorization URL to redirect the user to."
          },
          "link_id": {
            "type": "string",
            "format": "uuid",
            "description": "The link ID for tracking the OAuth flow."
          }
        }
      },
      "InviteEntry": {
        "type": "object",
        "description": "A single invite entry with email and tier",
        "required": ["email"],
        "properties": {
          "email": {
            "type": "string",
            "description": "The email of the user to invite"
          }
        }
      },
      "InviteToTeamRequest": {
        "type": "object",
        "description": "The request body to invite a user to a team",
        "required": ["invites"],
        "properties": {
          "invites": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InviteEntry"
            },
            "description": "The invites to send, each with an email and tier"
          },
          "is_agent": {
            "type": "boolean",
            "description": "Invite these addresses as agents: an address with no account signs up\nas an agent and joins the team when it first signs in."
          },
          "team_id": {
            "type": ["string", "null"],
            "format": "uuid",
            "description": "The team the caller means to invite to. Invites always go to the\ncaller's current team; when this names another team, nothing is sent\nand the request answers 409."
          }
        }
      },
      "JoinTeamByInviteLinkResponse": {
        "type": "object",
        "description": "The result of opening a team invite link.",
        "required": ["team_id", "already_member"],
        "properties": {
          "already_member": {
            "type": "boolean",
            "description": "True when the user was already on the team and nothing changed."
          },
          "team_id": {
            "type": "string",
            "format": "uuid",
            "description": "The team the link joins."
          }
        }
      },
      "Language": {
        "type": "string",
        "description": "A language the app's interface is available in, as a BCP 47 tag.",
        "enum": [
          "en",
          "de",
          "fr",
          "es",
          "it",
          "nl",
          "pt-PT",
          "sv",
          "da",
          "nb",
          "fi",
          "pl",
          "ru",
          "ja",
          "ko",
          "zh-Hans",
          "zh-Hant",
          "hi",
          "id",
          "vi",
          "th"
        ]
      },
      "LinkShare": {
        "type": "string",
        "description": "Defines who can access an item through its share link.",
        "enum": ["PUBLIC", "TEAM"]
      },
      "MacroApiTokenResponse": {
        "type": "object",
        "required": ["macro_api_token"],
        "properties": {
          "macro_api_token": {
            "type": "string",
            "description": "The newly created macro_api_token"
          }
        }
      },
      "MergeGithubPullRequestRequest": {
        "type": "object",
        "description": "A request to merge one pull request on the user's behalf.",
        "required": ["owner", "repo", "number"],
        "properties": {
          "mergeMethod": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/GithubMergeMethod",
                "description": "The merge method to use. Omitted means the first method the\nrepository allows, in the order merge, squash, rebase."
              }
            ]
          },
          "number": {
            "type": "integer",
            "format": "int64",
            "description": "The GitHub pull request number.",
            "minimum": 0
          },
          "owner": {
            "type": "string",
            "description": "The GitHub repository owner or organization."
          },
          "repo": {
            "type": "string",
            "description": "The GitHub repository name."
          }
        }
      },
      "MergeGithubPullRequestResponse": {
        "type": "object",
        "description": "Response body for a merged pull request.",
        "required": ["sha", "message"],
        "properties": {
          "message": {
            "type": "string",
            "description": "GitHub's own summary of the merge."
          },
          "pullRequest": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/EnrichedGithubPullRequest",
                "description": "The pull request as GitHub reports it after the merge, when the\nrefresh succeeded."
              }
            ]
          },
          "sha": {
            "type": "string",
            "description": "The merge commit's SHA."
          }
        }
      },
      "PasswordRequest": {
        "type": "object",
        "required": ["email", "password"],
        "properties": {
          "email": {
            "type": "string",
            "description": "The email to login with"
          },
          "password": {
            "type": "string"
          }
        }
      },
      "PasswordlessRequest": {
        "type": "object",
        "required": ["email", "redirect_uri"],
        "properties": {
          "email": {
            "type": "string",
            "description": "The email to initiate passwordless authentication for"
          },
          "is_agent": {
            "type": "boolean",
            "description": "Create an agent account if this address has no account yet. Otherwise\n`true` has no effect, and `false` reverts an agent flag nobody has proven:\nsee `revert_unconfirmed_agent`."
          },
          "redirect_uri": {
            "type": "string",
            "description": "The redirect uri to redirect to after login"
          },
          "referral_code": {
            "type": ["string", "null"],
            "description": "The referral code"
          }
        }
      },
      "PasswordlessStartedResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": ["string", "null"],
            "description": "The one-time login code, returned only by local environments so dev\ntooling can complete the flow without reading the email."
          }
        }
      },
      "PatchTeamCrmSettingsRequest": {
        "type": "object",
        "description": "Request body for `PATCH /team/crm`.",
        "required": ["enabled"],
        "properties": {
          "backfill": {
            "type": "boolean",
            "description": "On a disabled → enabled transition, whether to backfill the CRM\nfrom members' existing email history. Ignored when disabling.",
            "default": true
          },
          "enabled": {
            "type": "boolean",
            "description": "The desired CRM state for the team."
          }
        }
      },
      "PatchTeamCrmSettingsResponse": {
        "type": "object",
        "description": "Response for `PATCH /team/crm`. Reports both the resulting state\nand whether this call changed it; for the enable-flip case it also\nreports the backfill fan-out tallies.",
        "required": [
          "enabled",
          "changed",
          "backfill_enqueued",
          "backfill_failed"
        ],
        "properties": {
          "backfill_enqueued": {
            "type": "integer",
            "description": "Number of members for whom a `PopulateCrmForUser` message was\nenqueued. Non-zero only on a disabled → enabled transition;\nper-user enqueue failures are logged and swallowed.",
            "minimum": 0
          },
          "backfill_failed": {
            "type": "integer",
            "description": "Number of members whose enqueue failed (and was swallowed).\nNon-zero only on a disabled → enabled transition.",
            "minimum": 0
          },
          "changed": {
            "type": "boolean",
            "description": "True if this call flipped the value (false → true or true →\nfalse). False if the team was already at the requested state."
          },
          "enabled": {
            "type": "boolean",
            "description": "The resulting `crm_enabled` value after the call."
          }
        }
      },
      "PatchTeamMemberPlanRequest": {
        "type": "object",
        "description": "Request body for `PATCH /team/members/{member_user_id}/plan`.",
        "required": ["plan"],
        "properties": {
          "plan": {
            "$ref": "#/components/schemas/SeatPlan",
            "description": "The plan to bill the member's seat at from now on."
          }
        }
      },
      "PatchTeamRequest": {
        "type": "object",
        "description": "Request to update a team",
        "properties": {
          "default_link_share": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/LinkShare",
                "description": "The default link-share scope for items owned by the team. Omit to\nleave unchanged or pass `null` to default to link sharing off."
              }
            ]
          },
          "language": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Language",
                "description": "The interface language for the team's members. Omit to leave\nunchanged or pass `null` to let each member's browser decide."
              }
            ]
          },
          "name": {
            "type": ["string", "null"],
            "description": "The new name for the team"
          },
          "slug": {
            "type": ["string", "null"],
            "description": "The new slug for the team. This is normalized to SCREAMING_SNAKE_CASE."
          },
          "user_role_updates": {
            "type": ["array", "null"],
            "items": {
              "$ref": "#/components/schemas/PatchTeamUserRole"
            },
            "description": "Role updates to apply to team users"
          }
        }
      },
      "PatchTeamUserRole": {
        "type": "object",
        "description": "Request to update a team user's role",
        "required": ["team_user_id", "role"],
        "properties": {
          "role": {
            "$ref": "#/components/schemas/TeamRole",
            "description": "The new role of the team user"
          },
          "team_user_id": {
            "type": "string",
            "description": "The team user you are updating"
          }
        }
      },
      "PatchUserGroupRequest": {
        "type": "object",
        "required": ["group"],
        "properties": {
          "group": {
            "type": "string",
            "description": "The group to add the user to"
          }
        }
      },
      "PatchUserOnboardingRequest": {
        "type": "object",
        "required": ["firstName", "lastName", "title", "industry"],
        "properties": {
          "firstName": {
            "type": "string",
            "description": "The first name of the user"
          },
          "industry": {
            "type": "string",
            "description": "The industry of the user"
          },
          "lastName": {
            "type": "string",
            "description": "The last name of the user"
          },
          "title": {
            "type": "string",
            "description": "The title of the user"
          }
        }
      },
      "PatchUserTutorialRequest": {
        "type": "object",
        "required": ["tutorialComplete"],
        "properties": {
          "tutorialComplete": {
            "type": "boolean",
            "description": "If the user has completed the tutorial"
          }
        }
      },
      "Permission": {
        "type": "object",
        "required": ["id", "description"],
        "properties": {
          "description": {
            "type": "string",
            "description": "The description of the permission"
          },
          "id": {
            "type": "string",
            "description": "The permission"
          }
        }
      },
      "PlanCatalogEntry": {
        "type": "object",
        "description": "One plan in the catalog.",
        "required": [
          "tier",
          "monthly_price_cents",
          "included_ai_cents_per_seat",
          "purchasable"
        ],
        "properties": {
          "auto_reload_default_monthly_limit_cents": {
            "type": ["integer", "null"],
            "format": "int64",
            "description": "Monthly automatic reload limit a payer on this plan starts from,\ncents. Absent for plans that cannot reload."
          },
          "included_ai_cents_per_seat": {
            "type": "integer",
            "format": "int64",
            "description": "Included AI per seat per period, in cents at provider cost. For the\nfree plan this is its monthly hard cap."
          },
          "monthly_price_cents": {
            "type": "integer",
            "format": "int64",
            "description": "Monthly subscription price per seat, cents."
          },
          "purchasable": {
            "type": "boolean",
            "description": "Whether a new purchase or plan move may pick this plan today."
          },
          "tier": {
            "$ref": "#/components/schemas/PlanTier",
            "description": "The tier."
          }
        }
      },
      "PlanCatalogResponse": {
        "type": "object",
        "description": "The plan catalog and the knobs the billing UI offers.",
        "required": [
          "plans",
          "credit_packs_cents",
          "overage_limit_min_cents",
          "overage_limit_max_cents",
          "auto_reload_target_max_cents",
          "auto_reload_defaults"
        ],
        "properties": {
          "auto_reload_defaults": {
            "$ref": "#/components/schemas/AutoReloadDefaults",
            "description": "Thresholds automatic reload starts from before the payer sets their own."
          },
          "auto_reload_target_max_cents": {
            "type": "integer",
            "format": "int64",
            "description": "Largest allowed automatic reload target, cents."
          },
          "credit_packs_cents": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int64"
            },
            "description": "Credit packs a payer may buy, cents."
          },
          "overage_limit_max_cents": {
            "type": "integer",
            "format": "int64",
            "description": "Largest allowed overage cap, cents."
          },
          "overage_limit_min_cents": {
            "type": "integer",
            "format": "int64",
            "description": "Smallest allowed overage cap, cents."
          },
          "plans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlanCatalogEntry"
            },
            "description": "Every plan, cheapest first. Clients read allowances from here rather\nthan hard-coding them; `purchasable` marks the plans a user can buy."
          }
        }
      },
      "PlanTier": {
        "type": "string",
        "description": "The plans a user can be on, cheapest first.",
        "enum": ["free", "premium", "max"]
      },
      "PostGetNamesRequestBody": {
        "type": "object",
        "required": ["user_ids"],
        "properties": {
          "user_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ProfilePictureQueryParams": {
        "type": "object",
        "required": ["url"],
        "properties": {
          "url": {
            "type": "string"
          }
        }
      },
      "ProfilePictureUpload": {
        "type": "object",
        "description": "Where to upload a new profile picture, and the file id to set afterwards.",
        "required": ["file_id", "upload_url"],
        "properties": {
          "file_id": {
            "type": "string",
            "description": "Id to pass to `PUT /user/profile_picture/file` once uploaded."
          },
          "upload_url": {
            "type": "string",
            "description": "Expiring URL to `PUT` the image bytes to."
          }
        }
      },
      "ProfilePictures": {
        "type": "object",
        "required": ["pictures"],
        "properties": {
          "pictures": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UserProfilePicture"
            }
          }
        }
      },
      "PublicGtmInviteLink": {
        "type": "object",
        "description": "What the public welcome page learns about a link.",
        "required": ["firstName", "status", "freeMonths"],
        "properties": {
          "firstName": {
            "type": "string",
            "description": "The recipient's first name."
          },
          "freeMonths": {
            "type": "integer",
            "format": "int32",
            "description": "Free months the promotion grants.",
            "minimum": 0
          },
          "status": {
            "$ref": "#/components/schemas/GtmInviteLinkStatus",
            "description": "Whether the link can still be used."
          }
        }
      },
      "PutAgentApiKeyRequest": {
        "type": "object",
        "description": "The key someone pasted.",
        "required": ["apiKey"],
        "properties": {
          "apiKey": {
            "type": "string",
            "description": "An Anthropic (`sk-ant-…`) or OpenAI (`sk-…`) key, for the provider of\nthe agent's model."
          }
        }
      },
      "PutCursorApiKeyRequest": {
        "type": "object",
        "description": "The key the user pasted.",
        "required": ["apiKey"],
        "properties": {
          "apiKey": {
            "type": "string",
            "description": "A Cursor API key: `grok_…`, or `crsr_…` for older keys."
          }
        }
      },
      "PutCursorDefaultModelRequest": {
        "type": "object",
        "description": "The model the user chose for their sessions.",
        "properties": {
          "modelId": {
            "type": ["string", "null"],
            "description": "A Cursor model id (e.g. `grok-4.6`), or `null` to clear the choice and\nfall back to the deployment default."
          }
        }
      },
      "PutProfilePictureFileRequest": {
        "type": "object",
        "required": ["file_id"],
        "properties": {
          "file_id": {
            "type": "string",
            "description": "Id of an image the caller uploaded to static file storage."
          }
        }
      },
      "PutUserNameQueryParams": {
        "type": "object",
        "properties": {
          "first_name": {
            "type": ["string", "null"],
            "description": "First Name of user"
          },
          "last_name": {
            "type": ["string", "null"],
            "description": "Last Name of user"
          }
        }
      },
      "RedeemGtmInviteLinkRequest": {
        "type": "object",
        "description": "Request body to redeem a link.",
        "required": ["token"],
        "properties": {
          "token": {
            "type": "string",
            "description": "The token from the link URL."
          }
        }
      },
      "ResendFusionauthVerifyUserEmailRequest": {
        "type": "object",
        "required": ["email"],
        "properties": {
          "email": {
            "type": "string",
            "description": "The email address to resend the verification email to"
          }
        }
      },
      "SavedAgentApiKey": {
        "type": "object",
        "description": "The agent's saved key. Never includes the key.",
        "required": ["provider", "updatedAt"],
        "properties": {
          "provider": {
            "$ref": "#/components/schemas/AgentApiKeyProvider",
            "description": "The provider the key is for."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the key was last replaced."
          }
        }
      },
      "ScheduledSeatPlan": {
        "type": "object",
        "description": "A seat's future plan in the subscription's currently attached schedule.",
        "required": ["plan", "effectiveAt"],
        "properties": {
          "effectiveAt": {
            "type": "string",
            "format": "date-time",
            "description": "Provider-confirmed time when the future phase starts."
          },
          "plan": {
            "$ref": "#/components/schemas/SeatPlan",
            "description": "Plan that takes effect at renewal."
          }
        }
      },
      "SeatPlan": {
        "type": "string",
        "description": "The paid plan a seat is billed at. Every member of a paying team has one;\na team may mix them, and its Stripe subscription carries one seat item per\nplan in use.",
        "enum": ["premium", "max"]
      },
      "SendDomainNoticeResponse": {
        "type": "object",
        "description": "Response for the domain notice endpoint.",
        "required": ["sent"],
        "properties": {
          "sent": {
            "type": "integer",
            "format": "int32",
            "description": "How many colleagues were emailed by this call.",
            "minimum": 0
          }
        }
      },
      "SendInviteBody": {
        "type": "object",
        "description": "The body which is used to describe the recipient email",
        "required": ["recipient"],
        "properties": {
          "recipient": {
            "type": "string",
            "description": "the recipient of the referral email"
          }
        }
      },
      "SendMobileWelcomeEmailRequest": {
        "type": "object",
        "required": ["email"],
        "properties": {
          "email": {
            "type": "string",
            "description": "The email address to send the welcome email to"
          }
        }
      },
      "SendMobileWelcomeEmailResponse": {
        "type": "object",
        "required": ["sent"],
        "properties": {
          "sent": {
            "type": "boolean",
            "description": "Whether the lead was enrolled (false if they were already enrolled previously)"
          }
        }
      },
      "SetGithubPullRequestDraftRequest": {
        "type": "object",
        "description": "A request to mark one pull request as a draft, or as ready for review, on\nthe user's behalf.",
        "required": ["owner", "repo", "number", "draft"],
        "properties": {
          "draft": {
            "type": "boolean",
            "description": "`true` converts the pull request to a draft; `false` marks it ready for review."
          },
          "number": {
            "type": "integer",
            "format": "int64",
            "description": "The GitHub pull request number.",
            "minimum": 0
          },
          "owner": {
            "type": "string",
            "description": "The GitHub repository owner or organization."
          },
          "repo": {
            "type": "string",
            "description": "The GitHub repository name."
          }
        }
      },
      "SetGithubPullRequestDraftResponse": {
        "type": "object",
        "description": "Response body for a pull request whose draft state changed.",
        "required": ["draft"],
        "properties": {
          "draft": {
            "type": "boolean",
            "description": "Whether the pull request is now a draft."
          },
          "pullRequest": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/EnrichedGithubPullRequest",
                "description": "The pull request as GitHub reports it after the change, when the\nrefresh succeeded."
              }
            ]
          }
        }
      },
      "SetGithubPullRequestStateRequest": {
        "type": "object",
        "description": "A request to close one pull request, or reopen it, on the user's behalf.",
        "required": ["owner", "repo", "number", "state"],
        "properties": {
          "number": {
            "type": "integer",
            "format": "int64",
            "description": "The GitHub pull request number.",
            "minimum": 0
          },
          "owner": {
            "type": "string",
            "description": "The GitHub repository owner or organization."
          },
          "repo": {
            "type": "string",
            "description": "The GitHub repository name."
          },
          "state": {
            "$ref": "#/components/schemas/GithubPullRequestState",
            "description": "`closed` closes the pull request; `open` reopens it."
          }
        }
      },
      "SetGithubPullRequestStateResponse": {
        "type": "object",
        "description": "Response body for a pull request that was closed or reopened.",
        "required": ["state"],
        "properties": {
          "pullRequest": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/EnrichedGithubPullRequest",
                "description": "The pull request as GitHub reports it after the change, when the\nrefresh succeeded."
              }
            ]
          },
          "state": {
            "$ref": "#/components/schemas/GithubPullRequestState",
            "description": "Whether the pull request is now open or closed."
          }
        }
      },
      "SsoRequiredResponse": {
        "type": "object",
        "required": ["idp_id"],
        "properties": {
          "idp_id": {
            "type": "string",
            "description": "The idp_id you need to perform sso login with."
          }
        }
      },
      "StatusUpdate": {
        "allOf": [
          {
            "$ref": "#/components/schemas/SystemStatus",
            "description": "The status that was set."
          },
          {
            "type": "object",
            "required": ["id", "userId", "createdAt"],
            "properties": {
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "description": "When it was set."
              },
              "id": {
                "type": "string",
                "format": "uuid",
                "description": "UUIDv7, so ids sort by creation."
              },
              "userId": {
                "type": "string",
                "description": "The staff member who set it."
              }
            }
          }
        ],
        "description": "One status a staff member set. The newest is the current status."
      },
      "StripeSessionResponse": {
        "type": "object",
        "description": "Response containing the Stripe session URL",
        "required": ["url"],
        "properties": {
          "url": {
            "type": "string",
            "description": "The URL to redirect the user to"
          }
        }
      },
      "SubscriptionStatus": {
        "type": "object",
        "description": "Current renewal and scheduled change; empty for accounts without a subscription.",
        "properties": {
          "renewalDate": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "Provider-confirmed subscription renewal date."
          },
          "scheduledChange": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ScheduledSeatPlan",
                "description": "Future downgrade for the caller's seat, if still pending."
              }
            ]
          }
        }
      },
      "SystemStatus": {
        "oneOf": [
          {
            "type": "object",
            "description": "Everything works; no banner is shown.",
            "required": ["status"],
            "properties": {
              "status": {
                "type": "string",
                "enum": ["operational"]
              }
            }
          },
          {
            "type": "object",
            "description": "Some features are slow or failing.",
            "required": ["message", "status"],
            "properties": {
              "message": {
                "type": "string",
                "description": "What users should know."
              },
              "status": {
                "type": "string",
                "enum": ["degraded"]
              }
            }
          },
          {
            "type": "object",
            "description": "Macro is largely unavailable.",
            "required": ["message", "status"],
            "properties": {
              "message": {
                "type": "string",
                "description": "What users should know."
              },
              "status": {
                "type": "string",
                "enum": ["major_outage"]
              }
            }
          }
        ],
        "description": "The platform status. Only the non-operational statuses carry a message."
      },
      "SystemStatusHistory": {
        "type": "object",
        "description": "Recent status updates, newest first.",
        "required": ["updates"],
        "properties": {
          "updates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StatusUpdate"
            },
            "description": "The updates."
          }
        }
      },
      "Team": {
        "type": "object",
        "description": "The Team struct",
        "required": [
          "id",
          "name",
          "slug",
          "owner_id",
          "crm_enabled",
          "enterprise",
          "allow_non_admin_invites"
        ],
        "properties": {
          "allow_non_admin_invites": {
            "type": "boolean",
            "description": "Whether non-admin members may invite users to the team. Defaults to\ntrue; admins can turn it off so only admins/owners may invite."
          },
          "auto_join_domain": {
            "type": ["string", "null"],
            "description": "The email domain new users are automatically joined to this team\nwith, when automatic domain joining is enabled (None otherwise)."
          },
          "crm_enabled": {
            "type": "boolean",
            "description": "Whether the CRM is enabled for this team (from `team_crm_settings`;\n`false` when no row exists)."
          },
          "default_link_share": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/LinkShare",
                "description": "The default link-share scope applied when items owned by the team are\nshared via link without an explicit choice. `None` means link sharing\nis off by default. Defaults to [`LinkShare::Team`]."
              }
            ]
          },
          "enterprise": {
            "type": "boolean",
            "description": "Whether this team is on an enterprise license. Enterprise teams are\nbilled out-of-band; membership changes skip all Stripe subscription\nbookkeeping (no seat counts, no subscription backfill, no paying check)."
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "language": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Language",
                "description": "The interface language for the team's members, unless a member picks\ntheir own. `None` lets each member's browser decide."
              }
            ]
          },
          "name": {
            "type": "string"
          },
          "owner_id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          }
        }
      },
      "TeamInviteDetails": {
        "type": "object",
        "description": "Detailed information about a team invite",
        "required": [
          "id",
          "email",
          "team_id",
          "team_role",
          "invited_by",
          "created_at",
          "last_sent_at",
          "is_agent"
        ],
        "properties": {
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the invite was created"
          },
          "email": {
            "type": "string",
            "description": "The invited email"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The invite id"
          },
          "invited_by": {
            "type": "string",
            "description": "The user who sent the invitation"
          },
          "is_agent": {
            "type": "boolean",
            "description": "Whether the invite creates an agent account"
          },
          "last_sent_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the invite was last sent"
          },
          "team_id": {
            "type": "string",
            "format": "uuid",
            "description": "The team id"
          },
          "team_role": {
            "$ref": "#/components/schemas/TeamRole",
            "description": "The role being invited as"
          }
        }
      },
      "TeamInviteLinkResponse": {
        "type": "object",
        "description": "The caller's team invite link.",
        "properties": {
          "token": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/TeamInviteLinkToken",
                "description": "The link's token, or null when the team has no invite link."
              }
            ]
          }
        }
      },
      "TeamInviteLinkTeam": {
        "type": "object",
        "description": "The team an invite link joins, shown before the user accepts.",
        "required": ["team_id", "team_name"],
        "properties": {
          "team_id": {
            "type": "string",
            "format": "uuid",
            "description": "Id of the team the link joins."
          },
          "team_name": {
            "type": "string",
            "description": "Name of the team the link joins."
          }
        }
      },
      "TeamInviteLinkToken": {
        "type": "string",
        "description": "The secret in a team's shareable invite link.\n\nAnyone signed in who holds the token can join the team, so it is a random\nvalue rather than a time-ordered id, and an admin resetting the link\nreplaces it."
      },
      "TeamInviteLinkTokenRequest": {
        "type": "object",
        "description": "Identifies an invite link. The token travels in the body, not the path, so\nrequest spans and access logs that record the path never see it.",
        "required": ["token"],
        "properties": {
          "token": {
            "$ref": "#/components/schemas/TeamInviteLinkToken",
            "description": "The invite link's token."
          }
        }
      },
      "TeamInvitesResponse": {
        "type": "object",
        "description": "Response containing a list of team invites",
        "required": ["invites"],
        "properties": {
          "invites": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TeamInviteDetails"
            },
            "description": "The invites"
          }
        }
      },
      "TeamMember": {
        "type": "object",
        "description": "The team member struct",
        "required": ["team_id", "user_id", "role", "plan"],
        "properties": {
          "plan": {
            "$ref": "#/components/schemas/SeatPlan",
            "description": "The paid plan the member's seat is billed at. Meaningful on paying\nand enterprise teams; free-team members carry the default."
          },
          "role": {
            "$ref": "#/components/schemas/TeamRole",
            "description": "The role of the team member"
          },
          "team_id": {
            "type": "string",
            "format": "uuid",
            "description": "The id of the team"
          },
          "user_id": {
            "type": "string",
            "description": "The user id of the team member"
          }
        }
      },
      "TeamPlan": {
        "type": "string",
        "description": "Team plans",
        "enum": ["idea", "pre_seed", "seed", "series_a", "growth"]
      },
      "TeamRole": {
        "type": "string",
        "description": "Ordered from least to most access top -> bottom",
        "enum": ["member", "admin", "owner"]
      },
      "TeamWithMembers": {
        "type": "object",
        "description": "A team with its members",
        "required": ["team", "members"],
        "properties": {
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TeamMember"
            },
            "description": "The members of the team"
          },
          "scheduled_seat_plans": {
            "type": ["object", "null"],
            "description": "Provider-confirmed pending seat changes, keyed by member user ID.\nEmpty when no changes apply to this viewer; absent when the lookup fails.",
            "additionalProperties": {
              "$ref": "#/components/schemas/ScheduledSeatPlan"
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "team": {
            "$ref": "#/components/schemas/Team",
            "description": "The team"
          }
        }
      },
      "ToggleAutoJoinDomainResponse": {
        "type": "object",
        "description": "Response for the toggle auto-join domain endpoint.",
        "properties": {
          "auto_join_domain": {
            "type": ["string", "null"],
            "description": "The team's auto-join domain after the toggle (null when it was\nunset by this call)."
          }
        }
      },
      "ToggleNonAdminInvitesResponse": {
        "type": "object",
        "description": "Response for the toggle non-admin invites endpoint.",
        "required": ["allow_non_admin_invites"],
        "properties": {
          "allow_non_admin_invites": {
            "type": "boolean",
            "description": "Whether non-admin members may invite users to the team after the\ntoggle."
          }
        }
      },
      "TrialEligibility": {
        "type": "object",
        "description": "Whether the authenticated customer can receive the introductory Pro trial.",
        "required": ["eligible", "existingSubscription"],
        "properties": {
          "eligible": {
            "type": "boolean",
            "description": "Confirmed against the same subscription history used during checkout."
          },
          "existingSubscription": {
            "type": "boolean",
            "description": "An existing subscription requires management instead of a new checkout."
          }
        }
      },
      "UpdateAutoReloadRequest": {
        "type": "object",
        "description": "Request body for [`update_auto_reload_handler`].",
        "required": ["enabled", "minimumBalanceCents", "targetBalanceCents"],
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Purchase prepaid credits automatically using the payer's card."
          },
          "minimumBalanceCents": {
            "type": "integer",
            "format": "int64",
            "description": "Reload once the balance drops below this, cents. Must be positive."
          },
          "monthlySpendLimitCents": {
            "type": ["integer", "null"],
            "format": "int64",
            "description": "Most to reload per calendar month, cents. Omit or `null` for no limit.\nMust be at least the catalog's `overage_limit_min_cents` (legacy name)."
          },
          "targetBalanceCents": {
            "type": "integer",
            "format": "int64",
            "description": "Reload the balance back up to this, cents. At least $0.50 above the\nminimum and no more than the catalog's `auto_reload_target_max_cents`."
          }
        }
      },
      "UpdateOverageRequest": {
        "type": "object",
        "description": "Request body for [`update_overage_handler`].",
        "required": ["enabled"],
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Bill usage past allowance and credits."
          },
          "limitCents": {
            "type": "integer",
            "format": "int64",
            "description": "Per-period cap on overage spend, cents. Required when enabling."
          }
        }
      },
      "UpstreamErrorCode": {
        "type": "string",
        "description": "What kind of upstream failure a 502 or 503 reports, for clients that\nbranch on it.",
        "enum": [
          "upstream_unavailable",
          "upstream_rate_limited",
          "upstream_invalid_response"
        ]
      },
      "UpstreamErrorResponse": {
        "type": "object",
        "description": "The body of a 502 or 503 caused by a third-party service.",
        "required": ["message", "code"],
        "properties": {
          "code": {
            "$ref": "#/components/schemas/UpstreamErrorCode",
            "description": "The kind of failure."
          },
          "message": {
            "type": "string",
            "description": "What failed and what to do about it, written for the user."
          }
        }
      },
      "UsageSnapshot": {
        "type": "object",
        "description": "The payer's current-period position, as shown in Billing settings and used\nby the gate.",
        "required": [
          "tier",
          "unlimited",
          "payer",
          "can_manage_billing",
          "seats",
          "period_start",
          "period_end",
          "included_cents",
          "used_cents",
          "credits_consumed_cents",
          "credit_balance_cents",
          "credits_shared_with_team",
          "overage_enabled",
          "overage_limit_cents",
          "overage_charged_cents",
          "overage_suspended",
          "auto_reload",
          "uncovered_cents",
          "remaining_cents"
        ],
        "properties": {
          "auto_reload": {
            "$ref": "#/components/schemas/AutoReloadSnapshot",
            "description": "Automatic credit reload settings. `active` means the payer opted in and\nreloads are not suspended."
          },
          "blocked_reason": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/DenyReason",
                "description": "Why requests are refused right now, if they are."
              }
            ]
          },
          "can_manage_billing": {
            "type": "boolean",
            "description": "Whether the requesting user is the payer."
          },
          "credit_balance_cents": {
            "type": "integer",
            "format": "int64",
            "description": "Shared prepaid credit balance, in customer cents."
          },
          "credit_purchase": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CreditPurchaseSnapshot",
                "description": "The monthly credit limit for one-time purchases charged to the card on\nfile. Present for paid, metered users, payer and team members alike."
              }
            ]
          },
          "credits_consumed_cents": {
            "type": "integer",
            "format": "int64",
            "description": "Shared payer credits already applied to this period, in customer cents."
          },
          "credits_shared_with_team": {
            "type": "boolean",
            "description": "Whether prepaid credits belong to the team, including a team with one seat."
          },
          "included_cents": {
            "type": "integer",
            "format": "int64",
            "description": "Included AI for this user's seat this period, in cents at provider cost."
          },
          "overage_charged_cents": {
            "type": "integer",
            "format": "int64",
            "description": "Shared overage charged so far this period, in customer cents."
          },
          "overage_enabled": {
            "type": "boolean",
            "description": "Legacy API name for the automatic reload opt-in. Never authorizes direct charges."
          },
          "overage_limit_cents": {
            "type": "integer",
            "format": "int64",
            "description": "Per-period overage cap, in customer cents."
          },
          "overage_suspended": {
            "type": "boolean",
            "description": "Whether overage is paused after a failed charge."
          },
          "payer": {
            "type": "string",
            "description": "The payer for this user's AI."
          },
          "period_end": {
            "type": "string",
            "format": "date-time",
            "description": "Period end (exclusive)."
          },
          "period_start": {
            "type": "string",
            "format": "date-time",
            "description": "Period start."
          },
          "remaining_cents": {
            "type": "integer",
            "format": "int64",
            "description": "Cost cents of usage this seat may still consume: its remaining allowance\nplus whatever shared credit and overage headroom pays for at the markup.\n0 when blocked."
          },
          "seats": {
            "type": "integer",
            "format": "int32",
            "description": "Seats billed to the payer.",
            "minimum": 0
          },
          "tier": {
            "$ref": "#/components/schemas/PlanTier",
            "description": "The plan."
          },
          "uncovered_cents": {
            "type": "integer",
            "format": "int64",
            "description": "Team-wide usage beyond per-seat allowances, at the overage markup, that\nis not yet covered by shared credits or charges (awaiting settlement).\nCustomer cents."
          },
          "unlimited": {
            "type": "boolean",
            "description": "Enterprise: never metered."
          },
          "used_cents": {
            "type": "integer",
            "format": "int64",
            "description": "AI used by this user this period, in cents at provider cost."
          }
        }
      },
      "UserLanguage": {
        "type": "object",
        "description": "The interface language a user picked for themselves. `None` follows their\nteam's language, else their browser's.",
        "properties": {
          "language": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Language",
                "description": "The user's language, or `None` to use the team's, else the browser's."
              }
            ]
          }
        }
      },
      "UserLinkResponse": {
        "type": "object",
        "required": ["link_exists"],
        "properties": {
          "link_exists": {
            "type": "boolean",
            "description": "Whether or not a link exists for the given idp"
          }
        }
      },
      "UserName": {
        "type": "object",
        "required": ["id"],
        "properties": {
          "first_name": {
            "type": ["string", "null"]
          },
          "id": {
            "type": "string"
          },
          "is_agent": {
            "type": "boolean",
            "description": "Whether this is an agent account rather than a person."
          },
          "last_name": {
            "type": ["string", "null"]
          }
        }
      },
      "UserNames": {
        "type": "object",
        "required": ["names"],
        "properties": {
          "names": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UserName"
            }
          }
        }
      },
      "UserOrganizationResponse": {
        "type": "object",
        "required": ["organizationId", "organizationName"],
        "properties": {
          "organizationId": {
            "type": "integer",
            "format": "int32",
            "description": "The id of the organization"
          },
          "organizationName": {
            "type": "string",
            "description": "The name of the organization"
          }
        }
      },
      "UserProfilePicture": {
        "type": "object",
        "required": ["id", "url"],
        "properties": {
          "checksum": {
            "type": ["string", "null"]
          },
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        }
      },
      "UserQuota": {
        "type": "object",
        "description": "The UserQuota represents the user's current quota",
        "required": [
          "documents",
          "ai_chat_messages",
          "max_documents",
          "max_ai_chat_messages"
        ],
        "properties": {
          "ai_chat_messages": {
            "type": "integer",
            "format": "int64",
            "description": "The user's total number of AI chat messages the user has sent."
          },
          "documents": {
            "type": "integer",
            "format": "int64",
            "description": "The user's total number of documents they have created."
          },
          "max_ai_chat_messages": {
            "type": "integer",
            "format": "int32",
            "description": "The maximum number of AI chat messages they can send.",
            "minimum": 0
          },
          "max_documents": {
            "type": "integer",
            "format": "int32",
            "description": "The maximum number of documents they can create.",
            "minimum": 0
          }
        }
      },
      "UserTokensResponse": {
        "type": "object",
        "required": ["access_token", "refresh_token"],
        "properties": {
          "access_token": {
            "type": "string",
            "description": "The users access token"
          },
          "refresh_token": {
            "type": "string",
            "description": "The users refresh token"
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "auth service",
      "description": "Macro Authentication Service"
    }
  ]
}