{
  "openapi": "3.1.0",
  "info": {
    "title": "AI Passport Partner API",
    "version": "1.0.0-beta",
    "description": "Private-beta server and delegated-user APIs for managed AI Passport partners."
  },
  "servers": [
    {
      "url": "https://passport.gachaz.fun"
    }
  ],
  "paths": {
    "/partner/v1/me": {
      "get": {
        "operationId": "getPartnerMetadata",
        "summary": "Read the authenticated partner posture",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "x-error-codes": [
          "browser_refused",
          "invalid_key",
          "key_revoked",
          "partner_suspended",
          "rate_limited",
          "unavailable"
        ],
        "responses": {
          "200": {
            "description": "Content-free partner metadata and aggregate usage",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerMetadata"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/partner/v1/users": {
      "post": {
        "operationId": "provisionPartnerUser",
        "summary": "Provision a net-new Passport account",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "x-error-codes": [
          "account_exists",
          "account_pending_deletion",
          "browser_refused",
          "delegation_revoked",
          "invalid_attestation",
          "invalid_email",
          "invalid_external_user_id",
          "invalid_key",
          "invalid_profile",
          "key_revoked",
          "partner_not_ready",
          "partner_suspended",
          "rate_limited",
          "unavailable"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProvisionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing live delegation replayed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DelegatedTokenPair"
                }
              }
            }
          },
          "201": {
            "description": "Passport and delegation created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DelegatedTokenPair"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/partner/v1/events": {
      "post": {
        "operationId": "pollPartnerEvents",
        "summary": "Poll and acknowledge standing events",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "x-error-codes": [
          "browser_refused",
          "invalid_key",
          "invalid_request",
          "key_revoked",
          "rate_limited",
          "unavailable"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventPollRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "RFC 8936 SET delivery response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventPollResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/partner/v1/link/tickets": {
      "post": {
        "operationId": "mintLinkTicket",
        "summary": "Mint a Passport Link ticket",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "x-error-codes": [
          "booking_scope_not_link_requestable",
          "browser_refused",
          "email_refused",
          "invalid_account_context",
          "invalid_body",
          "invalid_completion_redirect_uri",
          "invalid_external_user_id",
          "invalid_key",
          "invalid_scopes",
          "key_revoked",
          "partner_not_ready",
          "partner_suspended",
          "rate_limited",
          "unavailable",
          "unregistered_completion_redirect_uri"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LinkTicketRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Ticket minted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkTicketResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/partner/v1/link/tickets/{id}/redeem": {
      "post": {
        "operationId": "redeemLinkTicket",
        "summary": "Redeem one completed Passport Link ticket",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "x-error-codes": [
          "browser_refused",
          "invalid_key",
          "key_revoked",
          "link_not_available",
          "partner_suspended",
          "rate_limited",
          "unavailable"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Delegated token pair",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkRedeemResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/partner/v1/connectors": {
      "get": {
        "operationId": "listPartnerConnectors",
        "summary": "List connectors for one delegated user",
        "security": [
          {
            "delegatedBearer": []
          }
        ],
        "x-error-codes": [
          "forbidden",
          "insufficient_scope",
          "invalid_token",
          "unavailable"
        ],
        "responses": {
          "200": {
            "description": "Connector catalog and current state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectorListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/OAuthError"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/partner/v1/catalog/connectors": {
      "get": {
        "operationId": "listPartnerConnectorCatalog",
        "summary": "List the pre-link connector catalog",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "x-error-codes": [
          "browser_refused",
          "invalid_key",
          "key_revoked",
          "partner_suspended",
          "rate_limited",
          "unavailable"
        ],
        "responses": {
          "200": {
            "description": "Static connector catalog without user connection or availability state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerConnectorCatalogResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/partner/v1/connectors/connect": {
      "post": {
        "operationId": "connectPartnerConnector",
        "summary": "Start a provider OAuth connection",
        "security": [
          {
            "delegatedBearer": []
          }
        ],
        "x-error-codes": [
          "connect_failed",
          "forbidden",
          "health_disclosure_required",
          "insufficient_scope",
          "invalid_completion_redirect_uri",
          "invalid_connector",
          "invalid_token",
          "no_training_attestation_required",
          "rate_limited",
          "unavailable",
          "unregistered_completion_redirect_uri"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectorConnectRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Provider and optional pass URLs. A granted pass returns to completion_redirect_uri when provided.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectorConnectResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/OAuthError"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/partner/v1/connectors/connect-key": {
      "post": {
        "operationId": "mintConnectorKeyTicket",
        "summary": "Mint a hosted connector credential page",
        "security": [
          {
            "delegatedBearer": []
          }
        ],
        "x-error-codes": [
          "account_pending_deletion",
          "connector_already_connected",
          "forbidden",
          "health_disclosure_required",
          "insufficient_scope",
          "invalid_completion_redirect_uri",
          "invalid_connector",
          "invalid_token",
          "provider_credential_refused",
          "rate_limited",
          "unavailable",
          "unregistered_completion_redirect_uri"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectorKeyRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Hosted credential ticket",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectorKeyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/OAuthError"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/partner/v1/connectors/{connector}/activities": {
      "get": {
        "operationId": "listPartnerActivities",
        "summary": "List recent connector activities",
        "security": [
          {
            "delegatedBearer": []
          }
        ],
        "x-error-codes": [
          "forbidden",
          "insufficient_scope",
          "invalid_days",
          "invalid_token",
          "no_pass",
          "not_connected",
          "not_found",
          "rate_limited",
          "unavailable"
        ],
        "parameters": [
          {
            "name": "connector",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "garmin",
                "strava",
                "oura"
              ]
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 28,
              "default": 7
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Recent activities with stable opaque refs, newest first, up to 100 rows. An empty array is a successful read.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerActivityIndexResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/OAuthError"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        },
        "description": "Garmin reads bounded activity summaries received after Garmin notifications and kept encrypted for at most 30 days. It reports streams_available: true only when Garmin sample streams are enabled and an unexpired Activity Details callback is retained for the workout's sync window, otherwise false. Strava and Oura use Terra activity reads."
      }
    },
    "/partner/v1/connectors/{connector}/activities/{ref}/samples": {
      "get": {
        "operationId": "getPartnerActivitySamples",
        "summary": "Read mechanical streams for one activity",
        "security": [
          {
            "delegatedBearer": []
          }
        ],
        "x-error-codes": [
          "forbidden",
          "insufficient_scope",
          "invalid_ref",
          "invalid_token",
          "no_pass",
          "not_connected",
          "not_found",
          "rate_limited",
          "unavailable"
        ],
        "parameters": [
          {
            "name": "connector",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "garmin",
                "strava"
              ]
            }
          },
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "description": "Opaque activity ref from the index. Valid only for the last 28 civil days, inclusive of today, with tomorrow accepted for timezone skew.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Mechanical sample streams for one activity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerActivitySamplesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/OAuthError"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "description": "Source does not serve sample streams, activity ref is malformed, unknown or expired, source is not connected, or connector is not on this surface. Unsupported sources return the sourceDoesNotServeStreams example before claiming a pass. Garmin workouts without a retained callback return the noRetainedGarminCallback example.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "sourceDoesNotServeStreams": {
                    "value": {
                      "error": "not_found",
                      "hint": "This source does not serve sample streams."
                    }
                  },
                  "unknownOrExpiredRef": {
                    "value": {
                      "error": "not_found",
                      "hint": "No activity with this ref in the last 28 days. Refresh the activity index before treating the activity as gone."
                    }
                  },
                  "noRetainedGarminCallback": {
                    "value": {
                      "error": "not_found",
                      "hint": "No retained sample streams for this workout."
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        },
        "description": "Strava serves mechanical sample streams. Garmin serves Activity Details through retained Garmin-issued callbacks when enabled for the deployment and Garmin application, while Garmin's Activity Details notification for that workout is retained, for seven days from the time Garmin notified us. The notification must arrive within a day of the workout's own notification, from one hour before to 24 hours after it. Only the encrypted callback capability is retained; nothing from the streams is stored. Missing retained callbacks return 404 not_found with the hint: No retained sample streams for this workout. A completed search without a matching workout also returns 404 not_found. Each read tries at most eight callbacks within an eight-second deadline; reaching either limit without a match returns retryable 503 unavailable. Disabled Garmin samples return 404 with the unsupported-source hint before claiming a pass. Manual activities and devices without details can return empty streams. Pool swims have no position and may omit speed. Garmin cadence_rpm prefers bike revolutions per minute, then steps per minute, then swim strokes per minute. Garmin keeps at most the oldest 20,000 points per stream, 60,000 total and 1,000 laps; this response has no cadence_unit or truncated field. A malformed Activity Details response is 503 unavailable, never 404. Heart rate, temperature and other physiological fields are excluded. When Activity Files is enabled for the owner, Garmin pool swims may include a structured swim section with pool length, per-length timing, stroke type/count, pace and SWOLF, interval totals and session totals. File callbacks permit one download within 24 hours. The worker acquires and filters them promptly; only the encrypted, closed swim projection is retained for up to 30 days, and raw FIT is never returned or stored. Acquisition pending or failed is retryable 503 unavailable, never an empty swim. File-derived swims may have empty per-second streams because physiological records are excluded. The same exact fitness.samples pass is claimed once. File acquisition and reads are default-off and separately cohort-gated."
      }
    },
    "/partner/v1/source/items": {
      "post": {
        "operationId": "pushPartnerSourceItems",
        "summary": "Push source-attributed memory records",
        "security": [
          {
            "delegatedBearer": []
          }
        ],
        "x-error-codes": [
          "busy",
          "forbidden",
          "insufficient_scope",
          "invalid_items",
          "invalid_token",
          "partner_not_ready",
          "quota_exceeded",
          "rate_limited",
          "unavailable"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SourceItemsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Per-item outcomes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceItemsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/OAuthError"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/partner/v1/recall": {
      "post": {
        "operationId": "recallPartnerMemory",
        "summary": "Recall own-source and pass-governed memory",
        "security": [
          {
            "delegatedBearer": []
          }
        ],
        "x-error-codes": [
          "forbidden",
          "insufficient_scope",
          "invalid_categories",
          "invalid_limit",
          "invalid_query",
          "invalid_token",
          "rate_limited",
          "unavailable"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecallRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Available rows and skipped categories",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecallResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/OAuthError"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/partner/v1/store/items": {
      "post": {
        "operationId": "saveWorkspaceItems",
        "summary": "Save partner workspace items",
        "security": [
          {
            "delegatedBearer": []
          }
        ],
        "x-error-codes": [
          "busy",
          "deletion_pending",
          "forbidden",
          "insufficient_scope",
          "invalid_items",
          "invalid_token",
          "memory_locked",
          "quota_exceeded",
          "rate_limited",
          "rejected",
          "stale_epoch",
          "unavailable",
          "workspace_export_in_progress",
          "workspace_retained"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkspaceSaveRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Workspace generation and item outcomes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceSaveResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/OAuthError"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "423": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "get": {
        "operationId": "listWorkspaceItems",
        "summary": "List partner workspace items",
        "security": [
          {
            "delegatedBearer": []
          }
        ],
        "x-error-codes": [
          "forbidden",
          "insufficient_scope",
          "invalid_page",
          "invalid_token",
          "memory_locked",
          "rate_limited",
          "unavailable",
          "workspace_retained"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Opaque cursor with a maximum of 256 UTF-8 bytes",
              "x-max-utf8-bytes": 256
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One keyset page",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/OAuthError"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "423": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/partner/v1/store/recall": {
      "post": {
        "operationId": "recallWorkspaceItems",
        "summary": "Recall partner workspace items",
        "security": [
          {
            "delegatedBearer": []
          }
        ],
        "x-error-codes": [
          "forbidden",
          "insufficient_scope",
          "invalid_limit",
          "invalid_query",
          "invalid_token",
          "memory_locked",
          "rate_limited",
          "unavailable",
          "workspace_retained"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkspaceRecallRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Semantic workspace results",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceRecallResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/OAuthError"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "423": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/partner/v1/store/items/{id}": {
      "delete": {
        "operationId": "forgetWorkspaceItem",
        "summary": "Forget one partner workspace item",
        "security": [
          {
            "delegatedBearer": []
          }
        ],
        "x-error-codes": [
          "deletion_pending",
          "forbidden",
          "insufficient_scope",
          "invalid_id",
          "invalid_token",
          "memory_locked",
          "rate_limited",
          "stale_epoch",
          "unavailable",
          "workspace_export_in_progress",
          "workspace_retained"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deletion outcome",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceDeleteResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/OAuthError"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "423": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/partner/v1/mcp": {
      "post": {
        "operationId": "partnerWorkspaceMcp",
        "summary": "Use the partner workspace over streamable HTTP MCP",
        "description": "Supports MCP protocol revision 2025-11-25 through the official SDK.",
        "security": [
          {
            "delegatedBearer": []
          }
        ],
        "x-error-codes": [
          "busy",
          "deletion_pending",
          "forbidden",
          "invalid_id",
          "invalid_items",
          "invalid_limit",
          "invalid_page",
          "invalid_query",
          "memory_locked",
          "quota_exceeded",
          "rate_limited",
          "rejected",
          "stale_epoch",
          "unavailable",
          "workspace_export_in_progress",
          "workspace_retained"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JsonRpcRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC response or SSE stream",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Empty response for any failed partner MCP guard"
          },
          "500": {
            "description": "JSON-RPC internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcResponse"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "rejectPartnerWorkspaceMcpGet",
        "summary": "Reject unsupported MCP GET",
        "security": [
          {
            "delegatedBearer": []
          }
        ],
        "responses": {
          "401": {
            "description": "Empty failed-guard response"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      },
      "delete": {
        "operationId": "rejectPartnerWorkspaceMcpDelete",
        "summary": "Reject unsupported MCP DELETE",
        "security": [
          {
            "delegatedBearer": []
          }
        ],
        "responses": {
          "401": {
            "description": "Empty failed-guard response"
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/partner/v1/structured-recall": {
      "post": {
        "operationId": "structuredRecallPartnerMemory",
        "summary": "Recall governed memory with exact user-present pass claims",
        "security": [
          {
            "delegatedBearer": []
          }
        ],
        "x-error-codes": [
          "insufficient_scope",
          "invalid_categories",
          "invalid_limit",
          "invalid_purpose",
          "invalid_query",
          "invalid_read_id",
          "invalid_token",
          "read_id_conflict"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StructuredRecallRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Typed per-category governed recall outcome",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StructuredRecallResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/OAuthError"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "description": "Structured recall rate limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StructuredRecallResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "partnerSecurityEvent": {
      "post": {
        "summary": "Signed thin-ping partner delivery",
        "description": "Managed endpoints receive a compact RFC Security Event Token. Verify it against the Passport JWKS before use. The connector-activity-created event contains only connector and opaque ref; pull data through the delegated pass-gated endpoints.",
        "requestBody": {
          "required": true,
          "content": {
            "application/secevent+jwt": {
              "schema": {
                "type": "string",
                "description": "Compact RS256 Security Event Token with typ secevent+jwt."
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Notification accepted."
          },
          "200": {
            "description": "Notification accepted."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "partnerKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "pp_ partner API key"
      },
      "delegatedBearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "delegated OAuth access token"
      }
    },
    "responses": {
      "Error": {
        "description": "Partner API error. Retry behavior depends on the status and error code.",
        "headers": {
          "X-Request-Id": {
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          "Retry-After": {
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          "X-RateLimit-Name": {
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "OAuthError": {
        "description": "Bearer-token error",
        "headers": {
          "WWW-Authenticate": {
            "schema": {
              "type": "string"
            }
          },
          "X-Request-Id": {
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/OAuthError"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error",
          "request_id",
          "docs_url"
        ],
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "account_exists",
              "account_pending_deletion",
              "booking_scope_not_link_requestable",
              "browser_refused",
              "busy",
              "connect_failed",
              "connector_already_connected",
              "delegation_revoked",
              "deletion_pending",
              "email_refused",
              "forbidden",
              "health_disclosure_required",
              "insufficient_scope",
              "invalid_account_context",
              "invalid_attestation",
              "invalid_body",
              "invalid_categories",
              "invalid_completion_redirect_uri",
              "invalid_connector",
              "invalid_days",
              "invalid_email",
              "invalid_external_user_id",
              "invalid_id",
              "invalid_items",
              "invalid_key",
              "invalid_limit",
              "invalid_page",
              "invalid_profile",
              "invalid_purpose",
              "invalid_query",
              "invalid_read_id",
              "invalid_ref",
              "invalid_request",
              "invalid_scopes",
              "invalid_token",
              "key_revoked",
              "link_not_available",
              "memory_locked",
              "no_pass",
              "no_training_attestation_required",
              "not_connected",
              "not_found",
              "partner_not_ready",
              "partner_suspended",
              "provider_credential_refused",
              "quota_exceeded",
              "rate_limited",
              "read_id_conflict",
              "rejected",
              "stale_epoch",
              "unavailable",
              "unregistered_completion_redirect_uri",
              "workspace_export_in_progress",
              "workspace_retained"
            ]
          },
          "code": {
            "type": "string"
          },
          "error_description": {
            "type": "string"
          },
          "detail": {
            "type": [
              "string",
              "null"
            ]
          },
          "hint": {
            "type": "string"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "docs_url": {
            "type": "string",
            "format": "uri"
          },
          "limit_name": {
            "type": "string"
          },
          "daily_item_quota": {
            "type": "integer",
            "minimum": 0
          },
          "quota": {
            "type": "string",
            "enum": [
              "daily_items",
              "live_total"
            ]
          },
          "limit": {
            "type": "integer",
            "minimum": 0
          }
        },
        "additionalProperties": false
      },
      "OAuthError": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "invalid_token",
              "insufficient_scope"
            ]
          },
          "error_description": {
            "type": "string"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "docs_url": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      },
      "PartnerMetadata": {
        "type": "object",
        "required": [
          "partner",
          "workspace_readability",
          "quotas",
          "entitled_scopes",
          "active_key_prefix"
        ],
        "properties": {
          "partner": {
            "type": "object",
            "required": [
              "id",
              "name",
              "source_slug",
              "logo_url"
            ],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              },
              "source_slug": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "logo_url": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Operator-set logo, re-hosted on AI Passport storage; null when unset."
              }
            },
            "additionalProperties": false
          },
          "workspace_readability": {
            "type": "string",
            "enum": [
              "partner_only",
              "owner_readable"
            ]
          },
          "quotas": {
            "type": "object",
            "required": [
              "source_daily_items",
              "workspace_daily_items",
              "workspace_live_items",
              "workspace_item_bytes"
            ],
            "properties": {
              "source_daily_items": {
                "$ref": "#/components/schemas/DailyQuota"
              },
              "workspace_daily_items": {
                "type": "object",
                "required": [
                  "limit_per_user",
                  "used_today_across_users"
                ],
                "properties": {
                  "limit_per_user": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "used_today_across_users": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false
              },
              "workspace_live_items": {
                "type": "object",
                "required": [
                  "limit_per_user"
                ],
                "properties": {
                  "limit_per_user": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false
              },
              "workspace_item_bytes": {
                "type": "object",
                "required": [
                  "limit"
                ],
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 16384
                  }
                },
                "additionalProperties": false
              }
            },
            "additionalProperties": false
          },
          "entitled_scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "partner-api",
                "partner:store"
              ]
            },
            "uniqueItems": true
          },
          "active_key_prefix": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "DailyQuota": {
        "type": "object",
        "required": [
          "limit",
          "used_today"
        ],
        "properties": {
          "limit": {
            "type": "integer",
            "minimum": 0
          },
          "used_today": {
            "type": "integer",
            "minimum": 0
          }
        },
        "additionalProperties": false
      },
      "ProvisionRequest": {
        "type": "object",
        "required": [
          "email",
          "external_user_id",
          "attestation"
        ],
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 320
          },
          "external_user_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "attestation": {
            "type": "object",
            "required": [
              "email_verified_at",
              "terms_ack",
              "terms_version",
              "age_attested"
            ],
            "properties": {
              "email_verified_at": {
                "type": "string",
                "format": "date-time"
              },
              "terms_ack": {
                "const": true
              },
              "terms_version": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              },
              "age_attested": {
                "const": true
              }
            },
            "additionalProperties": true
          },
          "profile": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "name": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 200
              }
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "DelegatedTokenPair": {
        "type": "object",
        "required": [
          "created",
          "passport_user_id",
          "delegation_id",
          "access_token",
          "refresh_token",
          "token_type",
          "expires_in",
          "scope"
        ],
        "properties": {
          "created": {
            "type": "boolean"
          },
          "passport_user_id": {
            "type": "string",
            "format": "uuid"
          },
          "delegation_id": {
            "type": "string"
          },
          "access_token": {
            "type": "string"
          },
          "refresh_token": {
            "type": "string"
          },
          "token_type": {
            "const": "bearer"
          },
          "expires_in": {
            "const": 3600
          },
          "scope": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "LinkTicketRequest": {
        "type": "object",
        "required": [
          "external_user_id",
          "account_context",
          "requested_scopes"
        ],
        "properties": {
          "external_user_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "account_context": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "requested_scopes": {
            "type": "array",
            "minItems": 1,
            "maxItems": 4,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "openid",
                "profile",
                "email",
                "memory"
              ]
            }
          },
          "completion_redirect_uri": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://(?![^/?#]*@)[^#]+$"
          }
        },
        "additionalProperties": true
      },
      "LinkTicketResponse": {
        "type": "object",
        "required": [
          "ticket_id",
          "link_url",
          "expires_at"
        ],
        "properties": {
          "ticket_id": {
            "type": "string",
            "format": "uuid"
          },
          "link_url": {
            "type": "string",
            "format": "uri"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "LinkRedeemResponse": {
        "type": "object",
        "required": [
          "outcome",
          "passport_user_id",
          "delegation_id",
          "access_token",
          "refresh_token",
          "token_type",
          "expires_in",
          "scope"
        ],
        "properties": {
          "outcome": {
            "type": "string"
          },
          "passport_user_id": {
            "type": "string",
            "format": "uuid"
          },
          "delegation_id": {
            "type": "string"
          },
          "access_token": {
            "type": "string"
          },
          "refresh_token": {
            "type": "string"
          },
          "token_type": {
            "const": "bearer"
          },
          "expires_in": {
            "const": 3600
          },
          "scope": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "EventPollRequest": {
        "type": "object",
        "properties": {
          "maxEvents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "default": 50
          },
          "ack": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[0-9]{1,19}$"
            },
            "uniqueItems": true
          },
          "setErrs": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "required": [
                "err",
                "description"
              ],
              "properties": {
                "err": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "description": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1024
                }
              },
              "additionalProperties": true
            }
          }
        },
        "additionalProperties": true
      },
      "EventPollResponse": {
        "type": "object",
        "required": [
          "sets",
          "moreAvailable"
        ],
        "properties": {
          "sets": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "description": "Compact signed Security Event Token"
            }
          },
          "moreAvailable": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "Connector": {
        "type": "object",
        "required": [
          "connector",
          "label",
          "reads",
          "connected",
          "unavailable",
          "connected_at",
          "auth_mode",
          "special_category"
        ],
        "properties": {
          "connector": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "reads": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "connected": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "unavailable": {
            "type": "boolean"
          },
          "connected_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "auth_mode": {
            "type": "string",
            "enum": [
              "oauth",
              "api_key",
              "phone_code",
              "qr_pair",
              "device",
              "builtin"
            ]
          },
          "special_category": {
            "type": "boolean"
          },
          "health_disclosure": {
            "type": "object",
            "required": [
              "version",
              "text"
            ],
            "properties": {
              "version": {
                "type": "string"
              },
              "text": {
                "type": "string"
              }
            },
            "additionalProperties": false,
            "description": "When present, render this connector-specific disclosure and echo its version instead of the response-level default."
          },
          "no_training_attestation": {
            "type": "object",
            "required": [
              "version",
              "text"
            ],
            "properties": {
              "version": {
                "type": "string"
              },
              "text": {
                "type": "string"
              }
            },
            "additionalProperties": false,
            "description": "Garmin only. Render this confirmation as a required checkbox and echo its version as no_training_attestation_version on the connect request."
          },
          "pending": {
            "type": "boolean",
            "description": "Garmin only. True while an authorization or token exchange is in flight; not a connected source."
          }
        },
        "additionalProperties": false
      },
      "ConnectorListResponse": {
        "type": "object",
        "required": [
          "available",
          "connectors"
        ],
        "properties": {
          "available": {
            "type": "boolean"
          },
          "connectors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Connector"
            }
          },
          "health_disclosure": {
            "type": "object",
            "required": [
              "version",
              "text"
            ],
            "properties": {
              "version": {
                "type": "string"
              },
              "text": {
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "PartnerConnectorCatalogEntry": {
        "type": "object",
        "required": [
          "connector",
          "label",
          "reads",
          "auth_mode",
          "special_category"
        ],
        "properties": {
          "connector": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "reads": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "auth_mode": {
            "type": "string",
            "enum": [
              "oauth",
              "api_key",
              "phone_code",
              "qr_pair",
              "device",
              "builtin"
            ]
          },
          "special_category": {
            "type": "boolean"
          },
          "health_disclosure": {
            "type": "object",
            "required": [
              "version",
              "text"
            ],
            "properties": {
              "version": {
                "type": "string"
              },
              "text": {
                "type": "string"
              }
            },
            "additionalProperties": false,
            "description": "When present, render this connector-specific disclosure and echo its version instead of the response-level default."
          },
          "no_training_attestation": {
            "type": "object",
            "required": [
              "version",
              "text"
            ],
            "properties": {
              "version": {
                "type": "string"
              },
              "text": {
                "type": "string"
              }
            },
            "additionalProperties": false,
            "description": "Garmin only. Render this confirmation as a required checkbox and echo its version as no_training_attestation_version on the connect request."
          }
        },
        "additionalProperties": false
      },
      "PartnerConnectorCatalogResponse": {
        "type": "object",
        "required": [
          "connectors"
        ],
        "properties": {
          "connectors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PartnerConnectorCatalogEntry"
            }
          },
          "health_disclosure": {
            "type": "object",
            "required": [
              "version",
              "text"
            ],
            "properties": {
              "version": {
                "type": "string"
              },
              "text": {
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "ConnectorConnectRequest": {
        "type": "object",
        "required": [
          "connector"
        ],
        "properties": {
          "connector": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "disclosure_version": {
            "type": "string"
          },
          "completion_redirect_uri": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://(?![^/?#]*@)[^#]+$"
          },
          "no_training_attestation_version": {
            "type": "string",
            "description": "Required for garmin: the version of the no_training_attestation the user confirmed."
          }
        },
        "additionalProperties": true
      },
      "ConnectorConnectResponse": {
        "type": "object",
        "required": [
          "authUrl",
          "connector",
          "expires_at"
        ],
        "properties": {
          "authUrl": {
            "type": "string",
            "format": "uri"
          },
          "connector": {
            "type": "string"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "grant_url": {
            "type": "string",
            "format": "uri",
            "description": "Hosted pass page. When completion_redirect_uri is provided, a granted pass returns the user to that URL."
          },
          "grant_url_expires_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "ConnectorKeyRequest": {
        "type": "object",
        "required": [
          "connector"
        ],
        "properties": {
          "connector": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,63}$"
          },
          "disclosure_version": {
            "type": "string"
          },
          "completion_redirect_uri": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://(?![^/?#]*@)[^#]+$"
          }
        },
        "additionalProperties": true
      },
      "ConnectorKeyResponse": {
        "type": "object",
        "required": [
          "ticket_id",
          "connector",
          "credential_url",
          "expires_at"
        ],
        "properties": {
          "ticket_id": {
            "type": "string",
            "format": "uuid"
          },
          "connector": {
            "type": "string"
          },
          "credential_url": {
            "type": "string",
            "format": "uri"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "SourceItemsRequest": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "items": {
              "type": "object",
              "required": [
                "external_id",
                "content"
              ],
              "properties": {
                "external_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "content": {
                  "type": "string",
                  "minLength": 1,
                  "description": "Maximum 8,000 UTF-8 bytes"
                },
                "category": {
                  "type": "string"
                },
                "occurred_at": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "additionalProperties": true
            }
          }
        },
        "additionalProperties": true
      },
      "SourceItemsResponse": {
        "type": "object",
        "required": [
          "source",
          "results"
        ],
        "properties": {
          "source": {
            "type": "string",
            "pattern": "^partner:"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "external_id",
                "status"
              ],
              "properties": {
                "external_id": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "stored",
                    "duplicate",
                    "rejected",
                    "locked",
                    "retry"
                  ]
                },
                "id": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "additionalProperties": false
            }
          }
        },
        "additionalProperties": false
      },
      "PartnerActivityIndexEntry": {
        "type": "object",
        "required": [
          "ref",
          "type",
          "start_time",
          "duration_seconds",
          "distance_meters",
          "calories",
          "untrusted_name",
          "streams_available"
        ],
        "properties": {
          "ref": {
            "type": "string"
          },
          "type": {
            "type": [
              "number",
              "string",
              "null"
            ],
            "description": "Garmin activity type label, or Terra numeric activity type code. Provider labels are untrusted text. Null when no type is supplied."
          },
          "start_time": {
            "type": "string",
            "format": "date-time"
          },
          "end_time": {
            "type": "string",
            "format": "date-time"
          },
          "duration_seconds": {
            "type": [
              "number",
              "null"
            ]
          },
          "distance_meters": {
            "type": [
              "number",
              "null"
            ]
          },
          "calories": {
            "type": [
              "number",
              "null"
            ]
          },
          "untrusted_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "streams_available": {
            "type": "boolean",
            "description": "Whether this source can serve sample reads in this deployment. Garmin is true only when sample streams are enabled and an unexpired Activity Details callback is retained for the workout's sync window; a particular activity can still have empty or unavailable details."
          },
          "garmin_attribution": {
            "$ref": "#/components/schemas/GarminAttribution"
          }
        },
        "additionalProperties": false
      },
      "PartnerActivityIndexResponse": {
        "type": "object",
        "required": [
          "activities"
        ],
        "properties": {
          "activities": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/PartnerActivityIndexEntry"
            }
          }
        },
        "additionalProperties": false
      },
      "PartnerActivitySamplesResponse": {
        "type": "object",
        "required": [
          "activity",
          "streams",
          "laps",
          "polyline",
          "source"
        ],
        "properties": {
          "activity": {
            "type": "object",
            "required": [
              "ref",
              "type",
              "start_time",
              "duration_seconds",
              "distance_meters"
            ],
            "properties": {
              "ref": {
                "type": "string"
              },
              "type": {
                "type": [
                  "number",
                  "string",
                  "null"
                ],
                "description": "Garmin activity type label for Garmin samples; Terra activity type code for Terra-backed samples. Treat provider labels as untrusted text."
              },
              "start_time": {
                "type": "string",
                "format": "date-time"
              },
              "end_time": {
                "type": "string",
                "format": "date-time"
              },
              "duration_seconds": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "distance_meters": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "garmin_attribution": {
                "$ref": "#/components/schemas/GarminAttribution"
              }
            },
            "additionalProperties": false
          },
          "streams": {
            "type": "object",
            "required": [
              "position",
              "distance",
              "elevation",
              "speed",
              "cadence",
              "power"
            ],
            "properties": {
              "position": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "coords_lat_lng_deg"
                  ],
                  "properties": {
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "timer_duration_seconds": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "coords_lat_lng_deg": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "type": "number"
                      }
                    }
                  },
                  "additionalProperties": false
                }
              },
              "distance": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "distance_meters"
                  ],
                  "properties": {
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "timer_duration_seconds": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "distance_meters": {
                      "type": [
                        "number",
                        "null"
                      ]
                    }
                  },
                  "additionalProperties": false
                }
              },
              "elevation": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "elev_meters"
                  ],
                  "properties": {
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "timer_duration_seconds": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "elev_meters": {
                      "type": [
                        "number",
                        "null"
                      ]
                    }
                  },
                  "additionalProperties": false
                }
              },
              "speed": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "speed_meters_per_second"
                  ],
                  "properties": {
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "timer_duration_seconds": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "speed_meters_per_second": {
                      "type": [
                        "number",
                        "null"
                      ]
                    }
                  },
                  "additionalProperties": false
                }
              },
              "cadence": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "cadence_rpm"
                  ],
                  "properties": {
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "timer_duration_seconds": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "cadence_rpm": {
                      "type": [
                        "number",
                        "null"
                      ]
                    }
                  },
                  "additionalProperties": false
                }
              },
              "power": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "watts"
                  ],
                  "properties": {
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "timer_duration_seconds": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "watts": {
                      "type": [
                        "number",
                        "null"
                      ]
                    }
                  },
                  "additionalProperties": false
                }
              }
            },
            "additionalProperties": false
          },
          "laps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "start_time": {
                  "type": "string",
                  "format": "date-time"
                },
                "end_time": {
                  "type": "string",
                  "format": "date-time"
                },
                "distance_meters": {
                  "type": "number"
                },
                "avg_speed_meters_per_second": {
                  "type": "number"
                },
                "total_strokes": {
                  "type": "number"
                },
                "stroke_type": {
                  "type": "number"
                },
                "calories": {
                  "type": "number"
                },
                "avg_watts": {
                  "type": "number"
                }
              },
              "additionalProperties": false
            }
          },
          "polyline": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "garmin",
              "strava"
            ]
          },
          "garmin_attribution": {
            "$ref": "#/components/schemas/GarminAttribution"
          },
          "swim": {
            "$ref": "#/components/schemas/GarminSwimWorkout"
          }
        },
        "additionalProperties": false
      },
      "RecallRequest": {
        "type": "object",
        "required": [
          "categories"
        ],
        "properties": {
          "categories": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string"
            }
          },
          "query": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 256
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 50,
            "default": 20
          }
        },
        "additionalProperties": true
      },
      "MemoryRow": {
        "type": "object",
        "required": [
          "memory_id",
          "content",
          "source",
          "category",
          "created_at"
        ],
        "properties": {
          "memory_id": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "source": {
            "type": [
              "string",
              "null"
            ]
          },
          "category": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "occurred_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "entities": {
            "type": "array",
            "maxItems": 32,
            "description": "Optional knowledge-graph entities directly evidenced by this memory's eligible facts. May be absent while extraction or graph annotation is unavailable.",
            "items": {
              "type": "object",
              "required": [
                "id",
                "type",
                "label"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "person",
                    "org",
                    "place",
                    "product",
                    "project",
                    "topic",
                    "event",
                    "activity",
                    "other"
                  ]
                },
                "label": {
                  "type": "string"
                }
              },
              "additionalProperties": false
            }
          },
          "client_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "evidence_basis": {
            "type": [
              "string",
              "null"
            ]
          },
          "record_kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "verified_issuer": {
            "type": [
              "string",
              "null"
            ]
          },
          "verified_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "additionalProperties": true
      },
      "RecallResponse": {
        "type": "object",
        "required": [
          "rows",
          "skipped_categories",
          "approval_url"
        ],
        "properties": {
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MemoryRow"
            }
          },
          "skipped_categories": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "category",
                "reason"
              ],
              "properties": {
                "category": {
                  "type": "string"
                },
                "reason": {
                  "type": "string",
                  "enum": [
                    "no_pass",
                    "once_only",
                    "locked"
                  ]
                }
              },
              "additionalProperties": false
            }
          },
          "approval_url": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      },
      "WorkspaceItemInput": {
        "type": "object",
        "required": [
          "external_id",
          "content"
        ],
        "properties": {
          "external_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "content": {
            "type": "string",
            "minLength": 1
          },
          "created_at": {
            "type": "string",
            "description": "Accepted when JavaScript Date.parse returns a finite timestamp"
          }
        },
        "additionalProperties": true
      },
      "WorkspaceSaveRequest": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 25,
            "items": {
              "$ref": "#/components/schemas/WorkspaceItemInput"
            }
          }
        },
        "additionalProperties": true
      },
      "WorkspaceSaveResponse": {
        "type": "object",
        "required": [
          "epoch",
          "results"
        ],
        "properties": {
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "external_id",
                "status"
              ],
              "properties": {
                "external_id": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "stored",
                    "deleted",
                    "rejected"
                  ]
                },
                "id": {
                  "type": "string"
                }
              },
              "additionalProperties": false
            }
          }
        },
        "additionalProperties": false
      },
      "WorkspaceRecallRequest": {
        "type": "object",
        "required": [
          "query"
        ],
        "properties": {
          "query": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 20
          }
        },
        "additionalProperties": true
      },
      "WorkspaceItem": {
        "type": "object",
        "required": [
          "id",
          "external_id",
          "content",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "external_id": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "score": {
            "type": "number"
          }
        },
        "additionalProperties": false
      },
      "WorkspaceRecallResponse": {
        "type": "object",
        "required": [
          "epoch",
          "results"
        ],
        "properties": {
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkspaceItem"
            }
          }
        },
        "additionalProperties": false
      },
      "WorkspaceListResponse": {
        "type": "object",
        "required": [
          "epoch",
          "items",
          "next_after"
        ],
        "properties": {
          "epoch": {
            "type": "integer",
            "minimum": 0
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkspaceItem"
            }
          },
          "next_after": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "additionalProperties": false
      },
      "WorkspaceDeleteResponse": {
        "type": "object",
        "required": [
          "deleted"
        ],
        "properties": {
          "deleted": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "JsonRpcRequest": {
        "type": "object",
        "required": [
          "jsonrpc",
          "method"
        ],
        "properties": {
          "jsonrpc": {
            "const": "2.0"
          },
          "id": {
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "method": {
            "type": "string"
          },
          "params": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "JsonRpcResponse": {
        "type": "object",
        "required": [
          "jsonrpc"
        ],
        "properties": {
          "jsonrpc": {
            "const": "2.0"
          },
          "id": {
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "result": {
            "type": "object",
            "additionalProperties": true
          },
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "integer"
              },
              "message": {
                "type": "string"
              },
              "data": {}
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "StructuredRecallRequest": {
        "type": "object",
        "required": [
          "categories",
          "purpose",
          "read_id"
        ],
        "properties": {
          "categories": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string"
            }
          },
          "purpose": {
            "type": "string",
            "enum": [
              "recall",
              "personalize"
            ]
          },
          "query": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 256
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 50,
            "default": 20,
            "description": "Maximum rows returned independently for each declared category; there is no cross-category budget."
          },
          "read_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Opaque logical-read id. Retries must keep query, category set, purpose, and limit unchanged or receive read_id_conflict; served retries replay only the recorded memory IDs."
          }
        },
        "additionalProperties": false
      },
      "StructuredMemoryRow": {
        "type": "object",
        "required": [
          "memory_id",
          "content",
          "source",
          "created_at",
          "occurred_at",
          "category",
          "client_id",
          "evidence_basis",
          "record_kind",
          "verified_issuer",
          "verified_at"
        ],
        "properties": {
          "memory_id": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "source": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "occurred_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "category": {
            "type": "string"
          },
          "client_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "evidence_basis": {
            "type": [
              "string",
              "null"
            ]
          },
          "record_kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "verified_issuer": {
            "type": [
              "string",
              "null"
            ]
          },
          "verified_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "additionalProperties": true
      },
      "StructuredRecallCategory": {
        "type": "object",
        "required": [
          "category",
          "outcome"
        ],
        "properties": {
          "category": {
            "type": "string"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "results",
              "empty",
              "approval_required",
              "declined",
              "expired",
              "locked",
              "unavailable"
            ]
          },
          "approval_url": {
            "type": "string",
            "format": "uri"
          },
          "approval_expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StructuredMemoryRow"
            }
          }
        },
        "additionalProperties": false
      },
      "StructuredRecallResponse": {
        "type": "object",
        "required": [
          "outcome",
          "categories"
        ],
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "ok",
              "approval_required",
              "locked",
              "unavailable",
              "account_unavailable",
              "rate_limited",
              "partial"
            ]
          },
          "categories": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StructuredRecallCategory"
            }
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "limit_name": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "GarminAttribution": {
        "type": "array",
        "minItems": 1,
        "maxItems": 8,
        "uniqueItems": true,
        "items": {
          "type": "string",
          "maxLength": 87,
          "pattern": "^Garmin(?: .+)?$"
        },
        "description": "Display attribution supplied with Garmin data. Preserve with data and derived outputs, visibly adjacent to the view heading and in exports. Garmin alone means no model was supplied."
      },
      "GarminSwimSession": {
        "type": "object",
        "required": [
          "start_time",
          "duration_seconds",
          "elapsed_seconds",
          "distance_meters",
          "stroke_count",
          "average_swolf",
          "calories",
          "length_count",
          "active_length_count"
        ],
        "properties": {
          "start_time": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "duration_seconds": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "elapsed_seconds": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "distance_meters": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "stroke_count": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "average_swolf": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "calories": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "length_count": {
            "type": "integer",
            "minimum": 0
          },
          "active_length_count": {
            "type": "integer",
            "minimum": 0
          }
        },
        "additionalProperties": false
      },
      "GarminSwimInterval": {
        "type": "object",
        "required": [
          "index",
          "start_time",
          "duration_seconds",
          "elapsed_seconds",
          "distance_meters",
          "stroke_count",
          "average_swolf",
          "calories",
          "stroke_type",
          "first_length_index",
          "length_count",
          "active_length_count"
        ],
        "properties": {
          "index": {
            "type": "integer",
            "minimum": 0
          },
          "start_time": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "duration_seconds": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "elapsed_seconds": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "distance_meters": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "stroke_count": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "average_swolf": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "calories": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "stroke_type": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "freestyle",
              "backstroke",
              "breaststroke",
              "butterfly",
              "drill",
              "mixed",
              "im",
              null
            ]
          },
          "first_length_index": {
            "type": "integer",
            "minimum": 0
          },
          "length_count": {
            "type": "integer",
            "minimum": 0
          },
          "active_length_count": {
            "type": "integer",
            "minimum": 0
          }
        },
        "additionalProperties": false
      },
      "GarminSwimLength": {
        "type": "object",
        "required": [
          "index",
          "interval_index",
          "start_time",
          "duration_seconds",
          "elapsed_seconds",
          "length_type",
          "distance_meters",
          "stroke_type",
          "stroke_count",
          "pace_seconds_per_100_meters",
          "swolf",
          "swolf_source"
        ],
        "properties": {
          "index": {
            "type": "integer",
            "minimum": 0
          },
          "interval_index": {
            "type": "integer",
            "minimum": 0
          },
          "start_time": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "duration_seconds": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "elapsed_seconds": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "length_type": {
            "type": "string",
            "enum": [
              "active",
              "idle"
            ]
          },
          "distance_meters": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "stroke_type": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "freestyle",
              "backstroke",
              "breaststroke",
              "butterfly",
              "drill",
              "mixed",
              "im",
              null
            ]
          },
          "stroke_count": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "pace_seconds_per_100_meters": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "swolf": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "swolf_source": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "recorded",
              "derived",
              null
            ]
          }
        },
        "additionalProperties": false
      },
      "GarminSwimWorkout": {
        "type": "object",
        "required": [
          "pool_length_meters",
          "session",
          "lengths",
          "intervals"
        ],
        "properties": {
          "pool_length_meters": {
            "type": "number",
            "minimum": 1,
            "maximum": 200
          },
          "session": {
            "$ref": "#/components/schemas/GarminSwimSession"
          },
          "lengths": {
            "type": "array",
            "maxItems": 4096,
            "items": {
              "$ref": "#/components/schemas/GarminSwimLength"
            }
          },
          "intervals": {
            "type": "array",
            "maxItems": 512,
            "items": {
              "$ref": "#/components/schemas/GarminSwimInterval"
            }
          }
        },
        "additionalProperties": false,
        "description": "Filtered FIT pool-swim metrics, available only when Garmin Activity Files is enabled for this owner and a matching file was acquired. Durations are seconds; pool length and distances are metres. Device-recorded SWOLF totals are preserved where present. Per-length SWOLF is otherwise rounded duration plus strokes and labelled derived. Workout calories are permitted; heart rate, temperature, physiological sensor streams, profile data, device identifiers, developer fields and raw FIT bytes are excluded."
      }
    }
  }
}
