{
  "openapi": "3.0.3",
  "info": {
    "title": "Mind Upload Partner API",
    "version": "1.15.47",
    "description": "Integrate Mind Upload AI consciousnesses into your own platform.\n\n**Authentication.** Every request carries your partner key in the `X-Partner-Key` header, always over TLS. Your end-users sign in once with their `username` and `password`; `login` and `register` return a signed, expiring session token (a JWT). On every subsequent call, send that token in the `password` field in place of the raw password — the field accepts either. Reusing the token is the recommended flow and a deliberate security choice: your platform never has to store or replay a user's actual password, and tokens can be rotated or simply left to expire. External Authorization provides passwordless, owner-approved clone invocation without exposing a native password or session token. Grant tokens are accepted only by the External Authorization operations; never substitute them for native session tokens.\n\n**Calling convention.** Every operation is a single HTTPS POST of a JSON body to `/v1/{operation}`.\n\n**Rate limits.** Limits apply per end-user and across your whole account (see `get_quota`); a 429 response carries a plain-language message. Contact us to raise your limits.\n\n**Getting a key.** Partner keys are issued on request — tell us about your integration and we will review it and reply."
  },
  "servers": [
    {
      "url": "https://partner.mindupload.app"
    }
  ],
  "tags": [
    {
      "name": "Authentication",
      "description": "Sign users in and out, register accounts, and check username availability."
    },
    {
      "name": "Users",
      "description": "Read and update the signed-in user's profile."
    },
    {
      "name": "AI Consciousnesses",
      "description": "Create and manage a user's AI consciousnesses (clones)."
    },
    {
      "name": "Memories",
      "description": "Upload and list the memories and persona that shape an AI consciousness."
    },
    {
      "name": "Voice Interviews",
      "description": "Interview a user by voice, one question at a time, and turn what they say into memories or persona they can upload."
    },
    {
      "name": "Conversation",
      "description": "One-on-one chat and proactive group replies with an AI consciousness."
    },
    {
      "name": "Insights",
      "description": "Mind-graph visualization and two-member compatibility reports."
    },
    {
      "name": "Chatrooms",
      "description": "Create chatrooms, manage members, and exchange messages."
    },
    {
      "name": "Live calls",
      "description": "Live voice and video calls between the people in a chatroom."
    },
    {
      "name": "Media",
      "description": "Signed upload slots and multipart uploads for media attachments, and starting an attachment's description before its message is sent."
    },
    {
      "name": "External Authorization",
      "description": "Owner-approved grant issuance, inspection, and clone-scoped invocation."
    },
    {
      "name": "Account",
      "description": "Your partner account — rate limits, credit caps, capacity, and current usage."
    }
  ],
  "components": {
    "securitySchemes": {
      "PartnerKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Partner-Key"
      }
    }
  },
  "paths": {
    "/v1/login": {
      "post": {
        "operationId": "login",
        "summary": "Sign a user in and receive a session token (JWT) for subsequent calls.",
        "tags": [
          "Authentication"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "visitor_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Optional. A stable identifier for the device or app install signing in. Send the same value every time from one install: a new sign-in then replaces only the earlier session of that install and leaves the other devices of the user signed in."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "jwt": {
                      "type": "string",
                      "nullable": true
                    },
                    "decrypted_user": {
                      "type": "object",
                      "additionalProperties": {},
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/logout": {
      "post": {
        "operationId": "logout",
        "summary": "End the current user session.",
        "tags": [
          "Authentication"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "revoked": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "operation_duration_ms": {
                      "type": "number",
                      "nullable": true,
                      "description": "Server-side duration of the operation in milliseconds."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/register": {
      "post": {
        "operationId": "register",
        "summary": "Create a user account on your platform.",
        "tags": [
          "Authentication"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "email": {
                    "type": "string",
                    "nullable": true
                  },
                  "email_verification_code": {
                    "type": "string",
                    "nullable": true
                  },
                  "first_name": {
                    "type": "string",
                    "nullable": true
                  },
                  "last_name": {
                    "type": "string",
                    "nullable": true
                  },
                  "nickname": {
                    "type": "string",
                    "nullable": true
                  },
                  "gender": {
                    "type": "string",
                    "nullable": true
                  },
                  "birth_date": {
                    "type": "integer",
                    "nullable": true
                  },
                  "phone_number": {
                    "type": "string",
                    "nullable": true
                  },
                  "avatar_id": {
                    "type": "string",
                    "nullable": true
                  },
                  "accept_chatroom_invitation_by_others": {
                    "type": "boolean",
                    "default": true
                  },
                  "visitor_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Optional. The same device or app install identifier as for login; the first session of the new account is kept under it."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "jwt": {
                      "type": "string",
                      "nullable": true
                    },
                    "decrypted_user": {
                      "type": "object",
                      "additionalProperties": {},
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/check_username": {
      "post": {
        "operationId": "check_username",
        "summary": "Check whether a username is still available before registering.",
        "tags": [
          "Authentication"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "exists": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "disabled": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "rate_limited": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "flood_window": {
                      "type": "string",
                      "nullable": true
                    },
                    "wait_seconds": {
                      "type": "integer",
                      "nullable": true
                    },
                    "operation_duration_ms": {
                      "type": "number",
                      "nullable": true,
                      "description": "Server-side duration of the operation in milliseconds."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/get_user": {
      "post": {
        "operationId": "get_user",
        "summary": "Fetch the signed-in user's profile.",
        "tags": [
          "Users"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "jwt": {
                      "type": "string",
                      "nullable": true
                    },
                    "decrypted_user": {
                      "type": "object",
                      "additionalProperties": {},
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/update_user": {
      "post": {
        "operationId": "update_user",
        "summary": "Update the signed-in user's profile.",
        "tags": [
          "Users"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "email": {
                    "type": "string",
                    "nullable": true,
                    "description": "A new email address for the account. Over the Partner API it is saved unverified, and the Partner API never uses it to reset the password."
                  },
                  "email_verification_code": {
                    "type": "string",
                    "nullable": true,
                    "description": "Only a code the MindUpload app emailed to the new address for this account is accepted. The Partner API cannot send one, so leave this out; a wrong code fails the whole update."
                  },
                  "first_name": {
                    "type": "string",
                    "nullable": true
                  },
                  "last_name": {
                    "type": "string",
                    "nullable": true
                  },
                  "nickname": {
                    "type": "string",
                    "nullable": true
                  },
                  "gender": {
                    "type": "string",
                    "nullable": true
                  },
                  "birth_date": {
                    "type": "integer",
                    "nullable": true
                  },
                  "phone_number": {
                    "type": "string",
                    "nullable": true
                  },
                  "avatar_id": {
                    "type": "string",
                    "nullable": true
                  },
                  "accept_chatroom_invitation_by_others": {
                    "type": "boolean",
                    "nullable": true
                  },
                  "auto_invoke_ai_on_mention": {
                    "type": "boolean",
                    "nullable": true,
                    "description": "Whether @-mentioning an AI consciousness in a group chat asks it to reply. An account that never set it reads as on."
                  },
                  "auto_invoke_ai_on_reply": {
                    "type": "boolean",
                    "nullable": true,
                    "description": "Whether replying to an AI consciousness's message in a group chat asks it to reply. An account that never set it reads as on."
                  },
                  "low_credit_email_reminder": {
                    "type": "boolean",
                    "nullable": true,
                    "description": "Whether the account may get an email, at most once a week, reminding it to top up when it has too few credits for an AI reply. An account that never set it reads as on."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/get_transaction_history": {
      "post": {
        "operationId": "get_transaction_history",
        "summary": "List the user's Rabbit balance history (top-ups, spending, earnings, withdrawals, tax), newest first, filterable by category and paged with a cursor.",
        "tags": [
          "Users"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "page": {
                    "type": "integer",
                    "nullable": true,
                    "default": 1
                  },
                  "page_size": {
                    "type": "integer",
                    "description": "Maximum records requested for one server-capped page.",
                    "default": 25
                  },
                  "sort_by": {
                    "type": "string",
                    "nullable": true,
                    "default": "created_at"
                  },
                  "sort_order": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Sort direction; supported values depend on the operation.",
                    "default": -1
                  },
                  "use_cursor_pagination": {
                    "type": "boolean",
                    "nullable": true,
                    "default": true
                  },
                  "cursor_value": {
                    "type": "string",
                    "nullable": true,
                    "description": "Opaque pagination cursor value from the previous page (`next_cursor_value`)."
                  },
                  "cursor_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Opaque pagination cursor id from the previous page (`next_cursor_id`)."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "type_filter": {
                    "type": "string",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "total_count": {
                      "type": "integer",
                      "nullable": true
                    },
                    "page": {
                      "type": "integer",
                      "nullable": true
                    },
                    "page_size": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Maximum records requested for one server-capped page."
                    },
                    "total_pages": {
                      "type": "integer",
                      "nullable": true
                    },
                    "has_next": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when another page is available after this response."
                    },
                    "has_prev": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "next_cursor_value": {
                      "type": "string",
                      "nullable": true,
                      "description": "Pass as `cursor_value` on the next page request."
                    },
                    "next_cursor_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Pass as `cursor_id` on the next page request."
                    },
                    "transactions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      },
                      "nullable": true
                    },
                    "operation_duration_ms": {
                      "type": "number",
                      "nullable": true,
                      "description": "Server-side duration of the operation in milliseconds."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/get_quota": {
      "post": {
        "operationId": "get_quota",
        "summary": "Check your partner API rate limits, credit caps, and current usage.",
        "tags": [
          "Account"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "per_user_rate_limit_per_min": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Requests allowed per minute for each of your end-users."
                    },
                    "per_user_daily_credit_cap": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Credit-spending calls allowed per rolling 24h for each end-user."
                    },
                    "partner_rate_limit_per_min": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Account-wide requests/min ceiling across all your users; the platform default applies when none is configured for your account."
                    },
                    "external_authorization_rate_limit_per_min": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Same value as partner_rate_limit_per_min, which now covers every operation; kept for integrations that already read it."
                    },
                    "partner_daily_credit_cap": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Optional account-wide credit-spending calls per rolling 24h; null means no aggregate limit."
                    },
                    "max_users": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Maximum end-users you may register; null means unlimited."
                    },
                    "registered_users": {
                      "type": "integer",
                      "nullable": true,
                      "description": "How many end-users you have registered so far."
                    },
                    "partner_requests_last_minute": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Your requests across all users in the last 60 seconds."
                    },
                    "partner_credit_spends_last_day": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Your credit-spending calls across all users in the last 24 hours."
                    },
                    "user": {
                      "type": "string",
                      "nullable": true,
                      "description": "The end-user that every `user_...` figure in this response is scoped to (echoes your request)."
                    },
                    "user_requests_last_minute": {
                      "type": "integer",
                      "nullable": true,
                      "description": "This user's requests in the last 60 seconds (present only when you pass a username)."
                    },
                    "user_credit_spends_last_day": {
                      "type": "integer",
                      "nullable": true,
                      "description": "This user's credit-spending calls in the last 24 hours (present only when you pass a username)."
                    },
                    "credit_spending_tasks": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Which operations count toward the credit-spend caps."
                    },
                    "calls_enabled": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "Whether live calls are switched on for your account. When false, every call operation is refused and no `call_...` figure in this response applies."
                    },
                    "call_minutes_cap_monthly": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Participant-minutes allowed per calendar month across both kinds of call. One participant-minute is one person connected for one minute, so a four-person call for ten minutes is forty. Null means no combined ceiling."
                    },
                    "call_max_concurrent_sessions": {
                      "type": "integer",
                      "nullable": true,
                      "description": "How many of your calls may be running at the same moment. Null means no ceiling on how many run at once."
                    },
                    "call_voice_minutes_cap_monthly": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Participant-minutes of calls with no picture allowed per calendar month, on top of the combined ceiling rather than instead of it. Null means no separate ceiling on voice calls — the combined one still applies."
                    },
                    "call_video_minutes_cap_monthly": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Participant-minutes of calls with a picture allowed per calendar month, on top of the combined ceiling rather than instead of it. Null means no separate ceiling on video calls. Running out of these does not stop you making voice calls."
                    },
                    "call_voice_participant_minutes_this_month": {
                      "type": "number",
                      "nullable": true,
                      "description": "Participant-minutes of calls with no picture used this calendar month, including any still running."
                    },
                    "call_video_participant_minutes_this_month": {
                      "type": "number",
                      "nullable": true,
                      "description": "Participant-minutes of calls with a picture used this calendar month, including any still running."
                    },
                    "call_month_start_timestamp": {
                      "type": "integer",
                      "nullable": true,
                      "description": "UNIX timestamp of the first second of the calendar month that every `call_..._this_month` figure is counted over."
                    },
                    "call_sessions_this_month": {
                      "type": "integer",
                      "nullable": true,
                      "description": "How many calls you have started this calendar month."
                    },
                    "call_participant_minutes_this_month": {
                      "type": "number",
                      "nullable": true,
                      "description": "Participant-minutes you have used this calendar month across both kinds of call. Always `call_voice_participant_minutes_this_month` plus `call_video_participant_minutes_this_month`. Covers the calls still running as well as the ones that have finished, so it can rise while you read it; `call_live_participant_minutes` is how much of it is still being spent."
                    },
                    "call_live_participant_minutes": {
                      "type": "number",
                      "nullable": true,
                      "description": "How much of `call_participant_minutes_this_month` belongs to calls that have not finished. Measured from how long each has been running and how many people are in it, so it is an estimate until the call ends and the exact figure replaces it."
                    },
                    "call_data_transferred_bytes_this_month": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Bytes of sound and picture moved by the calls we have measured this calendar month. Not every call is measured, so check `call_data_transferred_is_complete` before treating this as the month total."
                    },
                    "call_data_transferred_is_complete": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "Whether `call_data_transferred_bytes_this_month` covers every call this month. When false, some calls are not counted in it."
                    },
                    "call_live_sessions": {
                      "type": "integer",
                      "nullable": true,
                      "description": "How many of your calls are running at this moment."
                    },
                    "call_spending_tasks": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Which operations count toward the call allowances."
                    },
                    "operation_duration_ms": {
                      "type": "number",
                      "nullable": true,
                      "description": "Server-side duration of the operation in milliseconds."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/create_external_authorization_request": {
      "post": {
        "operationId": "create_external_authorization_request",
        "summary": "Start passwordless grant issuance for an external identity and installation.",
        "description": "Use this when a person on your platform already has a Mind Upload account. Store the returned device code only for the short authorization window. Show the user code and verification link to the person; they review the application, requested scopes, and selected AI consciousnesses on Mind Upload. Each owner keeps one grant per installation: exchanging this request ends that owner's earlier grants for the same installation.",
        "tags": [
          "External Authorization"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "idempotency_key": {
                    "type": "string",
                    "description": "A stable opaque event key that makes exact retries return the same outcome.",
                    "example": "unique-request-id-from-your-system",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "installation_id": {
                    "type": "string",
                    "description": "Your stable opaque identifier for this app installation.",
                    "example": "your-installation-id",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "external_subject": {
                    "type": "string",
                    "description": "Your stable opaque identifier for the person authorizing this installation.",
                    "example": "your-external-user-id",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "installation_label": {
                    "type": "string",
                    "nullable": true,
                    "description": "Optional user-readable name for the installation shown during consent.",
                    "example": "Work laptop",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "external_identity_label": {
                    "type": "string",
                    "nullable": true,
                    "description": "Optional user-readable external identity shown during consent.",
                    "example": "External account",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "requested_scopes": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "clone:invoke",
                        "clone:learn",
                        "clone:invoke_shared",
                        "clone:upload",
                        "clone:review",
                        "clone:evidence"
                      ]
                    },
                    "description": "Capabilities the owner is being asked to delegate.",
                    "example": [
                      "clone:invoke"
                    ],
                    "minItems": 1,
                    "uniqueItems": true,
                    "maxItems": 10
                  },
                  "optional_scopes": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "clone:invoke",
                        "clone:learn",
                        "clone:invoke_shared",
                        "clone:upload",
                        "clone:review",
                        "clone:evidence"
                      ]
                    },
                    "nullable": true,
                    "description": "No longer needed: the consent screen starts with every requested capability ticked, and the owner can untick any. Still accepted, so existing clients keep working.",
                    "minItems": 1,
                    "uniqueItems": true
                  },
                  "replace_earlier_approvals": {
                    "type": "boolean",
                    "nullable": true,
                    "description": "No longer needed: exchanging any request ends the same owner's earlier grants for this installation. Still accepted, so existing clients keep working."
                  }
                },
                "required": [
                  "external_subject",
                  "idempotency_key",
                  "installation_id",
                  "requested_scopes"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "device_code": {
                      "type": "string",
                      "nullable": true,
                      "description": "Short-lived high-entropy secret used only to poll and exchange this request."
                    },
                    "user_code": {
                      "type": "string",
                      "nullable": true,
                      "description": "Short-lived human-entered code shown to the owner."
                    },
                    "verification_uri": {
                      "type": "string",
                      "nullable": true,
                      "description": "Mind Upload location where the owner reviews the request."
                    },
                    "verification_uri_complete": {
                      "type": "string",
                      "nullable": true,
                      "description": "Verification location with the human code prefilled."
                    },
                    "expires_in": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Seconds until the device authorization request expires."
                    },
                    "poll_interval": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Minimum seconds to wait between exchange polls."
                    },
                    "grant_duration_seconds": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Grant lifetime shown to the owner before consent."
                    }
                  },
                  "required": [
                    "device_code",
                    "error_message",
                    "expires_in",
                    "grant_duration_seconds",
                    "poll_interval",
                    "success",
                    "user_code",
                    "verification_uri",
                    "verification_uri_complete"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/exchange_external_authorization": {
      "post": {
        "operationId": "exchange_external_authorization",
        "summary": "Poll owner consent and exchange an approval for a clone-scoped grant token.",
        "description": "Poll no faster than `poll_interval`. `pending`, `slow_down`, and `denied` are successful protocol states without a token. After approval, repeated calls with the same unexpired device code return the same grant token, which makes a lost response safe to retry. On success the response includes `clone_ids` and `clone_nicknames` (id → display name) so partners can label linked clones immediately without a prior invoke.",
        "tags": [
          "External Authorization"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "device_code": {
                    "type": "string",
                    "description": "Short-lived high-entropy secret used only to poll and exchange this request.",
                    "example": "device-code-from-create-response",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  }
                },
                "required": [
                  "device_code"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "nullable": true,
                      "description": "Current authorization or invocation lifecycle state.",
                      "enum": [
                        "pending",
                        "slow_down",
                        "denied",
                        "expired",
                        "revoked",
                        "exchanged"
                      ]
                    },
                    "access_token": {
                      "type": "string",
                      "nullable": true,
                      "description": "Opaque grant token accepted only by grant inspection and external clone invocation; store it as a secret and never expose it to users."
                    },
                    "refresh_token": {
                      "type": "string",
                      "nullable": true,
                      "description": "Opaque grant-lifetime token used only with refresh_external_authorization; store it as a secret."
                    },
                    "token_type": {
                      "type": "string",
                      "nullable": true,
                      "description": "Authorization token type.",
                      "enum": [
                        "Bearer"
                      ]
                    },
                    "grant_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Stable grant identifier used by the owner-facing revocation surface."
                    },
                    "scopes": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "clone:invoke",
                          "clone:learn",
                          "clone:invoke_shared",
                          "clone:upload",
                          "clone:review",
                          "clone:evidence"
                        ]
                      },
                      "nullable": true,
                      "description": "Capabilities approved by the owner.",
                      "minItems": 1,
                      "uniqueItems": true
                    },
                    "clone_ids": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "AI consciousness resources selected by the owner."
                    },
                    "clone_nicknames": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Map of granted clone id to plaintext display nickname so partners can label linked clones immediately after approval."
                    },
                    "access_token_expires_at": {
                      "type": "integer",
                      "nullable": true,
                      "description": "UNIX timestamp after which the short-lived access token must be refreshed."
                    },
                    "expires_at": {
                      "type": "integer",
                      "nullable": true,
                      "description": "UNIX timestamp when this resource or capability expires."
                    },
                    "poll_interval": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Minimum seconds to wait between exchange polls."
                    }
                  },
                  "required": [
                    "access_token",
                    "access_token_expires_at",
                    "clone_ids",
                    "clone_nicknames",
                    "error_message",
                    "expires_at",
                    "grant_id",
                    "poll_interval",
                    "refresh_token",
                    "scopes",
                    "status",
                    "success",
                    "token_type"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/refresh_external_authorization": {
      "post": {
        "operationId": "refresh_external_authorization",
        "summary": "Refresh a short-lived clone-invocation access token.",
        "description": "Use the grant-lifetime refresh token before the access token expires. The refresh token is bound to the same authenticated application, installation, and external identity. Concurrent or repeated refreshes return the same current access token and never extend the owner-approved grant expiry. The response includes `clone_ids` and `clone_nicknames` so partners can keep display names warm across token rotation.",
        "tags": [
          "External Authorization"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "refresh_token": {
                    "type": "string",
                    "description": "Opaque grant-lifetime token used only with refresh_external_authorization; store it as a secret.",
                    "example": "refresh-token-from-exchange-response",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "installation_id": {
                    "type": "string",
                    "description": "Your stable opaque identifier for this app installation.",
                    "example": "your-installation-id",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "external_subject": {
                    "type": "string",
                    "description": "Your stable opaque identifier for the person authorizing this installation.",
                    "example": "your-external-user-id",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "idempotency_key": {
                    "type": "string",
                    "nullable": true,
                    "description": "A stable opaque event key that makes exact retries return the same outcome."
                  }
                },
                "required": [
                  "external_subject",
                  "installation_id",
                  "refresh_token"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "nullable": true,
                      "description": "Current authorization or invocation lifecycle state.",
                      "enum": [
                        "active",
                        "revoked",
                        "expired"
                      ]
                    },
                    "access_token": {
                      "type": "string",
                      "nullable": true,
                      "description": "Opaque grant token accepted only by grant inspection and external clone invocation; store it as a secret and never expose it to users."
                    },
                    "refresh_token": {
                      "type": "string",
                      "nullable": true,
                      "description": "Opaque grant-lifetime token used only with refresh_external_authorization; store it as a secret."
                    },
                    "token_type": {
                      "type": "string",
                      "nullable": true,
                      "description": "Authorization token type.",
                      "enum": [
                        "Bearer"
                      ]
                    },
                    "grant_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Stable grant identifier used by the owner-facing revocation surface."
                    },
                    "scopes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Capabilities approved by the owner."
                    },
                    "clone_ids": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "AI consciousness resources selected by the owner."
                    },
                    "clone_nicknames": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Map of granted clone id to plaintext display nickname (same shape as exchange)."
                    },
                    "access_token_expires_at": {
                      "type": "integer",
                      "nullable": true,
                      "description": "UNIX timestamp after which the short-lived access token must be refreshed."
                    },
                    "expires_at": {
                      "type": "integer",
                      "nullable": true,
                      "description": "UNIX timestamp when this resource or capability expires."
                    }
                  },
                  "required": [
                    "access_token",
                    "access_token_expires_at",
                    "clone_ids",
                    "clone_nicknames",
                    "error_message",
                    "expires_at",
                    "grant_id",
                    "refresh_token",
                    "scopes",
                    "status",
                    "success",
                    "token_type"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/inspect_external_authorization": {
      "post": {
        "operationId": "inspect_external_authorization",
        "summary": "Inspect the scopes, clone resources, expiry, and revocation state of a grant token.",
        "description": "Returns only authorization metadata. It never returns an owner password, session token, external identifier, memory, or conversation content.",
        "tags": [
          "External Authorization"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "access_token": {
                    "type": "string",
                    "description": "Opaque grant token accepted only by grant inspection and external clone invocation; store it as a secret and never expose it to users.",
                    "example": "grant-token-from-exchange-response",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  }
                },
                "required": [
                  "access_token"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "grant_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Stable grant identifier used by the owner-facing revocation surface."
                    },
                    "status": {
                      "type": "string",
                      "nullable": true,
                      "description": "Current authorization or invocation lifecycle state.",
                      "enum": [
                        "active",
                        "revoked",
                        "expired"
                      ]
                    },
                    "scopes": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "clone:invoke",
                          "clone:learn",
                          "clone:invoke_shared",
                          "clone:upload",
                          "clone:review",
                          "clone:evidence"
                        ]
                      },
                      "nullable": true,
                      "description": "Capabilities approved by the owner.",
                      "minItems": 1,
                      "uniqueItems": true
                    },
                    "clone_ids": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "AI consciousness resources selected by the owner."
                    },
                    "created_at": {
                      "type": "integer",
                      "nullable": true
                    },
                    "access_token_expires_at": {
                      "type": "integer",
                      "nullable": true,
                      "description": "UNIX timestamp after which the short-lived access token must be refreshed."
                    },
                    "expires_at": {
                      "type": "integer",
                      "nullable": true,
                      "description": "UNIX timestamp when this resource or capability expires."
                    },
                    "revoked_at": {
                      "type": "integer",
                      "nullable": true,
                      "description": "UNIX timestamp when the owner revoked the grant, or null."
                    }
                  },
                  "required": [
                    "access_token_expires_at",
                    "clone_ids",
                    "created_at",
                    "error_message",
                    "expires_at",
                    "grant_id",
                    "revoked_at",
                    "scopes",
                    "status",
                    "success"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/end_external_authorization": {
      "post": {
        "operationId": "end_external_authorization",
        "summary": "End a grant your application holds, for example when its user disconnects.",
        "description": "Ends the grant behind `access_token`, proven with the same installation and external identity it was issued for. Its tokens stop working at once and the owner sees it as revoked. `ended` is false when the grant had already ended.",
        "tags": [
          "External Authorization"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "access_token": {
                    "type": "string",
                    "description": "Opaque grant token accepted only by grant inspection and external clone invocation; store it as a secret and never expose it to users.",
                    "example": "grant-token-from-exchange-response",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "installation_id": {
                    "type": "string",
                    "description": "Your stable opaque identifier for this app installation.",
                    "example": "your-installation-id",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "external_subject": {
                    "type": "string",
                    "description": "Your stable opaque identifier for the person authorizing this installation.",
                    "example": "your-external-user-id",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  }
                },
                "required": [
                  "access_token",
                  "external_subject",
                  "installation_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "ended": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "Whether this call ended the grant; false when it had already ended."
                    },
                    "grant_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Stable grant identifier used by the owner-facing revocation surface."
                    }
                  },
                  "required": [
                    "ended",
                    "error_message",
                    "grant_id",
                    "success"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/invoke_external_clone": {
      "post": {
        "operationId": "invoke_external_clone",
        "summary": "Send one idempotent text event to an owner-approved AI consciousness.",
        "description": "Requires the partner key plus an active `clone:invoke` grant bound to the same installation, external identity, and clone. Use a provider event id as `idempotency_key`: exact retries return the stored encrypted outcome and never run generation twice. A concurrent retry returns `processing` with `retry_after_seconds`; an abandoned receipt eventually becomes terminal `failed` and is not regenerated with the same key. The message may include media links so the consciousness can perceive a shared image, clip, or audio; `media_analysis` then says, link by link, whether it actually did. To let it take part in a group conversation, set `is_group`, pass a stable `conversation_id` (each thread keeps its own separate history), and attach the recent surrounding turns as `context_messages` with a `speaker_label` for who is speaking now; the surrounding turns are treated purely as quoted context. The owner must retain normal subscription entitlement; this operation does not spend credits.",
        "tags": [
          "External Authorization"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "access_token": {
                    "type": "string",
                    "description": "Opaque grant token accepted only by grant inspection and external clone invocation; store it as a secret and never expose it to users.",
                    "example": "grant-token-from-exchange-response",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "literal_text": {
                    "type": "boolean",
                    "description": "When true, marker-like text is quoted literally and cannot fetch media. Only the owner’s own clone is accepted; use explicit consolidation/save for learning. For an app we have approved as one owners use personally as their own Mind Upload app, a one-on-one conversation turn is the owner’s own chat, and media links in `text` are then fetched and analyzed as in the Mind Upload app.",
                    "default": false
                  },
                  "media_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 24,
                      "maxLength": 24,
                      "pattern": "^[0-9a-fA-F]{24}$"
                    },
                    "nullable": true,
                    "description": "Completed controlled media IDs, checked for ownership, application, scope, retention and exact object version. No analysis is started here.",
                    "maxItems": 20,
                    "uniqueItems": true
                  },
                  "references": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "title": {
                          "type": "string",
                          "description": "The page's title, as the person saw it."
                        },
                        "url": {
                          "type": "string",
                          "description": "The page's address: `http` or `https`, with no user name or password. Kept as where the passage came from; never fetched."
                        },
                        "text": {
                          "type": "string",
                          "description": "The passage taken from the page."
                        }
                      },
                      "required": [
                        "text",
                        "title",
                        "url"
                      ]
                    },
                    "nullable": true,
                    "description": "Quoted page or subtitle sources kept separate from owner statements. Titles, URLs and bodies share the request text bound; URLs are never fetched.",
                    "maxItems": 30
                  },
                  "installation_id": {
                    "type": "string",
                    "description": "Your stable opaque identifier for this app installation.",
                    "example": "your-installation-id",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "external_subject": {
                    "type": "string",
                    "description": "Your stable opaque identifier for the person authorizing this installation.",
                    "example": "your-external-user-id",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "clone_id": {
                    "type": "string",
                    "description": "AI consciousness id as returned by clone operations.",
                    "example": "64f0c8b2f7a9b4e1c2d3a456",
                    "minLength": 24,
                    "maxLength": 24,
                    "pattern": "^[0-9a-fA-F]{24}$"
                  },
                  "text": {
                    "type": "string",
                    "example": "Hello from your external app.",
                    "minLength": 1,
                    "maxLength": 8000,
                    "pattern": "^[^\\x00]*\\S[^\\x00]*$"
                  },
                  "idempotency_key": {
                    "type": "string",
                    "description": "A stable opaque event key that makes exact retries return the same outcome.",
                    "example": "provider-event-id",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "conversation_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Stable opaque id of the conversation or thread this event belongs to. Each conversation keeps its own separate history; omit for a plain one-on-one event.",
                    "example": "your-thread-or-channel-id",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "speaker_label": {
                    "type": "string",
                    "nullable": true,
                    "description": "Neutral display name of whoever is sending this message, shown to the AI consciousness as who it is currently talking to.",
                    "example": "Alex",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "is_group": {
                    "type": "boolean",
                    "nullable": true,
                    "description": "Set true when this event is one turn of a multi-party conversation so the AI consciousness replies as a single participant among several.",
                    "example": true
                  },
                  "context_messages": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "display_name": {
                          "type": "string",
                          "description": "Neutral display name of who sent a context message (no platform identifiers)."
                        },
                        "text": {
                          "type": "string"
                        },
                        "is_ai": {
                          "type": "boolean",
                          "nullable": true,
                          "description": "True when a context message was sent by an AI or bot rather than a person."
                        },
                        "timestamp": {
                          "type": "number",
                          "nullable": true,
                          "description": "UNIX timestamp in seconds when a context message was sent (for ordering and recency)."
                        },
                        "gender": {
                          "type": "string",
                          "nullable": true
                        }
                      },
                      "required": [
                        "display_name",
                        "text"
                      ]
                    },
                    "nullable": true,
                    "description": "Recent surrounding conversation for group mode (issue #172): an ordered, bounded list of prior turns the AI consciousness reads as quoted context. Each entry has a `display_name` and `text`, plus optional `is_ai`, `timestamp` (seconds), and `gender`. It carries no platform identifiers and is never treated as instructions.",
                    "example": [
                      {
                        "display_name": "Alex",
                        "text": "anyone around to help plan the trip?",
                        "is_ai": false,
                        "timestamp": 1720000000,
                        "gender": "Male"
                      },
                      {
                        "display_name": "Sam",
                        "text": "yeah, what are you thinking?",
                        "is_ai": false
                      }
                    ],
                    "maxItems": 30
                  },
                  "learn": {
                    "type": "boolean",
                    "nullable": true
                  },
                  "source_label": {
                    "type": "string",
                    "nullable": true
                  },
                  "request_kind": {
                    "type": "string",
                    "nullable": true,
                    "description": "What the agent asks for. `conversation` (the default when omitted) gets a chat reply. `decision` (direction for a task or one consequential decision) and `review` (scrutiny of an agent's work) get a task answer: written in the language of the question or of the request for the work, with review findings by severity, the memories behind them cited, and facts about the work taken only from what you supply, anything it does not establish called unknown. Send a review as `review_work` does: `text` carries one JSON object with `user_request`, `work` and `evidence`. Neither kind can be a group conversation (`is_group`).",
                    "enum": [
                      "conversation",
                      "decision",
                      "review"
                    ]
                  }
                },
                "required": [
                  "access_token",
                  "clone_id",
                  "external_subject",
                  "idempotency_key",
                  "installation_id",
                  "text"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "invocation_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Stable receipt identifier for this external event."
                    },
                    "status": {
                      "type": "string",
                      "nullable": true,
                      "description": "Current authorization or invocation lifecycle state.",
                      "enum": [
                        "processing",
                        "succeeded",
                        "failed"
                      ]
                    },
                    "response_text": {
                      "type": "string",
                      "nullable": true,
                      "description": "The AI consciousness reply when status is `succeeded`."
                    },
                    "clone_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "AI consciousness id as returned by clone operations."
                    },
                    "clone_nickname": {
                      "type": "string",
                      "nullable": true,
                      "description": "User-facing name of the invoked AI consciousness."
                    },
                    "generated_by_ai": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when the returned response was generated by an AI consciousness."
                    },
                    "idempotent_replay": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when this response came from an existing durable receipt."
                    },
                    "retry_after_seconds": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Suggested delay before retrying the same event while processing."
                    },
                    "media_analysis": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "media_type": {
                            "type": "string",
                            "enum": [
                              "image",
                              "audio",
                              "video"
                            ],
                            "description": "The kind of media: `image`, `video`, or `audio`."
                          },
                          "analysis_outcome": {
                            "type": "string",
                            "enum": [
                              "analyzed",
                              "refused",
                              "failed"
                            ],
                            "description": "What happened to this media link: `analyzed` when the consciousness received a description of it; `refused` when it was not opened at all; `failed` when it was meant to be analyzed but no description resulted. Only `analyzed` media was perceived; treat anything else as not seen."
                          },
                          "analysis_outcome_reason": {
                            "type": "string",
                            "enum": [
                              "hosted_by_mind_upload",
                              "export_not_allowed",
                              "analysis_unavailable",
                              "download_failed",
                              "analysis_failed",
                              "content_filtered",
                              "empty_analysis",
                              "time_budget_exhausted",
                              "item_limit_reached"
                            ],
                            "description": "Why the link was not analyzed, present on every entry except `analyzed`: `hosted_by_mind_upload` (refused): the link points at media stored by Mind Upload, which a link in `text` never opens; `export_not_allowed` (refused): the data-handling rules that apply to your application do not allow its media to be sent for analysis; `analysis_unavailable` (failed): media analysis is not available; `download_failed` (failed): the link could not be fetched, because it is not a public address, redirected somewhere unsafe, answered an error status, named a video that could not be found, was larger than the size limit, or took too long; `analysis_failed` (failed): the media was fetched but could not be analyzed; `content_filtered` (failed): the analysis declined to describe this content; the same media is not sent for analysis again for 24 hours; `empty_analysis` (failed): the analysis produced no description; the same media is not sent for analysis again for 24 hours; `time_budget_exhausted` (failed): the analysis did not finish within the time a reply allows; `item_limit_reached` (failed): the call carried more new media than one call analyzes; media in `text` is analyzed before media in `context_messages`."
                          }
                        },
                        "required": [
                          "analysis_outcome",
                          "media_type"
                        ]
                      },
                      "description": "One entry per media link in `text`, in the order the links appear, saying whether the consciousness actually perceived it. Entries carry no URL; match them to your links by position. Present on a `succeeded` result whose `text` carried media links, idempotent replays included; absent otherwise, with `literal_text` (including a turn in the owner’s own chat, whose media is read as the Mind Upload app reads it), and on a replay of an invocation made before this field existed."
                    },
                    "chat_id": {
                      "type": "string",
                      "description": "One-on-one chat turn id."
                    }
                  },
                  "required": [
                    "clone_id",
                    "clone_nickname",
                    "error_message",
                    "generated_by_ai",
                    "idempotent_replay",
                    "invocation_id",
                    "response_text",
                    "retry_after_seconds",
                    "status",
                    "success"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/upload_external_mind_data": {
      "post": {
        "operationId": "upload_external_mind_data",
        "summary": "Upload mind data (text and media) into the owner's own AI consciousness.",
        "description": "Upload mind data (text and/or media tags) into the owner's own AI consciousness under an active `clone:upload` grant. Uploads are unbilled and quarantined for owner review unless the owner enabled auto-keep, or we have approved your app as one that uploads only what the owner wrote; `pending_owner_review` in the result says which happened. A supplied `idempotency_key` deduplicates the complete request until account deletion; changing its payload is rejected. Retry `processing` results with the same key after `retry_after_seconds`. A `succeeded` replay means the original submission completed; it never restores a subsequently edited or deleted memory. Legacy requests without a key retain their previous behavior. Each media tag is replaced with a written description of what was uploaded, so the stored text is longer than what you send; if the result exceeds 50000 characters the request is rejected with 400. Sending fewer attachments or shorter text avoids it.",
        "tags": [
          "External Authorization"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "access_token": {
                    "type": "string",
                    "description": "Opaque grant token accepted only by grant inspection and external clone invocation; store it as a secret and never expose it to users.",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "literal_text": {
                    "type": "boolean",
                    "description": "When true, upload the exact edited body without interpreting embedded media markers.",
                    "default": false
                  },
                  "media_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 24,
                      "maxLength": 24,
                      "pattern": "^[0-9a-fA-F]{24}$"
                    },
                    "nullable": true,
                    "description": "Completed controlled media IDs, checked for ownership, application, scope, retention and exact object version. No analysis is started here.",
                    "maxItems": 20,
                    "uniqueItems": true
                  },
                  "installation_id": {
                    "type": "string",
                    "description": "Your stable opaque identifier for this app installation.",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "external_subject": {
                    "type": "string",
                    "description": "Your stable opaque identifier for the person authorizing this installation.",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "clone_id": {
                    "type": "string",
                    "description": "AI consciousness id as returned by clone operations.",
                    "minLength": 24,
                    "maxLength": 24,
                    "pattern": "^[0-9a-fA-F]{24}$"
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 8000,
                    "pattern": "^[^\\x00]*\\S[^\\x00]*$"
                  },
                  "text_type": {
                    "type": "string",
                    "nullable": true,
                    "enum": [
                      "memory",
                      "persona",
                      "conscious"
                    ]
                  },
                  "idempotency_key": {
                    "type": "string",
                    "nullable": true,
                    "description": "Optional for legacy clients. Reuse for retries of the same complete upload. A key is bound to the partner, grant, installation, external identity, clone, text type, text and provenance; changing any part is rejected. Receipts survive text deletion and are removed with the account.",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "preview_id": {
                    "type": "string",
                    "nullable": true
                  },
                  "source_label": {
                    "type": "string",
                    "nullable": true
                  }
                },
                "required": [
                  "access_token",
                  "clone_id",
                  "external_subject",
                  "installation_id",
                  "text"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "clone_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "AI consciousness id as returned by clone operations."
                    },
                    "text_type": {
                      "type": "string",
                      "nullable": true
                    },
                    "pending_owner_review": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "text_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Original submitted memory id once committed. A replay does not assert this memory still exists or restore an edited or deleted body."
                    },
                    "status": {
                      "type": "string",
                      "nullable": true,
                      "description": "For keyed requests: processing or succeeded. Processing is not success; retry the same request and key after retry_after_seconds.",
                      "enum": [
                        "processing",
                        "succeeded"
                      ]
                    },
                    "idempotent_replay": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when this response came from an existing durable receipt."
                    },
                    "retry_after_seconds": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Suggested delay before retrying the same event while processing."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/request_external_media_upload": {
      "post": {
        "operationId": "request_external_media_upload",
        "summary": "Authorize one exact media upload to the owner’s granted AI consciousness. Needs `clone:evidence` (analysis only, never kept as a memory) or `clone:upload`.",
        "tags": [
          "External Authorization"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "access_token": {
                    "type": "string",
                    "description": "Opaque grant token accepted only by grant inspection and external clone invocation; store it as a secret and never expose it to users.",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "installation_id": {
                    "type": "string",
                    "description": "Your stable opaque identifier for this app installation.",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "external_subject": {
                    "type": "string",
                    "description": "Your stable opaque identifier for the person authorizing this installation.",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "clone_id": {
                    "type": "string",
                    "description": "AI consciousness id as returned by clone operations.",
                    "minLength": 24,
                    "maxLength": 24,
                    "pattern": "^[0-9a-fA-F]{24}$"
                  },
                  "idempotency_key": {
                    "type": "string",
                    "description": "A stable opaque event key that makes exact retries return the same outcome.",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "filename": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "content_type": {
                    "type": "string",
                    "enum": [
                      "application/ogg",
                      "audio/3gpp",
                      "audio/aac",
                      "audio/m4a",
                      "audio/mp3",
                      "audio/mp4",
                      "audio/mpeg",
                      "audio/ogg",
                      "audio/wav",
                      "audio/wave",
                      "audio/webm",
                      "audio/x-m4a",
                      "audio/x-wav",
                      "image/gif",
                      "image/heic",
                      "image/heif",
                      "image/jpeg",
                      "image/png",
                      "image/webp",
                      "video/3gpp",
                      "video/avi",
                      "video/mp4",
                      "video/ogg",
                      "video/quicktime",
                      "video/webm",
                      "video/x-flv",
                      "video/x-m4v",
                      "video/x-matroska",
                      "video/x-ms-wmv",
                      "video/x-msvideo"
                    ]
                  },
                  "file_size_bytes": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "media_type": {
                    "type": "string",
                    "description": "The kind of media: `image`, `video`, or `audio`.",
                    "enum": [
                      "image",
                      "video",
                      "audio"
                    ]
                  }
                },
                "required": [
                  "access_token",
                  "clone_id",
                  "content_type",
                  "external_subject",
                  "file_size_bytes",
                  "filename",
                  "idempotency_key",
                  "installation_id",
                  "media_type"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "upload_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Multipart upload session id returned by `request_multipart_upload`."
                    },
                    "presigned_url": {
                      "type": "string",
                      "nullable": true,
                      "description": "Temporary URL where the client uploads the file or part."
                    },
                    "content_type": {
                      "type": "string",
                      "nullable": true
                    },
                    "file_size_bytes": {
                      "type": "integer",
                      "nullable": true
                    },
                    "expires_at": {
                      "type": "integer",
                      "nullable": true,
                      "description": "UNIX timestamp when this resource or capability expires."
                    },
                    "idempotent_replay": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when this response came from an existing durable receipt."
                    },
                    "required_headers": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Send these exact headers with the PUT, including the signed If-None-Match: * condition. An existing object answers 412; inspect/start its stored analysis to recover a lost acknowledgement, never remove the condition."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/cancel_external_media_upload": {
      "post": {
        "operationId": "cancel_external_media_upload",
        "summary": "Cancel one controlled upload through the existing media lifecycle.",
        "tags": [
          "External Authorization"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "access_token": {
                    "type": "string",
                    "description": "Opaque grant token accepted only by grant inspection and external clone invocation; store it as a secret and never expose it to users.",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "installation_id": {
                    "type": "string",
                    "description": "Your stable opaque identifier for this app installation.",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "external_subject": {
                    "type": "string",
                    "description": "Your stable opaque identifier for the person authorizing this installation.",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "clone_id": {
                    "type": "string",
                    "description": "AI consciousness id as returned by clone operations.",
                    "minLength": 24,
                    "maxLength": 24,
                    "pattern": "^[0-9a-fA-F]{24}$"
                  },
                  "upload_id": {
                    "type": "string",
                    "description": "Server-issued controlled upload reference returned by request_external_media_upload; never a URL.",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  }
                },
                "required": [
                  "access_token",
                  "clone_id",
                  "external_subject",
                  "installation_id",
                  "upload_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/start_external_media_analysis": {
      "post": {
        "operationId": "start_external_media_analysis",
        "summary": "Explicitly describe one completed controlled upload.",
        "tags": [
          "External Authorization"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "access_token": {
                    "type": "string",
                    "description": "Opaque grant token accepted only by grant inspection and external clone invocation; store it as a secret and never expose it to users.",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "installation_id": {
                    "type": "string",
                    "description": "Your stable opaque identifier for this app installation.",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "external_subject": {
                    "type": "string",
                    "description": "Your stable opaque identifier for the person authorizing this installation.",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "clone_id": {
                    "type": "string",
                    "description": "AI consciousness id as returned by clone operations.",
                    "minLength": 24,
                    "maxLength": 24,
                    "pattern": "^[0-9a-fA-F]{24}$"
                  },
                  "upload_id": {
                    "type": "string",
                    "description": "Server-issued controlled upload reference returned by request_external_media_upload; never a URL.",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  }
                },
                "required": [
                  "access_token",
                  "clone_id",
                  "external_subject",
                  "installation_id",
                  "upload_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "media": {
                      "type": "object",
                      "properties": {
                        "media_id": {
                          "type": "string"
                        },
                        "media_type": {
                          "type": "string",
                          "description": "The kind of media: `image`, `video`, or `audio`."
                        },
                        "analysis_status": {
                          "type": "string",
                          "description": "How far this attachment's description had got at the moment this call returned: `pending` when it was just started, `processing` while it is being written, `completed` when it is already available, and `failed` when this attachment could not be started at all, or was analyzed and the analysis declined to describe it — the other entries are unaffected and the attachment is still sendable, though a declined one stays undescribed when it is sent. The value is never updated afterwards and there is nothing to poll: calling again to see a newer one is a fresh charged request that buys no more than sending the message does."
                        },
                        "analysis_text": {
                          "type": "string",
                          "nullable": true
                        },
                        "media_url": {
                          "type": "string",
                          "description": "Media URL returned by this operation; use signed read URLs unchanged."
                        },
                        "content_type": {
                          "type": "string"
                        },
                        "file_size_bytes": {
                          "type": "integer"
                        },
                        "expires_at": {
                          "type": "integer",
                          "description": "UNIX timestamp when this resource or capability expires."
                        },
                        "draft_expires_at": {
                          "type": "integer",
                          "nullable": true
                        }
                      },
                      "required": [
                        "analysis_status",
                        "analysis_text",
                        "content_type",
                        "draft_expires_at",
                        "expires_at",
                        "file_size_bytes",
                        "media_id",
                        "media_type",
                        "media_url"
                      ],
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/get_external_media_analysis": {
      "post": {
        "operationId": "get_external_media_analysis",
        "summary": "Read the current owned media analysis without restarting generation.",
        "tags": [
          "External Authorization"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "access_token": {
                    "type": "string",
                    "description": "Opaque grant token accepted only by grant inspection and external clone invocation; store it as a secret and never expose it to users.",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "installation_id": {
                    "type": "string",
                    "description": "Your stable opaque identifier for this app installation.",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "external_subject": {
                    "type": "string",
                    "description": "Your stable opaque identifier for the person authorizing this installation.",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "clone_id": {
                    "type": "string",
                    "description": "AI consciousness id as returned by clone operations.",
                    "minLength": 24,
                    "maxLength": 24,
                    "pattern": "^[0-9a-fA-F]{24}$"
                  },
                  "upload_id": {
                    "type": "string",
                    "description": "Server-issued controlled upload reference returned by request_external_media_upload; never a URL.",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  }
                },
                "required": [
                  "access_token",
                  "clone_id",
                  "external_subject",
                  "installation_id",
                  "upload_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "media": {
                      "type": "object",
                      "properties": {
                        "media_id": {
                          "type": "string"
                        },
                        "media_type": {
                          "type": "string",
                          "description": "The kind of media: `image`, `video`, or `audio`."
                        },
                        "analysis_status": {
                          "type": "string",
                          "description": "How far this attachment's description had got at the moment this call returned: `pending` when it was just started, `processing` while it is being written, `completed` when it is already available, and `failed` when this attachment could not be started at all, or was analyzed and the analysis declined to describe it — the other entries are unaffected and the attachment is still sendable, though a declined one stays undescribed when it is sent. The value is never updated afterwards and there is nothing to poll: calling again to see a newer one is a fresh charged request that buys no more than sending the message does."
                        },
                        "analysis_text": {
                          "type": "string",
                          "nullable": true
                        },
                        "media_url": {
                          "type": "string",
                          "description": "Media URL returned by this operation; use signed read URLs unchanged."
                        },
                        "content_type": {
                          "type": "string"
                        },
                        "file_size_bytes": {
                          "type": "integer"
                        },
                        "expires_at": {
                          "type": "integer",
                          "description": "UNIX timestamp when this resource or capability expires."
                        },
                        "draft_expires_at": {
                          "type": "integer",
                          "nullable": true
                        }
                      },
                      "required": [
                        "analysis_status",
                        "analysis_text",
                        "content_type",
                        "draft_expires_at",
                        "expires_at",
                        "file_size_bytes",
                        "media_id",
                        "media_type",
                        "media_url"
                      ],
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/get_external_media_policy": {
      "post": {
        "operationId": "get_external_media_policy",
        "summary": "Read current native media limits and owner quota without starting work.",
        "tags": [
          "External Authorization"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "access_token": {
                    "type": "string",
                    "description": "Opaque grant token accepted only by grant inspection and external clone invocation; store it as a secret and never expose it to users.",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "installation_id": {
                    "type": "string",
                    "description": "Your stable opaque identifier for this app installation.",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "external_subject": {
                    "type": "string",
                    "description": "Your stable opaque identifier for the person authorizing this installation.",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
                  },
                  "clone_id": {
                    "type": "string",
                    "description": "AI consciousness id as returned by clone operations.",
                    "minLength": 24,
                    "maxLength": 24,
                    "pattern": "^[0-9a-fA-F]{24}$"
                  }
                },
                "required": [
                  "access_token",
                  "clone_id",
                  "external_subject",
                  "installation_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "allowed_content_types": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "max_file_size_bytes_by_type": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "integer"
                      }
                    },
                    "video_frame_count": {
                      "type": "integer",
                      "description": "Current configured number of frames taken from a video that is analyzed frame by frame. A short, small video is analyzed whole instead, and no frames are taken from it. Auxiliary spelling/reference calls and retries are additional; this is not a model-call or money ceiling."
                    },
                    "video_audio_max_seconds": {
                      "type": "integer",
                      "description": "Current maximum seconds of audio extracted from the beginning of the uploaded video; shorter or silent files use less."
                    },
                    "can_upload": {
                      "type": "boolean"
                    },
                    "can_analyze": {
                      "type": "boolean",
                      "description": "Current feature, scope, membership and application-route eligibility. Explicit start still applies authoritative partner and owner admission limits."
                    },
                    "remaining_storage_bytes": {
                      "type": "integer"
                    },
                    "remaining_uploads_monthly": {
                      "type": "integer",
                      "description": "Advisory current native monthly upload slots. The upload transaction rechecks and reserves a slot; reading policy reserves nothing."
                    },
                    "upload_limit_monthly": {
                      "type": "integer"
                    },
                    "upload_count_renews_at": {
                      "type": "integer",
                      "nullable": true
                    },
                    "retention_days": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/consolidate_external_conversation": {
      "post": {
        "operationId": "consolidate_external_conversation",
        "summary": "Prepare a verified memory from an explicitly selected owner conversation.",
        "description": "Use one `idempotency_key` per memory you want prepared: an exact retry with the same key returns the stored outcome, `failed` included, instead of preparing another. A concurrent retry returns `processing` with `retry_after_seconds`. Only `ready` counts toward the wait between memories: `failed` means nothing was prepared, so send the request again with a new key.",
        "tags": [
          "External Authorization"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "access_token": {
                    "type": "string",
                    "description": "Opaque grant token accepted only by grant inspection and external clone invocation; store it as a secret and never expose it to users."
                  },
                  "installation_id": {
                    "type": "string",
                    "description": "Your stable opaque identifier for this app installation."
                  },
                  "external_subject": {
                    "type": "string",
                    "description": "Your stable opaque identifier for the person authorizing this installation."
                  },
                  "clone_id": {
                    "type": "string",
                    "description": "AI consciousness id as returned by clone operations."
                  },
                  "idempotency_key": {
                    "type": "string",
                    "description": "A stable opaque event key that makes exact retries return the same outcome."
                  },
                  "current_text": {
                    "type": "string"
                  },
                  "clone_response": {
                    "type": "string"
                  },
                  "context_messages": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "display_name": {
                          "type": "string",
                          "description": "Neutral display name of who sent a context message (no platform identifiers)."
                        },
                        "text": {
                          "type": "string"
                        },
                        "is_ai": {
                          "type": "boolean",
                          "nullable": true,
                          "description": "True when a context message was sent by an AI or bot rather than a person."
                        },
                        "timestamp": {
                          "type": "number",
                          "nullable": true,
                          "description": "UNIX timestamp in seconds when a context message was sent (for ordering and recency)."
                        },
                        "gender": {
                          "type": "string",
                          "nullable": true
                        }
                      },
                      "required": [
                        "display_name",
                        "text"
                      ]
                    },
                    "nullable": true
                  },
                  "references": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "title": {
                          "type": "string",
                          "description": "The page's title, as the person saw it."
                        },
                        "url": {
                          "type": "string",
                          "description": "The page's address: `http` or `https`, with no user name or password. Kept as where the passage came from; never fetched."
                        },
                        "text": {
                          "type": "string",
                          "description": "The passage taken from the page."
                        }
                      },
                      "required": [
                        "text",
                        "title",
                        "url"
                      ]
                    },
                    "nullable": true
                  },
                  "speaker_label": {
                    "type": "string",
                    "nullable": true,
                    "description": "Neutral display name of whoever is sending this message, shown to the AI consciousness as who it is currently talking to."
                  },
                  "source_label": {
                    "type": "string",
                    "nullable": true
                  },
                  "media_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "nullable": true
                  },
                  "purpose": {
                    "type": "string",
                    "enum": [
                      "conversation",
                      "reading"
                    ],
                    "default": "conversation"
                  },
                  "owner_notes": {
                    "type": "string",
                    "nullable": true
                  }
                },
                "required": [
                  "access_token",
                  "clone_id",
                  "clone_response",
                  "current_text",
                  "external_subject",
                  "idempotency_key",
                  "installation_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "processing",
                        "ready",
                        "empty",
                        "failed"
                      ],
                      "description": "Current authorization or invocation lifecycle state."
                    },
                    "text": {
                      "type": "string",
                      "nullable": true
                    },
                    "auto_keep_external_memories": {
                      "type": "boolean"
                    },
                    "retry_after_seconds": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Suggested delay before retrying the same event while processing."
                    },
                    "preview_id": {
                      "type": "string",
                      "nullable": true
                    },
                    "reading_provenance": {
                      "type": "object",
                      "properties": {
                        "content_state": {
                          "type": "string",
                          "enum": [
                            "checked_candidate",
                            "owner_edited"
                          ]
                        },
                        "memory_kinds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "sources": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "source_kind": {
                                "type": "string",
                                "enum": [
                                  "page",
                                  "media"
                                ]
                              },
                              "title": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string",
                                "description": "Where the attachment is — the `media_url` an upload returned, or an external link. Echoed back in the result so you can match each entry to what you sent."
                              },
                              "media_id": {
                                "type": "string"
                              },
                              "source_id": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "source_id",
                              "source_kind"
                            ]
                          }
                        }
                      },
                      "required": [
                        "content_state",
                        "memory_kinds",
                        "sources"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "This AI consciousness prepared a memory moments ago, or today's memories awaiting its owner's review are full. The `Retry-After` header says how many seconds until a new one can be prepared; send the request again then."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/get_external_quarantined_texts": {
      "post": {
        "operationId": "get_external_quarantined_texts",
        "summary": "List pending memories of the owner's granted AI consciousness.",
        "tags": [
          "External Authorization"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "page": {
                    "type": "integer",
                    "nullable": true,
                    "default": 1
                  },
                  "page_size": {
                    "type": "integer",
                    "description": "Maximum records requested for one server-capped page.",
                    "default": 30
                  },
                  "sort_by": {
                    "type": "string",
                    "nullable": true,
                    "default": "created_at"
                  },
                  "sort_order": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Sort direction; supported values depend on the operation.",
                    "default": -1
                  },
                  "use_cursor_pagination": {
                    "type": "boolean",
                    "nullable": true,
                    "default": true
                  },
                  "cursor_value": {
                    "type": "number",
                    "nullable": true,
                    "description": "Opaque pagination cursor value from the previous page (`next_cursor_value`)."
                  },
                  "cursor_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Opaque pagination cursor id from the previous page (`next_cursor_id`)."
                  },
                  "access_token": {
                    "type": "string",
                    "description": "Opaque grant token accepted only by grant inspection and external clone invocation; store it as a secret and never expose it to users."
                  },
                  "installation_id": {
                    "type": "string",
                    "description": "Your stable opaque identifier for this app installation."
                  },
                  "external_subject": {
                    "type": "string",
                    "description": "Your stable opaque identifier for the person authorizing this installation."
                  },
                  "clone_id": {
                    "type": "string",
                    "description": "AI consciousness id as returned by clone operations."
                  }
                },
                "required": [
                  "access_token",
                  "clone_id",
                  "external_subject",
                  "installation_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "total_count": {
                      "type": "integer",
                      "nullable": true
                    },
                    "page": {
                      "type": "integer",
                      "nullable": true
                    },
                    "page_size": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Maximum records requested for one server-capped page."
                    },
                    "total_pages": {
                      "type": "integer",
                      "nullable": true
                    },
                    "has_next": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when another page is available after this response."
                    },
                    "has_prev": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "next_cursor_value": {
                      "type": "number",
                      "nullable": true,
                      "description": "Pass as `cursor_value` on the next page request."
                    },
                    "next_cursor_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Pass as `cursor_id` on the next page request."
                    },
                    "texts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text_id": {
                            "type": "string"
                          },
                          "media_upload_ids": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "text": {
                            "type": "string"
                          },
                          "text_type": {
                            "type": "string"
                          },
                          "source_label": {
                            "type": "string",
                            "nullable": true
                          },
                          "created_at": {
                            "type": "integer",
                            "nullable": true
                          },
                          "updated_at": {
                            "type": "integer",
                            "nullable": true,
                            "description": "Opaque freshness watermark to send back as `known_updated_at` on the next poll."
                          },
                          "pending_owner_review": {
                            "type": "boolean"
                          },
                          "content_revision": {
                            "type": "string"
                          },
                          "reading_provenance": {
                            "type": "object",
                            "properties": {
                              "content_state": {
                                "type": "string",
                                "enum": [
                                  "checked_candidate",
                                  "owner_edited"
                                ]
                              },
                              "memory_kinds": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "sources": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "source_kind": {
                                      "type": "string",
                                      "enum": [
                                        "page",
                                        "media"
                                      ]
                                    },
                                    "title": {
                                      "type": "string"
                                    },
                                    "url": {
                                      "type": "string",
                                      "description": "Where the attachment is — the `media_url` an upload returned, or an external link. Echoed back in the result so you can match each entry to what you sent."
                                    },
                                    "media_id": {
                                      "type": "string"
                                    },
                                    "source_id": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "source_id",
                                    "source_kind"
                                  ]
                                }
                              }
                            },
                            "required": [
                              "content_state",
                              "memory_kinds",
                              "sources"
                            ]
                          }
                        },
                        "required": [
                          "content_revision",
                          "created_at",
                          "pending_owner_review",
                          "source_label",
                          "text",
                          "text_id",
                          "text_type",
                          "updated_at"
                        ]
                      }
                    },
                    "scopes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Capabilities approved by the owner."
                    },
                    "can_invoke": {
                      "type": "boolean"
                    },
                    "can_upload": {
                      "type": "boolean"
                    },
                    "can_consolidate": {
                      "type": "boolean"
                    },
                    "auto_keep_external_memories": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/review_external_quarantined_text": {
      "post": {
        "operationId": "review_external_quarantined_text",
        "summary": "Edit, approve or reject the displayed revision of one pending memory.",
        "tags": [
          "External Authorization"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "access_token": {
                    "type": "string",
                    "description": "Opaque grant token accepted only by grant inspection and external clone invocation; store it as a secret and never expose it to users."
                  },
                  "installation_id": {
                    "type": "string",
                    "description": "Your stable opaque identifier for this app installation."
                  },
                  "external_subject": {
                    "type": "string",
                    "description": "Your stable opaque identifier for the person authorizing this installation."
                  },
                  "clone_id": {
                    "type": "string",
                    "description": "AI consciousness id as returned by clone operations."
                  },
                  "idempotency_key": {
                    "type": "string",
                    "description": "A stable opaque event key that makes exact retries return the same outcome."
                  },
                  "text_id": {
                    "type": "string"
                  },
                  "expected_content_revision": {
                    "type": "string"
                  },
                  "decision": {
                    "type": "string",
                    "enum": [
                      "approve",
                      "reject",
                      "update"
                    ]
                  },
                  "text": {
                    "type": "string",
                    "nullable": true
                  }
                },
                "required": [
                  "access_token",
                  "clone_id",
                  "decision",
                  "expected_content_revision",
                  "external_subject",
                  "idempotency_key",
                  "installation_id",
                  "text_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "processing",
                        "updated",
                        "approved",
                        "rejected"
                      ],
                      "description": "Current authorization or invocation lifecycle state."
                    },
                    "text_id": {
                      "type": "string"
                    },
                    "text": {
                      "type": "string",
                      "nullable": true
                    },
                    "content_revision": {
                      "type": "string",
                      "nullable": true
                    },
                    "pending_owner_review": {
                      "type": "boolean"
                    },
                    "retry_after_seconds": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Suggested delay before retrying the same event while processing."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/get_external_chat": {
      "post": {
        "operationId": "get_external_chat",
        "summary": "Read the owner's own chat with their AI consciousness, a page at a time.",
        "description": "One page of the owner's own one-on-one chat with the granted AI consciousness, newest first, with the same fields and paging as the chat the Mind Upload app shows: pass the previous page's `next_cursor_value` and `next_cursor_id` to read further back. Needs `clone:invoke`. Only an app Mind Upload has approved as one owners use personally as their own Mind Upload app can call it; every other app is refused. For such an app, an `invoke_external_clone` conversation turn with `literal_text`, one-on-one with the owner's own AI consciousness, is written to this chat and returns its `chat_id`.",
        "tags": [
          "External Authorization"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "page": {
                    "type": "integer",
                    "nullable": true,
                    "default": 1
                  },
                  "page_size": {
                    "type": "integer",
                    "description": "Maximum records requested for one server-capped page.",
                    "default": 30
                  },
                  "sort_by": {
                    "type": "string",
                    "nullable": true,
                    "default": "created_at"
                  },
                  "sort_order": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Sort direction; supported values depend on the operation.",
                    "default": -1
                  },
                  "use_cursor_pagination": {
                    "type": "boolean",
                    "nullable": true,
                    "default": true
                  },
                  "cursor_value": {
                    "type": "number",
                    "nullable": true,
                    "description": "Opaque pagination cursor value from the previous page (`next_cursor_value`)."
                  },
                  "cursor_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Opaque pagination cursor id from the previous page (`next_cursor_id`)."
                  },
                  "access_token": {
                    "type": "string",
                    "description": "Opaque grant token accepted only by grant inspection and external clone invocation; store it as a secret and never expose it to users."
                  },
                  "installation_id": {
                    "type": "string",
                    "description": "Your stable opaque identifier for this app installation."
                  },
                  "external_subject": {
                    "type": "string",
                    "description": "Your stable opaque identifier for the person authorizing this installation."
                  },
                  "clone_id": {
                    "type": "string",
                    "description": "AI consciousness id as returned by clone operations."
                  }
                },
                "required": [
                  "access_token",
                  "clone_id",
                  "external_subject",
                  "installation_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "total_count": {
                      "type": "integer",
                      "nullable": true
                    },
                    "page": {
                      "type": "integer",
                      "nullable": true
                    },
                    "page_size": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Maximum records requested for one server-capped page."
                    },
                    "total_pages": {
                      "type": "integer",
                      "nullable": true
                    },
                    "has_next": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when another page is available after this response."
                    },
                    "has_prev": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "next_cursor_value": {
                      "type": "string",
                      "nullable": true,
                      "description": "Pass as `cursor_value` on the next page request."
                    },
                    "next_cursor_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Pass as `cursor_id` on the next page request."
                    },
                    "chats": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      },
                      "nullable": true,
                      "description": "One-on-one turns returned by this operation. A turn the person shared pages with also has `references`, the pages as `rag` took them. A turn with pictures or recordings attached also has `multimedia_ids`, their ids in the order they were attached."
                    },
                    "media_thumbnails": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Mapping from an external media URL in a result to its preferred display URL (normally a retained thumbnail)."
                    },
                    "media_fallbacks": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Mapping from a provably expired signed image URL to a safe legacy display candidate."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/search_external_chats": {
      "post": {
        "operationId": "search_external_chats",
        "summary": "Find turns in the owner's own chat with their AI consciousness.",
        "description": "Find turns in the owner's own chat with the granted AI consciousness by keyword, date or media, exactly as the Mind Upload app's Find does. Each hit names its `chat_id`, which `get_external_chat_around` opens. Needs `clone:invoke`. Only an app Mind Upload has approved as one owners use personally as their own Mind Upload app can call it; every other app is refused.",
        "tags": [
          "External Authorization"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "access_token": {
                    "type": "string",
                    "description": "Opaque grant token accepted only by grant inspection and external clone invocation; store it as a secret and never expose it to users."
                  },
                  "installation_id": {
                    "type": "string",
                    "description": "Your stable opaque identifier for this app installation."
                  },
                  "external_subject": {
                    "type": "string",
                    "description": "Your stable opaque identifier for the person authorizing this installation."
                  },
                  "clone_id": {
                    "type": "string",
                    "description": "AI consciousness id as returned by clone operations."
                  },
                  "keyword": {
                    "type": "string",
                    "nullable": true,
                    "description": "Optional find query. Whole-word tokens across alphabetic and numeric scripts; character phrases for Chinese / Japanese / Korean; mixed language supported."
                  },
                  "content_media_types": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "nullable": true,
                    "description": "Optional list of media kinds to match: `image`, `video`, and/or `audio`."
                  },
                  "created_after": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Optional lower bound on message time as a UNIX timestamp in seconds."
                  },
                  "created_before": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Optional upper bound on message time as a UNIX timestamp in seconds."
                  },
                  "sort_order": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Sort direction; supported values depend on the operation.",
                    "default": -1
                  },
                  "side": {
                    "type": "string",
                    "nullable": true,
                    "description": "Optional 1v1 side filter: `user` (human), `assistant` (AI), or `both` (turns that include both sides)."
                  },
                  "page_size": {
                    "type": "integer",
                    "description": "Maximum records requested for one server-capped page.",
                    "default": 30
                  },
                  "cursor_value": {
                    "type": "number",
                    "nullable": true,
                    "description": "Opaque pagination cursor value from the previous page (`next_cursor_value`)."
                  },
                  "cursor_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Opaque pagination cursor id from the previous page (`next_cursor_id`)."
                  }
                },
                "required": [
                  "access_token",
                  "clone_id",
                  "external_subject",
                  "installation_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "chats": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      },
                      "nullable": true,
                      "description": "One-on-one turns returned by this operation. A turn the person shared pages with also has `references`, the pages as `rag` took them."
                    },
                    "media_thumbnails": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Mapping from an external media URL in a result to its preferred display URL (normally a retained thumbnail)."
                    },
                    "media_fallbacks": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Mapping from a provably expired signed image URL to a safe legacy display candidate."
                    },
                    "has_next": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when another page is available after this response."
                    },
                    "next_cursor_value": {
                      "type": "number",
                      "nullable": true,
                      "description": "Pass as `cursor_value` on the next page request."
                    },
                    "next_cursor_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Pass as `cursor_id` on the next page request."
                    },
                    "page_size": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Maximum records requested for one server-capped page."
                    },
                    "media_urls_expire_at": {
                      "type": "integer",
                      "nullable": true,
                      "description": "UNIX timestamp after which cached result media links must be refreshed."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/get_external_chat_around": {
      "post": {
        "operationId": "get_external_chat_around",
        "summary": "Open the owner's own chat around one turn.",
        "description": "The turns before and after one turn of the owner's own chat, for jumping to a search hit or a reply. `before` and `after` count turns. Needs `clone:invoke`. Only an app Mind Upload has approved as one owners use personally as their own Mind Upload app can call it; every other app is refused.",
        "tags": [
          "External Authorization"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "access_token": {
                    "type": "string",
                    "description": "Opaque grant token accepted only by grant inspection and external clone invocation; store it as a secret and never expose it to users."
                  },
                  "installation_id": {
                    "type": "string",
                    "description": "Your stable opaque identifier for this app installation."
                  },
                  "external_subject": {
                    "type": "string",
                    "description": "Your stable opaque identifier for the person authorizing this installation."
                  },
                  "clone_id": {
                    "type": "string",
                    "description": "AI consciousness id as returned by clone operations."
                  },
                  "chat_id": {
                    "type": "string",
                    "description": "One-on-one chat turn id."
                  },
                  "before": {
                    "type": "integer",
                    "description": "How many earlier neighbors to include around the anchor id.",
                    "default": 15
                  },
                  "after": {
                    "type": "integer",
                    "description": "How many later neighbors to include around the anchor id.",
                    "default": 15
                  }
                },
                "required": [
                  "access_token",
                  "chat_id",
                  "clone_id",
                  "external_subject",
                  "installation_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "chats": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      },
                      "nullable": true,
                      "description": "One-on-one turns returned by this operation. A turn the person shared pages with also has `references`, the pages as `rag` took them."
                    },
                    "media_thumbnails": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Mapping from an external media URL in a result to its preferred display URL (normally a retained thumbnail)."
                    },
                    "media_fallbacks": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Mapping from a provably expired signed image URL to a safe legacy display candidate."
                    },
                    "anchor_chat_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Echo of the one-on-one chat id the window is centered on."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/speak_external_chat": {
      "post": {
        "operationId": "speak_external_chat",
        "summary": "Hear one part of a reply in the owner's chat, in the AI consciousness's own voice.",
        "description": "One part of a reply in the owner's own chat, spoken in the voice the owner gave the AI consciousness in Mind Upload. Ask for part 0 first; every answer says how many parts there are, so a player can ask for the next while one plays. `include_audio` returns the part's audio as well as its link. Free with a membership and bounded by the same limits as the app's read-aloud. Needs `clone:invoke`. Only an app Mind Upload has approved as one owners use personally as their own Mind Upload app can call it; every other app is refused.",
        "tags": [
          "External Authorization"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "access_token": {
                    "type": "string",
                    "description": "Opaque grant token accepted only by grant inspection and external clone invocation; store it as a secret and never expose it to users."
                  },
                  "installation_id": {
                    "type": "string",
                    "description": "Your stable opaque identifier for this app installation."
                  },
                  "external_subject": {
                    "type": "string",
                    "description": "Your stable opaque identifier for the person authorizing this installation."
                  },
                  "clone_id": {
                    "type": "string",
                    "description": "AI consciousness id as returned by clone operations."
                  },
                  "chat_id": {
                    "type": "string",
                    "description": "One-on-one chat turn id."
                  },
                  "part": {
                    "type": "integer",
                    "default": 0
                  },
                  "include_audio": {
                    "type": "boolean",
                    "default": false
                  }
                },
                "required": [
                  "access_token",
                  "chat_id",
                  "clone_id",
                  "external_subject",
                  "installation_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "audio_url": {
                      "type": "string",
                      "nullable": true
                    },
                    "audio_content_type": {
                      "type": "string",
                      "nullable": true
                    },
                    "audio_base64": {
                      "type": "string",
                      "nullable": true
                    },
                    "speech_failure": {
                      "type": "string",
                      "nullable": true
                    },
                    "part": {
                      "type": "integer",
                      "nullable": true
                    },
                    "part_count": {
                      "type": "integer",
                      "nullable": true
                    },
                    "language": {
                      "type": "string",
                      "nullable": true
                    },
                    "clone_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "AI consciousness id as returned by clone operations."
                    },
                    "voice_written_at": {
                      "type": "integer",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/open_external_conversation": {
      "post": {
        "operationId": "open_external_conversation",
        "summary": "Let the owner's AI consciousness speak first as the owner opens their chat.",
        "description": "Call this as the owner opens their chat. When the owner has been away long enough and the last opening was answered, the AI consciousness writes the first message, stores it in the owner's chat and returns it with its `chat_id`, exactly as the Mind Upload app's chat does; otherwise `response_text` and `chat_id` are null. Needs `clone:invoke` and a membership. Only an app Mind Upload has approved as one owners use personally as their own Mind Upload app can call it; every other app is refused.",
        "tags": [
          "External Authorization"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "access_token": {
                    "type": "string",
                    "description": "Opaque grant token accepted only by grant inspection and external clone invocation; store it as a secret and never expose it to users."
                  },
                  "installation_id": {
                    "type": "string",
                    "description": "Your stable opaque identifier for this app installation."
                  },
                  "external_subject": {
                    "type": "string",
                    "description": "Your stable opaque identifier for the person authorizing this installation."
                  },
                  "clone_id": {
                    "type": "string",
                    "description": "AI consciousness id as returned by clone operations."
                  }
                },
                "required": [
                  "access_token",
                  "clone_id",
                  "external_subject",
                  "installation_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "response_text": {
                      "type": "string",
                      "nullable": true,
                      "description": "The AI consciousness reply when status is `succeeded`."
                    },
                    "chat_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "One-on-one chat turn id."
                    },
                    "clone_nickname": {
                      "type": "string",
                      "nullable": true,
                      "description": "User-facing name of the invoked AI consciousness."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/get_clones": {
      "post": {
        "operationId": "get_clones",
        "summary": "List the user's AI consciousnesses.",
        "tags": [
          "AI Consciousnesses"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "clones": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      },
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/create_clone": {
      "post": {
        "operationId": "create_clone",
        "summary": "Create a new AI consciousness for the user.",
        "tags": [
          "AI Consciousnesses"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "codename": {
                    "type": "string",
                    "nullable": true,
                    "description": "Ask for a consciousness by name instead of writing up an interview: returns the third-person description of that consciousness, if one has been produced. Any authenticated caller may ask. Only the third-person form is available this way; the first- and second-person forms address the interviewee and are theirs alone."
                  },
                  "nickname": {
                    "type": "string",
                    "nullable": true
                  },
                  "gender": {
                    "type": "string",
                    "nullable": true
                  },
                  "avatar_id": {
                    "type": "string",
                    "nullable": true
                  },
                  "accept_chatroom_invitation_by_others": {
                    "type": "boolean",
                    "default": true
                  },
                  "reinforcement_learning": {
                    "type": "boolean",
                    "default": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/update_clone": {
      "post": {
        "operationId": "update_clone",
        "summary": "Update an AI consciousness's profile.",
        "tags": [
          "AI Consciousnesses"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "codename": {
                    "type": "string",
                    "nullable": true,
                    "description": "Ask for a consciousness by name instead of writing up an interview: returns the third-person description of that consciousness, if one has been produced. Any authenticated caller may ask. Only the third-person form is available this way; the first- and second-person forms address the interviewee and are theirs alone."
                  },
                  "nickname": {
                    "type": "string",
                    "nullable": true
                  },
                  "gender": {
                    "type": "string",
                    "nullable": true
                  },
                  "avatar_id": {
                    "type": "string",
                    "nullable": true
                  },
                  "accept_chatroom_invitation_by_others": {
                    "type": "boolean",
                    "nullable": true
                  },
                  "auto_keep_external_memories": {
                    "type": "boolean",
                    "nullable": true
                  },
                  "reinforcement_learning": {
                    "type": "boolean",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/get_texts": {
      "post": {
        "operationId": "get_texts",
        "summary": "List the memories and persona entries uploaded to an AI consciousness.",
        "tags": [
          "Memories"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "page": {
                    "type": "integer",
                    "nullable": true,
                    "default": 1
                  },
                  "page_size": {
                    "type": "integer",
                    "description": "Maximum records requested for one server-capped page.",
                    "default": 30
                  },
                  "sort_by": {
                    "type": "string",
                    "nullable": true,
                    "default": "created_at"
                  },
                  "sort_order": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Sort direction; supported values depend on the operation.",
                    "default": -1
                  },
                  "use_cursor_pagination": {
                    "type": "boolean",
                    "nullable": true,
                    "default": true
                  },
                  "cursor_value": {
                    "type": "string",
                    "nullable": true,
                    "description": "Opaque pagination cursor value from the previous page (`next_cursor_value`)."
                  },
                  "cursor_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Opaque pagination cursor id from the previous page (`next_cursor_id`)."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "codename": {
                    "type": "string",
                    "nullable": true,
                    "description": "Ask for a consciousness by name instead of writing up an interview: returns the third-person description of that consciousness, if one has been produced. Any authenticated caller may ask. Only the third-person form is available this way; the first- and second-person forms address the interviewee and are theirs alone."
                  },
                  "type": {
                    "type": "string",
                    "nullable": true,
                    "enum": [
                      "memory",
                      "persona",
                      "conscious"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "total_count": {
                      "type": "integer",
                      "nullable": true
                    },
                    "page": {
                      "type": "integer",
                      "nullable": true
                    },
                    "page_size": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Maximum records requested for one server-capped page."
                    },
                    "total_pages": {
                      "type": "integer",
                      "nullable": true
                    },
                    "has_next": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when another page is available after this response."
                    },
                    "has_prev": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "next_cursor_value": {
                      "type": "string",
                      "nullable": true,
                      "description": "Pass as `cursor_value` on the next page request."
                    },
                    "next_cursor_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Pass as `cursor_id` on the next page request."
                    },
                    "texts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "type": "string"
                          },
                          "clone_id": {
                            "type": "string",
                            "description": "AI consciousness id as returned by clone operations."
                          },
                          "user_id": {
                            "type": "string"
                          },
                          "multimedia_ids": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "nullable": true
                          },
                          "text": {
                            "type": "string",
                            "nullable": true
                          },
                          "type": {
                            "type": "string",
                            "nullable": true
                          },
                          "created_at": {
                            "type": "integer",
                            "nullable": true
                          },
                          "updated_at": {
                            "type": "integer",
                            "nullable": true,
                            "description": "Opaque freshness watermark to send back as `known_updated_at` on the next poll."
                          },
                          "is_active": {
                            "type": "boolean",
                            "nullable": true
                          },
                          "pending_owner_review": {
                            "type": "boolean",
                            "nullable": true
                          },
                          "source_label": {
                            "type": "string",
                            "nullable": true
                          },
                          "reconcile_flagged_at": {
                            "type": "integer",
                            "nullable": true
                          },
                          "owner_reviewed_at": {
                            "type": "integer",
                            "nullable": true
                          },
                          "media": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "media_id": {
                                  "type": "string"
                                },
                                "media_type": {
                                  "type": "string",
                                  "description": "The kind of media: `image`, `video`, or `audio`."
                                },
                                "media_url": {
                                  "type": "string",
                                  "description": "Media URL returned by this operation; use signed read URLs unchanged."
                                },
                                "content_type": {
                                  "type": "string"
                                },
                                "file_size_bytes": {
                                  "type": "integer"
                                },
                                "expires_at": {
                                  "type": "integer",
                                  "description": "UNIX timestamp when this resource or capability expires."
                                }
                              },
                              "required": [
                                "content_type",
                                "expires_at",
                                "file_size_bytes",
                                "media_id",
                                "media_type",
                                "media_url"
                              ]
                            }
                          },
                          "reading_provenance": {
                            "type": "object",
                            "properties": {
                              "content_state": {
                                "type": "string",
                                "enum": [
                                  "checked_candidate",
                                  "owner_edited"
                                ]
                              },
                              "memory_kinds": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "sources": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "source_kind": {
                                      "type": "string",
                                      "enum": [
                                        "page",
                                        "media"
                                      ]
                                    },
                                    "title": {
                                      "type": "string"
                                    },
                                    "url": {
                                      "type": "string",
                                      "description": "Where the attachment is — the `media_url` an upload returned, or an external link. Echoed back in the result so you can match each entry to what you sent."
                                    },
                                    "media_id": {
                                      "type": "string"
                                    },
                                    "source_id": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "source_id",
                                    "source_kind"
                                  ]
                                }
                              }
                            },
                            "required": [
                              "content_state",
                              "memory_kinds",
                              "sources"
                            ]
                          }
                        },
                        "required": [
                          "_id",
                          "clone_id",
                          "created_at",
                          "is_active",
                          "owner_reviewed_at",
                          "pending_owner_review",
                          "reconcile_flagged_at",
                          "source_label",
                          "text",
                          "type",
                          "updated_at",
                          "user_id"
                        ]
                      },
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/create_text": {
      "post": {
        "operationId": "create_text",
        "summary": "Upload a memory or persona entry to an AI consciousness.",
        "tags": [
          "Memories"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "codename": {
                    "type": "string",
                    "nullable": true,
                    "description": "Ask for a consciousness by name instead of writing up an interview: returns the third-person description of that consciousness, if one has been produced. Any authenticated caller may ask. Only the third-person form is available this way; the first- and second-person forms address the interviewee and are theirs alone."
                  },
                  "clone_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "AI consciousness id as returned by clone operations."
                  },
                  "text": {
                    "type": "string",
                    "nullable": true,
                    "description": "The mind data itself. At most 50000 characters, counted in Unicode code points; longer text is rejected with 400 and nothing is stored.",
                    "maxLength": 50000
                  },
                  "type": {
                    "type": "string",
                    "nullable": true,
                    "enum": [
                      "memory",
                      "persona",
                      "conscious"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "cluster_label": {
                      "type": "string",
                      "nullable": true
                    },
                    "cluster_modified_count": {
                      "type": "integer",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/get_chat": {
      "post": {
        "operationId": "get_chat",
        "summary": "Fetch the one-on-one conversation history with an AI consciousness.",
        "tags": [
          "Conversation"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "page": {
                    "type": "integer",
                    "nullable": true,
                    "default": 1
                  },
                  "page_size": {
                    "type": "integer",
                    "description": "Maximum records requested for one server-capped page.",
                    "default": 30
                  },
                  "sort_by": {
                    "type": "string",
                    "nullable": true,
                    "default": "created_at"
                  },
                  "sort_order": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Sort direction; supported values depend on the operation.",
                    "default": -1
                  },
                  "use_cursor_pagination": {
                    "type": "boolean",
                    "nullable": true,
                    "default": true
                  },
                  "cursor_value": {
                    "type": "string",
                    "nullable": true,
                    "description": "Opaque pagination cursor value from the previous page (`next_cursor_value`)."
                  },
                  "cursor_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Opaque pagination cursor id from the previous page (`next_cursor_id`)."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "codename": {
                    "type": "string",
                    "nullable": true,
                    "description": "Ask for a consciousness by name instead of writing up an interview: returns the third-person description of that consciousness, if one has been produced. Any authenticated caller may ask. Only the third-person form is available this way; the first- and second-person forms address the interviewee and are theirs alone."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "total_count": {
                      "type": "integer",
                      "nullable": true
                    },
                    "page": {
                      "type": "integer",
                      "nullable": true
                    },
                    "page_size": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Maximum records requested for one server-capped page."
                    },
                    "total_pages": {
                      "type": "integer",
                      "nullable": true
                    },
                    "has_next": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when another page is available after this response."
                    },
                    "has_prev": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "next_cursor_value": {
                      "type": "string",
                      "nullable": true,
                      "description": "Pass as `cursor_value` on the next page request."
                    },
                    "next_cursor_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Pass as `cursor_id` on the next page request."
                    },
                    "chats": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      },
                      "nullable": true,
                      "description": "One-on-one turns returned by this operation. A turn the person shared pages with also has `references`, the pages as `rag` took them. A turn with pictures or recordings attached also has `multimedia_ids`, their ids in the order they were attached."
                    },
                    "media_thumbnails": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Mapping from an external media URL in a result to its preferred display URL (normally a retained thumbnail)."
                    },
                    "media_fallbacks": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Mapping from a provably expired signed image URL to a safe legacy display candidate."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/rag": {
      "post": {
        "operationId": "rag",
        "summary": "Send a message to an AI consciousness and receive its reply.",
        "tags": [
          "Conversation"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "codename": {
                    "type": "string",
                    "nullable": true,
                    "description": "Ask for a consciousness by name instead of writing up an interview: returns the third-person description of that consciousness, if one has been produced. Any authenticated caller may ask. Only the third-person form is available this way; the first- and second-person forms address the interviewee and are theirs alone."
                  },
                  "text": {
                    "type": "string",
                    "nullable": true
                  },
                  "chatroom_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Chatroom id as returned by chatroom operations."
                  },
                  "references": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "title": {
                          "type": "string",
                          "description": "The page's title, as the person saw it."
                        },
                        "url": {
                          "type": "string",
                          "description": "The page's address: `http` or `https`, with no user name or password. Kept as where the passage came from; never fetched."
                        },
                        "text": {
                          "type": "string",
                          "description": "The passage taken from the page."
                        }
                      },
                      "required": [
                        "text",
                        "title",
                        "url"
                      ]
                    },
                    "nullable": true,
                    "description": "Pages shared with this message, as `invoke_external_clone` takes them: quoted background kept separate from the message, never read as what the person said. Titles, URLs, bodies and `text` share one text bound; URLs are never fetched. The turn keeps them, and `get_chat` returns them as that turn's `references`. Not accepted with `chatroom_id`: a chatroom's pages go with `create_chatroom_message`.",
                    "maxItems": 30
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "response_text": {
                      "type": "string",
                      "nullable": true,
                      "description": "The AI consciousness reply when status is `succeeded`."
                    },
                    "chat_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "The stored chat turn the reply is in, for `speak_message` or `get_chat_around`; null when the conversation is not stored."
                    },
                    "multimedia_ids": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "The ids of the pictures and recordings stored with that turn, in the order the message linked them, as `get_chat` reads them back; null when the turn is not stored or has none."
                    },
                    "content_format": {
                      "type": "string"
                    },
                    "clone_nickname": {
                      "type": "string",
                      "nullable": true,
                      "description": "User-facing name of the invoked AI consciousness."
                    },
                    "consolidation_summary": {
                      "type": "string",
                      "nullable": true
                    },
                    "consolidation_count": {
                      "type": "integer",
                      "nullable": true
                    },
                    "consolidation_dispatched": {
                      "type": "boolean",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/trigger_social": {
      "post": {
        "operationId": "trigger_social",
        "summary": "Have an AI consciousness proactively join the conversation in a chatroom.",
        "tags": [
          "Conversation"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "membership_id": {
                    "type": "string",
                    "nullable": true
                  },
                  "chatroom_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Chatroom id as returned by chatroom operations."
                  },
                  "expected_credit_cost": {
                    "type": "string",
                    "nullable": true,
                    "description": "Credit amount displayed before the action, as an exact decimal string. The action is refused if a new charge would use a different amount. Omit for older clients; cached reports remain free."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "content_format": {
                      "type": "string"
                    },
                    "response_text": {
                      "type": "string",
                      "nullable": true,
                      "description": "The AI consciousness reply, as posted in the chatroom. Null while `reply_pending` is true, even though `success` is true: the reply then appears in the chatroom as the message `reply_message_id`."
                    },
                    "reply_pending": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when the reply is still being written. It appears in the chatroom by itself shortly, so read the chatroom messages again; if it cannot be written, the credits are returned."
                    },
                    "reply_message_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Id of the chatroom message the reply is, or will be, posted as."
                    },
                    "chatroom_digests_count": {
                      "type": "integer",
                      "nullable": true
                    },
                    "chatroom_digests_summary": {
                      "type": "string",
                      "nullable": true
                    },
                    "consolidation_summary": {
                      "type": "string",
                      "nullable": true
                    },
                    "consolidation_count": {
                      "type": "integer",
                      "nullable": true
                    },
                    "consolidation_dispatched": {
                      "type": "boolean",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/get_mind_cluster": {
      "post": {
        "operationId": "get_mind_cluster",
        "summary": "Fetch the mind-graph visualization data of an AI consciousness.",
        "tags": [
          "Insights"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "codename": {
                    "type": "string",
                    "nullable": true,
                    "description": "Ask for a consciousness by name instead of writing up an interview: returns the third-person description of that consciousness, if one has been produced. Any authenticated caller may ask. Only the third-person form is available this way; the first- and second-person forms address the interviewee and are theirs alone."
                  },
                  "node_id": {
                    "type": "string",
                    "nullable": true
                  },
                  "texts_offset": {
                    "type": "integer",
                    "nullable": true,
                    "minimum": 0,
                    "default": 0
                  },
                  "texts_page_size": {
                    "type": "integer",
                    "nullable": true,
                    "minimum": 1,
                    "maximum": 200
                  },
                  "force_rebuild": {
                    "type": "boolean",
                    "nullable": true,
                    "default": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "root_node_id": {
                      "type": "string",
                      "nullable": true
                    },
                    "node": {
                      "type": "object",
                      "additionalProperties": {},
                      "nullable": true
                    },
                    "children": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      },
                      "nullable": true
                    },
                    "texts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text_id": {
                            "type": "string"
                          },
                          "text": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "created_at": {
                            "type": "integer",
                            "nullable": true
                          },
                          "updated_at": {
                            "type": "integer",
                            "description": "Opaque freshness watermark to send back as `known_updated_at` on the next poll."
                          },
                          "multimedia_ids": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "reading_provenance": {
                            "type": "object",
                            "properties": {
                              "content_state": {
                                "type": "string",
                                "enum": [
                                  "checked_candidate",
                                  "owner_edited"
                                ]
                              },
                              "memory_kinds": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "sources": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "source_kind": {
                                      "type": "string",
                                      "enum": [
                                        "page",
                                        "media"
                                      ]
                                    },
                                    "title": {
                                      "type": "string"
                                    },
                                    "url": {
                                      "type": "string",
                                      "description": "Where the attachment is — the `media_url` an upload returned, or an external link. Echoed back in the result so you can match each entry to what you sent."
                                    },
                                    "media_id": {
                                      "type": "string"
                                    },
                                    "source_id": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "source_id",
                                    "source_kind"
                                  ]
                                }
                              }
                            },
                            "required": [
                              "content_state",
                              "memory_kinds",
                              "sources"
                            ]
                          }
                        },
                        "required": [
                          "created_at",
                          "text",
                          "text_id",
                          "type"
                        ]
                      },
                      "nullable": true
                    },
                    "total_texts": {
                      "type": "integer",
                      "nullable": true
                    },
                    "texts_offset": {
                      "type": "integer",
                      "nullable": true
                    },
                    "has_more_texts": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "is_building": {
                      "type": "boolean",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/get_soulmate_report": {
      "post": {
        "operationId": "get_soulmate_report",
        "summary": "Generate or fetch the compatibility report between two chatroom members.",
        "tags": [
          "Insights"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "my_clone_id": {
                    "type": "string",
                    "nullable": true
                  },
                  "other_clone_id": {
                    "type": "string",
                    "nullable": true
                  },
                  "chatroom_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Chatroom id as returned by chatroom operations."
                  },
                  "expected_credit_cost": {
                    "type": "string",
                    "nullable": true,
                    "description": "Credit amount displayed before the action, as an exact decimal string. The action is refused if a new charge would use a different amount. Omit for older clients; cached reports remain free."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "report": {
                      "type": "object",
                      "additionalProperties": {},
                      "nullable": true
                    },
                    "report_generated_at": {
                      "type": "integer",
                      "nullable": true
                    },
                    "is_generating": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "charged": {
                      "type": "boolean",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/create_chatroom": {
      "post": {
        "operationId": "create_chatroom",
        "summary": "Create a chatroom.",
        "tags": [
          "Chatrooms"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "chatroom_name": {
                    "type": "string",
                    "nullable": true
                  },
                  "is_public": {
                    "type": "boolean",
                    "nullable": true
                  },
                  "avatar_id": {
                    "type": "string",
                    "nullable": true
                  },
                  "expected_credit_cost": {
                    "type": "string",
                    "nullable": true,
                    "description": "Credit amount displayed before the action, as an exact decimal string. The action is refused if a new charge would use a different amount. Omit for older clients; cached reports remain free."
                  },
                  "soulmate_check_enabled": {
                    "type": "boolean",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "chatroom_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Chatroom id as returned by chatroom operations."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/get_chatrooms": {
      "post": {
        "operationId": "get_chatrooms",
        "summary": "List the chatrooms the user belongs to.",
        "tags": [
          "Chatrooms"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "page": {
                    "type": "integer",
                    "nullable": true,
                    "default": 1
                  },
                  "page_size": {
                    "type": "integer",
                    "description": "Maximum records requested for one server-capped page.",
                    "default": 10000
                  },
                  "sort_by": {
                    "type": "string",
                    "nullable": true,
                    "default": "created_at"
                  },
                  "sort_order": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Sort direction; supported values depend on the operation.",
                    "default": -1
                  },
                  "use_cursor_pagination": {
                    "type": "boolean",
                    "nullable": true,
                    "default": true
                  },
                  "cursor_value": {
                    "type": "string",
                    "nullable": true,
                    "description": "Opaque pagination cursor value from the previous page (`next_cursor_value`)."
                  },
                  "cursor_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Opaque pagination cursor id from the previous page (`next_cursor_id`)."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "get_public": {
                    "type": "boolean",
                    "nullable": true
                  },
                  "get_private": {
                    "type": "boolean",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "total_count": {
                      "type": "integer",
                      "nullable": true
                    },
                    "page": {
                      "type": "integer",
                      "nullable": true
                    },
                    "page_size": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Maximum records requested for one server-capped page."
                    },
                    "total_pages": {
                      "type": "integer",
                      "nullable": true
                    },
                    "has_next": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when another page is available after this response."
                    },
                    "has_prev": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "next_cursor_value": {
                      "type": "string",
                      "nullable": true,
                      "description": "Pass as `cursor_value` on the next page request."
                    },
                    "next_cursor_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Pass as `cursor_id` on the next page request."
                    },
                    "chatrooms": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      },
                      "nullable": true,
                      "description": "Chatroom-related objects for this operation."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/create_chatroom_message": {
      "post": {
        "operationId": "create_chatroom_message",
        "summary": "Send a message to a chatroom.",
        "tags": [
          "Chatrooms"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "chatroom_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Chatroom id as returned by chatroom operations."
                  },
                  "text": {
                    "type": "string",
                    "nullable": true
                  },
                  "references": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "title": {
                          "type": "string",
                          "description": "The page's title, as the person saw it."
                        },
                        "url": {
                          "type": "string",
                          "description": "The page's address: `http` or `https`, with no user name or password. Kept as where the passage came from; never fetched."
                        },
                        "text": {
                          "type": "string",
                          "description": "The passage taken from the page."
                        }
                      },
                      "required": [
                        "text",
                        "title",
                        "url"
                      ]
                    },
                    "nullable": true,
                    "description": "Pages shared with this message, as `rag` takes them: quoted background kept separate from the message, never read as what the sender said. Titles, URLs, bodies and `text` share one text bound; URLs are never fetched. The message keeps them, every member reading the room gets them as that message's `references`, and the room's AI replies read them as quoted sources.",
                    "maxItems": 30
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "message_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Chatroom message id."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/get_chatroom_messages": {
      "post": {
        "operationId": "get_chatroom_messages",
        "summary": "Fetch messages from a chatroom the user belongs to.",
        "tags": [
          "Chatrooms"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "page": {
                    "type": "integer",
                    "nullable": true,
                    "default": 1
                  },
                  "page_size": {
                    "type": "integer",
                    "description": "Maximum records requested for one server-capped page.",
                    "default": 30
                  },
                  "sort_by": {
                    "type": "string",
                    "nullable": true,
                    "default": "created_at"
                  },
                  "sort_order": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Sort direction; supported values depend on the operation.",
                    "default": -1
                  },
                  "use_cursor_pagination": {
                    "type": "boolean",
                    "nullable": true,
                    "default": true
                  },
                  "cursor_value": {
                    "type": "string",
                    "nullable": true,
                    "description": "Opaque pagination cursor value from the previous page (`next_cursor_value`)."
                  },
                  "cursor_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Opaque pagination cursor id from the previous page (`next_cursor_id`)."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "chatroom_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Chatroom id as returned by chatroom operations."
                  },
                  "since_value": {
                    "type": "number",
                    "nullable": true
                  },
                  "since_id": {
                    "type": "string",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "total_count": {
                      "type": "integer",
                      "nullable": true
                    },
                    "page": {
                      "type": "integer",
                      "nullable": true
                    },
                    "page_size": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Maximum records requested for one server-capped page."
                    },
                    "total_pages": {
                      "type": "integer",
                      "nullable": true
                    },
                    "has_next": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when another page is available after this response."
                    },
                    "has_prev": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "next_cursor_value": {
                      "type": "string",
                      "nullable": true,
                      "description": "Pass as `cursor_value` on the next page request."
                    },
                    "next_cursor_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Pass as `cursor_id` on the next page request."
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      },
                      "nullable": true,
                      "description": "Chatroom messages returned by this operation. A message its sender shared pages with also has `references`, the pages as `create_chatroom_message` took them."
                    },
                    "media_thumbnails": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Mapping from an external media URL in a result to its preferred display URL (normally a retained thumbnail)."
                    },
                    "media_fallbacks": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Mapping from a provably expired signed image URL to a safe legacy display candidate."
                    },
                    "since_overflow": {
                      "type": "boolean",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/search_chatroom_messages": {
      "post": {
        "operationId": "search_chatroom_messages",
        "summary": "Find messages in a chatroom by keyword, date, media type, and/or sender.",
        "description": "Search one chatroom the signed-in user belongs to. Combine an optional keyword with optional media types (`image` / `video` / `audio`), unix date bounds, and optional sender ids. Empty keyword with media, date, or sender filters still returns matching messages. Page with `cursor_value` + `cursor_id` from the previous response. Use a hit id with `get_chatroom_messages_around` to jump the conversation UI.",
        "tags": [
          "Chatrooms"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "description": "The end-user's username.",
                    "minLength": 1
                  },
                  "password": {
                    "type": "string",
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.",
                    "minLength": 1
                  },
                  "chatroom_id": {
                    "type": "string",
                    "description": "Chatroom id as returned by chatroom operations.",
                    "minLength": 24,
                    "maxLength": 24,
                    "pattern": "^[0-9a-fA-F]{24}$"
                  },
                  "keyword": {
                    "type": "string",
                    "nullable": true,
                    "description": "Optional find query. Whole-word tokens across alphabetic and numeric scripts; character phrases for Chinese / Japanese / Korean; mixed language supported.",
                    "maxLength": 512
                  },
                  "content_media_types": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "image",
                        "video",
                        "audio"
                      ]
                    },
                    "nullable": true,
                    "description": "Optional list of media kinds to match: `image`, `video`, and/or `audio`.",
                    "maxItems": 3,
                    "uniqueItems": true
                  },
                  "created_after": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Optional lower bound on message time as a UNIX timestamp in seconds."
                  },
                  "created_before": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Optional upper bound on message time as a UNIX timestamp in seconds."
                  },
                  "sort_order": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Message send-time order: `-1` newest first (default), `1` oldest first.",
                    "enum": [
                      -1,
                      1
                    ],
                    "default": -1
                  },
                  "sender_user_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Optional human member id; only messages from that user match. Mutually exclusive with `sender_clone_id`.",
                    "minLength": 24,
                    "maxLength": 24,
                    "pattern": "^[0-9a-fA-F]{24}$"
                  },
                  "sender_clone_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Optional AI member id; only messages from that AI match. Mutually exclusive with `sender_user_id`.",
                    "minLength": 24,
                    "maxLength": 24,
                    "pattern": "^[0-9a-fA-F]{24}$"
                  },
                  "page_size": {
                    "type": "integer",
                    "description": "Maximum Find hits for one page.",
                    "minimum": 1,
                    "maximum": 30,
                    "default": 30
                  },
                  "cursor_value": {
                    "type": "number",
                    "nullable": true,
                    "description": "Opaque pagination cursor value from the previous page (`next_cursor_value`)."
                  },
                  "cursor_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Opaque pagination cursor id from the previous page (`next_cursor_id`).",
                    "minLength": 24,
                    "maxLength": 24,
                    "pattern": "^[0-9a-fA-F]{24}$"
                  }
                },
                "required": [
                  "chatroom_id",
                  "password",
                  "username"
                ],
                "allOf": [
                  {
                    "oneOf": [
                      {
                        "required": [
                          "cursor_value",
                          "cursor_id"
                        ]
                      },
                      {
                        "not": {
                          "anyOf": [
                            {
                              "required": [
                                "cursor_value"
                              ]
                            },
                            {
                              "required": [
                                "cursor_id"
                              ]
                            }
                          ]
                        }
                      }
                    ]
                  },
                  {
                    "not": {
                      "required": [
                        "sender_user_id",
                        "sender_clone_id"
                      ]
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      },
                      "nullable": true,
                      "description": "Chatroom messages returned by this operation. A message its sender shared pages with also has `references`, the pages as `create_chatroom_message` took them."
                    },
                    "media_thumbnails": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Mapping from an external media URL in a result to its preferred display URL (normally a retained thumbnail)."
                    },
                    "media_fallbacks": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Mapping from a provably expired signed image URL to a safe legacy display candidate."
                    },
                    "has_next": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when another page is available after this response."
                    },
                    "next_cursor_value": {
                      "type": "number",
                      "nullable": true,
                      "description": "Pass as `cursor_value` on the next page request."
                    },
                    "next_cursor_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Pass as `cursor_id` on the next page request."
                    },
                    "page_size": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Maximum records requested for one server-capped page."
                    },
                    "media_urls_expire_at": {
                      "type": "integer",
                      "nullable": true,
                      "description": "UNIX timestamp after which cached result media links must be refreshed."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/get_chatroom_messages_around": {
      "post": {
        "operationId": "get_chatroom_messages_around",
        "summary": "Fetch a window of chatroom messages around one message id (for jump-to).",
        "description": "Load a contiguous window of chatroom messages around `message_id` so a client can jump from a find hit into the live timeline. `before` and `after` cap how many neighbors are returned on each side of the anchor.",
        "tags": [
          "Chatrooms"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "description": "The end-user's username.",
                    "minLength": 1
                  },
                  "password": {
                    "type": "string",
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.",
                    "minLength": 1
                  },
                  "chatroom_id": {
                    "type": "string",
                    "description": "Chatroom id as returned by chatroom operations.",
                    "minLength": 24,
                    "maxLength": 24,
                    "pattern": "^[0-9a-fA-F]{24}$"
                  },
                  "message_id": {
                    "type": "string",
                    "description": "Chatroom message id.",
                    "minLength": 24,
                    "maxLength": 24,
                    "pattern": "^[0-9a-fA-F]{24}$"
                  },
                  "before": {
                    "type": "integer",
                    "description": "How many earlier neighbors to include around the anchor id.",
                    "minimum": 0,
                    "maximum": 50,
                    "default": 15
                  },
                  "after": {
                    "type": "integer",
                    "description": "How many later neighbors to include around the anchor id.",
                    "minimum": 0,
                    "maximum": 50,
                    "default": 15
                  }
                },
                "required": [
                  "chatroom_id",
                  "message_id",
                  "password",
                  "username"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      },
                      "nullable": true,
                      "description": "Chatroom messages returned by this operation. A message its sender shared pages with also has `references`, the pages as `create_chatroom_message` took them."
                    },
                    "media_thumbnails": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Mapping from an external media URL in a result to its preferred display URL (normally a retained thumbnail)."
                    },
                    "media_fallbacks": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Mapping from a provably expired signed image URL to a safe legacy display candidate."
                    },
                    "anchor_message_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Echo of the chatroom message id the window is centered on."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "404": {
            "description": "The anchor message is gone — deleted, or not part of this chatroom. Show the reader that the message no longer exists rather than retrying."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/search_chats": {
      "post": {
        "operationId": "search_chats",
        "summary": "Find turns in a one-on-one AI conversation by keyword, date, media type, and/or Human/AI side.",
        "description": "Search the signed-in user's one-on-one conversation with one AI consciousness. Combine an optional keyword with optional media types, unix date bounds, and optional `side` (`user` / `assistant` / `both`). Page with `cursor_value` + `cursor_id`. Use a hit id with `get_chat_around` to jump the dialogue UI.",
        "tags": [
          "Conversation"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "description": "The end-user's username.",
                    "minLength": 1
                  },
                  "password": {
                    "type": "string",
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.",
                    "minLength": 1
                  },
                  "clone_id": {
                    "type": "string",
                    "description": "Owner AI consciousness id from `get_clones` (required for one-on-one find).",
                    "minLength": 24,
                    "maxLength": 24,
                    "pattern": "^[0-9a-fA-F]{24}$"
                  },
                  "keyword": {
                    "type": "string",
                    "nullable": true,
                    "description": "Optional find query. Whole-word tokens across alphabetic and numeric scripts; character phrases for Chinese / Japanese / Korean; mixed language supported.",
                    "maxLength": 512
                  },
                  "content_media_types": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "image",
                        "video",
                        "audio"
                      ]
                    },
                    "nullable": true,
                    "description": "Optional list of media kinds to match: `image`, `video`, and/or `audio`.",
                    "maxItems": 3,
                    "uniqueItems": true
                  },
                  "created_after": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Optional lower bound on message time as a UNIX timestamp in seconds."
                  },
                  "created_before": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Optional upper bound on message time as a UNIX timestamp in seconds."
                  },
                  "sort_order": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Turn send-time order: `-1` newest first (default), `1` oldest first.",
                    "enum": [
                      -1,
                      1
                    ],
                    "default": -1
                  },
                  "side": {
                    "type": "string",
                    "nullable": true,
                    "description": "Optional 1v1 side filter: `user` (human), `assistant` (AI), or `both` (turns that include both sides).",
                    "enum": [
                      "user",
                      "assistant",
                      "both"
                    ]
                  },
                  "page_size": {
                    "type": "integer",
                    "description": "Maximum Find hits for one page.",
                    "minimum": 1,
                    "maximum": 30,
                    "default": 30
                  },
                  "cursor_value": {
                    "type": "number",
                    "nullable": true,
                    "description": "Opaque pagination cursor value from the previous page (`next_cursor_value`)."
                  },
                  "cursor_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Opaque pagination cursor id from the previous page (`next_cursor_id`).",
                    "minLength": 24,
                    "maxLength": 24,
                    "pattern": "^[0-9a-fA-F]{24}$"
                  }
                },
                "required": [
                  "clone_id",
                  "password",
                  "username"
                ],
                "allOf": [
                  {
                    "oneOf": [
                      {
                        "required": [
                          "cursor_value",
                          "cursor_id"
                        ]
                      },
                      {
                        "not": {
                          "anyOf": [
                            {
                              "required": [
                                "cursor_value"
                              ]
                            },
                            {
                              "required": [
                                "cursor_id"
                              ]
                            }
                          ]
                        }
                      }
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "chats": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      },
                      "nullable": true,
                      "description": "One-on-one turns returned by this operation. A turn the person shared pages with also has `references`, the pages as `rag` took them."
                    },
                    "media_thumbnails": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Mapping from an external media URL in a result to its preferred display URL (normally a retained thumbnail)."
                    },
                    "media_fallbacks": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Mapping from a provably expired signed image URL to a safe legacy display candidate."
                    },
                    "has_next": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when another page is available after this response."
                    },
                    "next_cursor_value": {
                      "type": "number",
                      "nullable": true,
                      "description": "Pass as `cursor_value` on the next page request."
                    },
                    "next_cursor_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Pass as `cursor_id` on the next page request."
                    },
                    "page_size": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Maximum records requested for one server-capped page."
                    },
                    "media_urls_expire_at": {
                      "type": "integer",
                      "nullable": true,
                      "description": "UNIX timestamp after which cached result media links must be refreshed."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/get_chat_around": {
      "post": {
        "operationId": "get_chat_around",
        "summary": "Fetch a window of one-on-one turns around one chat id (for jump-to).",
        "description": "Load a contiguous window of one-on-one turns around `chat_id` so a client can jump from a find hit into the live dialogue. `before` and `after` cap neighbors on each side of the anchor.",
        "tags": [
          "Conversation"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "description": "The end-user's username.",
                    "minLength": 1
                  },
                  "password": {
                    "type": "string",
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage.",
                    "minLength": 1
                  },
                  "clone_id": {
                    "type": "string",
                    "description": "Owner AI consciousness id from `get_clones` (required for one-on-one jump).",
                    "minLength": 24,
                    "maxLength": 24,
                    "pattern": "^[0-9a-fA-F]{24}$"
                  },
                  "chat_id": {
                    "type": "string",
                    "description": "One-on-one chat turn id.",
                    "minLength": 24,
                    "maxLength": 24,
                    "pattern": "^[0-9a-fA-F]{24}$"
                  },
                  "before": {
                    "type": "integer",
                    "description": "How many earlier neighbors to include around the anchor id.",
                    "minimum": 0,
                    "maximum": 50,
                    "default": 15
                  },
                  "after": {
                    "type": "integer",
                    "description": "How many later neighbors to include around the anchor id.",
                    "minimum": 0,
                    "maximum": 50,
                    "default": 15
                  }
                },
                "required": [
                  "chat_id",
                  "clone_id",
                  "password",
                  "username"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "chats": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      },
                      "nullable": true,
                      "description": "One-on-one turns returned by this operation. A turn the person shared pages with also has `references`, the pages as `rag` took them."
                    },
                    "media_thumbnails": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Mapping from an external media URL in a result to its preferred display URL (normally a retained thumbnail)."
                    },
                    "media_fallbacks": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Mapping from a provably expired signed image URL to a safe legacy display candidate."
                    },
                    "anchor_chat_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Echo of the one-on-one chat id the window is centered on."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "404": {
            "description": "The anchor turn is gone — deleted, or not part of this conversation. Show the reader that the turn no longer exists rather than retrying."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/translate_chatroom_message": {
      "post": {
        "operationId": "translate_chatroom_message",
        "summary": "Translate a text chatroom message into the viewer language.",
        "description": "Translates one text chatroom message into `preferred_language`. This operation requires an active subscription for the end-user. The message body is translated by Mind Upload, and repeated requests may return a cached translation until the source message changes. Reply quotes and media tags are ignored so only the human-readable text body is translated. Very large text messages may be rejected with a validation error before work starts.",
        "tags": [
          "Chatrooms"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "chatroom_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Chatroom id as returned by chatroom operations."
                  },
                  "message_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Chatroom message id."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "translated_text": {
                      "type": "string",
                      "nullable": true
                    },
                    "target_language": {
                      "type": "string",
                      "nullable": true
                    },
                    "cached": {
                      "type": "boolean",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/get_clone_voice": {
      "post": {
        "operationId": "get_clone_voice",
        "summary": "Read the voice an AI consciousness speaks one language in, and hear it.",
        "description": "Returns the voice the end-user's AI consciousness speaks one language in: a description of how it sounds, in the owner's own words or imagined by the consciousness, and its gender. A language without one gets one imagined the first time it is read, from what the consciousness knows of itself, and it is kept. With `include_preview`, the response also carries a short greeting spoken in that voice. Requires an active subscription for the end-user.",
        "tags": [
          "AI Consciousnesses"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "codename": {
                    "type": "string",
                    "nullable": true,
                    "description": "Ask for a consciousness by name instead of writing up an interview: returns the third-person description of that consciousness, if one has been produced. Any authenticated caller may ask. Only the third-person form is available this way; the first- and second-person forms address the interviewee and are theirs alone."
                  },
                  "clone_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "AI consciousness id as returned by clone operations.",
                    "minLength": 24,
                    "maxLength": 24,
                    "pattern": "^[0-9a-fA-F]{24}$"
                  },
                  "language": {
                    "type": "string",
                    "nullable": true,
                    "description": "The app language whose voice to read or change. Defaults to `preferred_language`.",
                    "enum": [
                      "ar",
                      "de",
                      "en",
                      "es",
                      "fa",
                      "fr",
                      "hi",
                      "it",
                      "ja",
                      "ko",
                      "nl",
                      "pl",
                      "pt",
                      "ru",
                      "th",
                      "tr",
                      "vi",
                      "zh-cn",
                      "zh-tw"
                    ]
                  },
                  "include_preview": {
                    "type": "boolean",
                    "description": "Also speak, or fetch, a short greeting in this voice.",
                    "default": false
                  },
                  "include_audio": {
                    "type": "boolean",
                    "description": "Also return the audio itself in `audio_base64`: one request instead of a second download from `audio_url`, for a client that reaches this API more easily than the media host.",
                    "default": false
                  }
                },
                "required": [
                  "password",
                  "username"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "clone_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "The consciousness whose voice this is."
                    },
                    "language": {
                      "type": "string",
                      "nullable": true,
                      "description": "The app language this voice belongs to.",
                      "enum": [
                        "ar",
                        "de",
                        "en",
                        "es",
                        "fa",
                        "fr",
                        "hi",
                        "it",
                        "ja",
                        "ko",
                        "nl",
                        "pl",
                        "pt",
                        "ru",
                        "th",
                        "tr",
                        "vi",
                        "zh-cn",
                        "zh-tw"
                      ]
                    },
                    "description": {
                      "type": "string",
                      "nullable": true,
                      "description": "How the voice sounds, in the owner's own words or imagined by the consciousness."
                    },
                    "written_by": {
                      "type": "string",
                      "nullable": true,
                      "description": "Who wrote the description: the owner, or the consciousness from what it knows of itself (`persona`) or with nothing to go on (`random`).",
                      "enum": [
                        "owner",
                        "persona",
                        "random"
                      ]
                    },
                    "gender": {
                      "type": "string",
                      "nullable": true,
                      "description": "The voice's gender, which is the consciousness's own whenever it has one.",
                      "enum": [
                        "Female",
                        "Male"
                      ]
                    },
                    "can_undo": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when an earlier voice of this language can be brought back with `undo`."
                    },
                    "can_redo": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "written_at": {
                      "type": "integer",
                      "nullable": true,
                      "description": "When this became the consciousness's voice in `language` (UNIX seconds), an `undo` included: later than the voice it replaced. A `speak_message` part of the same `clone_id` and `language` whose `voice_written_at` equals it was spoken in this voice."
                    },
                    "audio_url": {
                      "type": "string",
                      "nullable": true,
                      "description": "A time-limited link to the greeting spoken in this voice; null when none was asked for or it could not be spoken."
                    },
                    "audio_content_type": {
                      "type": "string",
                      "nullable": true,
                      "description": "The audio format of `audio_url`."
                    },
                    "audio_base64": {
                      "type": "string",
                      "nullable": true,
                      "description": "The audio itself, base64-encoded, when `include_audio` was asked for; null otherwise or when there is no audio."
                    },
                    "speech_failure": {
                      "type": "string",
                      "nullable": true,
                      "description": "Why there is no greeting: `refused` (asking again gives the same answer) or `unavailable` (asking again may work). Null when there is one or none was asked for.",
                      "enum": [
                        "refused",
                        "unavailable"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/design_clone_voice": {
      "post": {
        "operationId": "design_clone_voice",
        "summary": "Change an AI consciousness's voice by trying a new one.",
        "description": "Tries a new voice for one language and keeps it only if it could be heard: `own_words` with a `description` of how it sounds, `imagine` for one the consciousness imagines, `undo` for the one before, or `gender`, which sets the consciousness's own gender and makes the voice again for it. The response is the voice as it is afterwards, with the new voice's greeting. When `speech_failure` is `refused` the voice is unchanged and the same description will be refused again; when it is `unavailable`, trying again may work. A description that tells the voice what to say, rather than how it sounds, is rejected with a validation error. Requires an active subscription.",
        "tags": [
          "AI Consciousnesses"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "codename": {
                    "type": "string",
                    "nullable": true,
                    "description": "Ask for a consciousness by name instead of writing up an interview: returns the third-person description of that consciousness, if one has been produced. Any authenticated caller may ask. Only the third-person form is available this way; the first- and second-person forms address the interviewee and are theirs alone."
                  },
                  "clone_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "AI consciousness id as returned by clone operations.",
                    "minLength": 24,
                    "maxLength": 24,
                    "pattern": "^[0-9a-fA-F]{24}$"
                  },
                  "language": {
                    "type": "string",
                    "nullable": true,
                    "description": "The app language whose voice to read or change. Defaults to `preferred_language`.",
                    "enum": [
                      "ar",
                      "de",
                      "en",
                      "es",
                      "fa",
                      "fr",
                      "hi",
                      "it",
                      "ja",
                      "ko",
                      "nl",
                      "pl",
                      "pt",
                      "ru",
                      "th",
                      "tr",
                      "vi",
                      "zh-cn",
                      "zh-tw"
                    ]
                  },
                  "change": {
                    "type": "string",
                    "description": "How to change it: `own_words` (with `description`), `imagine`, `undo`, or `gender` (with `gender`).",
                    "enum": [
                      "own_words",
                      "imagine",
                      "undo",
                      "redo",
                      "gender"
                    ]
                  },
                  "description": {
                    "type": "string",
                    "nullable": true,
                    "description": "With `own_words`: how the voice sounds, e.g. age, timbre, pace, accent, mood. Never words for it to say.",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "gender": {
                    "type": "string",
                    "nullable": true,
                    "description": "With `gender`: the consciousness's gender, which its voice then has.",
                    "enum": [
                      "Female",
                      "Male"
                    ]
                  },
                  "include_audio": {
                    "type": "boolean",
                    "description": "Also return the audio itself in `audio_base64`: one request instead of a second download from `audio_url`, for a client that reaches this API more easily than the media host.",
                    "default": false
                  }
                },
                "required": [
                  "change",
                  "password",
                  "username"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "clone_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "The consciousness whose voice this is."
                    },
                    "language": {
                      "type": "string",
                      "nullable": true,
                      "description": "The app language this voice belongs to.",
                      "enum": [
                        "ar",
                        "de",
                        "en",
                        "es",
                        "fa",
                        "fr",
                        "hi",
                        "it",
                        "ja",
                        "ko",
                        "nl",
                        "pl",
                        "pt",
                        "ru",
                        "th",
                        "tr",
                        "vi",
                        "zh-cn",
                        "zh-tw"
                      ]
                    },
                    "description": {
                      "type": "string",
                      "nullable": true,
                      "description": "How the voice sounds, in the owner's own words or imagined by the consciousness."
                    },
                    "written_by": {
                      "type": "string",
                      "nullable": true,
                      "description": "Who wrote the description: the owner, or the consciousness from what it knows of itself (`persona`) or with nothing to go on (`random`).",
                      "enum": [
                        "owner",
                        "persona",
                        "random"
                      ]
                    },
                    "gender": {
                      "type": "string",
                      "nullable": true,
                      "description": "The voice's gender, which is the consciousness's own whenever it has one.",
                      "enum": [
                        "Female",
                        "Male"
                      ]
                    },
                    "can_undo": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when an earlier voice of this language can be brought back with `undo`."
                    },
                    "can_redo": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "written_at": {
                      "type": "integer",
                      "nullable": true,
                      "description": "When this became the consciousness's voice in `language` (UNIX seconds), an `undo` included: later than the voice it replaced. A `speak_message` part of the same `clone_id` and `language` whose `voice_written_at` equals it was spoken in this voice."
                    },
                    "audio_url": {
                      "type": "string",
                      "nullable": true,
                      "description": "A time-limited link to the greeting spoken in this voice; null when none was asked for or it could not be spoken."
                    },
                    "audio_content_type": {
                      "type": "string",
                      "nullable": true,
                      "description": "The audio format of `audio_url`."
                    },
                    "audio_base64": {
                      "type": "string",
                      "nullable": true,
                      "description": "The audio itself, base64-encoded, when `include_audio` was asked for; null otherwise or when there is no audio."
                    },
                    "speech_failure": {
                      "type": "string",
                      "nullable": true,
                      "description": "Why there is no greeting: `refused` (asking again gives the same answer) or `unavailable` (asking again may work). Null when there is one or none was asked for.",
                      "enum": [
                        "refused",
                        "unavailable"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/speak_message": {
      "post": {
        "operationId": "speak_message",
        "summary": "Hear one part of an AI consciousness's message in its own voice.",
        "description": "Speaks one part of a message an AI consciousness wrote, in that consciousness's voice: a chatroom message by `chatroom_id` and `message_id`, or a one-on-one reply by `chat_id`. The text is cut into parts the same way every time; ask for part 0, read `part_count`, and ask for the next parts while the first plays. Reply quotes, media, links and formatting are not spoken. With `translation`, a chatroom message's stored translation into `preferred_language` is spoken instead. A clip may be refused (`speech_failure: refused`; asking again gives the same answer) or not ready (`unavailable`; asking again may work). Audio links expire after a day. Requires an active subscription.",
        "tags": [
          "Conversation"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "chatroom_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Chatroom id as returned by chatroom operations.",
                    "minLength": 24,
                    "maxLength": 24,
                    "pattern": "^[0-9a-fA-F]{24}$"
                  },
                  "message_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Chatroom message id.",
                    "minLength": 24,
                    "maxLength": 24,
                    "pattern": "^[0-9a-fA-F]{24}$"
                  },
                  "chat_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "A one-on-one reply to speak, as `rag` and `get_chat` return it.",
                    "minLength": 24,
                    "maxLength": 24,
                    "pattern": "^[0-9a-fA-F]{24}$"
                  },
                  "translation": {
                    "type": "boolean",
                    "description": "Speak the chatroom message's stored translation into `preferred_language` instead of the original.",
                    "default": false
                  },
                  "part": {
                    "type": "integer",
                    "description": "Which part to speak, from 0.",
                    "minimum": 0,
                    "default": 0
                  },
                  "include_audio": {
                    "type": "boolean",
                    "description": "Also return the audio itself in `audio_base64`: one request instead of a second download from `audio_url`, for a client that reaches this API more easily than the media host.",
                    "default": false
                  }
                },
                "required": [
                  "password",
                  "username"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "audio_url": {
                      "type": "string",
                      "nullable": true,
                      "description": "A time-limited link to this part's audio; null on a failure."
                    },
                    "audio_content_type": {
                      "type": "string",
                      "nullable": true,
                      "description": "The audio format of `audio_url`."
                    },
                    "audio_base64": {
                      "type": "string",
                      "nullable": true,
                      "description": "The audio itself, base64-encoded, when `include_audio` was asked for; null otherwise or when there is no audio."
                    },
                    "speech_failure": {
                      "type": "string",
                      "nullable": true,
                      "description": "Why there is no audio: `refused` (asking again gives the same answer) or `unavailable` (asking again may work). Null when there is audio.",
                      "enum": [
                        "refused",
                        "unavailable"
                      ]
                    },
                    "part": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Which part this is."
                    },
                    "part_count": {
                      "type": "integer",
                      "nullable": true,
                      "description": "How many parts the message is spoken in."
                    },
                    "language": {
                      "type": "string",
                      "nullable": true,
                      "description": "The app language whose voice spoke it.",
                      "enum": [
                        "ar",
                        "de",
                        "en",
                        "es",
                        "fa",
                        "fr",
                        "hi",
                        "it",
                        "ja",
                        "ko",
                        "nl",
                        "pl",
                        "pt",
                        "ru",
                        "th",
                        "tr",
                        "vi",
                        "zh-cn",
                        "zh-tw"
                      ]
                    },
                    "clone_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "The consciousness whose voice spoke it."
                    },
                    "voice_written_at": {
                      "type": "integer",
                      "nullable": true,
                      "description": "When the voice that spoke it became the consciousness's voice in `language` (UNIX seconds): the same for every part spoken in it since, and later for any voice that replaced it (an `undo` included). A client keeping audio to play again keeps, for each `clone_id` and `language`, only parts whose `voice_written_at` is the newest it has seen for them. Null only when no voice could be made."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/check_chatroom_updates": {
      "post": {
        "operationId": "check_chatroom_updates",
        "summary": "Cheaply poll whether the user's chatrooms have new activity.",
        "description": "Cheap poll endpoint for chatroom freshness. Send each local chatroom id with the last `updated_at` value you saw, or `null` on the first poll. The response echoes one result per requested room in request order, tells you whether the room is still accessible, and returns `has_updates` when you should fetch new messages.",
        "tags": [
          "Chatrooms"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "chatrooms": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "chatroom_id": {
                          "type": "string",
                          "description": "Chatroom id as returned by chatroom operations."
                        },
                        "known_updated_at": {
                          "type": "number",
                          "nullable": true,
                          "description": "The last `updated_at` value your client has for this room, or null on the first poll."
                        }
                      },
                      "required": [
                        "chatroom_id"
                      ]
                    },
                    "nullable": true,
                    "description": "Rooms to check. Each entry must include `chatroom_id`; include `known_updated_at` from the previous response, or null/omit it on the first poll.",
                    "example": [
                      {
                        "chatroom_id": "64f0c8b2f7a9b4e1c2d3a456",
                        "known_updated_at": 1720000000.123
                      },
                      {
                        "chatroom_id": "64f0c8b2f7a9b4e1c2d3a457",
                        "known_updated_at": null
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "number",
                      "nullable": true,
                      "description": "Current server timestamp, useful for client-side poll scheduling."
                    },
                    "poll_config": {
                      "type": "object",
                      "properties": {
                        "enabled": {
                          "type": "boolean",
                          "description": "Whether adaptive chatroom polling is enabled."
                        },
                        "hot_seconds": {
                          "type": "integer",
                          "description": "Suggested short polling interval while the room is active."
                        },
                        "max_seconds": {
                          "type": "integer",
                          "description": "Suggested longest polling interval while the room is idle."
                        },
                        "hot_window_seconds": {
                          "type": "integer",
                          "description": "How long recent activity keeps a room in the hot polling window."
                        }
                      },
                      "required": [
                        "enabled",
                        "hot_seconds",
                        "hot_window_seconds",
                        "max_seconds"
                      ],
                      "nullable": true,
                      "description": "Recommended polling cadence for adaptive chatroom polling."
                    },
                    "chatrooms": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "chatroom_id": {
                            "type": "string",
                            "description": "Chatroom id as returned by chatroom operations."
                          },
                          "accessible": {
                            "type": "boolean",
                            "description": "Whether the caller can currently read this room."
                          },
                          "updated_at": {
                            "type": "number",
                            "nullable": true,
                            "description": "Opaque freshness watermark to send back as `known_updated_at` on the next poll."
                          },
                          "has_updates": {
                            "type": "boolean",
                            "description": "True when the room changed after the supplied `known_updated_at` value."
                          }
                        },
                        "required": [
                          "accessible",
                          "chatroom_id",
                          "has_updates",
                          "updated_at"
                        ]
                      },
                      "nullable": true,
                      "description": "One freshness result per requested room, in the same order as the request."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/create_chatroom_membership": {
      "post": {
        "operationId": "create_chatroom_membership",
        "summary": "Invite a user or an AI consciousness into a chatroom.",
        "tags": [
          "Chatrooms"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "chatroom_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Chatroom id as returned by chatroom operations."
                  },
                  "invitee_username": {
                    "type": "string",
                    "nullable": true
                  },
                  "invitee_codename": {
                    "type": "string",
                    "nullable": true
                  },
                  "admin_level": {
                    "type": "string",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "membership_id": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/get_chatroom_membership": {
      "post": {
        "operationId": "get_chatroom_membership",
        "summary": "List the members of a chatroom the user belongs to.",
        "tags": [
          "Chatrooms"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "page": {
                    "type": "integer",
                    "nullable": true,
                    "default": 1
                  },
                  "page_size": {
                    "type": "integer",
                    "description": "Maximum records requested for one server-capped page.",
                    "default": 10000
                  },
                  "sort_by": {
                    "type": "string",
                    "nullable": true,
                    "default": "created_at"
                  },
                  "sort_order": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Sort direction; supported values depend on the operation.",
                    "default": -1
                  },
                  "use_cursor_pagination": {
                    "type": "boolean",
                    "nullable": true,
                    "default": true
                  },
                  "cursor_value": {
                    "type": "string",
                    "nullable": true,
                    "description": "Opaque pagination cursor value from the previous page (`next_cursor_value`)."
                  },
                  "cursor_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Opaque pagination cursor id from the previous page (`next_cursor_id`)."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "chatroom_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Chatroom id as returned by chatroom operations."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "total_count": {
                      "type": "integer",
                      "nullable": true
                    },
                    "page": {
                      "type": "integer",
                      "nullable": true
                    },
                    "page_size": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Maximum records requested for one server-capped page."
                    },
                    "total_pages": {
                      "type": "integer",
                      "nullable": true
                    },
                    "has_next": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when another page is available after this response."
                    },
                    "has_prev": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "next_cursor_value": {
                      "type": "string",
                      "nullable": true,
                      "description": "Pass as `cursor_value` on the next page request."
                    },
                    "next_cursor_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Pass as `cursor_id` on the next page request."
                    },
                    "memberships": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      },
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/create_call_session": {
      "post": {
        "operationId": "create_call_session",
        "summary": "Start a live voice and video call in a chatroom, or join the one already running.",
        "description": "Starts a live voice and video call in a chatroom. Only one call runs in a room at a time: if somebody has already started one, this returns that call rather than a second one, so two people pressing call at the same moment end up together. The response contains a short-lived joining pass for the person making the request. Hand that pass to the real-time client library on your own app, which is what carries the sound and picture; the media never travels through this API, which only grants permission to join. Live calls are enabled per account, and we send you the client library and its integration guide when we switch them on for you — ask us to get started. Starting a call counts against your monthly allowance; `get_quota` reports your entitlement and what you have used. Use `mode` to choose the kind of call: a conversation everyone can speak in, or a broadcast where the audience listens and asks to speak first. Use `media_tier` to choose whether it carries a picture: `voice` is sound only. Voice and video minutes are counted separately, and your plan may put a ceiling on each kind on top of your combined monthly allowance — `get_quota` reports every ceiling and every figure. A broadcast is always a video call, whatever `media_tier` asks for.",
        "tags": [
          "Live calls"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "chatroom_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Chatroom id as returned by chatroom operations."
                  },
                  "mode": {
                    "type": "string",
                    "nullable": true,
                    "description": "What kind of call to start. `conversation` (the default) admits everyone able to speak and show their camera. `broadcast` admits everyone except the chatroom owner and admins able to watch, listen and ask to speak, until somebody running the call lets them. Only the chatroom owner and admins may start a broadcast; anyone else asking for one starts a conversation.",
                    "enum": [
                      "conversation",
                      "broadcast"
                    ]
                  },
                  "media_tier": {
                    "type": "string",
                    "nullable": true,
                    "description": "Whether this call carries a picture. `video` (the default) is a call with cameras; `voice` is a call with none at all — sound only, which asks far less of a slow or metered connection. It is fixed for the whole call and applies to everybody in it — nobody can turn a camera on in a voice call, and nobody can join one as a video participant — so switching means starting a new call. Two things override it. A call already running in the room wins: the caller joins that one, in the kind it is already in. And `mode: broadcast` wins: a broadcast is always a video call, counted and capped as one. Read `media_tier` back off the call in the response to see which kind you got.",
                    "enum": [
                      "voice",
                      "video"
                    ]
                  },
                  "host_inheritance": {
                    "type": "boolean",
                    "nullable": true,
                    "description": "Whether whoever starts this call runs it. False, and absent, mean the call controls rest only on chatroom standing — so a call whose owner and admins have all left carries on with nobody running it until one of them returns. Only the chatroom owner and admins may turn it on; anyone else asking for it is ignored. Set once, when the call starts."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "call_session_id": {
                      "type": "string",
                      "nullable": true
                    },
                    "auth_token": {
                      "type": "string",
                      "nullable": true
                    },
                    "participant_id": {
                      "type": "string",
                      "nullable": true
                    },
                    "expires_at": {
                      "type": "integer",
                      "nullable": true,
                      "description": "UNIX timestamp when this resource or capability expires."
                    },
                    "is_host": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "call_session": {
                      "type": "object",
                      "additionalProperties": {},
                      "nullable": true,
                      "description": "The call you are now in. Carries `call_session_id`, the `mode` and `media_tier` it is actually running in — which is what you got, not necessarily what you asked for when a call was already going — and who is in it."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "409": {
            "description": "This call already holds as many people as it can take. Nothing is wrong with the request — wait for somebody to leave and send it again, or run a second call in another room."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/join_call_session": {
      "post": {
        "operationId": "join_call_session",
        "summary": "Join a live call that is already running in a chatroom.",
        "description": "Joins a call that is already running, and returns a joining pass for the person making the request. Someone who is already in the call gets a fresh pass instead of appearing twice. Counts against your monthly allowance.",
        "tags": [
          "Live calls"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "call_session_id": {
                    "type": "string",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "call_session_id": {
                      "type": "string",
                      "nullable": true
                    },
                    "auth_token": {
                      "type": "string",
                      "nullable": true
                    },
                    "participant_id": {
                      "type": "string",
                      "nullable": true
                    },
                    "expires_at": {
                      "type": "integer",
                      "nullable": true,
                      "description": "UNIX timestamp when this resource or capability expires."
                    },
                    "is_host": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "call_session": {
                      "type": "object",
                      "additionalProperties": {},
                      "nullable": true,
                      "description": "The call you are now in. Carries `call_session_id`, the `mode` and `media_tier` it is actually running in — which is what you got, not necessarily what you asked for when a call was already going — and who is in it."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "409": {
            "description": "This call already holds as many people as it can take. Nothing is wrong with the request — wait for somebody to leave and send it again, or run a second call in another room."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/refresh_call_token": {
      "post": {
        "operationId": "refresh_call_token",
        "summary": "Get a fresh joining pass for a call, before the current one expires.",
        "description": "Returns a new joining pass for somebody already in a call. A pass authorizes joining, so a call in progress does not drop when one expires — but a fresh pass is what lets a client reconnect after losing its network, so ask for one before the current pass expires. Never refused for being over your allowance.",
        "tags": [
          "Live calls"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "call_session_id": {
                    "type": "string",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "call_session_id": {
                      "type": "string",
                      "nullable": true
                    },
                    "auth_token": {
                      "type": "string",
                      "nullable": true
                    },
                    "participant_id": {
                      "type": "string",
                      "nullable": true
                    },
                    "expires_at": {
                      "type": "integer",
                      "nullable": true,
                      "description": "UNIX timestamp when this resource or capability expires."
                    },
                    "is_host": {
                      "type": "boolean",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/leave_call_session": {
      "post": {
        "operationId": "leave_call_session",
        "summary": "Say that this person has left a call the others are still in.",
        "description": "Says that the person making the request has walked out of a call. Use it whenever somebody leaves, not only when the call is over: it is what keeps the number of people shown beside a call honest, since that number would otherwise count everybody who had ever been in it. It never ends the call and never affects anybody else, so it is safe to send more than once, and it is not refused for being over your allowance. To end a call for everyone, use end_call_session.",
        "tags": [
          "Live calls"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "call_session_id": {
                    "type": "string",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/end_call_session": {
      "post": {
        "operationId": "end_call_session",
        "summary": "End a live call for everyone in it.",
        "description": "Ends a call for everyone. Available to whoever started it, to the chatroom owner and admins, and to the last person still connected — so a call closes itself when the last participant hangs up instead of staying open. Never refused for being over your allowance, because ending a call is what stops it costing anything.",
        "tags": [
          "Live calls"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "call_session_id": {
                    "type": "string",
                    "nullable": true
                  },
                  "only_if_empty": {
                    "type": "boolean",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/set_call_host": {
      "post": {
        "operationId": "set_call_host",
        "summary": "Make somebody a co-host of a live call, or stand them down again.",
        "description": "Gives somebody the call controls — muting, removing, and deciding who may speak — for the length of one call, or takes them back. Available to anybody who already has them. The chatroom owner and admins are not affected either way: they hold these controls in every call in their room, so they cannot be given them and, more importantly, cannot be stripped of them by a guest. A change takes effect the next time that person connects to the call, because what somebody is allowed to do is fixed in the joining pass they were issued; ask them to reconnect, or call join_call_session for them again. The appointment lasts as long as the call and does not make anybody an admin of the chatroom.",
        "tags": [
          "Live calls"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "call_session_id": {
                    "type": "string",
                    "nullable": true
                  },
                  "target_user_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "User id of the person whose standing in the call is changing."
                  },
                  "runs_the_call": {
                    "type": "boolean",
                    "nullable": true,
                    "description": "True to give that person the call controls for the length of this call; false to take them back."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/get_active_call_session": {
      "post": {
        "operationId": "get_active_call_session",
        "summary": "Check whether a chatroom has a live call, and how many people are in it.",
        "description": "Reports the live call in a chatroom, or null when there is none, along with how many people are in it. Use it when opening a room so somebody arriving late can see a call in progress. A call whose participants have all disappeared without saying so is detected and closed here rather than being reported forever.",
        "tags": [
          "Live calls"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "chatroom_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Chatroom id as returned by chatroom operations."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "call_session": {
                      "type": "object",
                      "additionalProperties": {},
                      "nullable": true,
                      "description": "The call running in this chatroom, or null when there is none. Reported whether or not you are in it, so a client opening a room can offer the way in; joining is a separate request."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/request_upload_url": {
      "post": {
        "operationId": "request_upload_url",
        "summary": "Request an upload slot and a signed viewing link for a media attachment.",
        "tags": [
          "Media"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "filename": {
                    "type": "string",
                    "nullable": true
                  },
                  "content_type": {
                    "type": "string",
                    "nullable": true
                  },
                  "file_size_bytes": {
                    "type": "integer",
                    "nullable": true
                  },
                  "media_type": {
                    "type": "string",
                    "nullable": true,
                    "description": "The kind of media: `image`, `video`, or `audio`."
                  },
                  "has_thumbnail": {
                    "type": "boolean",
                    "nullable": true
                  },
                  "thumbnail_file_size_bytes": {
                    "type": "integer",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "r2_key": {
                      "type": "string",
                      "nullable": true,
                      "description": "Opaque media object key returned by upload-start operations and reused for multipart upload calls."
                    },
                    "presigned_url": {
                      "type": "string",
                      "nullable": true,
                      "description": "Temporary URL where the client PUTs the file. Valid for 60 minutes."
                    },
                    "media_url": {
                      "type": "string",
                      "nullable": true,
                      "description": "Media URL returned by this operation; use signed read URLs unchanged."
                    },
                    "signed_media_url": {
                      "type": "string",
                      "nullable": true,
                      "description": "Temporary readable media URL."
                    },
                    "thumbnail_r2_key": {
                      "type": "string",
                      "nullable": true,
                      "description": "Opaque thumbnail media object key, present only when a thumbnail upload was requested."
                    },
                    "thumbnail_presigned_url": {
                      "type": "string",
                      "nullable": true,
                      "description": "Temporary URL where the client PUTs the thumbnail. Valid for 60 minutes."
                    },
                    "signed_thumbnail_url": {
                      "type": "string",
                      "nullable": true,
                      "description": "Temporary readable thumbnail URL."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/request_multipart_upload": {
      "post": {
        "operationId": "request_multipart_upload",
        "summary": "Start a large-file upload in multiple parts.",
        "tags": [
          "Media"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "filename": {
                    "type": "string",
                    "nullable": true
                  },
                  "content_type": {
                    "type": "string",
                    "nullable": true
                  },
                  "file_size_bytes": {
                    "type": "integer",
                    "nullable": true
                  },
                  "media_type": {
                    "type": "string",
                    "nullable": true,
                    "description": "The kind of media: `image`, `video`, or `audio`."
                  },
                  "has_thumbnail": {
                    "type": "boolean",
                    "nullable": true
                  },
                  "thumbnail_file_size_bytes": {
                    "type": "integer",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "upload_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Multipart upload session id returned by `request_multipart_upload`."
                    },
                    "r2_key": {
                      "type": "string",
                      "nullable": true,
                      "description": "Opaque media object key returned by upload-start operations and reused for multipart upload calls."
                    },
                    "media_url": {
                      "type": "string",
                      "nullable": true,
                      "description": "Media URL returned by this operation; use signed read URLs unchanged."
                    },
                    "signed_media_url": {
                      "type": "string",
                      "nullable": true,
                      "description": "Temporary readable media URL."
                    },
                    "thumbnail_r2_key": {
                      "type": "string",
                      "nullable": true,
                      "description": "Opaque thumbnail media object key, present only when a thumbnail upload was requested."
                    },
                    "thumbnail_presigned_url": {
                      "type": "string",
                      "nullable": true,
                      "description": "Temporary URL where the client PUTs the thumbnail. Valid for 60 minutes."
                    },
                    "signed_thumbnail_url": {
                      "type": "string",
                      "nullable": true,
                      "description": "Temporary readable thumbnail URL."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/sign_upload_part": {
      "post": {
        "operationId": "sign_upload_part",
        "summary": "Get the signed link for one part of a multipart upload.",
        "tags": [
          "Media"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "r2_key": {
                    "type": "string",
                    "nullable": true,
                    "description": "Opaque media object key returned by upload-start operations and reused for multipart upload calls."
                  },
                  "upload_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Multipart upload session id returned by `request_multipart_upload`."
                  },
                  "part_number": {
                    "type": "integer",
                    "nullable": true,
                    "description": "One-based multipart part number."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "presigned_url": {
                      "type": "string",
                      "nullable": true,
                      "description": "Temporary URL where the client PUTs this part. Valid for 60 minutes."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/sign_upload_parts_batch": {
      "post": {
        "operationId": "sign_upload_parts_batch",
        "summary": "Get signed links for several parts of a multipart upload at once.",
        "tags": [
          "Media"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "r2_key": {
                    "type": "string",
                    "nullable": true,
                    "description": "Opaque media object key returned by upload-start operations and reused for multipart upload calls."
                  },
                  "upload_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Multipart upload session id returned by `request_multipart_upload`."
                  },
                  "part_numbers": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "nullable": true,
                    "description": "One-based multipart part numbers to sign in a single batch."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "presigned_urls": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "nullable": true,
                      "description": "Temporary upload URLs keyed by multipart part number. Each is valid for 60 minutes."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/list_upload_parts": {
      "post": {
        "operationId": "list_upload_parts",
        "summary": "List the parts already uploaded in a multipart upload.",
        "tags": [
          "Media"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "r2_key": {
                    "type": "string",
                    "nullable": true,
                    "description": "Opaque media object key returned by upload-start operations and reused for multipart upload calls."
                  },
                  "upload_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Multipart upload session id returned by `request_multipart_upload`."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "parts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      },
                      "nullable": true,
                      "description": "Completed multipart upload parts in ascending part-number order."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/complete_multipart_upload": {
      "post": {
        "operationId": "complete_multipart_upload",
        "summary": "Finish a multipart upload.",
        "tags": [
          "Media"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "r2_key": {
                    "type": "string",
                    "nullable": true,
                    "description": "Opaque media object key returned by upload-start operations and reused for multipart upload calls."
                  },
                  "upload_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Multipart upload session id returned by `request_multipart_upload`."
                  },
                  "parts": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    "nullable": true,
                    "description": "The successfully uploaded parts, using the `part_number` and `etag` returned by each part upload.",
                    "example": [
                      {
                        "part_number": 1,
                        "etag": "\"9b2cf535f27731c974343645a3985328\""
                      },
                      {
                        "part_number": 2,
                        "etag": "\"4c6426ac7ef186464ecbb0d81cbfcb1e\""
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "media_url": {
                      "type": "string",
                      "nullable": true,
                      "description": "Media URL returned by this operation; use signed read URLs unchanged."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/abort_multipart_upload": {
      "post": {
        "operationId": "abort_multipart_upload",
        "summary": "Cancel a multipart upload and discard its parts.",
        "tags": [
          "Media"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "r2_key": {
                    "type": "string",
                    "nullable": true,
                    "description": "Opaque media object key returned by upload-start operations and reused for multipart upload calls."
                  },
                  "upload_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Multipart upload session id returned by `request_multipart_upload`."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/cancel_upload": {
      "post": {
        "operationId": "cancel_upload",
        "summary": "Cancel a pending upload.",
        "tags": [
          "Media"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "r2_key": {
                    "type": "string",
                    "nullable": true,
                    "description": "Opaque media object key returned by upload-start operations and reused for multipart upload calls."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/start_media_analysis": {
      "post": {
        "operationId": "start_media_analysis",
        "summary": "Begin analysing an uploaded or linked attachment so its description is ready before the message is sent.",
        "description": "Start describing an attachment the moment it is uploaded or pasted in, while the person is still typing. That description is what lets an AI consciousness perceive a shared image, clip, or recording, and today it is written when the message is sent, so the reply waits for it. Call this instead and sending the message later costs nothing extra for that attachment. Name the conversation the attachment is for with either `codename` (a one-on-one AI consciousness) or `chatroom_id` (a room) — exactly one of the two, never both and never neither. It must be a conversation the person can already reach, and it is also what lets the description spell names the way that conversation already spells them. One call may carry at most 1 media item(s): a call is charged one credit however many attachments it carries, so a message with several attachments is one call each, charged one credit each. Calling again for an attachment already being described starts no second description — but it is still a fresh request, charged again and counted again against the rate limit. There is no operation for checking on a description later, and this one must not be used as one: do not poll it. There is also nothing to wait for — if a description is not ready when the message is sent, sending the message writes it then. Call this once per attachment and carry on. Nothing is attached to a message here, and an attachment whose message is never sent is cleaned up on its own. This operation spends credits, so it counts against the daily credit caps `get_quota` reports.",
        "tags": [
          "Media"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "media": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "media_type": {
                          "type": "string",
                          "description": "The kind of media: `image`, `video`, or `audio`."
                        },
                        "url": {
                          "type": "string",
                          "description": "Where the attachment is — the `media_url` an upload returned, or an external link. Echoed back in the result so you can match each entry to what you sent."
                        }
                      },
                      "required": [
                        "media_type",
                        "url"
                      ]
                    },
                    "description": "The attachment to start describing, as its own call. Send each one as soon as it is uploaded or pasted, while the person is still typing, so nothing is left to do at send time. `maxItems` is the cap; a longer array is rejected, not truncated.",
                    "example": [
                      {
                        "media_type": "image",
                        "url": "https://example.com/holiday-photo.jpg"
                      }
                    ],
                    "maxItems": 1
                  },
                  "codename": {
                    "type": "string",
                    "nullable": true,
                    "description": "The AI consciousness this attachment is for, named the way `rag` and `get_chat` name it. Send this for a one-on-one conversation, or `chatroom_id` for a room — exactly one of the two, and the person must be able to reach it.",
                    "example": "Aria"
                  },
                  "chatroom_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "The chatroom this attachment is for, as returned by chatroom operations. Send this for a room, or `codename` for a one-on-one conversation — exactly one of the two, and the person must already be in the room.",
                    "example": "64f0c8b2f7a9b4e1c2d3a456",
                    "minLength": 24,
                    "maxLength": 24,
                    "pattern": "^[0-9a-fA-F]{24}$"
                  }
                },
                "required": [
                  "media",
                  "password",
                  "username"
                ],
                "allOf": [
                  {
                    "oneOf": [
                      {
                        "required": [
                          "codename"
                        ]
                      },
                      {
                        "required": [
                          "chatroom_id"
                        ]
                      }
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "analyses": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string",
                            "description": "Where the attachment is — the `media_url` an upload returned, or an external link. Echoed back in the result so you can match each entry to what you sent."
                          },
                          "analysis_status": {
                            "type": "string",
                            "description": "How far this attachment's description had got at the moment this call returned: `pending` when it was just started, `processing` while it is being written, `completed` when it is already available, and `failed` when this attachment could not be started at all, or was analyzed and the analysis declined to describe it — the other entries are unaffected and the attachment is still sendable, though a declined one stays undescribed when it is sent. The value is never updated afterwards and there is nothing to poll: calling again to see a newer one is a fresh charged request that buys no more than sending the message does."
                          }
                        },
                        "required": [
                          "analysis_status",
                          "url"
                        ]
                      },
                      "nullable": true,
                      "description": "One entry per attachment you sent, in the same order. `completed` means the description is already written; `pending` or `processing` means it is under way, and `failed` means no description was started for that attachment — the attachment is still perfectly sendable either way. Every value is a one-shot report from this call and is never updated: there is nothing to poll and nothing a client has to do with it, because sending the message describes whatever is still missing."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/start_voice_interview": {
      "post": {
        "operationId": "start_voice_interview",
        "summary": "Begin a spoken interview with one of your end-users, or hand back one they have not finished with.",
        "description": "Starts an interview and returns its first question as both text and a playable audio URL. Pick the question set with `template_key`; the whole interview — every question and the final write-up — is produced in the language you send as `preferred_language`. If this user already has an unfinished interview on the same clone, it is resumed instead of restarted and `is_resumed` is true, so a person who closed your app halfway through picks up where they stopped. If instead they finished one recently and never asked for the write-up, that session is handed back: `is_complete` is true, there is no question, and `interview_session_id` is the one to pass to `generate_voice_interview_report`. Neither case counts against the daily limit, because neither starts an interview. Hold on to `interview_session_id`: every later call needs it.",
        "tags": [
          "Voice Interviews"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "codename": {
                    "type": "string",
                    "nullable": true,
                    "description": "Ask for a consciousness by name instead of writing up an interview: returns the third-person description of that consciousness, if one has been produced. Any authenticated caller may ask. Only the third-person form is available this way; the first- and second-person forms address the interviewee and are theirs alone."
                  },
                  "clone_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "AI consciousness id as returned by clone operations."
                  },
                  "template_key": {
                    "type": "string",
                    "nullable": true,
                    "description": "Which question set to run. `mind_upload_first_time` is a long first-run interview whose write-up is meant for a mind-data upload; `memory_refresh` and `personality_refresh` are short repeatable ones that ask something different each time; `matchmaking` surfaces what someone values; `guided_reflection` gives them somewhere to think out loud, and is not counseling.",
                    "enum": [
                      "mind_upload_first_time",
                      "memory_refresh",
                      "personality_refresh",
                      "matchmaking",
                      "guided_reflection"
                    ]
                  },
                  "voice_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Optional. Which voice the interviewer speaks in, one of the `voices` a start returns. Sending it keeps it for this consciousness, and an interview in progress answers with its current question spoken in it, so the voice is heard as it is chosen. Left out, the consciousness keeps the voice it has.",
                    "enum": [
                      "female_warm",
                      "female_gentle",
                      "female_soft",
                      "female_bright",
                      "female_clear",
                      "female_smooth",
                      "female_easygoing",
                      "female_breezy",
                      "female_upbeat",
                      "female_youthful",
                      "female_firm",
                      "female_forward",
                      "female_mature",
                      "female_yoga_instructor",
                      "female_aloof",
                      "female_secretary",
                      "female_innocent",
                      "female_bashful",
                      "female_playful",
                      "male_friendly",
                      "male_casual",
                      "male_easygoing",
                      "male_smooth",
                      "male_clear",
                      "male_even",
                      "male_informative",
                      "male_knowledgeable",
                      "male_upbeat",
                      "male_lively",
                      "male_excitable",
                      "male_firm",
                      "male_breathy",
                      "male_gravelly",
                      "male_cool_idol",
                      "male_confident_charmer",
                      "male_young_scholar",
                      "male_indie_singer",
                      "male_sunny_athlete"
                    ]
                  },
                  "accent_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Optional. Which accent the interviewer speaks the interview's language in, one of the `accents` a start returns for that language. It is picked apart from the voice, so every voice can speak in every accent of the language. Sending it keeps it for this consciousness in that language, and an interview in progress answers with its current question spoken in it, as with `voice_id`; both may be sent together. One that is not an accent of the interview's language is refused. Left out, the consciousness keeps the accent it has in that language, the one marked `is_default` until one is picked.",
                    "enum": [
                      "en_standard",
                      "en_british",
                      "en_indian",
                      "en_london",
                      "en_australian",
                      "en_irish",
                      "en_scottish",
                      "en_american_south",
                      "en_chinese",
                      "en_russian",
                      "en_french",
                      "en_japanese",
                      "en_german",
                      "en_spanish",
                      "en_italian",
                      "en_portuguese",
                      "en_dutch",
                      "en_new_zealand",
                      "en_canadian",
                      "en_south_african",
                      "en_nigerian",
                      "en_kenyan",
                      "en_ghanaian",
                      "en_singaporean",
                      "en_filipino",
                      "en_malaysian",
                      "en_hong_kong",
                      "en_jamaican",
                      "en_korean",
                      "en_brazilian",
                      "en_vietnamese",
                      "en_thai",
                      "en_egyptian",
                      "en_african_american",
                      "cmn_standard",
                      "cmn_taiwan",
                      "cmn_guangdong",
                      "cmn_sichuan",
                      "cmn_shandong",
                      "cmn_dongbei",
                      "cmn_shanghai",
                      "cmn_wuhan",
                      "cmn_tianjin",
                      "cmn_xinjiang",
                      "cmn_fujian",
                      "cmn_henan",
                      "cmn_guangxi",
                      "cmn_beijing",
                      "cmn_hunan",
                      "cmn_shaanxi",
                      "cmn_shanxi",
                      "cmn_guizhou",
                      "cmn_yunnan",
                      "es_standard",
                      "es_colombian",
                      "es_caribbean",
                      "es_andalusian",
                      "es_mexican",
                      "es_chilean",
                      "pt_standard",
                      "pt_european",
                      "pt_carioca",
                      "ru_standard",
                      "ru_southern",
                      "ja_standard",
                      "ja_kansai",
                      "de_standard",
                      "de_austrian",
                      "de_swiss",
                      "ko_standard",
                      "ko_gyeongsang",
                      "fr_standard",
                      "fr_west_african",
                      "fr_quebec",
                      "fr_southern",
                      "it_standard",
                      "it_tuscan",
                      "it_roman",
                      "it_neapolitan",
                      "it_sicilian",
                      "nl_standard",
                      "nl_amsterdam",
                      "nl_surinamese",
                      "pl_standard",
                      "pl_silesian",
                      "hi_standard",
                      "ar_standard",
                      "fa_standard",
                      "tr_standard",
                      "vi_standard",
                      "th_standard"
                    ]
                  },
                  "interview_session_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Optional. The interview a `voice_id` or `accent_id` is for. With it, the call only switches that interview's voice or accent while it is in progress, and is refused once it has ended rather than starting or resuming another."
                  },
                  "include_audio": {
                    "type": "boolean",
                    "description": "Include short preview clips in `inline_audio`, so they can play without a separate download. Longer clips keep their audio links.",
                    "default": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "interview_session_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Identifies one interview. Returned by start_voice_interview and required by every later call."
                    },
                    "template_key": {
                      "type": "string",
                      "nullable": true,
                      "description": "Which question set to run.",
                      "enum": [
                        "mind_upload_first_time",
                        "memory_refresh",
                        "personality_refresh",
                        "matchmaking",
                        "guided_reflection"
                      ]
                    },
                    "language": {
                      "type": "string",
                      "nullable": true
                    },
                    "turn_index": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Which question this call is about. Send back the one you were last given; it makes the call safe to retry."
                    },
                    "question_text": {
                      "type": "string",
                      "nullable": true,
                      "description": "The question the user is being asked, in the interview language."
                    },
                    "question_audio_url": {
                      "type": "string",
                      "nullable": true,
                      "description": "A time-limited URL for the spoken question. Play it to the user."
                    },
                    "question_audio_content_type": {
                      "type": "string",
                      "nullable": true,
                      "description": "Media type of the question audio, so a player can be chosen without sniffing."
                    },
                    "inline_audio": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "audio_url": {
                            "type": "string",
                            "nullable": true
                          },
                          "audio_content_type": {
                            "type": "string",
                            "nullable": true
                          },
                          "audio_base64": {
                            "type": "string",
                            "nullable": true
                          },
                          "speech_failure": {
                            "type": "string",
                            "nullable": true
                          }
                        },
                        "required": [
                          "audio_base64",
                          "audio_content_type",
                          "audio_url",
                          "speech_failure"
                        ]
                      },
                      "nullable": true,
                      "description": "Short clips with their audio links, formats and base64-encoded bytes, when `include_audio` was requested. Other clips keep their audio links."
                    },
                    "progress": {
                      "type": "number",
                      "nullable": true,
                      "description": "How far through the interview the user is, from 0 to 1."
                    },
                    "is_complete": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when there are no further questions and the write-up can be requested."
                    },
                    "is_resumed": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when this picked up an interview the user had already started rather than beginning a new one."
                    },
                    "status": {
                      "type": "string",
                      "nullable": true,
                      "description": "Where the interview itself stands: `in_progress` while there are questions left, `completed` once the write-up can be asked for, `aborted` when the user ended it and the transcript was discarded, and `halted_for_safety` when an answer suggested the person needed help rather than another question -- on which show `safety_message` and stop asking. The new first interview instead uses `safety_paused`: its earlier confirmed answers are kept, the triggering answer is excluded, and questions remain paused.",
                      "enum": [
                        "in_progress",
                        "safety_paused",
                        "completed",
                        "aborted",
                        "halted_for_safety"
                      ]
                    },
                    "voice_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "The voice this consciousness's interviews speak in now.",
                      "enum": [
                        "female_warm",
                        "female_gentle",
                        "female_soft",
                        "female_bright",
                        "female_clear",
                        "female_smooth",
                        "female_easygoing",
                        "female_breezy",
                        "female_upbeat",
                        "female_youthful",
                        "female_firm",
                        "female_forward",
                        "female_mature",
                        "female_yoga_instructor",
                        "female_aloof",
                        "female_secretary",
                        "female_innocent",
                        "female_bashful",
                        "female_playful",
                        "male_friendly",
                        "male_casual",
                        "male_easygoing",
                        "male_smooth",
                        "male_clear",
                        "male_even",
                        "male_informative",
                        "male_knowledgeable",
                        "male_upbeat",
                        "male_lively",
                        "male_excitable",
                        "male_firm",
                        "male_breathy",
                        "male_gravelly",
                        "male_cool_idol",
                        "male_confident_charmer",
                        "male_young_scholar",
                        "male_indie_singer",
                        "male_sunny_athlete"
                      ]
                    },
                    "voices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "voice_id": {
                            "type": "string"
                          },
                          "gender": {
                            "type": "string"
                          },
                          "character": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "character",
                          "gender",
                          "voice_id"
                        ]
                      },
                      "nullable": true,
                      "description": "Every voice on offer, each with its `voice_id`, its `gender` (`female`, `male`) and its `character`, a word or two in snake_case for who it is or how it sounds. Name a voice by its `voice_id`: two voices may share a character word in different genders."
                    },
                    "accent_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "The accent this interview speaks its language in now.",
                      "enum": [
                        "en_standard",
                        "en_british",
                        "en_indian",
                        "en_london",
                        "en_australian",
                        "en_irish",
                        "en_scottish",
                        "en_american_south",
                        "en_chinese",
                        "en_russian",
                        "en_french",
                        "en_japanese",
                        "en_german",
                        "en_spanish",
                        "en_italian",
                        "en_portuguese",
                        "en_dutch",
                        "en_new_zealand",
                        "en_canadian",
                        "en_south_african",
                        "en_nigerian",
                        "en_kenyan",
                        "en_ghanaian",
                        "en_singaporean",
                        "en_filipino",
                        "en_malaysian",
                        "en_hong_kong",
                        "en_jamaican",
                        "en_korean",
                        "en_brazilian",
                        "en_vietnamese",
                        "en_thai",
                        "en_egyptian",
                        "en_african_american",
                        "cmn_standard",
                        "cmn_taiwan",
                        "cmn_guangdong",
                        "cmn_sichuan",
                        "cmn_shandong",
                        "cmn_dongbei",
                        "cmn_shanghai",
                        "cmn_wuhan",
                        "cmn_tianjin",
                        "cmn_xinjiang",
                        "cmn_fujian",
                        "cmn_henan",
                        "cmn_guangxi",
                        "cmn_beijing",
                        "cmn_hunan",
                        "cmn_shaanxi",
                        "cmn_shanxi",
                        "cmn_guizhou",
                        "cmn_yunnan",
                        "es_standard",
                        "es_colombian",
                        "es_caribbean",
                        "es_andalusian",
                        "es_mexican",
                        "es_chilean",
                        "pt_standard",
                        "pt_european",
                        "pt_carioca",
                        "ru_standard",
                        "ru_southern",
                        "ja_standard",
                        "ja_kansai",
                        "de_standard",
                        "de_austrian",
                        "de_swiss",
                        "ko_standard",
                        "ko_gyeongsang",
                        "fr_standard",
                        "fr_west_african",
                        "fr_quebec",
                        "fr_southern",
                        "it_standard",
                        "it_tuscan",
                        "it_roman",
                        "it_neapolitan",
                        "it_sicilian",
                        "nl_standard",
                        "nl_amsterdam",
                        "nl_surinamese",
                        "pl_standard",
                        "pl_silesian",
                        "hi_standard",
                        "ar_standard",
                        "fa_standard",
                        "tr_standard",
                        "vi_standard",
                        "th_standard"
                      ]
                    },
                    "accents": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "accent_id": {
                            "type": "string"
                          },
                          "is_default": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "accent_id",
                          "is_default"
                        ]
                      },
                      "nullable": true,
                      "description": "Every accent on offer in the interview's language, in the order to show them, each with its `accent_id` and `is_default`, true for the one alone that the interview speaks in until another is picked: its language's standard. Some languages offer only their standard."
                    },
                    "spoken_lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "line_id": {
                            "type": "string",
                            "nullable": true
                          },
                          "line_role": {
                            "type": "string"
                          },
                          "text": {
                            "type": "string"
                          },
                          "audio_url": {
                            "type": "string"
                          },
                          "audio_content_type": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "audio_content_type",
                          "audio_url",
                          "line_id",
                          "line_role",
                          "text"
                        ]
                      },
                      "nullable": true,
                      "description": "Present only on an interview made of spoken lines. Every line this reply says, in the order to play them, each with its `line_id` (null for a question written for this answer), its `line_role` (`anchor`, `chaser`, `statement`, `pivot`, `acknowledgement`, `backchannel`, `waiting`, `mirror`, `closing`, `follow_up`), its `text` in the interview language, and its `audio_url` and `audio_content_type`; a line with an empty `audio_url` is shown as text. The last line is the question, which `question_text` and `question_audio_url` carry too. Skip the first line when you have already played that `line_id`."
                    },
                    "chapter_key": {
                      "type": "string",
                      "nullable": true,
                      "description": "Present only on an interview made of spoken lines. Which chapter the question is in."
                    },
                    "chapter_title": {
                      "type": "string",
                      "nullable": true,
                      "description": "Present only on an interview made of spoken lines. The chapter's title, in the interview language."
                    },
                    "chapter_index": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Present only on an interview made of spoken lines. Where the chapter comes, counting from 0; a new value means a new chapter has begun."
                    },
                    "chapter_count": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Present only on an interview made of spoken lines. How many chapters it has."
                    },
                    "minutes_left_estimate": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Present only on an interview made of spoken lines. Roughly how many minutes of answering are left, rounded up, from how long this user's answers have taken so far; 0 once it has ended."
                    },
                    "review_mode": {
                      "type": "string",
                      "nullable": true,
                      "description": "Present only on an interview made of spoken lines. How the user accepts the transcript of their answer to the question: `auto` lets it through after a short pause unless they touch it, and `confirm` waits for them, as for a name or a date of birth, and for every answer once they have corrected one. Null when nothing is asked.",
                      "enum": [
                        "auto",
                        "confirm"
                      ]
                    },
                    "learned_facts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "slot": {
                            "type": "string"
                          },
                          "display_value": {
                            "type": "string"
                          },
                          "visibility": {
                            "type": "string"
                          },
                          "certainty": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "certainty",
                          "display_value",
                          "slot",
                          "visibility"
                        ]
                      },
                      "nullable": true,
                      "description": "Present only on an interview made of spoken lines. The basic facts of their life the user has told it so far, each with its `slot`, its `display_value`, its `visibility` (`shared`, `general_only`, `owner_only`) and its `certainty` (`said`, `inferred`, `needs_confirmation`). This is the owner's review snapshot. Confirmed facts become consciousness knowledge; legacy visibility labels do not control what it may disclose."
                    },
                    "ambient_clips": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "line_id": {
                            "type": "string",
                            "nullable": true
                          },
                          "line_role": {
                            "type": "string"
                          },
                          "text": {
                            "type": "string"
                          },
                          "audio_url": {
                            "type": "string"
                          },
                          "audio_content_type": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "audio_content_type",
                          "audio_url",
                          "line_id",
                          "line_role",
                          "text"
                        ]
                      },
                      "nullable": true,
                      "description": "Present only on an interview made of spoken lines. Lines to download now and play without another call when their moment comes, shaped as `spoken_lines` are: the answer to the user's first hello, the short sounds made as an answer ends and while a reply is slow, the lines said while a longer reply is being prepared and in its place should it not come, and the line said on finishing early. A line with an empty `audio_url` is shown as text."
                    },
                    "answered_count": {
                      "type": "integer",
                      "nullable": true
                    },
                    "safety_paused": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "safety_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Present only when the interview stopped because an answer suggested the person needed help rather than another question. Show it, and do not continue the interview."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/transcribe_voice_interview_answer": {
      "post": {
        "operationId": "transcribe_voice_interview_answer",
        "summary": "Turn one recorded spoken answer into text for the user to check before it is accepted.",
        "description": "Transcribes one recorded answer and returns the text. Send the recording base64-encoded in `answer_audio_base64` with its container in `answer_audio_content_type`. Show the returned text to the user to confirm or correct before you accept it with `advance_voice_interview` — that review step is the point of this being a separate call. The recording is transcribed and discarded; it is never stored. Record compactly: a short, compressed clip transcribes several times faster than a large uncompressed one of the same speech.",
        "tags": [
          "Voice Interviews"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "interview_session_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Identifies one interview. Returned by start_voice_interview and required by every later call."
                  },
                  "answer_audio_base64": {
                    "type": "string",
                    "nullable": true,
                    "description": "The user's recorded answer, base64-encoded. Discarded after transcription; never stored."
                  },
                  "answer_audio_content_type": {
                    "type": "string",
                    "nullable": true,
                    "description": "Container of the recording being sent."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "recognized_text": {
                      "type": "string",
                      "nullable": true,
                      "description": "What the user was heard to say. Show it to them to confirm or correct."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/advance_voice_interview": {
      "post": {
        "operationId": "advance_voice_interview",
        "summary": "Accept, edit, skip, re-record or abandon the question the user is on, and receive the next one.",
        "description": "Records what the user decided about the question they are on, and returns the next one with its audio. Set `action` to `confirm` to accept the transcript as it stands, `edit` to accept text the user changed, `skip` to move on without answering, `re_answer` to discard the recording and be given the same question again, or `abort` to end the interview and discard it. `turn_index` must be the one you were last given: it makes this call safe to retry, because a repeat of a turn that already moved on is answered with the question the interview is on instead of consuming another one. Send `client_answer_id` as well, and a retry of an answer still being saved returns `is_processing`, while one after it was saved returns the reply the first request was given. `progress` runs from 0 to 1. When `is_complete` is true there are no more questions and you can ask for the write-up.",
        "tags": [
          "Voice Interviews"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "interview_session_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Identifies one interview. Returned by start_voice_interview and required by every later call."
                  },
                  "turn_index": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Which question this call is about. Send back the one you were last given; it makes the call safe to retry."
                  },
                  "action": {
                    "type": "string",
                    "nullable": true,
                    "description": "What the user did with the question: `confirm` accepts the transcript unchanged, `edit` accepts text they corrected, `skip` moves on without an answer, `re_answer` discards the recording and re-serves the same question, and `abort` ends the interview and discards it. `skip`, `re_answer` and `abort` must not carry `confirmed_text`.",
                    "enum": [
                      "confirm",
                      "prepare",
                      "finish_now",
                      "edit",
                      "skip",
                      "re_answer",
                      "abort"
                    ]
                  },
                  "confirmed_text": {
                    "type": "string",
                    "nullable": true,
                    "description": "The answer text the user accepted, after any correction they made."
                  },
                  "client_answer_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Optional. An id your app makes for this one answer, at most 64 characters, and sends again unchanged with every retry of it. With it, a retry that arrives while the answer is still being saved returns `is_processing` instead of an error, and one that arrives after it was saved returns the reply the first request was given. Make a new one for each answer.",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "fact_corrections": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    "nullable": true
                  },
                  "review_dwell_milliseconds": {
                    "type": "integer",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "interview_session_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Identifies one interview. Returned by start_voice_interview and required by every later call."
                    },
                    "template_key": {
                      "type": "string",
                      "nullable": true,
                      "description": "Which question set to run.",
                      "enum": [
                        "mind_upload_first_time",
                        "memory_refresh",
                        "personality_refresh",
                        "matchmaking",
                        "guided_reflection"
                      ]
                    },
                    "language": {
                      "type": "string",
                      "nullable": true
                    },
                    "turn_index": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Which question this call is about. Send back the one you were last given; it makes the call safe to retry."
                    },
                    "question_text": {
                      "type": "string",
                      "nullable": true,
                      "description": "The question the user is being asked, in the interview language."
                    },
                    "question_audio_url": {
                      "type": "string",
                      "nullable": true,
                      "description": "A time-limited URL for the spoken question. Play it to the user."
                    },
                    "question_audio_content_type": {
                      "type": "string",
                      "nullable": true,
                      "description": "Media type of the question audio, so a player can be chosen without sniffing."
                    },
                    "progress": {
                      "type": "number",
                      "nullable": true,
                      "description": "How far through the interview the user is, from 0 to 1."
                    },
                    "is_complete": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when there are no further questions and the write-up can be requested."
                    },
                    "is_resumed": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when this picked up an interview the user had already started rather than beginning a new one."
                    },
                    "is_processing": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when this request repeated, by its `client_answer_id`, an answer that is still being saved. Nothing else in the reply describes a question: wait a moment and send the same request again to receive the reply the answer was given. Absent otherwise."
                    },
                    "status": {
                      "type": "string",
                      "nullable": true,
                      "description": "Where the interview itself stands: `in_progress` while there are questions left, `completed` once the write-up can be asked for, `aborted` when the user ended it and the transcript was discarded, and `halted_for_safety` when an answer suggested the person needed help rather than another question -- on which show `safety_message` and stop asking. The new first interview instead uses `safety_paused`: its earlier confirmed answers are kept, the triggering answer is excluded, and questions remain paused.",
                      "enum": [
                        "in_progress",
                        "safety_paused",
                        "completed",
                        "aborted",
                        "halted_for_safety"
                      ]
                    },
                    "safety_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Present only when the interview stopped because an answer suggested the person needed help rather than another question. Show it, and do not continue the interview."
                    },
                    "spoken_lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "line_id": {
                            "type": "string",
                            "nullable": true
                          },
                          "line_role": {
                            "type": "string"
                          },
                          "text": {
                            "type": "string"
                          },
                          "audio_url": {
                            "type": "string"
                          },
                          "audio_content_type": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "audio_content_type",
                          "audio_url",
                          "line_id",
                          "line_role",
                          "text"
                        ]
                      },
                      "nullable": true,
                      "description": "Present only on an interview made of spoken lines. Every line this reply says, in the order to play them, each with its `line_id` (null for a question written for this answer), its `line_role` (`anchor`, `chaser`, `statement`, `pivot`, `acknowledgement`, `backchannel`, `waiting`, `mirror`, `closing`, `follow_up`), its `text` in the interview language, and its `audio_url` and `audio_content_type`; a line with an empty `audio_url` is shown as text. The last line is the question, which `question_text` and `question_audio_url` carry too. Skip the first line when you have already played that `line_id`."
                    },
                    "chapter_key": {
                      "type": "string",
                      "nullable": true,
                      "description": "Present only on an interview made of spoken lines. Which chapter the question is in."
                    },
                    "chapter_title": {
                      "type": "string",
                      "nullable": true,
                      "description": "Present only on an interview made of spoken lines. The chapter's title, in the interview language."
                    },
                    "chapter_index": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Present only on an interview made of spoken lines. Where the chapter comes, counting from 0; a new value means a new chapter has begun."
                    },
                    "chapter_count": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Present only on an interview made of spoken lines. How many chapters it has."
                    },
                    "minutes_left_estimate": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Present only on an interview made of spoken lines. Roughly how many minutes of answering are left, rounded up, from how long this user's answers have taken so far; 0 once it has ended."
                    },
                    "review_mode": {
                      "type": "string",
                      "nullable": true,
                      "description": "Present only on an interview made of spoken lines. How the user accepts the transcript of their answer to the question: `auto` lets it through after a short pause unless they touch it, and `confirm` waits for them, as for a name or a date of birth, and for every answer once they have corrected one. Null when nothing is asked.",
                      "enum": [
                        "auto",
                        "confirm"
                      ]
                    },
                    "learned_facts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "slot": {
                            "type": "string"
                          },
                          "display_value": {
                            "type": "string"
                          },
                          "visibility": {
                            "type": "string"
                          },
                          "certainty": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "certainty",
                          "display_value",
                          "slot",
                          "visibility"
                        ]
                      },
                      "nullable": true,
                      "description": "Present only on an interview made of spoken lines. The basic facts of their life the user has told it so far, each with its `slot`, its `display_value`, its `visibility` (`shared`, `general_only`, `owner_only`) and its `certainty` (`said`, `inferred`, `needs_confirmation`). This is the owner's review snapshot. Confirmed facts become consciousness knowledge; legacy visibility labels do not control what it may disclose."
                    },
                    "prepared": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "next_turn_kind": {
                      "type": "string",
                      "nullable": true
                    },
                    "safety_paused": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "answered_count": {
                      "type": "integer",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/generate_voice_interview_report": {
      "post": {
        "operationId": "generate_voice_interview_report",
        "summary": "Write a finished interview up as prose, in first, second or third person.",
        "description": "Writes the interview up as prose and returns it. Nothing is added to the user's mind data: what you do with the text is yours to decide, and uploading it as the user's mind data is a separate call they should confirm first. A finished interview's write-up is kept with the interview until it expires, so asking again in the same `person` returns the same text without writing it again, which is how a reply that never arrived is fetched. `person` chooses the voice it is written in — `first_person` reads as the user themselves and is what a mind-data upload wants, `second_person` addresses them, and `third_person` describes them for someone who was not there. `text_type` tells you which mind-data category this interview belongs to.",
        "tags": [
          "Voice Interviews"
        ],
        "security": [
          {
            "PartnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preferred_language": {
                    "type": "string",
                    "nullable": true,
                    "description": "BCP-47-ish language code (e.g. 'en', 'zh-cn') for localized messages."
                  },
                  "username": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's username."
                  },
                  "password": {
                    "type": "string",
                    "nullable": true,
                    "description": "The end-user's password on first sign-in. After login/register, send the returned session token (JWT) here instead — the field accepts either, and reusing the token keeps raw passwords out of your storage."
                  },
                  "interview_session_id": {
                    "type": "string",
                    "nullable": true,
                    "description": "Identifies one interview. Returned by start_voice_interview and required by every later call."
                  },
                  "codename": {
                    "type": "string",
                    "nullable": true,
                    "description": "Ask for a consciousness by name instead of writing up an interview: returns the third-person description of that consciousness, if one has been produced. Any authenticated caller may ask. Only the third-person form is available this way; the first- and second-person forms address the interviewee and are theirs alone."
                  },
                  "share_description": {
                    "type": "boolean",
                    "nullable": true,
                    "description": "The owner's answer to whether other people may read this consciousness's description. True publishes the description already written for it; false withdraws it and erases the text. A newly written description is never readable by anybody else until this says so, so the person can read what is being said about them first."
                  },
                  "person": {
                    "type": "string",
                    "nullable": true,
                    "description": "Which voice to write in. `first_person` reads as the user themselves and is what a mind-data upload wants; `second_person` addresses them; `third_person` describes them for a reader who was not present and leaves out anything they would not want quoted.",
                    "enum": [
                      "first_person",
                      "second_person",
                      "third_person"
                    ]
                  },
                  "module_key": {
                    "type": "string",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result envelope — check the success field.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the call succeeded."
                    },
                    "error_message": {
                      "type": "string",
                      "nullable": true,
                      "description": "Human-readable reason when success is false."
                    },
                    "error_code": {
                      "type": "string"
                    },
                    "interview_session_id": {
                      "type": "string",
                      "nullable": true,
                      "description": "Identifies one interview. Returned by start_voice_interview and required by every later call."
                    },
                    "person": {
                      "type": "string",
                      "nullable": true,
                      "description": "Which voice the write-up was produced in, echoing the request.",
                      "enum": [
                        "first_person",
                        "second_person",
                        "third_person"
                      ]
                    },
                    "report_text": {
                      "type": "string",
                      "nullable": true,
                      "description": "The finished interview, written as prose."
                    },
                    "text_type": {
                      "type": "string",
                      "nullable": true,
                      "description": "Which mind-data category this interview produces — `memory` or `persona` — so an upload can be filed without guessing.",
                      "enum": [
                        "memory",
                        "persona"
                      ]
                    },
                    "is_raw_answers": {
                      "type": "boolean",
                      "nullable": true,
                      "description": "True when a written-up version could not be produced and report_text is the answers the user gave instead, joined in the order they were given. Say so before showing it, rather than presenting it as a finished piece of writing."
                    },
                    "paragraphs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      },
                      "nullable": true
                    },
                    "speaker_facts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {}
                      },
                      "nullable": true
                    },
                    "self_introduction": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request payload."
          },
          "401": {
            "description": "Missing or invalid partner key."
          },
          "403": {
            "description": "Partner is not authorized for this operation."
          },
          "429": {
            "description": "Rate limit exceeded — retry later."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    }
  }
}