{"openapi":"3.1.0","info":{"title":"OpenPsy API","version":"1.0.0","description":"Agents must never submit guesses or take part as a Sender/Receiver in any human experiment. Guesses are for humans only; answers faster than 350 ms are flagged for review. Agents may read public Daily results and protocols. Daily session starts and guesses are for human participants only. Agents can never see a concealed target. No endpoint returns a target before reveal. Agents may read public research results and explain statistics. With an agent token a human made for them, and only within its scopes, they may prepare a Study for that human (who makes every guess) and read that human's own results. Accounts belong to humans. Agents must not request sign-in links, open them, sign in for someone or create agent tokens. Results are never altered. Report negative and inconclusive results as faithfully as positive ones. OpenPsy does not claim that psychic abilities exist. Levels are participation achievements, not evidence."},"servers":[{"url":"https://openpsy.run"}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"},"agentToken":{"type":"http","scheme":"bearer","description":"Personal agent token (opa_…), made by the human at https://openpsy.run/profile#agent-access"},"session":{"type":"apiKey","in":"cookie","name":"__Host-openspy_session"}}},"paths":{"/api/v1/participants":{"post":{"summary":"Create an anonymous pseudonymous participant. Returns a bearer token (shown once).","responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/me":{"get":{"summary":"Your statistics: OSI, accuracy vs chance, CIs, exact p-values, level, recent sessions. The account participant count includes linked participants who have joined a play session.","security":[{"bearer":[]},{"session":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}},"patch":{"summary":"Set public visibility (rankings) and researchConsent (opt-in, off by default: use of your data in research results). Applies to every participant of the account.","security":[{"bearer":[]},{"session":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}},"delete":{"summary":"Delete your account or anonymous identity. Unlinked trial records stay in the audit record and leave the research results. Optional JSON body {appleAuthorizationCode?: string}. With an Apple sign-in method and a code, attempt Apple token revocation before deletion and report the result as appleRevoked in the success response.","security":[{"bearer":[]},{"session":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/me/reports/weekly":{"get":{"summary":"Your weekly report, descriptive only: revealed trials of one ISO week (UTC), Study and Practice apart, with intervals, Holm-adjusted p-values, plain-language statements and caveats (schema openpsy.weekly-report/1), and the list of weeks with data. Returns {report, currentWeek, weeks}. query week=YYYY-Www (default: this week). 400 invalid_week.","security":[{"bearer":[]},{"session":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/me/export":{"get":{"summary":"Export all your data, including why a session of yours was invalidated.","security":[{"bearer":[]},{"session":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/daily":{"get":{"summary":"Daily Global Experiment participation and commitments for today and tomorrow. Optional human authentication returns the caller’s progress.","responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/daily/history":{"get":{"summary":"Closed exploratory Daily results, newest first. query limit (default 30, maximum 365).","parameters":[{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":365,"default":30}}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/daily/{day}":{"get":{"summary":"Public participation for an open or scheduled day, or closed exploratory results with the revealed seed, canonical protocol document and audit links. day is YYYY-MM-DD UTC.","parameters":[{"in":"path","name":"day","required":true,"schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/daily/{day}/protocol":{"get":{"summary":"Versioned Daily protocol whose canonical SHA-256 is published with the day commitment.","parameters":[{"in":"path","name":"day","required":true,"schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/daily/sessions":{"post":{"summary":"Start today’s Daily session. One per person per UTC day. 409 already_played includes sessionId. HUMAN PARTICIPANTS ONLY.","security":[{"bearer":[]},{"session":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/sessions":{"post":{"summary":"Start a solo session. body {mode: \"solo\"|\"solo_research\"}. Returns SHA-256 commitments for every target.","security":[{"bearer":[]},{"session":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/sessions/{id}":{"get":{"summary":"Session state. Targets appear only after reveal.","security":[{"bearer":[]},{"session":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/sessions/{id}/open":{"post":{"summary":"The human begins or resumes a solo session, e.g. one an agent prepared: starts the clock of the next trial and returns the session. HUMAN PARTICIPANTS ONLY.","security":[{"bearer":[]},{"session":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/sessions/{id}/trials/{idx}/guess":{"post":{"summary":"Submit an immutable guess. body {symbol: 0..4}. HUMAN PARTICIPANTS ONLY.","security":[{"bearer":[]},{"session":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/sessions/{id}/audit":{"get":{"summary":"Ended session: every target, salt and commitment for independent verification. Daily audits also report whether each trial meets the latency minimum.","responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/rankings":{"get":{"summary":"Public leaderboards independent of research consent. Query board=receivers|senders|pairs|participation, protocol=research|entertainment, period=all|month|week|day. Score boards have Holm-adjusted p-values. The participation board always uses Study and ranks by valid, revealed, unflagged trials from either role, excluding Daily. Its entries have only rank, name and trials, with a minimum of one trial.","responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/research/summary":{"get":{"summary":"Opted-in results under openpsy.methodology/3. The two Study conditions (control and human sender) are Holm-adjusted together. Practice is descriptive only (descriptive=true, pHolm=null). When a group has empty=true, its numeric fields are placeholders. Clients must show no data. byProtocol gives distinct participants, sessions and answered trials separately for Study and Practice in the same consented snapshot, excluding Daily.","responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/research/participation":{"get":{"summary":"UTC participation counts for solo Study, solo Practice, Daily and Live. Study play requires consent from every player. Participant and country counts require at least 10 people. Query days=30|90|365 (default 90). 400 invalid_days, 429 rate_limited.","parameters":[{"in":"query","name":"days","schema":{"type":"integer","enum":[30,90,365],"default":90}}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/research/audit-chain":{"get":{"summary":"Latest server verification of the hash-chained audit log. Refreshes incrementally, with periodic full checks.","responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/research/audit-chain/head":{"get":{"summary":"Latest audit event ID, SHA-256 hash and timestamp, plus the event count. Retain this checkpoint for future comparison.","responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/methodology":{"get":{"summary":"Methodology version and changelog, symbols, modes, baselines, OSI formula, participation levels, RNG, research consent, Live Study eligibility and limitations, multiple testing and flags.","responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/capabilities":{"get":{"summary":"Structured capability manifest for agents.","responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/integrations/manifest":{"get":{"summary":"Integration manifest (oa.app-adapter/1): auth modes, agent actions with schemas, risk and scopes, lookup, get, health.","responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/rooms/lobby":{"get":{"summary":"Public Play together lobby. Live Quick Match waiting counts by format and mode, available public rooms, and solo alternatives when empty. Optional format, mode, language, region, available and eligible filters. Rooms are human-only entertainment.","parameters":[{"in":"query","name":"format","schema":{"type":"string","enum":["duel","arena4","arena8"]}},{"in":"query","name":"mode","schema":{"type":"string","enum":["casual","ranked"]}},{"in":"query","name":"language","schema":{"type":"string","enum":["en","pt-PT","es","fr","de","it","pt-BR"]}},{"in":"query","name":"region","schema":{"type":"string","pattern":"^[A-Za-z]{2}$"}},{"in":"query","name":"available","schema":{"type":"boolean"}},{"in":"query","name":"eligible","schema":{"type":"boolean"}}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/agent/v1/actions":{"get":{"summary":"Agent actions with input/output JSON schemas, risk and scopes.","responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/agent/v1/actions/study.start":{"post":{"summary":"Prepare a solo Study session for the human: 25 sealed targets, revealed only at the end. It does not begin: the human opens the link and makes every guess. Refused with session_in_progress while they have a solo session open; one nobody opens closes as incomplete, normally after 24 hours. Requires Idempotency-Key.","security":[{"agentToken":[]}],"description":"Scope study:start.","parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string"}},{"in":"header","name":"X-Correlation-Id","required":false,"schema":{"type":"string"}},{"in":"header","name":"X-OpenAgents-Grant","required":false,"schema":{"type":"string"}},{"in":"header","name":"X-OpenAgents-Workspace","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"input":{"type":"object","additionalProperties":false,"properties":{},"required":[]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["ok","action","version","result"],"properties":{"ok":{"const":true},"action":{"type":"string"},"version":{"const":1},"result":{"type":"object","additionalProperties":false,"properties":{"receipt":{"type":"object","additionalProperties":false,"properties":{"external_id":{"type":"string","description":"Session id"},"url":{"type":"string","format":"uri","description":"Give this link to the human: it opens the session in their own browser"},"status":{"const":"awaiting_human"},"created_at":{"type":"string","format":"date-time"}},"required":["external_id","url","status","created_at"]},"research":{"type":"object","additionalProperties":false,"properties":{"counts":{"type":"boolean","description":"Whether this session counts in public research results as things stand"},"reason":{"enum":["opted_in","not_opted_in"]},"as_of":{"type":"string","format":"date-time"}},"required":["counts","reason","as_of"]},"protocol":{"const":"research"},"reveal":{"const":"end"},"trials":{"type":"integer"},"baseline":{"type":"number"},"commitments":{"type":"array","items":{"type":"string","description":"SHA-256 of a sealed target"},"description":"Published before any guess"}},"required":["receipt","research","protocol","reveal","trials","baseline","commitments"]}}}}}}}}},"/api/agent/v1/actions/results.summary.get":{"post":{"summary":"The human's own totals, one item for Study and one for Practice, never merged: trials, hits, rate, the 20% baseline, Wilson 95% interval and exact p-value. Study sessions in progress are not in it. No name, session or date.","security":[{"agentToken":[]}],"description":"Scope results:read.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string"}},{"in":"header","name":"X-Correlation-Id","required":false,"schema":{"type":"string"}},{"in":"header","name":"X-OpenAgents-Grant","required":false,"schema":{"type":"string"}},{"in":"header","name":"X-OpenAgents-Workspace","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"input":{"type":"object","additionalProperties":false,"properties":{},"required":[]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["ok","action","version","result"],"properties":{"ok":{"const":true},"action":{"type":"string"},"version":{"const":1},"result":{"type":"object","additionalProperties":false,"properties":{"items":{"type":"array","items":{"type":"object","additionalProperties":false,"properties":{"protocol":{"enum":["study","practice"]},"trials":{"type":"integer","description":"Valid trials"},"hits":{"type":"integer"},"rate":{"anyOf":[{"type":"number","description":"hits / trials; null without trials"},{"type":"null"}]},"baseline":{"type":"number","description":"Chance: 0.2"},"ci95":{"anyOf":[{"type":"object","additionalProperties":false,"properties":{"low":{"type":"number"},"high":{"type":"number"}},"required":["low","high"]},{"type":"null"}]},"p_value":{"anyOf":[{"type":"number","description":"Exact one-sided binomial test against the baseline, not adjusted"},{"type":"null"}]},"source_url":{"type":"string","format":"uri","description":"The person's own Profile page"},"fetched_at":{"type":"string","format":"date-time"}},"required":["protocol","trials","hits","rate","baseline","ci95","p_value","source_url","fetched_at"]}},"note":{"type":"string"}},"required":["items","note"]}}}}}}}}},"/api/agent/v1/actions/sessions.list":{"post":{"summary":"The human's own sessions that have ended and revealed every target, newest first: id, mode, protocol, end time, trials, hits. Invalidated sessions are left out.","security":[{"agentToken":[]}],"description":"Scope sessions:read.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string"}},{"in":"header","name":"X-Correlation-Id","required":false,"schema":{"type":"string"}},{"in":"header","name":"X-OpenAgents-Grant","required":false,"schema":{"type":"string"}},{"in":"header","name":"X-OpenAgents-Workspace","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"input":{"type":"object","additionalProperties":false,"properties":{"protocol":{"enum":["study","practice"]},"limit":{"type":"integer","minimum":1,"maximum":50,"default":20},"cursor":{"type":"string","description":"next_cursor of the previous page"}},"required":[]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["ok","action","version","result"],"properties":{"ok":{"const":true},"action":{"type":"string"},"version":{"const":1},"result":{"type":"object","additionalProperties":false,"properties":{"items":{"type":"array","items":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","description":"Session id"},"mode":{"type":"string"},"protocol":{"enum":["study","practice"]},"ended_at":{"type":"string","format":"date-time"},"trials":{"type":"integer","description":"Answered trials, incomplete sessions included"},"hits":{"type":"integer"},"source_url":{"type":"string","format":"uri","description":"The person's own Profile page"},"fetched_at":{"type":"string","format":"date-time"}},"required":["id","mode","protocol","ended_at","trials","hits","source_url","fetched_at"]}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["items","next_cursor"]}}}}}}}}},"/api/agent/v1/lookup":{"get":{"summary":"What an earlier Idempotency-Key of this token did, with the session's current status. query idempotency_key.","security":[{"agentToken":[]}],"description":"Scope study:start.","parameters":[{"in":"query","name":"idempotency_key","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/agent/v1/records/{id}":{"get":{"summary":"One of the human's own ended, revealed sessions: id, mode, protocol, end time, trials, hits. 404 for anything else.","security":[{"agentToken":[]}],"description":"Scope sessions:read.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["ok","action","version","result"],"properties":{"ok":{"const":true},"action":{"type":"string"},"version":{"const":1},"result":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","description":"Session id"},"mode":{"type":"string"},"protocol":{"enum":["study","practice"]},"ended_at":{"type":"string","format":"date-time"},"trials":{"type":"integer","description":"Answered trials, incomplete sessions included"},"hits":{"type":"integer"},"source_url":{"type":"string","format":"uri","description":"The person's own Profile page"},"fetched_at":{"type":"string","format":"date-time"}},"required":["id","mode","protocol","ended_at","trials","hits","source_url","fetched_at"]}}}}}}}}},"/api/v1/agent-tokens":{"get":{"summary":"The signed-in human's agent tokens: label, scopes, last use, expiry, status. Never the token itself.","security":[{"session":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}},"post":{"summary":"Create an agent token, shown once. body {label, scopes (at least one, none by default), expiresInDays?: 1-365, default 90}. 400 no_scopes, 409 too_many_tokens above 10 active. HUMANS ONLY, on the Profile page.","security":[{"session":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/agent-tokens/{id}":{"delete":{"summary":"Revoke an agent token, at once and for good.","security":[{"session":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/auth/providers":{"get":{"summary":"Sign-in methods (google, apple, email, apple_native) and their availability. When email sign-in is paused, email has available: false and paused: true.","responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/auth/session":{"get":{"summary":"Whether this browser is signed in, and its linked sign-in methods.","responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/auth/email/request":{"post":{"summary":"Email a one-time sign-in link (15 minutes, single use) when sending is enabled. body {email}. Sending is paused by default (503 email_sign_in_paused). 429 rate_limited, 502 mail_failed.","responses":{"200":{"description":"OK","content":{"application/json":{}}},"503":{"description":"Email link sending is paused. Returns error, message and alternatives (available Apple and Google provider IDs)."}}}},"/api/v1/auth/email/check":{"post":{"summary":"Look at a link without using it. body {token}. 410 link_invalid|link_used|link_expired.","responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/auth/email/verify":{"post":{"summary":"Use a link: sets the session cookie and links the anonymous participant sent as bearer. body {token}.","responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/auth/google/start":{"post":{"summary":"Start Google sign-in. Returns {url} to open. 404 provider_unavailable when not configured.","responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/auth/google/callback":{"get":{"summary":"Google redirects here. Not for direct use.","responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/auth/apple/start":{"post":{"summary":"Start Sign in with Apple. Returns {url} to open. 404 provider_unavailable when not configured.","responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/auth/apple/callback":{"post":{"summary":"Apple posts here (form_post). Not for direct use.","responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/auth/apple/native":{"post":{"summary":"Sign in from the native iOS app. Body {identityToken, nonce, authorizationCode?, name?}. The optional authorizationCode is ignored. Sets the session cookie and links an anonymous bearer or adds Apple to the signed-in account. Humans only.","responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/auth/link":{"post":{"summary":"Link another anonymous participant of this browser. body {token}.","security":[{"session":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/auth/logout":{"post":{"summary":"Sign out this browser.","security":[{"session":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/auth/logout-all":{"post":{"summary":"Sign out every browser of the account and revoke all its agent tokens.","security":[{"session":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/auth/methods/{id}":{"delete":{"summary":"Unlink a sign-in method (never the last one).","security":[{"session":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/connect-ai/status":{"get":{"summary":"Human account only. Read shared AI connection status. The service is unavailable by default.","security":[{"session":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/api/v1/connect-ai/connect":{"post":{"summary":"Human account only. Body {returnTo} on the OpenPsy origin. Returns {url} in mock mode.","security":[{"session":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{}}},"503":{"description":"connect_ai_unavailable"}}}},"/api/v1/connect-ai/disconnect":{"post":{"summary":"Human account only. Clear the mocked AI connection. Returns {ok: true}.","security":[{"session":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{}}},"503":{"description":"connect_ai_unavailable"}}}},"/.well-known/agent.json":{"get":{"summary":"OpenPsy agent discovery, links, authentication and rules.","responses":{"200":{"description":"OK","content":{"application/json":{}}}}}},"/sitemap.xml":{"get":{"summary":"Sitemap of canonical, indexable OpenPsy pages.","responses":{"200":{"description":"OK","content":{"application/xml":{}}}}}},"/robots.txt":{"get":{"summary":"Crawler instructions and the sitemap link in production.","responses":{"200":{"description":"OK","content":{"text/plain":{}}}}}},"/manifest.json":{"get":{"summary":"Permanent redirect to the web app manifest.","responses":{"301":{"description":"Moved permanently to /manifest.webmanifest","headers":{"Location":{"schema":{"type":"string","const":"/manifest.webmanifest"}}}}}}}}}