{
  "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.ego.ist" }
  ],
  "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": ["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_connector", "invalid_token", "rate_limited", "unavailable"],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConnectorConnectRequest" } } } },
        "responses": {
          "200": { "description": "Provider and optional pass URLs", "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/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" } }
      }
    }
  },
  "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", "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_email", "invalid_external_user_id", "invalid_id", "invalid_items", "invalid_key", "invalid_limit", "invalid_page", "invalid_profile", "invalid_query", "invalid_request", "invalid_scopes", "invalid_token", "key_revoked", "link_not_available", "memory_locked", "partner_not_ready", "partner_suspended", "provider_credential_refused", "quota_exceeded", "rate_limited", "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"], "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "source_slug": { "type": ["string", "null"] } }, "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"] }, "special_category": { "type": "boolean" } }, "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"] }, "special_category": { "type": "boolean" } }, "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" } }, "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" }, "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 },
      "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" }, "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 }
    }
  }
}
