openapi: 3.1.1 info: title: Persona developer API version: 1.0.0-draft description: | Proposed contract for confidential server applications. The example host is reserved for documentation. The owner selects one identity and approves scopes and individual record revisions on Persona's consent screen. Send access tokens only in the Authorization header. Private responses use Cache-Control: no-store. A prepaid developer pack enables a daily allowance shared by all grants for one application. Each successful delegated response consumes one unit, including an empty search. OAuth exchanges, public passport reads and errors consume zero units. A new successful request after a network retry consumes its own unit. An access token conveys only the permissions the owner granted. servers: - url: https://api.persona.example description: Illustrative origin for the authorization and resource servers tags: - name: Authorization description: Connect one application to one identity. - name: Identity description: Read the owner's portable personality and approved vault records. - name: Passports description: Look up a published identity passport. paths: /oauth/authorize: get: operationId: authorize tags: [Authorization] summary: Request owner consent in a browser description: | Generate a new PKCE verifier and an unpredictable state bound to the originating browser session. Redirect the browser to this endpoint. Persona authenticates the owner, presents the requested scopes and allows the owner to select the identity and record revisions. The client verifies the returned state before exchanging the code. A code expires after 60 seconds and is single-use. security: [] parameters: - name: response_type in: query required: true schema: {type: string, const: code} - name: client_id in: query required: true schema: {type: string, minLength: 1} example: planner_demo - name: redirect_uri in: query required: true schema: {$ref: '#/components/schemas/RedirectURI'} - name: scope in: query required: true schema: {$ref: '#/components/schemas/Scope'} - name: state in: query required: true schema: {type: string, minLength: 1} example: rQFk3XHQJXmE9jT4YpVC7g - name: code_challenge in: query required: true description: Unpadded base64url of SHA-256 of the ASCII PKCE verifier. schema: {type: string, pattern: '^[A-Za-z0-9_-]{43}$'} example: E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM - name: code_challenge_method in: query required: true schema: {type: string, const: S256} responses: '200': description: Interactive Persona sign-in or consent page presented to the owner. content: text/html: schema: {type: string} '302': description: | Redirect to the verified callback. Success appends code and state as query parameters. A denial appends error=access_denied and state. Other request errors at a verified callback follow the OAuth authorization error format. headers: Location: required: true schema: {type: string, format: uri} examples: granted: value: 'https://planner.example/callback?code=example-one-time-code&state=rQFk3XHQJXmE9jT4YpVC7g' declined: value: 'https://planner.example/callback?error=access_denied&state=rQFk3XHQJXmE9jT4YpVC7g' '400': description: Unsafe or missing callback or unknown client. Persona shows the error in the browser. content: text/html: schema: {type: string} /oauth/token: post: operationId: exchangeToken tags: [Authorization] summary: Exchange a code or rotate a refresh token description: | Authenticate the registered confidential client using HTTP Basic over TLS. An authorization code is bound to the client, exact redirect URI and PKCE challenge. A successful refresh replaces the refresh token atomically. Serialize refresh attempts and store the replacement before the next use. Reuse of a consumed refresh token invalidates its token family. Owner consent sets a hard expiry at most 90 days after approval. Refresh preserves that expiry and the original authorization. A revoked or expired grant requires new consent. security: - ClientBasic: [] requestBody: required: true content: application/x-www-form-urlencoded: schema: oneOf: - type: object required: [grant_type, code, redirect_uri, code_verifier] properties: grant_type: {type: string, const: authorization_code} code: {type: string, minLength: 1} redirect_uri: {$ref: '#/components/schemas/RedirectURI'} code_verifier: {type: string, pattern: '^[A-Za-z0-9._~-]{43,128}$'} - type: object required: [grant_type, refresh_token] properties: grant_type: {type: string, const: refresh_token} refresh_token: {type: string, minLength: 1} examples: authorizationCode: value: grant_type: authorization_code code: example-one-time-code redirect_uri: https://planner.example/callback code_verifier: dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk refresh: value: grant_type: refresh_token refresh_token: example-opaque-refresh responses: '200': description: Token pair issued for one app, identity and grant. headers: Cache-Control: {$ref: '#/components/headers/NoStore'} Pragma: {required: true, schema: {type: string, const: no-cache}} content: application/json: schema: type: object required: [access_token, token_type, expires_in, refresh_token, scope] properties: access_token: {type: string, minLength: 1, description: Opaque token for the Persona API.} token_type: {type: string, const: Bearer} expires_in: type: integer minimum: 1 maximum: 600 description: Lifetime in seconds, capped by the remaining grant lifetime. refresh_token: {type: string, minLength: 1, description: Opaque single-use refresh token.} scope: {$ref: '#/components/schemas/Scope'} example: access_token: example-opaque-access token_type: Bearer expires_in: 600 refresh_token: example-opaque-refresh scope: personality.read memory.read '400': description: Invalid request, unsupported grant, or invalid, expired or reused grant credential. content: application/json: schema: {$ref: '#/components/schemas/OAuthError'} example: {error: invalid_grant} '401': description: Client authentication failed. headers: WWW-Authenticate: required: true schema: {type: string} example: 'Basic realm="Persona"' content: application/json: schema: {$ref: '#/components/schemas/OAuthError'} example: {error: invalid_client} /v1/personality: get: operationId: getPersonality tags: [Identity] summary: Read the current personality configuration description: The grant identifies the identity. Edits to its personality apply to subsequent reads. security: - PersonaOAuth: [personality.read] responses: '200': description: Current model-independent personality settings. headers: Cache-Control: {$ref: '#/components/headers/NoStore'} content: application/json: schema: {$ref: '#/components/schemas/Personality'} example: schema_version: '1.0' revision: 1 display_name: Maya tone: warm verbosity: concise locale: en-US instructions: Lead with the answer. '401': {$ref: '#/components/responses/Unauthenticated'} '403': {$ref: '#/components/responses/Forbidden'} '429': {$ref: '#/components/responses/QuotaExhausted'} /v1/memories/{memory_id}: get: operationId: getMemory tags: [Identity] summary: Read one approved vault record description: | The record must be current, undeleted and explicitly granted at its exact revision. Editing a shared record withdraws the previous revision. The replacement requires fresh approval before this app can read it. security: - PersonaOAuth: [memory.read] parameters: - name: memory_id in: path required: true schema: {$ref: '#/components/schemas/RecordID'} responses: '200': description: The selected record revision. headers: Cache-Control: {$ref: '#/components/headers/NoStore'} content: application/json: schema: {$ref: '#/components/schemas/Memory'} examples: deadline: {$ref: '#/components/examples/Deadline'} '401': {$ref: '#/components/responses/Unauthenticated'} '403': {$ref: '#/components/responses/Forbidden'} '404': {$ref: '#/components/responses/NotFound'} '429': {$ref: '#/components/responses/QuotaExhausted'} /v1/memories/search: post: operationId: searchMemories tags: [Identity] summary: Search the record revisions approved for this app description: | Search the selected identity's currently approved revisions only. Both memory and knowledge records are eligible. Return up to limit matches in descending relevance order. A valid search can return zero matches, including while a new revision awaits indexing. The endpoint has no pagination or total. security: - PersonaOAuth: [memory.read] requestBody: required: true content: application/json: schema: type: object additionalProperties: false required: [query] properties: query: {type: string, minLength: 1, maxLength: 500, pattern: '\S'} limit: {type: integer, minimum: 1, maximum: 20, default: 5} example: {query: 'When is the launch review?', limit: 5} responses: '200': description: Relevant records within the effective grant. headers: Cache-Control: {$ref: '#/components/headers/NoStore'} content: application/json: schema: type: object required: [matches] properties: matches: type: array maxItems: 20 items: {$ref: '#/components/schemas/Memory'} examples: found: value: matches: - id: mem_deadline revision: 1 kind: memory text: The launch review is on 12 March at 10:00 UTC. updated_at: '2026-12-03T10:00:00Z' empty: value: {matches: []} '400': {$ref: '#/components/responses/InvalidRequest'} '401': {$ref: '#/components/responses/Unauthenticated'} '403': {$ref: '#/components/responses/Forbidden'} '429': {$ref: '#/components/responses/QuotaExhausted'} '503': description: The retrieval service is unavailable. Retry after the specified delay. headers: Retry-After: required: true schema: {type: integer, minimum: 1} content: application/problem+json: schema: {$ref: '#/components/schemas/Problem'} example: {type: 'about:blank', title: Service Unavailable, status: 503, code: retrieval_unavailable, request_id: req_107} /v1/passports/{handle}: get: operationId: getPublicPassport tags: [Passports] summary: Read a published passport by handle description: | The owner chooses a public display name and optional bio. Include an attestation only after its transaction is finalized for the current published revision. A pending or outdated attestation is omitted. Unpublished handles return 404. security: [] parameters: - name: handle in: path required: true schema: {$ref: '#/components/schemas/Handle'} responses: '200': description: Public passport projection. headers: Cache-Control: {$ref: '#/components/headers/NoStore'} content: application/json: schema: {$ref: '#/components/schemas/Passport'} example: {handle: maya, display_name: Maya, bio: Product designer, revision: 1} '404': {$ref: '#/components/responses/NotFound'} components: securitySchemes: ClientBasic: type: http scheme: basic description: Registered client ID and client secret. Keep the secret on the application server. PersonaOAuth: type: oauth2 description: | Bearer access token from the authorization-code flow with S256 PKCE and confidential-client authentication. The service checks the live grant on every read. A client credential by itself conveys no permissions to an identity. flows: authorizationCode: authorizationUrl: https://api.persona.example/oauth/authorize tokenUrl: https://api.persona.example/oauth/token refreshUrl: https://api.persona.example/oauth/token scopes: personality.read: Read the current configuration of the selected identity. memory.read: Read and search the exact vault record revisions selected by the owner. headers: NoStore: {required: true, schema: {type: string, const: no-store}} schemas: RedirectURI: type: string format: uri pattern: '^https://[^#]+$' description: Must exactly match a registered HTTPS callback for this client. examples: ['https://planner.example/callback'] Scope: type: string description: Requested scopes on authorization, effective granted scopes on token responses. Each name occurs once. enum: [personality.read, memory.read, 'personality.read memory.read', 'memory.read personality.read'] examples: ['personality.read memory.read'] OAuthError: type: object required: [error] properties: error: type: string enum: [invalid_request, invalid_client, invalid_grant, unauthorized_client, unsupported_grant_type, invalid_scope] error_description: {type: string} DisplayName: {type: string, minLength: 1, maxLength: 80} Revision: {type: integer, minimum: 1} RecordID: {type: string, minLength: 1, maxLength: 128, description: Opaque record ID., examples: [mem_deadline]} Handle: type: string minLength: 3 maxLength: 32 pattern: '^[a-z0-9]+(-[a-z0-9]+)*$' examples: [maya] Personality: type: object required: [schema_version, revision, display_name, tone, verbosity, locale, instructions] properties: schema_version: {type: string, const: '1.0'} revision: {$ref: '#/components/schemas/Revision'} display_name: {$ref: '#/components/schemas/DisplayName'} tone: {type: string, enum: [neutral, warm, formal]} verbosity: {type: string, enum: [concise, balanced, detailed]} locale: {type: string, minLength: 1, description: BCP 47 language tag., examples: [en-US]} instructions: {type: string, maxLength: 2000, description: Owner-supplied behavioral preferences.} Memory: type: object required: [id, revision, kind, text, updated_at] properties: id: {$ref: '#/components/schemas/RecordID'} revision: {$ref: '#/components/schemas/Revision'} kind: {type: string, enum: [memory, knowledge]} text: {type: string, minLength: 1, maxLength: 16000} source_label: {type: string, maxLength: 120} updated_at: {type: string, format: date-time} Passport: type: object additionalProperties: false required: [handle, display_name, revision] properties: handle: {$ref: '#/components/schemas/Handle'} display_name: {$ref: '#/components/schemas/DisplayName'} bio: {type: string, maxLength: 280} revision: {$ref: '#/components/schemas/Revision'} attestation: {$ref: '#/components/schemas/Attestation'} Attestation: type: object additionalProperties: false required: [network, transaction_signature, issuer, commitment, salt] description: A finalized attestation of this exact public revision. See the product specification for canonicalization and verification. properties: network: {type: string, enum: [devnet, mainnet-beta]} transaction_signature: {type: string, minLength: 1, description: Base58 Solana transaction signature.} issuer: {type: string, minLength: 1, description: Attesting issuer public key.} commitment: {type: string, pattern: '^[0-9a-f]{64}$', description: Lowercase hex SHA-256 digest of the salted canonical public payload.} salt: {type: string, pattern: '^[A-Za-z0-9_-]{22}$', description: Public 16-byte salt encoded as unpadded base64url.} Problem: type: object description: RFC 9457 problem details with a stable Persona code and a support request identifier. required: [type, title, status, code, request_id] properties: type: {type: string, format: uri-reference} title: {type: string} status: {type: integer, minimum: 400, maximum: 599} code: {type: string} request_id: {type: string} detail: {type: string, description: Human-readable explanation.} examples: Deadline: value: id: mem_deadline revision: 1 kind: memory text: The launch review is on 12 March at 10:00 UTC. updated_at: '2026-12-03T10:00:00Z' responses: InvalidRequest: description: Malformed JSON, blank or oversized query, invalid limit or unknown request field. content: application/problem+json: schema: {$ref: '#/components/schemas/Problem'} example: {type: 'about:blank', title: Bad Request, status: 400, code: invalid_request, request_id: req_101} Unauthenticated: description: A valid access token from a current grant is required. Missing credentials receive a bare Bearer challenge. headers: WWW-Authenticate: required: true schema: {type: string} example: 'Bearer realm="Persona", error="invalid_token"' content: application/problem+json: schema: {$ref: '#/components/schemas/Problem'} example: {type: 'about:blank', title: Unauthorized, status: 401, code: invalid_token, request_id: req_102} Forbidden: description: The valid token lacks the operation's scope, or the application's prepaid developer access is inactive. headers: WWW-Authenticate: description: Present for insufficient scope. The scope parameter names the required permission. schema: {type: string} example: 'Bearer realm="Persona", error="insufficient_scope", scope="memory.read"' content: application/problem+json: schema: {$ref: '#/components/schemas/Problem'} examples: missingScope: value: {type: 'about:blank', title: Forbidden, status: 403, code: insufficient_scope, request_id: req_103} inactivePack: value: {type: 'about:blank', title: Forbidden, status: 403, code: developer_access_inactive, request_id: req_104} NotFound: description: The resource is missing or unavailable to this caller. Both cases return the same error shape. content: application/problem+json: schema: {$ref: '#/components/schemas/Problem'} example: {type: 'about:blank', title: Not Found, status: 404, code: not_found, request_id: req_105} QuotaExhausted: description: This app has used its daily allowance. Access resumes at the next UTC midnight if the developer pack remains active. headers: Retry-After: required: true description: Seconds until the next UTC midnight. schema: {type: integer, minimum: 1, maximum: 86400} example: 3600 content: application/problem+json: schema: {$ref: '#/components/schemas/Problem'} example: {type: 'about:blank', title: Too Many Requests, status: 429, code: quota_exhausted, request_id: req_106}