{"openapi":"3.1.0","info":{"title":"Refine API","description":"Refine proofreading and writing assistance API","version":"1.0.0"},"paths":{"/chatbot/{review_id}/messages":{"post":{"tags":["chatbot"],"summary":"Send chatbot message","description":"Send a message to the proofreading chatbot and stream the response via SSE. The LLM may call tools to retrieve document content, comments, or images.","operationId":"chatbot_sendMessage","security":[{"HTTPBearer":[]}],"parameters":[{"name":"review_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Review Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatMessageRequest"},"examples":{"About a comment":{"summary":"About a comment","value":{"message":"Why is this phrasing a problem?","comment_id":"1792a726-5a83-4d20-ad59-0cf0f72c7faf"}},"About the document":{"summary":"About the document","value":{"message":"What should I prioritise fixing first?","comment_id":null}}}}}},"responses":{"200":{"description":"SSE stream of chat response chunks","content":{"text/event-stream":{"itemSchema":{"type":"object","properties":{"data":{"type":"string"},"event":{"type":"string"},"id":{"type":"string"},"retry":{"type":"integer","minimum":0}}},"schema":{"oneOf":[{"description":"SSE start event — sent immediately to keep connection alive during LLM reasoning.","properties":{"type":{"const":"start","description":"Event type","title":"Type","type":"string"},"status":{"const":"processing","description":"Processing status","title":"Status","type":"string"}},"required":["type","status"],"title":"SSEChatStartEvent","type":"object"},{"description":"SSE data payload for chatbot streaming. Each chunk is a text fragment.","properties":{"type":{"const":"chunk","description":"Event type","title":"Type","type":"string"},"chunk":{"description":"Text chunk of the response","title":"Chunk","type":"string"}},"required":["type","chunk"],"title":"SSEChatChunkEvent","type":"object"},{"description":"SSE tool_call event — the model is calling a tool to retrieve information.","properties":{"type":{"const":"tool_call","description":"Event type","title":"Type","type":"string"},"tool":{"description":"Name of the tool being called","title":"Tool","type":"string"}},"required":["type","tool"],"title":"SSEChatToolCallEvent","type":"object"},{"description":"SSE complete event — stream completed successfully.","properties":{"type":{"const":"complete","description":"Event type","title":"Type","type":"string"},"status":{"const":"completed","description":"Completion status","title":"Status","type":"string"},"meta":{"description":"Metadata bundled on complete/error SSE events.","properties":{"turn_id":{"description":"Router-assigned turn identifier (uuid4)","title":"Turn Id","type":"string"},"quota":{"anyOf":[{"description":"Live snapshot of the chatbot daily quota for the requesting user.","properties":{"used_fraction":{"description":"Fraction of the daily budget consumed (0.0–1.0, clipped). Frontend renders as a progress bar or percentage.","maximum":1.0,"minimum":0.0,"title":"Used Fraction","type":"number"},"resets_at":{"description":"When the counter rolls over (UTC, ISO 8601). Literal Redis TTL expiry — the moment the user's budget is wiped.","format":"date-time","title":"Resets At","type":"string"}},"required":["used_fraction","resets_at"],"title":"QuotaStatus","type":"object"},{"type":"null"}],"description":"User's quota snapshot after enforcement; None if quota was not enforced"}},"required":["turn_id"],"title":"SSEChatTurnMeta","type":"object"}},"required":["type","status","meta"],"title":"SSEChatCompleteEvent","type":"object"},{"description":"SSE error event — stream failed.\n\nMembers mirror the HTTP problem contract so a frontend keys localized copy\noff one taxonomy across both transports: ``error_type`` is the RFC 9457\n``type`` slug, ``error`` the stable title, ``details`` the extension members.\n``error`` used to be ``str(exc)`` -- free-form English with the user's daily\nlimit interpolated into it, which nothing could translate or group.","properties":{"type":{"const":"error","description":"Event type","title":"Type","type":"string"},"error":{"description":"Stable human-readable title; does not vary per occurrence","title":"Error","type":"string"},"error_type":{"description":"Stable RFC 9457 type slug identifying the failure","title":"Error Type","type":"string"},"details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"description":"Error-specific extension members","title":"Details"},"meta":{"description":"Metadata bundled on complete/error SSE events.","properties":{"turn_id":{"description":"Router-assigned turn identifier (uuid4)","title":"Turn Id","type":"string"},"quota":{"anyOf":[{"description":"Live snapshot of the chatbot daily quota for the requesting user.","properties":{"used_fraction":{"description":"Fraction of the daily budget consumed (0.0–1.0, clipped). Frontend renders as a progress bar or percentage.","maximum":1.0,"minimum":0.0,"title":"Used Fraction","type":"number"},"resets_at":{"description":"When the counter rolls over (UTC, ISO 8601). Literal Redis TTL expiry — the moment the user's budget is wiped.","format":"date-time","title":"Resets At","type":"string"}},"required":["used_fraction","resets_at"],"title":"QuotaStatus","type":"object"},{"type":"null"}],"description":"User's quota snapshot after enforcement; None if quota was not enforced"}},"required":["turn_id"],"title":"SSEChatTurnMeta","type":"object"}},"required":["type","error","error_type","meta"],"title":"SSEChatErrorEvent","type":"object"}],"discriminator":{"propertyName":"type"}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessableChatMessageTooLong"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequired"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}},"get":{"tags":["chatbot"],"summary":"Get chatbot conversation history","description":"Get the message history for a chatbot conversation on a proofreading session. Returns user and assistant messages. The session must have proofreading results before a conversation can exist.","operationId":"chatbot_getConversationHistory","security":[{"HTTPBearer":[]}],"parameters":[{"name":"review_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Review Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationHistoryResponse"},"examples":{"With history":{"summary":"With history","value":{"conversation_id":"c9b1f6d2-4a83-4f21-9c07-2e5b8a1d3f40","messages":[{"role":"user","content":"Why is this phrasing a problem?","comment_id":"1792a726-5a83-4d20-ad59-0cf0f72c7faf","created_at":"2026-07-24T13:02:11.412000+00:00"},{"role":"assistant","content":"The claim is stated without the condition it depends on, so a reader cannot tell when it holds.","created_at":"2026-07-24T13:02:14.887000+00:00","turn_id":"turn_2fK9xLmQ"}],"created_at":"2026-07-24T13:02:11.412000+00:00","last_message_at":"2026-07-24T13:02:14.887000+00:00"}},"No conversation yet":{"summary":"No conversation yet","value":{"conversation_id":null,"messages":[],"created_at":null,"last_message_at":null}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequired"},"404":{"$ref":"#/components/responses/ProblemNotFoundSessionMissing"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/chatbot/{review_id}":{"delete":{"tags":["chatbot"],"summary":"Delete chatbot conversation","description":"Delete the chatbot conversation for a proofreading session. Removes all messages. The conversation can be restarted by sending a new message via send_chatbot_message.","operationId":"chatbot_deleteConversation","security":[{"HTTPBearer":[]}],"parameters":[{"name":"review_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Review Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"204":{"description":"Successful Response"},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequired"},"404":{"$ref":"#/components/responses/ProblemNotFoundSessionMissing"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/referrals/register":{"post":{"tags":["referrals"],"summary":"Register a referral code","description":"Record that the authenticated user was referred by another user. Call this once during onboarding when the user provides someone else's referral code, and call it before the user's first payment — referrals registered after the first payment do not qualify for rewards. Idempotent: re-registering the same code returns the existing referral. Returns 400 for malformed codes or self-referral, 404 if the code matches no user.","operationId":"referrals_registerReferral","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterReferralRequest"},"examples":{"Referral code":{"summary":"Referral code","value":{"referral_code":"REFINE-7K2QX"}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterReferralResponse"},"examples":{"Registered":{"summary":"Registered","value":{"referrer_email":"referrer@example.edu"}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"400":{"$ref":"#/components/responses/ProblemBadRequestMalformedReferralCodeOwnReferralCode"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"404":{"$ref":"#/components/responses/ProblemNotFoundReferralCodeNotFound"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}},"security":[{"HTTPBearer":[]}]}},"/referrals/status":{"get":{"tags":["referrals"],"summary":"Get referral status","description":"Return the current user's own referral code, plus whether they were referred and the status of any referral rewards. The code is created during registration and never changes; share it as `?ref=<code>`.","operationId":"referrals_getReferralStatus","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReferralStatusResponse"},"examples":{"No referral":{"summary":"No referral","value":{"own_referral_code":"q7Yt3wPzR2kLm9Xa","has_referral":false,"referrer_email":null,"referral_code":null,"created_at":null,"first_payment_at":null,"rewards_issued_at":null}},"Awaiting first payment":{"summary":"Awaiting first payment","value":{"own_referral_code":"q7Yt3wPzR2kLm9Xa","has_referral":true,"referrer_email":"referrer@example.edu","referral_code":"REFINE-7K2QX","created_at":"2026-07-12T14:02:00+00:00","first_payment_at":null,"rewards_issued_at":null}},"Rewards issued":{"summary":"Rewards issued","value":{"own_referral_code":"q7Yt3wPzR2kLm9Xa","has_referral":true,"referrer_email":"referrer@example.edu","referral_code":"REFINE-7K2QX","created_at":"2026-07-12T14:02:00+00:00","first_payment_at":"2026-07-18T09:41:00+00:00","rewards_issued_at":"2026-07-18T09:41:30+00:00"}}}}}},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}},"security":[{"HTTPBearer":[]}]}},"/reviews":{"get":{"tags":["reviews"],"summary":"List reviews","description":"List the user's completed reviews, ordered by most recent. Each item includes the document title, comment counts, and review ID needed for other operations. Does NOT include uploaded documents that haven't been processed yet.","operationId":"reviews_listReviews","security":[{"HTTPBearer":[]}],"parameters":[{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ReviewListItem"},"title":"Response Reviews Listreviews"},"examples":{"Completed review":{"summary":"Completed review","value":[{"review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf","created_at":"2026-07-24T12:45:39.418365+00:00","title":"Targeting Interventions in Networks","summary":"Studies how a planner optimally targets interventions in a network game with strategic spillovers, decomposing interventions into principal components.","domain":"social_sciences/economics","taxonomy":"academic/research_paper","document_id":"3eef6ca5-9388-45b4-92a8-c144347ad6ec","original_url":"/documents/3eef6ca5-9388-45b4-92a8-c144347ad6ec/original","content_url":"/documents/3eef6ca5-9388-45b4-92a8-c144347ad6ec/content","comments_count":19,"addressed_count":2,"dismissed_count":1,"is_preview":false,"general_access":"restricted","viewed":true}]},"Unenriched upload":{"summary":"Unenriched upload","value":[{"review_id":"e681ed2d-b844-48d4-81d7-8d499813c157","created_at":"2026-07-24T12:45:39.418365+00:00","title":null,"summary":null,"domain":null,"taxonomy":null,"document_id":"ff12d34a-ba00-4943-b25e-c23f92e68295","original_url":"/documents/ff12d34a-ba00-4943-b25e-c23f92e68295/original","content_url":"/documents/ff12d34a-ba00-4943-b25e-c23f92e68295/content","comments_count":0,"addressed_count":0,"dismissed_count":0,"is_preview":false,"general_access":"restricted","viewed":true}]}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequired"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/reviews/{review_id}":{"get":{"tags":["reviews"],"summary":"Get review details","description":"Get the full details of a review including all feedback comments, overall feedback, comment actions (dismissed/addressed), and metadata. Use the review_id from list_reviews.\n\nIMPORTANT: After viewing the results, call POST /reviews/mark-viewed with the review_id to mark it as viewed. This clears the unviewed indicator in GET /processing.\n\nWithout credentials, a review its owner opened to anyone (general_access anyone) is returned without the owner's and actors' data; any other review is a 404.","operationId":"reviews_getReview","security":[{"HTTPBearer":[]},{},{"BearerAuth":[]}],"parameters":[{"name":"review_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Review Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewResponse"},"examples":{"Completed full review":{"summary":"Completed full review","value":{"review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf","previous_review_id":null,"created_at":"2026-07-24T12:45:39.418365+00:00","completed_at":"2026-07-24T12:59:06.387687+00:00","user_email":"author@example.edu","feedback":{"overall":{"id":"overall-feedback","content":"**Scope of the benchmark assumptions**\n\nThe abstract frames the analysis more broadly than the core results support: the headline claims rely on the quadratic cost specification. Delimiting which claims belong to that benchmark would help the reader place the contribution."},"detailed":{"comments":[{"id":"1792a726-5a83-4d20-ad59-0cf0f72c7faf","title":"Large-budget claim is stated more strongly than shown","paragraph":"The intervention raises welfare for large budgets, which follows directly from the spectral decomposition of the network.","message":"The one-principal-component limit holds for the complements case, not for every environment. Qualify the claim, or state the condition it depends on.","quote":"The intervention raises welfare for large budgets, which follows directly from the spectral decomposition of the network.","score":0.34,"is_dismissed":false,"is_addressed":false,"types":["general"],"severity":"major","kind":"substance/reasoning","fix_effort":"edit_in_place"},{"id":"broad-2","title":"Citation does not support the attributed result","paragraph":"As shown by Kingma and Ba (2015), adaptive methods converge on convex objectives.","message":"The cited work introduces the optimiser but does not prove this convergence result. Attribute the claim to its actual source or soften it.","quote":"As shown by Kingma and Ba (2015), adaptive methods converge on convex objectives.","score":0.71,"is_dismissed":false,"is_addressed":false,"types":["external_references"],"severity":"minor","kind":"evidence/citation","fix_effort":"edit_in_place"}],"comments_count":2}},"progress_percentage":100,"processing_status":"completed","is_processing":false,"is_preview":false,"comment_actions":[],"comment_action_summary":{},"title":"Targeting Interventions in Networks","summary":"Studies how a planner optimally targets interventions in a network game with strategic spillovers.","domain":"social_sciences/economics","taxonomy":"academic/research_paper","steering_prompt":null,"document_id":"3eef6ca5-9388-45b4-92a8-c144347ad6ec","original_url":"/documents/3eef6ca5-9388-45b4-92a8-c144347ad6ec/original","content_url":"/documents/3eef6ca5-9388-45b4-92a8-c144347ad6ec/content","filename":"manuscript.pdf","general_access":"restricted","general_access_options":[],"restricted_reaches_organization":false,"is_owner":true,"discussions_enabled":false,"viewed":true,"revision_check":null}},"Preview review":{"summary":"Preview review","value":{"review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf","previous_review_id":null,"created_at":"2026-07-24T12:45:39.418365+00:00","completed_at":"2026-07-24T12:59:06.387687+00:00","user_email":"author@example.edu","feedback":{"overall":{"id":"overall-feedback","content":"**Scope of the benchmark assumptions**\n\nThe abstract frames the analysis more broadly than the core results support: the headline claims rely on the quadratic cost specification. Delimiting which claims belong to that benchmark would help the reader place the contribution."},"detailed":{"comments":[{"id":"1792a726-5a83-4d20-ad59-0cf0f72c7faf","title":"Large-budget claim is stated more strongly than shown","paragraph":"The intervention raises welfare for large budgets, which follows directly from the spectral decomposition of the network.","message":"The one-principal-component limit holds for the complements case, not for every environment. Qualify the claim, or state the condition it depends on.","quote":"The intervention raises welfare for large budgets, which follows directly from the spectral decomposition of the network.","score":0.34,"is_dismissed":false,"is_addressed":false,"types":["general"],"severity":"major","kind":"substance/reasoning","fix_effort":"edit_in_place"},{"id":"broad-2","title":"Citation does not support the attributed result","paragraph":"As shown by Kingma and Ba (2015), adaptive methods converge on convex objectives.","message":"The cited work introduces the optimiser but does not prove this convergence result. Attribute the claim to its actual source or soften it.","quote":"As shown by Kingma and Ba (2015), adaptive methods converge on convex objectives.","score":0.71,"is_dismissed":false,"is_addressed":false,"types":["external_references"],"severity":"minor","kind":"evidence/citation","fix_effort":"edit_in_place"}],"comments_count":2}},"progress_percentage":100,"processing_status":"completed","is_processing":false,"is_preview":true,"comment_actions":[],"comment_action_summary":{},"title":"Targeting Interventions in Networks","summary":"Studies how a planner optimally targets interventions in a network game with strategic spillovers.","domain":"social_sciences/economics","taxonomy":"academic/research_paper","steering_prompt":null,"document_id":"3eef6ca5-9388-45b4-92a8-c144347ad6ec","original_url":"/documents/3eef6ca5-9388-45b4-92a8-c144347ad6ec/original","content_url":"/documents/3eef6ca5-9388-45b4-92a8-c144347ad6ec/content","filename":"manuscript.pdf","general_access":"restricted","general_access_options":[],"restricted_reaches_organization":false,"is_owner":true,"discussions_enabled":false,"viewed":false,"revision_check":null}},"Still processing":{"summary":"Still processing","value":{"review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf","previous_review_id":null,"created_at":"2026-07-24T12:45:39.418365+00:00","completed_at":null,"user_email":"author@example.edu","feedback":{"overall":{"id":"overall-feedback","content":""},"detailed":{"comments":[],"comments_count":0}},"progress_percentage":45,"processing_status":"processing","is_processing":true,"is_preview":false,"comment_actions":[],"comment_action_summary":{},"title":null,"summary":null,"domain":null,"taxonomy":null,"steering_prompt":null,"document_id":"3eef6ca5-9388-45b4-92a8-c144347ad6ec","original_url":"/documents/3eef6ca5-9388-45b4-92a8-c144347ad6ec/original","content_url":"/documents/3eef6ca5-9388-45b4-92a8-c144347ad6ec/content","filename":"manuscript.pdf","general_access":"restricted","general_access_options":[],"restricted_reaches_organization":false,"is_owner":true,"discussions_enabled":false,"viewed":false,"revision_check":null}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequiredSessionNotAccessible"},"404":{"$ref":"#/components/responses/ProblemNotFoundSessionMissing"},"429":{"$ref":"#/components/responses/ProblemTooManyRequestsAnonymousReadRateLimited"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}},"delete":{"tags":["reviews"],"summary":"Delete a review","description":"Permanently delete a review and all its feedback. Cannot be undone.","operationId":"reviews_deleteReview","security":[{"HTTPBearer":[]}],"parameters":[{"name":"review_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Review Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"204":{"description":"Successful Response"},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"400":{"$ref":"#/components/responses/ProblemBadRequestMissingIdentifier"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequired"},"404":{"$ref":"#/components/responses/ProblemNotFoundSessionMissing"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/reviews/mark-viewed":{"post":{"tags":["reviews"],"summary":"Mark review as viewed","description":"Mark a review as viewed by the user. Used to track unread results.","operationId":"reviews_markViewed","security":[{"HTTPBearer":[]}],"parameters":[{"name":"review_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","description":"UUID of the review","title":"Review Id"},"description":"UUID of the review"},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarkViewedResponse"},"examples":{"Marked viewed":{"summary":"Marked viewed","value":{"review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf","user_email":"author@example.edu"}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequired"},"404":{"$ref":"#/components/responses/ProblemNotFoundSessionMissing"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/reviews/{review_id}/comments/{comment_id}/dismiss":{"patch":{"tags":["reviews"],"summary":"Dismiss a feedback comment","description":"Mark a feedback comment as dismissed (user chose to ignore it). Idempotent — calling again has no effect.","operationId":"reviews_dismissComment","security":[{"HTTPBearer":[]}],"parameters":[{"name":"review_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Review Id"}},{"name":"comment_id","in":"path","required":true,"schema":{"type":"string","title":"Comment Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommentActionItem"},"examples":{"Dismissal":{"summary":"Dismissal","value":{"id":"c2f7a1de-5b90-4f0c-9a11-6d3f2b8e4c07","review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf","comment_id":"broad-2","user_email":"author@example.edu","action_type":"dismissed","created_at":"2026-07-24T12:59:06.387687+00:00","notes":null}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorCommentActionNotStored"},"400":{"$ref":"#/components/responses/ProblemBadRequestCommentNotActionableMissingIdentifier"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequired"},"404":{"$ref":"#/components/responses/ProblemNotFoundSessionMissing"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/reviews/{review_id}/comments/{comment_id}/address":{"patch":{"tags":["reviews"],"summary":"Mark a feedback comment as addressed","description":"Mark a feedback comment as addressed (user applied the suggestion). Idempotent.","operationId":"reviews_addressComment","security":[{"HTTPBearer":[]}],"parameters":[{"name":"review_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Review Id"}},{"name":"comment_id","in":"path","required":true,"schema":{"type":"string","title":"Comment Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommentActionItem"},"examples":{"Dismissal":{"summary":"Dismissal","value":{"id":"c2f7a1de-5b90-4f0c-9a11-6d3f2b8e4c07","review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf","comment_id":"broad-2","user_email":"author@example.edu","action_type":"dismissed","created_at":"2026-07-24T12:59:06.387687+00:00","notes":null}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorCommentActionNotStored"},"400":{"$ref":"#/components/responses/ProblemBadRequestCommentNotActionableMissingIdentifier"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequired"},"404":{"$ref":"#/components/responses/ProblemNotFoundSessionMissing"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/reviews/{review_id}/comments/{comment_id}/actions/{action_type}":{"delete":{"tags":["reviews"],"summary":"Undo a comment action","description":"Remove a dismiss or address action from a comment, reverting it to its original state.","operationId":"reviews_deleteCommentAction","security":[{"HTTPBearer":[]}],"parameters":[{"name":"review_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Review Id"}},{"name":"comment_id","in":"path","required":true,"schema":{"type":"string","title":"Comment Id"}},{"name":"action_type","in":"path","required":true,"schema":{"type":"string","title":"Action Type"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"204":{"description":"Successful Response"},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"400":{"$ref":"#/components/responses/ProblemBadRequestCommentNotActionableInvalidCommentActionTypeMissingIdentifier"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequired"},"404":{"$ref":"#/components/responses/ProblemNotFoundSessionMissing"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/reviews/{review_id}/visibility":{"patch":{"tags":["reviews"],"summary":"Update review visibility","description":"Set how far a review is open: restricted, organization, signed_in (anyone signed in with the link) or anyone (no account needed). Only the owner may change it, and only to one of the review's general_access_options (see GET /reviews/{review_id}).","operationId":"reviews_updateVisibility","security":[{"HTTPBearer":[]}],"parameters":[{"name":"review_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Review Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateVisibilityRequest"},"examples":{"Anyone signed in with the link":{"summary":"Anyone signed in with the link","value":{"general_access":"signed_in"}},"Anyone with the link":{"summary":"Anyone with the link","value":{"general_access":"anyone"}},"Restricted":{"summary":"Restricted","value":{"general_access":"restricted"}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateVisibilityResponse"},"examples":{"Now open to anyone":{"summary":"Now open to anyone","value":{"review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf","general_access":"anyone","changed":true}},"Already restricted":{"summary":"Already restricted","value":{"review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf","general_access":"restricted","changed":false}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"400":{"$ref":"#/components/responses/ProblemBadRequestMissingIdentifier"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenGeneralAccessUnavailableOrganizationMembershipRequired"},"404":{"$ref":"#/components/responses/ProblemNotFoundSessionMissing"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/reviews/{review_id}/request-access":{"post":{"tags":["reviews"],"summary":"Request access to a private review","description":"Request view access to another user's private review. Sends an email notification to the owner.","operationId":"reviews_requestReviewAccess","security":[{"HTTPBearer":[]}],"parameters":[{"name":"review_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Review Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewAccessRequest"},"examples":{"With a message":{"summary":"With a message","value":{"message":"I am a co-author on this manuscript and would like to see the review."}},"Without a message":{"summary":"Without a message","value":{"message":null}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewAccessRequestResponse"},"examples":{"Request submitted":{"summary":"Request submitted","value":{"review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf"}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"400":{"$ref":"#/components/responses/ProblemBadRequestSessionAlreadyAccessible"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequiredSessionSharingRestricted"},"404":{"$ref":"#/components/responses/ProblemNotFoundSessionMissing"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/credit-score":{"get":{"tags":["credits"],"summary":"Get credit balance","description":"Get the user's current credit balance including paid credits, preview credits, credit source (personal or organization), document size limits, and current chatbot quota usage. Use this on app mount to prime user-state UI.","operationId":"credits_getCreditScore","security":[{"HTTPBearer":[]}],"parameters":[{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditScoreResponse"},"examples":{"Personal credits":{"summary":"Personal credits","value":{"paid_credits_remaining":4,"preview_credits_remaining":1,"user_has_paid_credits":true,"user_email":"author@example.edu","credit_source":"personal","personal_credits":4,"organization_credits":0,"organization_frozen":false,"tier":"default","max_document_words":100000,"max_file_size_mb":50,"max_supplementary_material":3,"max_chat_message_length":32000,"features":{"sharing_controls":false,"member_visibility":false,"data_retention":false,"verified_domains":false,"enterprise_sso":false},"chatbot_quota":{"used_fraction":0.25,"resets_at":"2026-08-01T10:17:43.611699Z"},"next_allowance_at":null}},"Organization credits":{"summary":"Organization credits","value":{"paid_credits_remaining":250,"preview_credits_remaining":0,"user_has_paid_credits":true,"user_email":"researcher@example.edu","credit_source":"organization","personal_credits":0,"organization_credits":250,"organization_frozen":false,"tier":"extended","max_document_words":120000,"max_file_size_mb":100,"max_supplementary_material":5,"max_chat_message_length":48000,"features":{"sharing_controls":false,"member_visibility":false,"data_retention":false,"verified_domains":false,"enterprise_sso":false},"chatbot_quota":{"used_fraction":0.25,"resets_at":"2026-08-01T10:17:43.611699Z"},"next_allowance_at":"2026-11-01T00:00:00+00:00"}},"Organization frozen":{"summary":"Organization frozen","value":{"paid_credits_remaining":0,"preview_credits_remaining":0,"user_has_paid_credits":false,"user_email":"researcher@example.edu","credit_source":"organization","personal_credits":0,"organization_credits":250,"organization_frozen":true,"tier":"extended","max_document_words":120000,"max_file_size_mb":100,"max_supplementary_material":5,"max_chat_message_length":48000,"features":{"sharing_controls":false,"member_visibility":false,"data_retention":false,"verified_domains":false,"enterprise_sso":false},"chatbot_quota":{"used_fraction":0.25,"resets_at":"2026-08-01T10:17:43.611699Z"},"next_allowance_at":null}},"Out of credits":{"summary":"Out of credits","value":{"paid_credits_remaining":0,"preview_credits_remaining":0,"user_has_paid_credits":false,"user_email":"newcomer@example.edu","credit_source":"personal","personal_credits":0,"organization_credits":0,"organization_frozen":false,"tier":"default","max_document_words":100000,"max_file_size_mb":50,"max_supplementary_material":3,"max_chat_message_length":32000,"features":{"sharing_controls":false,"member_visibility":false,"data_retention":false,"verified_domains":false,"enterprise_sso":false},"chatbot_quota":{"used_fraction":0.0,"resets_at":"2026-08-01T10:17:43.611699Z"},"next_allowance_at":null}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequired"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/products":{"get":{"tags":["products"],"summary":"List available products","description":"List all available credit packs and subscription plans with pricing, and the self-serve organization plans with the standard credit rates. Products are sorted by price. Pass a country code (and optionally region + postal_code, e.g. from Vercel geo headers) to get localized pricing with accurate sales tax. Organization prices are before tax, and each names the currency it is read in: the country's when the Stripe price holds an amount in it, else the price's own.","operationId":"products_getProducts","parameters":[{"name":"country","in":"query","required":false,"schema":{"anyOf":[{"type":"string","minLength":2,"maxLength":2,"pattern":"^[A-Za-z]{2}$"},{"type":"null"}],"description":"ISO 3166-1 alpha-2 country code (e.g. 'US', 'GB'). Forwarded from x-vercel-ip-country.","title":"Country"},"description":"ISO 3166-1 alpha-2 country code (e.g. 'US', 'GB'). Forwarded from x-vercel-ip-country."},{"name":"region","in":"query","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":6,"pattern":"^[A-Za-z0-9\\-]{1,6}$"},{"type":"null"}],"description":"State/province code (e.g. 'NY', 'ON'). Forwarded from x-vercel-ip-country-region. Required for state-precision tax in CA/IN/ES-Canary when no postal_code is provided.","title":"Region"},"description":"State/province code (e.g. 'NY', 'ON'). Forwarded from x-vercel-ip-country-region. Required for state-precision tax in CA/IN/ES-Canary when no postal_code is provided."},{"name":"postal_code","in":"query","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":12,"pattern":"^[A-Za-z0-9 \\-]{1,12}$"},{"type":"null"}],"description":"Postal/ZIP code. Forwarded from x-vercel-ip-postal-code. Required for US Stripe Tax; without it the call is skipped and total_cents falls back to price_cents.","title":"Postal Code"},"description":"Postal/ZIP code. Forwarded from x-vercel-ip-postal-code. Required for US Stripe Tax; without it the call is skipped and total_cents falls back to price_cents."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductsResponse"},"examples":{"Catalogue":{"summary":"Catalogue","value":{"credit_packs":[{"price_id":"price_1QeXamplePack","name":"10 credits","credits":10,"price_cents":4900,"currency":"eur","subscriber_price_cents":3900,"tax_included":true,"tax_amount_cents":850,"total_cents":4900,"subscriber_total_cents":3900,"subscriber_prices_cents":{"enterprise":1000}},{"price_id":"price_1QeXampleSingle","name":"1 credit","credits":1,"price_cents":900,"currency":"eur","subscriber_price_cents":null,"tax_included":true,"tax_amount_cents":156,"total_cents":900,"subscriber_total_cents":null,"subscriber_prices_cents":{}}],"subscriptions":[{"price_id":"price_1QeXampleMonthly","name":"Refine Monthly","credits":20,"price_cents":2900,"currency":"eur","interval":"month","tax_included":true,"tax_amount_cents":503,"total_cents":2900,"personal_tier":null,"family":"b2c","tier_rank":20},{"price_id":"price_1QeXampleEnterprise","name":"Refine Enterprise","credits":0,"price_cents":10000,"currency":"usd","interval":"month","tax_included":false,"tax_amount_cents":0,"total_cents":10000,"personal_tier":"enterprise","family":"b2b","tier_rank":40}],"organization_plans":[{"tier":"team","monthly":{"price_cents":10000,"currency":"eur"},"yearly":{"price_cents":110000,"currency":"eur"},"credit_rate":{"price_cents":3900,"currency":"eur"}}],"organization_credit_rate":{"price_cents":4999,"currency":"eur"}}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorUnexpectedFailure"},"502":{"$ref":"#/components/responses/ProblemBadGatewayPaymentSystem"}}}},"/documents/upload":{"post":{"tags":["documents"],"summary":"Upload and convert a document","description":"Upload a document file, start async conversion, and return task_id for SSE progress. When the SSE 'complete' event arrives, forward `result.previous_review_id` (if set) to `POST /documents/{document_id}/process` to run the review with the prior session as context.","operationId":"documents_uploadDocument","security":[{"HTTPBearer":[]}],"parameters":[{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/DocumentUploadForm"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentUploadResponse"},"examples":{"Main document":{"summary":"Main document","value":{"task_id":"a1c4f9e2-6d70-4b83-91ac-5f2e8d0b7c31","document_id":"3eef6ca5-9388-45b4-92a8-c144347ad6ec","filename":"manuscript.pdf","format":"pdf","parent_document_id":null}},"Supplementary material":{"summary":"Supplementary material","value":{"task_id":"b2d5a0f3-7e81-4c94-a2bd-6a3f9e1c8d42","document_id":"c3e6b1a4-8f92-4da5-b3ce-7b4f0a2d9e53","filename":"appendix.docx","format":"docx","parent_document_id":"3eef6ca5-9388-45b4-92a8-c144347ad6ec"}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorOriginalUploadStorage"},"400":{"$ref":"#/components/responses/ProblemBadRequestInvalidUploadedFileMalformedDocumentIdMissingFilenameNestedSupplementaryMaterialSupplementaryMaterialLimitReached"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequiredParentDocumentNotOwned"},"404":{"$ref":"#/components/responses/ProblemNotFoundAuthenticatedUserNotFoundParentDocumentNotFound"},"409":{"$ref":"#/components/responses/ProblemConflictUploadBundleChanged"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/documents/upload/events/{task_id}":{"get":{"tags":["documents"],"summary":"SSE endpoint for upload progress","description":"Server-Sent Events stream for document upload progress updates. Authentication is via query parameter `token` (not Bearer header) because EventSource cannot set HTTP headers.","operationId":"documents_uploadEvents","parameters":[{"name":"task_id","in":"path","required":true,"schema":{"type":"string","title":"Task Id"}},{"name":"token","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Authentication token","title":"Token"},"description":"Authentication token"},{"name":"organization","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"200":{"description":"SSE stream of upload progress events","content":{"text/event-stream":{"itemSchema":{"type":"object","properties":{"data":{"type":"string"},"event":{"type":"string"},"id":{"type":"string"},"retry":{"type":"integer","minimum":0}}},"schema":{"oneOf":[{"description":"SSE progress event. `stage` is null while a run is between mapped stages.","properties":{"type":{"const":"progress","description":"Event type","title":"Type","type":"string"},"value":{"description":"Progress percentage 0-100","title":"Value","type":"integer"},"stage":{"anyOf":[{"description":"Where a run currently is, at the granularity clients are given.","enum":["queued","uploading","converting","analyzing","reviewing","finalizing","complete"],"title":"ProgressStage","type":"string"},{"type":"null"}],"description":"Coarse stage the run is in"}},"required":["type","value"],"title":"SSEProgressEvent","type":"object"},{"description":"SSE completion event for upload.","properties":{"type":{"const":"complete","description":"Event type","title":"Type","type":"string"},"result":{"description":"Result for document upload completion.","properties":{"document_id":{"description":"UUID of the uploaded document","title":"Document Id","type":"string"},"filename":{"description":"Original filename","title":"Filename","type":"string"},"format":{"description":"Document format (PDF, DOCX, etc.)","title":"Format","type":"string"},"content_url":{"description":"URL to fetch converted markdown content","title":"Content Url","type":"string"},"original_url":{"description":"URL to fetch original file","title":"Original Url","type":"string"},"word_count":{"description":"Word count of the converted document","title":"Word Count","type":"integer"},"parent_document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"UUID of parent document if this is a supplement","title":"Parent Document Id"},"previous_review_id":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"UUID of a prior review this upload looks like a revision of, or null if no match was found. Forward to `POST /documents/{document_id}/process` as `previous_review_id` to run the new review with the prior review as context.","title":"Previous Review Id"}},"required":["document_id","filename","format","content_url","original_url","word_count"],"title":"UploadCompleteResult","type":"object"}},"required":["type","result"],"title":"SSEUploadCompleteEvent","type":"object"},{"description":"SSE error event — the same three members the chat stream and HTTP send.","properties":{"type":{"const":"error","description":"Event type","title":"Type","type":"string"},"error":{"description":"Stable human-readable title; does not vary per occurrence","title":"Error","type":"string"},"error_type":{"description":"Stable RFC 9457 type slug identifying the failure","title":"Error Type","type":"string"},"details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"description":"Error-specific extension members","title":"Details"}},"required":["type","error","error_type"],"title":"SSEErrorEvent","type":"object"}],"discriminator":{"propertyName":"type"}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequired"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}},"security":[]}},"/documents/{document_id}/process/events/{review_id}":{"get":{"tags":["documents"],"summary":"SSE endpoint for document processing progress","description":"Server-Sent Events stream for document processing progress updates. Authentication is via query parameter `token` (not Bearer header) because EventSource cannot set HTTP headers.","operationId":"documents_processEvents","parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}},{"name":"review_id","in":"path","required":true,"schema":{"type":"string","title":"Review Id"}},{"name":"attempt","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Attempt"}},{"name":"token","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Authentication token","title":"Token"},"description":"Authentication token"},{"name":"organization","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"200":{"description":"SSE stream of processing events","content":{"text/event-stream":{"itemSchema":{"type":"object","properties":{"data":{"type":"string"},"event":{"type":"string"},"id":{"type":"string"},"retry":{"type":"integer","minimum":0}}},"schema":{"oneOf":[{"description":"SSE progress event. `stage` is null while a run is between mapped stages.","properties":{"type":{"const":"progress","description":"Event type","title":"Type","type":"string"},"value":{"description":"Progress percentage 0-100","title":"Value","type":"integer"},"stage":{"anyOf":[{"description":"Where a run currently is, at the granularity clients are given.","enum":["queued","uploading","converting","analyzing","reviewing","finalizing","complete"],"title":"ProgressStage","type":"string"},{"type":"null"}],"description":"Coarse stage the run is in"}},"required":["type","value"],"title":"SSEProgressEvent","type":"object"},{"description":"SSE completion event for processing.","properties":{"type":{"const":"complete","description":"Event type","title":"Type","type":"string"},"result":{"description":"Result for document processing completion.","properties":{"review_id":{"description":"UUID of the created review","title":"Review Id","type":"string"},"preview_credits_remaining":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Viewer's remaining preview credits; null when the balance query is unavailable","title":"Preview Credits Remaining"},"paid_credits_remaining":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Viewer's paid credits in the acting context; null when the balance query is unavailable","title":"Paid Credits Remaining"},"comment_count":{"description":"Number of comments generated","title":"Comment Count","type":"integer"}},"required":["review_id","comment_count"],"title":"ProcessCompleteResult","type":"object"}},"required":["type","result"],"title":"SSEProcessCompleteEvent","type":"object"},{"description":"SSE error event — the same three members the chat stream and HTTP send.","properties":{"type":{"const":"error","description":"Event type","title":"Type","type":"string"},"error":{"description":"Stable human-readable title; does not vary per occurrence","title":"Error","type":"string"},"error_type":{"description":"Stable RFC 9457 type slug identifying the failure","title":"Error Type","type":"string"},"details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"description":"Error-specific extension members","title":"Details"}},"required":["type","error","error_type"],"title":"SSEErrorEvent","type":"object"}],"discriminator":{"propertyName":"type"}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequired"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}},"security":[]}},"/documents/{document_id}/process":{"post":{"tags":["documents"],"summary":"Start proofreading a document","description":"Start the proofreading analysis for an uploaded document. Consumes 1 credit (paid or preview); a frozen organization's (plan `unpaid` or `canceled`) is refused. The document and all its supplementary materials must be fully converted first — wait for the upload SSE complete event at /documents/upload/events/{task_id}. The tier word limit applies to the combined word count of the document plus its supplementary materials.","operationId":"documents_processDocument","security":[{"HTTPBearer":[]}],"parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}},{"name":"X-POSTHOG-SESSION-ID","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Posthog-Session-Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessDocumentRequest","default":{"preview":false}},"examples":{"Full review":{"summary":"Full review","value":{"preview":false,"previous_review_id":null,"steering_prompt":null,"supplementary_material_steering":null}},"Preview review":{"summary":"Preview review","value":{"preview":true,"previous_review_id":null,"steering_prompt":null,"supplementary_material_steering":null}},"Revision of a prior session":{"summary":"Revision of a prior session","value":{"preview":false,"previous_review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf","steering_prompt":"Focus on the statistics in section 4.","supplementary_material_steering":null}}}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessDocumentResponse"},"examples":{"Accepted":{"summary":"Accepted","value":{"review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf","events_endpoint":"/documents/3eef6ca5-9388-45b4-92a8-c144347ad6ec/process/events/7ab7324d-0968-40ac-9a0d-68fe4fbf11bf"}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessableDocumentTokenLimitDocumentWordLimitInvalidFlagOverrideShortDocumentTextUnknownPromptSetUnknownSteeringTarget"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorProcessingJobNotCreated"},"400":{"$ref":"#/components/responses/ProblemBadRequestMalformedDocumentId"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenDocumentNotAccessibleFlagOverridesForbiddenNoCreditsNoOrganizationCreditsOrganizationMembershipRequired"},"404":{"$ref":"#/components/responses/ProblemNotFoundAuthenticatedUserNotFoundDocumentNotFoundDocumentTextNotReadyRevisionSessionNotAccessible"},"409":{"$ref":"#/components/responses/ProblemConflictOrganizationFrozenSupplementaryMaterialNotReadyUploadBundleChanged"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailableProcessingDispatch"}}}},"/documents/{document_id}/content":{"get":{"tags":["documents"],"summary":"Get converted document text","description":"Return the converted Markdown text of a previously uploaded document. Use this to read or quote the source text after a successful upload — for example, before deciding whether to start proofreading, or to feed the text into another tool. Returns 404 while the document is still converting; if so, retry after a short wait.\n\nWithout credentials, only the document of a review shared with anyone is served.","operationId":"documents_getDocumentContent","security":[{"HTTPBearer":[]},{},{"BearerAuth":[]}],"parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"200":{"description":"The document's converted Markdown text.","content":{"text/markdown":{"schema":{"type":"string"}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"400":{"$ref":"#/components/responses/ProblemBadRequestMalformedDocumentId"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenDocumentNotAccessibleOrganizationMembershipRequired"},"404":{"$ref":"#/components/responses/ProblemNotFoundDocumentNotFoundDocumentTextNotReady"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/documents/{document_id}/original":{"get":{"tags":["documents"],"summary":"Get original document","description":"Stream the original uploaded document file. The response carries the file's own `Content-Type` (`application/pdf`, a Word type, and so on) and its filename in `Content-Disposition`; read the body as bytes, not as JSON.","operationId":"documents_getOriginalDocument","security":[{"HTTPBearer":[]}],"parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"200":{"description":"The original uploaded file, served under its own stored content type.","content":{"application/octet-stream":{"schema":{"type":"string"}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"400":{"$ref":"#/components/responses/ProblemBadRequestMalformedDocumentId"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenDocumentNotAccessibleOrganizationMembershipRequired"},"404":{"$ref":"#/components/responses/ProblemNotFoundDocumentNotFound"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/documents/{document_id}/images/{image_name}":{"get":{"tags":["documents"],"summary":"Get document image","description":"Get an extracted image from a document. Authentication via query parameter `token` for <img> tag compatibility (cannot set HTTP headers).","operationId":"documents_getDocumentImage","parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}},{"name":"image_name","in":"path","required":true,"schema":{"type":"string","title":"Image Name"}},{"name":"token","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Authentication token","title":"Token"},"description":"Authentication token"},{"name":"organization","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"200":{"description":"The extracted image, served under its own stored image content type.","content":{"application/octet-stream":{"schema":{"type":"string"}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"400":{"$ref":"#/components/responses/ProblemBadRequestInvalidImageRequestMalformedDocumentId"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenDocumentNotAccessibleOrganizationMembershipRequired"},"404":{"$ref":"#/components/responses/ProblemNotFoundImageNotFound"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}},"security":[]}},"/documents/{document_id}":{"delete":{"tags":["documents"],"summary":"Delete a document","description":"Delete a document and its blob storage. If the document is a main document, its supplementary material (DB rows and blob folders) are deleted too.","operationId":"documents_deleteDocument","security":[{"HTTPBearer":[]}],"parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"204":{"description":"Successful Response"},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"400":{"$ref":"#/components/responses/ProblemBadRequestMalformedDocumentId"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequired"},"404":{"$ref":"#/components/responses/ProblemNotFoundDocumentNotFound"},"409":{"$ref":"#/components/responses/ProblemConflictUploadBundleChanged"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/documents/{document_id}/supplementary-material":{"get":{"tags":["documents"],"summary":"List supplementary material for a document","description":"Get the list of supplementary material documents attached to a main document, ordered by display_order.","operationId":"documents_getSupplementaryMaterial","security":[{"HTTPBearer":[]}],"parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SupplementaryMaterialResponse"},"title":"Response Documents Getsupplementarymaterial"},"examples":{"Appendix":{"summary":"Appendix","value":[{"document_id":"b2d5a0f3-7e81-4c94-a2bd-6a3f9e1c8d42","filename":"appendix.docx","display_order":1,"steering_note":"Reference tables for section 4."}]}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"400":{"$ref":"#/components/responses/ProblemBadRequestMalformedDocumentId"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenDocumentNotAccessibleOrganizationMembershipRequired"},"404":{"$ref":"#/components/responses/ProblemNotFoundDocumentNotFound"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/subscriptions/status":{"get":{"tags":["subscriptions"],"summary":"Get subscription status","description":"Get the current user's subscription status including tier, credits remaining, renewal date, cancellation status, the plan changes allowed from here and the one pending for the period end.","operationId":"subscriptions_getStatus","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionStatusResponse"},"examples":{"Active":{"summary":"Active","value":{"has_active_subscription":true,"subscription_tier":"monthly","subscription_credits_remaining":14,"next_credit_renewal_at":"2026-08-12T00:00:00+00:00","stripe_subscription_id":"sub_1QeXampleActive","cancel_at_period_end":false,"current_period_ends_at":"2026-08-12T00:00:00+00:00","stripe_customer_id":"cus_QeXample123","personal_tier":null,"allowed_actions":[{"price_id":"price_1QeXampleAdvanced","kind":"upgrade_now","label":"Upgrade now"},{"price_id":"price_1QeXampleStarter","kind":"switch_at_period_end","label":"Switch at period end"}],"pending_change":null,"pause_resumes_at":null}},"Downgrade pending":{"summary":"Downgrade pending","value":{"has_active_subscription":true,"subscription_tier":"monthly","subscription_credits_remaining":14,"next_credit_renewal_at":"2026-08-12T00:00:00+00:00","stripe_subscription_id":"sub_1QeXampleActive","cancel_at_period_end":false,"current_period_ends_at":"2026-08-12T00:00:00+00:00","stripe_customer_id":"cus_QeXample123","personal_tier":null,"allowed_actions":[],"pending_change":{"price_id":"price_1QeXampleStarter","effective_at":"2026-08-12T00:00:00+00:00","kind":"switch_at_period_end"},"pause_resumes_at":null}},"Cancelling at period end":{"summary":"Cancelling at period end","value":{"has_active_subscription":true,"subscription_tier":"monthly","subscription_credits_remaining":6,"next_credit_renewal_at":null,"stripe_subscription_id":"sub_1QeXampleActive","cancel_at_period_end":true,"current_period_ends_at":"2026-08-12T00:00:00+00:00","stripe_customer_id":"cus_QeXample123","personal_tier":null,"allowed_actions":[],"pending_change":null,"pause_resumes_at":null}},"Paused":{"summary":"Paused","value":{"has_active_subscription":true,"subscription_tier":"monthly","subscription_credits_remaining":14,"next_credit_renewal_at":"2026-08-12T00:00:00+00:00","stripe_subscription_id":"sub_1QeXampleActive","cancel_at_period_end":false,"current_period_ends_at":"2026-08-12T00:00:00+00:00","stripe_customer_id":"cus_QeXample123","personal_tier":null,"allowed_actions":[],"pending_change":null,"pause_resumes_at":"2026-09-12T00:00:00+00:00"}},"No subscription":{"summary":"No subscription","value":{"has_active_subscription":false,"subscription_tier":null,"subscription_credits_remaining":null,"next_credit_renewal_at":null,"stripe_subscription_id":null,"cancel_at_period_end":null,"current_period_ends_at":null,"stripe_customer_id":null,"personal_tier":null,"allowed_actions":[],"pending_change":null,"pause_resumes_at":null}}}}}},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}},"security":[{"HTTPBearer":[]}]}},"/subscriptions/preview":{"get":{"tags":["subscriptions"],"summary":"Preview a plan change","description":"What changing to `price_id` would cost and when it would take effect: an upgrade's prorated invoice today and its new renewal date, or a switch's period end. Changes nothing.","operationId":"subscriptions_previewChange","security":[{"HTTPBearer":[]}],"parameters":[{"name":"price_id","in":"query","required":true,"schema":{"type":"string","title":"Price Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanChangePreviewResponse"},"examples":{"Upgrade":{"summary":"Upgrade","value":{"kind":"upgrade_now","amount_due_today":2000,"currency":"usd","effective_at":"2026-08-01T14:32:09+00:00","next_renewal_amount":2999,"next_renewal_at":"2026-09-01T14:32:09+00:00"}},"Switch":{"summary":"Switch","value":{"kind":"switch_at_period_end","amount_due_today":0,"currency":"usd","effective_at":"2026-08-12T00:00:00+00:00","next_renewal_amount":999,"next_renewal_at":"2026-08-12T00:00:00+00:00"}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"400":{"$ref":"#/components/responses/ProblemBadRequestUnknownPrice"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"404":{"$ref":"#/components/responses/ProblemNotFoundNoSubscription"},"409":{"$ref":"#/components/responses/ProblemConflictPlanChangeRefusedCurrencyPlanChangeRefusedCustomPlanChangeRefusedUnpaidPlanChangeSamePlan"},"502":{"$ref":"#/components/responses/ProblemBadGatewayPaymentSystem"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/subscriptions/upgrade":{"post":{"tags":["subscriptions"],"summary":"Create upgrade checkout session","description":"Create a Stripe checkout session for upgrading to a higher subscription plan. Returns a checkout URL for browser redirect. Refused with 409 for a plan that buys no more monthly credits (Enterprise monthly to annual): that change goes through `POST /subscriptions/change`.","operationId":"subscriptions_createUpgradeCheckoutSession","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpgradeSubscriptionRequest"},"examples":{"Upgrade to annual":{"summary":"Upgrade to annual","value":{"new_price_id":"price_1QeXampleAnnual","success_url":"https://refine.ink/account/billing?upgraded=1","cancel_url":"https://refine.ink/account/billing"}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpgradeSubscriptionResponse"},"examples":{"Checkout required":{"summary":"Checkout required","value":{"checkout_url":"https://checkout.stripe.com/c/pay/cs_test_upgrade123","session_id":"cs_test_upgrade123"}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"400":{"$ref":"#/components/responses/ProblemBadRequestRedirectOriginMismatchRedirectOriginRequiredUnknownPrice"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"404":{"$ref":"#/components/responses/ProblemNotFoundNoSubscription"},"409":{"$ref":"#/components/responses/ProblemConflictPlanSwitchAcrossTiersUpgradeBuysNoMoreCredits"},"502":{"$ref":"#/components/responses/ProblemBadGatewayPaymentSystem"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}},"security":[{"HTTPBearer":[]}]}},"/subscriptions/downgrade":{"post":{"tags":["subscriptions"],"summary":"Downgrade subscription","description":"Downgrade the current subscription to a lower plan. Takes effect at the next billing cycle.","operationId":"subscriptions_downgrade","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DowngradeSubscriptionRequest"},"examples":{"Downgrade to monthly":{"summary":"Downgrade to monthly","value":{"new_price_id":"price_1QeXampleMonthly"}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DowngradeSubscriptionResponse"},"examples":{"Applied":{"summary":"Applied","value":{"new_plan_name":"Starter","effective_at":"2026-08-01T14:32:09+00:00"}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"400":{"$ref":"#/components/responses/ProblemBadRequestUnknownPrice"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"404":{"$ref":"#/components/responses/ProblemNotFoundNoSubscription"},"409":{"$ref":"#/components/responses/ProblemConflictPlanSwitchAcrossTiers"},"502":{"$ref":"#/components/responses/ProblemBadGatewayPaymentSystem"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}},"security":[{"HTTPBearer":[]}]}},"/subscriptions/change":{"post":{"tags":["subscriptions"],"summary":"Change the plan","description":"Change the current subscription to `price_id` the way the policy says (#1963): a dearer plan in the same family is invoiced now for a fresh period (the unused time is credited) and the credit difference is granted when the invoice is paid; a cheaper plan, a cheaper interval or a switch between a credits plan and the personal tier takes effect at the end of the paid period. One change may be pending; `replace_pending` replaces it.","operationId":"subscriptions_changePlan","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangeSubscriptionRequest"},"examples":{"Upgrade":{"summary":"Upgrade","value":{"price_id":"price_1QeXampleAdvanced","replace_pending":false}},"Replace the pending change":{"summary":"Replace the pending change","value":{"price_id":"price_1QeXampleStarter","replace_pending":true}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanChangeResponse"},"examples":{"Upgraded now":{"summary":"Upgraded now","value":{"kind":"upgrade_now","effective_at":"2026-08-01T14:32:09+00:00","amount_due_today":2000,"currency":"usd","invoice_id":"in_1QeXample","paid":true}},"Upgrade declined":{"summary":"Upgrade declined","value":{"kind":"upgrade_now","effective_at":"2026-08-01T14:32:09+00:00","amount_due_today":2000,"currency":"usd","invoice_id":"in_1QeXample","paid":false}},"Switch scheduled":{"summary":"Switch scheduled","value":{"kind":"switch_at_period_end","effective_at":"2026-08-12T00:00:00+00:00","amount_due_today":null,"currency":null,"invoice_id":null,"paid":true}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"400":{"$ref":"#/components/responses/ProblemBadRequestUnknownPrice"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"404":{"$ref":"#/components/responses/ProblemNotFoundNoSubscription"},"409":{"$ref":"#/components/responses/ProblemConflictPlanChangePendingExistsPlanChangeRefusedCustomPlanChangeRefusedUnpaidPlanChangeSamePlanPlanSwitchAcrossTiers"},"502":{"$ref":"#/components/responses/ProblemBadGatewayPaymentSystem"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}},"security":[{"HTTPBearer":[]}]}},"/subscriptions/change/withdraw":{"post":{"tags":["subscriptions"],"summary":"Withdraw the pending plan change","description":"Drop the change scheduled for the end of the paid period; the current plan continues.","operationId":"subscriptions_withdrawChange","responses":{"204":{"description":"Successful Response"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"404":{"$ref":"#/components/responses/ProblemNotFoundNoPendingPlanChangeNoSubscription"},"502":{"$ref":"#/components/responses/ProblemBadGatewayPaymentSystem"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}},"security":[{"HTTPBearer":[]}]}},"/subscriptions/cancel/withdraw":{"post":{"tags":["subscriptions"],"summary":"Keep the plan","description":"Undo a cancellation scheduled for the end of the paid period; the subscription renews as before.","operationId":"subscriptions_withdrawCancellation","responses":{"204":{"description":"Successful Response"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"404":{"$ref":"#/components/responses/ProblemNotFoundCancellationNotPendingNoSubscription"},"502":{"$ref":"#/components/responses/ProblemBadGatewayPaymentSystem"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}},"security":[{"HTTPBearer":[]}]}},"/subscriptions/pause":{"post":{"tags":["subscriptions"],"summary":"Pause the subscription for a month","description":"The cancel dialog's save offer: the paid period runs to its end, the next invoice is voided and billing resumes one month later. A cancellation scheduled for the period end is withdrawn; a pending plan change is refused.","operationId":"subscriptions_pause","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PauseSubscriptionResponse"},"examples":{"Paused":{"summary":"Paused","value":{"resumes_at":"2026-09-12T00:00:00+00:00"}}}}}},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"404":{"$ref":"#/components/responses/ProblemNotFoundNoSubscription"},"409":{"$ref":"#/components/responses/ProblemConflictSubscriptionAlreadyPausedSubscriptionPauseRefused"},"502":{"$ref":"#/components/responses/ProblemBadGatewayPaymentSystem"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}},"security":[{"HTTPBearer":[]}]}},"/subscriptions/pause/withdraw":{"post":{"tags":["subscriptions"],"summary":"Withdraw the pause","description":"Lift the save offer's pause: billing resumes from the next period. Answers 204 when the subscription was not paused.","operationId":"subscriptions_withdrawPause","responses":{"204":{"description":"Successful Response"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"404":{"$ref":"#/components/responses/ProblemNotFoundNoSubscription"},"502":{"$ref":"#/components/responses/ProblemBadGatewayPaymentSystem"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}},"security":[{"HTTPBearer":[]}]}},"/subscriptions/cancel":{"post":{"tags":["subscriptions"],"summary":"Cancel subscription","description":"Cancel the current subscription. With `at_period_end` it stays active until the end of the paid period, then ends without renewing, and a plan change pending for the period end is dropped; `POST /subscriptions/cancel/withdraw` undoes it before then. Without a body it ends now, as before. The user keeps their credit balance and all documents and reviews.","operationId":"subscriptions_cancel","requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/CancelSubscriptionRequest"},{"type":"null"}],"title":"Request"},"examples":{"At period end":{"summary":"At period end","value":{"at_period_end":true}},"Now":{"summary":"Now","value":{"at_period_end":false}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelSubscriptionResponse"},"examples":{"Cancelled at period end":{"summary":"Cancelled at period end","value":{"subscription":{"has_active_subscription":true,"subscription_tier":"monthly","subscription_credits_remaining":6,"next_credit_renewal_at":null,"stripe_subscription_id":"sub_1QeXampleActive","cancel_at_period_end":true,"current_period_ends_at":"2026-08-12T00:00:00+00:00","stripe_customer_id":"cus_QeXample123","personal_tier":null,"allowed_actions":[],"pending_change":null,"pause_resumes_at":null}}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"404":{"$ref":"#/components/responses/ProblemNotFoundNoSubscription"},"502":{"$ref":"#/components/responses/ProblemBadGatewayPaymentSystem"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}},"security":[{"HTTPBearer":[]}]}},"/organizations":{"get":{"tags":["organizations"],"summary":"List my organizations","description":"The organizations the caller belongs to, with the caller's role in each. `organization_id` is the value to send as the `X-Refine-Organization` header (or `?organization=` on image URLs) to act for that organization; send `personal` to act on your own assets.","operationId":"organizations_listMyOrganizations","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/OrganizationMembershipResponse"},"type":"array","title":"Response Organizations Listmyorganizations"},"examples":{"A member":{"summary":"A member","value":[{"organization_id":"org_2fK9xLmQpR3sT","name":"Example University Research Group","slug":"example-university","role":"member"}]},"A billing admin":{"summary":"A billing admin","value":[{"organization_id":"org_2fK9xLmQpR3sT","name":"Example University Research Group","slug":"example-university","role":"billing_admin"}]}}}}},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}},"security":[{"HTTPBearer":[]}]}},"/organizations/{organization_id}/credits":{"get":{"tags":["organizations"],"summary":"Get organization credit balance","description":"Get the credit pool balance for an organization, including unallocated pool credits and per-user allocations. Requires organization membership.","operationId":"organizations_getCredits","security":[{"HTTPBearer":[]}],"parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","title":"Organization Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationCreditPoolResponse"},"examples":{"Partially allocated pool":{"summary":"Partially allocated pool","value":{"organization_id":"org_2fK9xLmQpR3sT","organization_name":"Example University Research Group","total_pool_credits":500,"user_allocations":{"researcher@example.edu":120,"author@example.edu":80},"total_allocated":200,"welcome_credits":5,"credit_allowance":{"amount":2,"max_balance":6,"period":"month","next_allowance_at":"2026-11-01T00:00:00+00:00"}}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorOrganizationCreditsUnavailable"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequiredOrganizationPermission"},"404":{"$ref":"#/components/responses/ProblemNotFoundOrganizationMissing"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/organizations/{organization_id}/credits/consumption":{"get":{"tags":["organizations"],"summary":"Get organization credit consumption","description":"Get credit consumption data for an organization. Shows how credits have been used across members between `starts_at` (inclusive) and `ends_at` (exclusive), a window of at most 366 days. Without bounds, it covers the 30 days up to the coming midnight UTC.","operationId":"organizations_getConsumption","security":[{"HTTPBearer":[]}],"parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","title":"Organization Id"}},{"name":"starts_at","in":"query","required":false,"schema":{"type":"string","format":"date-time","description":"Start of the window, inclusive, with a timezone. Defaults to midnight UTC 30 days before the coming midnight, whether or not `ends_at` is given.","title":"Starts At"},"description":"Start of the window, inclusive, with a timezone. Defaults to midnight UTC 30 days before the coming midnight, whether or not `ends_at` is given."},{"name":"ends_at","in":"query","required":false,"schema":{"type":"string","format":"date-time","description":"End of the window, exclusive, with a timezone. Defaults to the coming midnight UTC, so today is included.","title":"Ends At"},"description":"End of the window, exclusive, with a timezone. Defaults to the coming midnight UTC, so today is included."},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationConsumptionResponse"},"examples":{"One active member":{"summary":"One active member","value":{"users":[{"user_email":"researcher@example.edu","events":[{"occurred_at":"2026-07-28T09:14:02+00:00","credit_type":"paid","review_id":"8f1d9c44-2b70-4f0e-9a2f-6d1c53e0b7aa","amount":1,"filename":"thesis-chapter-3.pdf"}],"total_consumed":1}],"organization_total":1,"starts_at":"2026-07-01T00:00:00+00:00","ends_at":"2026-08-01T00:00:00+00:00"}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorOrganizationCreditsUnavailable"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequiredOrganizationPermission"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/organizations/{organization_id}/reviews/findings":{"get":{"tags":["organizations"],"summary":"Get organization review findings","description":"What the organization's full reviews found between `starts_at` (inclusive) and `ends_at` (exclusive), a window of at most 366 days: per review, its comments' severity, category and fix effort, and how many are marked addressed or dismissed so far. Previews are not counted: an organization can't run one, and a preview followed by its full review would count one document twice. Reviews carry findings from `tracking_started_at`; a window that starts earlier reads nothing before it. Without bounds, it covers the 30 days up to the coming midnight UTC.","operationId":"organizations_getReviewFindings","security":[{"HTTPBearer":[]}],"parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","title":"Organization Id"}},{"name":"starts_at","in":"query","required":false,"schema":{"type":"string","format":"date-time","description":"Start of the window, inclusive, with a timezone. Defaults to midnight UTC 30 days before the coming midnight, whether or not `ends_at` is given.","title":"Starts At"},"description":"Start of the window, inclusive, with a timezone. Defaults to midnight UTC 30 days before the coming midnight, whether or not `ends_at` is given."},{"name":"ends_at","in":"query","required":false,"schema":{"type":"string","format":"date-time","description":"End of the window, exclusive, with a timezone. Defaults to the coming midnight UTC, so today is included.","title":"Ends At"},"description":"End of the window, exclusive, with a timezone. Defaults to the coming midnight UTC, so today is included."},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationReviewFindingsResponse"},"examples":{"One tagged review":{"summary":"One tagged review","value":{"reviews":[{"review_id":"8f1d9c44-2b70-4f0e-9a2f-6d1c53e0b7aa","tagged_at":"2026-10-28T09:18:40+00:00","comment_count":48,"severity_counts":{"critical":1,"major":9,"minor":30,"suggestion":7},"category_counts":{"substance":33,"evidence":6,"presentation":7,"compliance":0,"other":1},"fix_effort_counts":{"edit_in_place":30,"rework":14,"new_work":3},"addressed_counts":{"critical":0,"major":2,"minor":1,"suggestion":0,"unrated":0},"dismissed_counts":{"critical":0,"major":0,"minor":0,"suggestion":1,"unrated":0}}],"tracking_started_at":"2026-10-21T00:00:00+00:00","starts_at":"2026-10-01T00:00:00+00:00","ends_at":"2026-11-01T00:00:00+00:00"}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorOrganizationCreditsUnavailable"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequiredOrganizationPermission"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/organizations/{organization_id}/credits/allocate":{"post":{"tags":["organizations"],"summary":"Allocate credits to organization member","description":"Move credits from the organization pool to a specific member. Requires admin or billing admin role.","operationId":"organizations_allocateCreditsToUser","security":[{"HTTPBearer":[]}],"parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","title":"Organization Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AllocateCreditsRequest"},"examples":{"Allocate 50":{"summary":"Allocate 50","value":{"user_email":"researcher@example.edu","amount":50}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AllocateCreditsResponse"},"examples":{"Allocated":{"summary":"Allocated","value":{"organization_id":"org_2fK9xLmQpR3sT","user_email":"researcher@example.edu","new_user_balance":170,"pool_remaining":250}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"400":{"$ref":"#/components/responses/ProblemBadRequestAllocationTargetNotAMemberCreditAllocationFailedOrganizationPoolExhausted"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequiredOrganizationPermission"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/organizations/{organization_id}/credits/deallocate":{"post":{"tags":["organizations"],"summary":"Return member credits to organization pool","description":"Move credits from a member back to the organization pool. Requires admin or billing admin role.","operationId":"organizations_deallocateCreditsFromUser","security":[{"HTTPBearer":[]}],"parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","title":"Organization Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeallocateCreditsRequest"},"examples":{"Reclaim 20":{"summary":"Reclaim 20","value":{"user_email":"researcher@example.edu","amount":20}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeallocateCreditsResponse"},"examples":{"Reclaimed":{"summary":"Reclaimed","value":{"organization_id":"org_2fK9xLmQpR3sT","user_email":"researcher@example.edu","new_user_balance":150,"pool_total":500}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"400":{"$ref":"#/components/responses/ProblemBadRequestAllocationTargetNotAMemberCreditAllocationFailed"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequiredOrganizationPermission"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/organizations/{organization_id}/credit-allowance":{"put":{"tags":["organizations"],"summary":"Set the organization's credit allowance","description":"Every period, each member gets `amount` credits from the pool, up to a maximum of `max_balance`. New members are granted their allowance as they join. Replaces any existing allowance. Requires admin or billing admin role.","operationId":"organizations_setCreditAllowance","security":[{"HTTPBearer":[]}],"parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","title":"Organization Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditAllowanceRequest"},"examples":{"Monthly allowance":{"summary":"Monthly allowance","value":{"amount":2,"max_balance":6,"period":"month"}},"Self-serve":{"summary":"Self-serve","value":{"amount":3,"max_balance":3,"period":"hour"}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditAllowanceResponse"},"examples":{"Monthly allowance":{"summary":"Monthly allowance","value":{"amount":2,"max_balance":6,"period":"month","next_allowance_at":"2026-11-01T00:00:00+00:00"}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequiredOrganizationPermission"},"404":{"$ref":"#/components/responses/ProblemNotFoundOrganizationMissing"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}},"delete":{"tags":["organizations"],"summary":"Turn off the organization's credit allowance","description":"Stops further allowance grants. Credits already granted stay on each member's allocation. Requires admin or billing admin role.","operationId":"organizations_removeCreditAllowance","security":[{"HTTPBearer":[]}],"parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","title":"Organization Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"204":{"description":"Successful Response"},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequiredOrganizationPermission"},"404":{"$ref":"#/components/responses/ProblemNotFoundOrganizationMissing"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/organizations/{organization_id}/welcome-credits":{"put":{"tags":["organizations"],"summary":"Set the organization's welcome credits","description":"Each new member gets `amount` credits from the pool once, when they join, before any credit allowance. Replaces the current amount. Requires admin or billing admin role.","operationId":"organizations_setWelcomeCredits","security":[{"HTTPBearer":[]}],"parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","title":"Organization Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WelcomeCreditsRequest"},"examples":{"Welcome credits":{"summary":"Welcome credits","value":{"amount":5}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WelcomeCreditsResponse"},"examples":{"Welcome credits":{"summary":"Welcome credits","value":{"welcome_credits":5}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequiredOrganizationPermission"},"404":{"$ref":"#/components/responses/ProblemNotFoundOrganizationMissing"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}},"delete":{"tags":["organizations"],"summary":"Turn off the organization's welcome credits","description":"New members stop getting welcome credits. Credits already granted stay on each member's allocation. Requires admin or billing admin role.","operationId":"organizations_removeWelcomeCredits","security":[{"HTTPBearer":[]}],"parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","title":"Organization Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"204":{"description":"Successful Response"},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequiredOrganizationPermission"},"404":{"$ref":"#/components/responses/ProblemNotFoundOrganizationMissing"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/organizations/{organization_id}":{"delete":{"tags":["organizations"],"summary":"Delete the organization","description":"Cancels the organization's plan subscription immediately, then deletes the organization in Clerk and here. Allowed only to an admin who is its sole remaining member, frozen organizations included. The organization's credits (its pool and the admin's own allocation) are forfeited in the same transaction, not moved to anyone's personal balance; the ledger keeps the record. With other members still in, answers `organization-not-empty` with how many. When the plan cannot be canceled, answers `organization-plan-cancellation-failed` and nothing is deleted: retry; if it keeps failing, contact support, since some failures need staff before a retry can succeed. When another plan subscription started meanwhile, answers `organization-plan-changed` and nothing is deleted: a retry cancels that one too. Cannot be undone, and a canceled plan stays canceled even when a later step fails.","operationId":"organizations_deleteOrganization","security":[{"HTTPBearer":[]}],"parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","title":"Organization Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"204":{"description":"Successful Response"},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequiredOrganizationPermission"},"404":{"$ref":"#/components/responses/ProblemNotFoundOrganizationMissing"},"409":{"$ref":"#/components/responses/ProblemConflictOrganizationNotEmptyOrganizationPlanChanged"},"502":{"$ref":"#/components/responses/ProblemBadGatewayOrganizationDeletionFailedOrganizationPlanCancellationFailed"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/organizations/{organization_id}/credits/request":{"post":{"tags":["organizations"],"summary":"Request more credits from organization admins","description":"Member-initiated request for more credits. Emits an event consumed by a PostHog workflow that notifies the org's admin(s). Does not allocate credits.","operationId":"organizations_requestOrganizationCredits","security":[{"HTTPBearer":[]}],"parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","title":"Organization Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationCreditsRequest"},"examples":{"With justification":{"summary":"With justification","value":{"message":"We are onboarding four new PhD students this term."}},"Without a message":{"summary":"Without a message","value":{"message":null}}}}}},"responses":{"202":{"description":"Successful Response"},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequired"},"404":{"$ref":"#/components/responses/ProblemNotFoundOrganizationMissing"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/organizations/{organization_id}/settings":{"get":{"tags":["organizations"],"summary":"Get the organization's settings","description":"The settings an organization's admins see in Advanced settings (public sharing, groups, session retention), each with its current value and whether the organization's plan includes changing it, and whether the plan includes verified domains and enterprise SSO. Every setting is locked until Refine support includes it in the organization's terms. Allowed only to an admin acting for the organization; billing admins get `organization-permission`.","operationId":"organizations_getOwnOrganizationSettings","security":[{"HTTPBearer":[]}],"parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","title":"Organization Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OwnOrganizationSettingsResponse"},"examples":{"Nothing included":{"summary":"Nothing included","value":{"public_sharing_enabled":{"value":true,"included":false},"groups_enabled":{"value":false,"included":false},"session_retention_days":{"value":0,"included":false},"verified_domains":{"included":false},"enterprise_sso":{"included":false}}},"Everything included":{"summary":"Everything included","value":{"public_sharing_enabled":{"value":false,"included":true},"groups_enabled":{"value":true,"included":true},"session_retention_days":{"value":365,"included":true},"verified_domains":{"included":true},"enterprise_sso":{"included":true}}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequiredOrganizationPermission"},"404":{"$ref":"#/components/responses/ProblemNotFoundOrganizationMissing"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}},"patch":{"tags":["organizations"],"summary":"Change the organization's settings","description":"Changes only the settings sent, at least one. Each must be one the organization's plan includes: otherwise answers 403 `setting-not-included` naming the first that is not, and nothing is changed. The change is stored in Clerk first and applied to the organization in the same request, so the answer already shows it. Answers 502 `organization-settings-not-saved` when Clerk refuses or cannot be reached, with nothing changed here; sending the same values again is safe. Allowed only to an admin acting for the organization; billing admins get `organization-permission`.","operationId":"organizations_updateOwnOrganizationSettings","security":[{"HTTPBearer":[]}],"parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","title":"Organization Id"}},{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OwnOrganizationSettingsPatch"},"examples":{"Turn public sharing off":{"summary":"Turn public sharing off","value":{"public_sharing_enabled":false,"groups_enabled":null,"session_retention_days":null}},"Keep sessions for a year":{"summary":"Keep sessions for a year","value":{"public_sharing_enabled":null,"groups_enabled":null,"session_retention_days":365}},"Several at once":{"summary":"Several at once","value":{"public_sharing_enabled":null,"groups_enabled":true,"session_retention_days":0}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OwnOrganizationSettingsResponse"},"examples":{"Nothing included":{"summary":"Nothing included","value":{"public_sharing_enabled":{"value":true,"included":false},"groups_enabled":{"value":false,"included":false},"session_retention_days":{"value":0,"included":false},"verified_domains":{"included":false},"enterprise_sso":{"included":false}}},"Everything included":{"summary":"Everything included","value":{"public_sharing_enabled":{"value":false,"included":true},"groups_enabled":{"value":true,"included":true},"session_retention_days":{"value":365,"included":true},"verified_domains":{"included":true},"enterprise_sso":{"included":true}}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequiredOrganizationPermissionSettingNotIncluded"},"404":{"$ref":"#/components/responses/ProblemNotFoundOrganizationMissing"},"502":{"$ref":"#/components/responses/ProblemBadGatewayOrganizationSettingsNotSaved"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/processing":{"get":{"tags":["processing"],"summary":"Check initial processing state","description":"Check if the user has any active proofreading tasks or unviewed results. Use this once on app load to detect in-progress work — do NOT poll this endpoint in a loop. To track progress of a specific task, use the SSE endpoint at /documents/{document_id}/process/events/{review_id} or the watch_processing_progress MCP tool.","operationId":"processing_getProcessingStatus","security":[{"HTTPBearer":[]}],"parameters":[{"name":"X-Refine-Organization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice.","title":"X-Refine-Organization"},"description":"Organization this request acts for: a Clerk organization id the caller belongs to (see `GET /organizations`), or `personal`. Non-members are refused (403). Absent means personal unless an MCP token carries the consent choice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessingStatusResponse"},"examples":{"Nothing in flight":{"summary":"Nothing in flight","value":{"processing":[],"unviewed_completed":null}},"Active task":{"summary":"Active task","value":{"processing":[{"review_id":"c9b1f6d2-4a83-4f21-9c07-2e5b8a1d3f40","document_id":"3eef6ca5-9388-45b4-92a8-c144347ad6ec","title":"Targeting Interventions in Networks","progress_percentage":45,"created_at":"2026-07-24T12:45:39.418365+00:00"}],"unviewed_completed":null}},"Unviewed result waiting":{"summary":"Unviewed result waiting","value":{"processing":[],"unviewed_completed":{"review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf","document_id":"3eef6ca5-9388-45b4-92a8-c144347ad6ec","title":"Targeting Interventions in Networks","created_at":"2026-07-24T12:45:39.418365+00:00"}}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"403":{"$ref":"#/components/responses/ProblemForbiddenOrganizationMembershipRequired"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}}}},"/marketing/preferences":{"get":{"tags":["marketing"],"summary":"Get marketing email opt-in state","description":"Return the authenticated user's current opt-in state.\n\nCQRS read — direct repository call, no use case. The JWT guarantees the\nuser exists; a missing row at this point indicates a Clerk-vs-DB drift\nbug and surfaces as 404.","operationId":"marketing_getMarketingPreferences","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketingPreferencesResponse"},"examples":{"Opted in":{"summary":"Opted in","value":{"opt_in":true,"updated_at":"2026-07-20T08:30:00+00:00"}},"Never set":{"summary":"Never set","value":{"opt_in":false,"updated_at":null}}}}}},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"404":{"$ref":"#/components/responses/ProblemNotFoundAuthenticatedUserNotFound"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}},"security":[{"HTTPBearer":[]}]},"put":{"tags":["marketing"],"summary":"Update marketing email opt-in state","description":"Update and return the authenticated user's opt-in state.\n\nReturns 404 if the JWT resolves to a user we don't have a row for\n(Clerk-vs-DB drift). UNCHANGED and UPDATED both return the post-call\nstate so the frontend can show the latest timestamp.","operationId":"marketing_updateMarketingPreferences","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateMarketingPreferencesRequest"},"examples":{"Opt in":{"summary":"Opt in","value":{"opt_in":true}},"Opt out":{"summary":"Opt out","value":{"opt_in":false}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketingPreferencesResponse"},"examples":{"Opted in":{"summary":"Opted in","value":{"opt_in":true,"updated_at":"2026-07-20T08:30:00+00:00"}},"Never set":{"summary":"Never set","value":{"opt_in":false,"updated_at":null}}}}}},"422":{"$ref":"#/components/responses/ProblemUnprocessable"},"500":{"$ref":"#/components/responses/ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure"},"401":{"$ref":"#/components/responses/ProblemUnauthenticated"},"404":{"$ref":"#/components/responses/ProblemNotFoundAuthenticatedUserNotFound"},"503":{"$ref":"#/components/responses/ProblemServiceUnavailable"}},"security":[{"HTTPBearer":[]}]}}},"components":{"schemas":{"AllocateCreditsRequest":{"properties":{"user_email":{"type":"string","format":"email","title":"User Email","description":"Email of user to receive credits"},"amount":{"type":"integer","exclusiveMinimum":0.0,"title":"Amount","description":"Number of credits to allocate"}},"type":"object","required":["user_email","amount"],"title":"AllocateCreditsRequest","description":"Request to allocate credits from pool to user.","examples":[{"user_email":"researcher@example.edu","amount":50}]},"AllocateCreditsResponse":{"properties":{"organization_id":{"type":"string","title":"Organization Id","description":"ID of the organization"},"user_email":{"type":"string","title":"User Email","description":"Email of the user who received credits"},"new_user_balance":{"type":"integer","title":"New User Balance","description":"User's new credit balance"},"pool_remaining":{"type":"integer","title":"Pool Remaining","description":"Remaining credits in the organization pool"}},"type":"object","required":["organization_id","user_email","new_user_balance","pool_remaining"],"title":"AllocateCreditsResponse","description":"Response for credit allocation.","examples":[{"organization_id":"org_2fK9xLmQpR3sT","user_email":"researcher@example.edu","new_user_balance":170,"pool_remaining":250}]},"AllowancePeriod":{"type":"string","enum":["hour","day","week","month"],"title":"AllowancePeriod","description":"How often each member can be granted their allowance."},"AllowedAction":{"properties":{"price_id":{"type":"string","title":"Price Id","description":"The target price"},"kind":{"$ref":"#/components/schemas/TransitionKind","description":"`upgrade_now` (invoiced today, anchor reset) or `switch_at_period_end` (a downgrade, a cheaper interval or a family switch)"},"label":{"type":"string","title":"Label","description":"A plain English label for the action"}},"type":"object","required":["price_id","kind","label"],"title":"AllowedAction","description":"A plan change the policy allows from the current plan (#1964)."},"AssistantChatMessage":{"properties":{"role":{"type":"string","const":"assistant","title":"Role","description":"Always 'assistant'"},"content":{"type":"string","title":"Content"},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"When the message was stored"},"turn_id":{"type":"string","title":"Turn Id","description":"Router-assigned turn identifier (uuid4)"}},"type":"object","required":["role","content","created_at","turn_id"],"title":"AssistantChatMessage","description":"An assistant message in conversation history."},"CancelSubscriptionRequest":{"properties":{"at_period_end":{"type":"boolean","title":"At Period End","description":"True: the plan stays active until the end of the paid period, then ends, and a pending change is dropped; `POST /subscriptions/cancel/withdraw` undoes it. False or absent: ends now.","default":false}},"type":"object","title":"CancelSubscriptionRequest","description":"Request schema for cancelling (#1963): the new UI asks for the period end; without a body the subscription ends now, as before."},"CancelSubscriptionResponse":{"properties":{"subscription":{"anyOf":[{"$ref":"#/components/schemas/SubscriptionStatusResponse"},{"type":"null"}],"description":"Updated subscription status after cancellation; `cancel_at_period_end` and `current_period_ends_at` say when access lapses"}},"type":"object","title":"CancelSubscriptionResponse","description":"Response schema for subscription cancellation.\n\nNote: Errors are returned as HTTP exceptions, not in the response body.\nA 200 response always indicates success.","examples":[{"subscription":{"has_active_subscription":true,"subscription_tier":"monthly","subscription_credits_remaining":6,"next_credit_renewal_at":null,"stripe_subscription_id":"sub_1QeXampleActive","cancel_at_period_end":true,"current_period_ends_at":"2026-08-12T00:00:00+00:00","stripe_customer_id":"cus_QeXample123","personal_tier":null,"allowed_actions":[],"pending_change":null,"pause_resumes_at":null}}]},"CategoryCountsResponse":{"properties":{"substance":{"type":"integer","title":"Substance","description":"Comments about substance"},"evidence":{"type":"integer","title":"Evidence","description":"Comments about evidence"},"presentation":{"type":"integer","title":"Presentation","description":"Comments about presentation"},"compliance":{"type":"integer","title":"Compliance","description":"Comments about compliance"},"other":{"type":"integer","title":"Other","description":"Comments of no other category"}},"type":"object","required":["substance","evidence","presentation","compliance","other"],"title":"CategoryCountsResponse","description":"Comments per category: the group of the comment's kind, as the review page shows it."},"ChangeSubscriptionRequest":{"properties":{"price_id":{"type":"string","title":"Price Id","description":"The target price"},"replace_pending":{"type":"boolean","title":"Replace Pending","description":"Replace the change already scheduled for the period end; without it a pending change answers `plan-change-pending-exists`","default":false}},"type":"object","required":["price_id"],"title":"ChangeSubscriptionRequest","description":"Request schema for changing the plan (#1963).","examples":[{"price_id":"price_1QeXampleAdvanced","replace_pending":false},{"price_id":"price_1QeXampleStarter","replace_pending":true}]},"ChatMessageRequest":{"properties":{"message":{"type":"string","maxLength":64000,"minLength":1,"title":"Message","description":"User's message"},"comment_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Comment Id","description":"Optional: Focus on specific comment ID, or 'overall' for overall feedback"}},"type":"object","required":["message"],"title":"ChatMessageRequest","description":"Request body for sending a chatbot message.","examples":[{"message":"Why is this phrasing a problem?","comment_id":"1792a726-5a83-4d20-ad59-0cf0f72c7faf"},{"message":"What should I prioritise fixing first?","comment_id":null}]},"CommentActionItem":{"properties":{"id":{"type":"string","title":"Id","description":"UUID of the action"},"review_id":{"type":"string","title":"Review Id","description":"UUID of the review the comment belongs to"},"comment_id":{"type":"string","title":"Comment Id","description":"ID of the comment"},"user_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Email","description":"Email of the user who took the action"},"action_type":{"type":"string","title":"Action Type","description":"Type of action (dismissed or addressed)"},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"When the action was taken"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes","description":"Optional notes for the action"}},"type":"object","required":["id","review_id","comment_id","user_email","action_type","created_at","notes"],"title":"CommentActionItem","description":"A comment action record.","examples":[{"id":"c2f7a1de-5b90-4f0c-9a11-6d3f2b8e4c07","review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf","comment_id":"broad-2","user_email":"author@example.edu","action_type":"dismissed","created_at":"2026-07-24T12:59:06.387687+00:00","notes":null}]},"CommentKind":{"type":"string","enum":["substance/factual_error","substance/contradiction","substance/reasoning","substance/methodology","substance/missing_content","evidence/unsupported_claim","evidence/citation","evidence/data","presentation/clarity","presentation/structure","presentation/language","presentation/formatting","compliance/legal_regulatory","compliance/ethics","compliance/guidelines","other/other"],"title":"CommentKind","description":"A leaf of the two-level kind tree; the frontend shows ``group``, analysis uses the leaf."},"CommentSchema":{"properties":{"id":{"type":"string","title":"Id","description":"Unique comment identifier"},"title":{"type":"string","title":"Title","description":"Short title/category of the comment"},"paragraph":{"type":"string","title":"Paragraph","description":"Original quote from document for context"},"message":{"type":"string","title":"Message","description":"The actual feedback/suggestion"},"quote":{"type":"string","title":"Quote","description":"Matched source text for highlighting; empty string when no exact match was found in the source document","default":""},"score":{"type":"number","title":"Score","description":"The comment's relevance score (0-1): its rank score when the comments were ranked, otherwise its tag score, otherwise the neutral 0.5"},"is_dismissed":{"type":"boolean","title":"Is Dismissed","description":"Whether comment is dismissed","default":false},"is_addressed":{"type":"boolean","title":"Is Addressed","description":"Whether comment is addressed","default":false},"types":{"items":{"$ref":"#/components/schemas/CommentType"},"type":"array","title":"Types","description":"Comment categories (closed public vocabulary). 'general' = segment-level review comment, 'broad' = document-level comment, 'external_references' = citation verification. A comment merged from several categories carries all of them."},"severity":{"anyOf":[{"$ref":"#/components/schemas/Severity"},{"type":"null"}],"description":"How serious the comment is: 'critical' (central to the work and blocks its conclusion), 'major' (central, blocking or supporting the main claim), 'minor' (a real but contained error), 'suggestion' (not wrong as written, an improvement). Null when the comment was not tagged."},"kind":{"anyOf":[{"$ref":"#/components/schemas/CommentKind"},{"type":"null"}],"description":"What the comment is about, as 'group/leaf' (for example 'substance/methodology' or 'presentation/language'). Show the part before the slash to group comments. Null when the comment was not tagged."},"fix_effort":{"anyOf":[{"$ref":"#/components/schemas/FixEffort"},{"type":"null"}],"description":"How much work resolving the comment takes: 'edit_in_place' (a local edit), 'rework' (restructure existing material) or 'new_work' (needs new material). Null when the comment was not tagged."}},"type":"object","required":["id","title","paragraph","message","score"],"title":"CommentSchema","description":"Schema for a single comment in feedback_detailed.\n\nOnly includes public API fields. Internal pipeline fields\n(reasoning, case, scores, etc.) are stored in DB but stripped here."},"CommentType":{"type":"string","enum":["general","broad","external_references","prior_art","writing","skeptic"],"title":"CommentType"},"ConversationHistoryResponse":{"properties":{"conversation_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Conversation Id"},"messages":{"items":{"oneOf":[{"$ref":"#/components/schemas/UserChatMessage"},{"$ref":"#/components/schemas/AssistantChatMessage"}],"discriminator":{"propertyName":"role","mapping":{"assistant":"#/components/schemas/AssistantChatMessage","user":"#/components/schemas/UserChatMessage"}}},"type":"array","title":"Messages","default":[]},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At"},"last_message_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Message At"}},"type":"object","title":"ConversationHistoryResponse","description":"Response for GET conversation history.","examples":[{"conversation_id":"c9b1f6d2-4a83-4f21-9c07-2e5b8a1d3f40","messages":[{"role":"user","content":"Why is this phrasing a problem?","comment_id":"1792a726-5a83-4d20-ad59-0cf0f72c7faf","created_at":"2026-07-24T13:02:11.412000+00:00"},{"role":"assistant","content":"The claim is stated without the condition it depends on, so a reader cannot tell when it holds.","created_at":"2026-07-24T13:02:14.887000+00:00","turn_id":"turn_2fK9xLmQ"}],"created_at":"2026-07-24T13:02:11.412000+00:00","last_message_at":"2026-07-24T13:02:14.887000+00:00"},{"conversation_id":null,"messages":[],"created_at":null,"last_message_at":null}]},"CreditAllowanceRequest":{"properties":{"amount":{"type":"integer","maximum":10000.0,"minimum":1.0,"title":"Amount","description":"Credits each member receives per period"},"max_balance":{"type":"integer","maximum":10000.0,"minimum":1.0,"title":"Max Balance","description":"An allowance never takes a member's balance above this; must be at least `amount`"},"period":{"$ref":"#/components/schemas/AllowancePeriod","description":"UTC calendar period: hour, day, week (from Monday) or month (from the 1st)"}},"type":"object","required":["amount","max_balance","period"],"title":"CreditAllowanceRequest","description":"A credit allowance: every `period`, each member gets `amount` credits from the pool, up to `max_balance`.","examples":[{"amount":2,"max_balance":6,"period":"month"},{"amount":3,"max_balance":3,"period":"hour"}]},"CreditAllowanceResponse":{"properties":{"amount":{"type":"integer","title":"Amount","description":"Credits each member receives per period"},"max_balance":{"type":"integer","title":"Max Balance","description":"An allowance never takes a member's balance above this"},"period":{"$ref":"#/components/schemas/AllowancePeriod","description":"UTC calendar period: hour, day, week (from Monday) or month (from the 1st)"},"next_allowance_at":{"type":"string","format":"date-time","title":"Next Allowance At","description":"Start of the next period. New members are granted their allowance as they join, and members at the maximum as soon as they drop below it."}},"type":"object","required":["amount","max_balance","period","next_allowance_at"],"title":"CreditAllowanceResponse","description":"An organization's credit allowance and when members below the maximum are next granted their allowance.","examples":[{"amount":2,"max_balance":6,"period":"month","next_allowance_at":"2026-11-01T00:00:00+00:00"}]},"CreditConsumptionEventResponse":{"properties":{"occurred_at":{"type":"string","format":"date-time","title":"Occurred At","description":"When the credit was consumed"},"credit_type":{"type":"string","title":"Credit Type","description":"Which balance the credit came from: 'paid' or 'preview'"},"review_id":{"type":"string","title":"Review Id","description":"UUID of the review the credit was spent on"},"amount":{"type":"integer","title":"Amount","description":"Number of credits consumed"},"filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Filename","description":"Filename of the reviewed document as uploaded; null for spends recorded before November 2026"}},"type":"object","required":["occurred_at","credit_type","review_id","amount"],"title":"CreditConsumptionEventResponse","description":"One credit spend, as published."},"CreditPackProduct":{"properties":{"price_id":{"type":"string","title":"Price Id"},"name":{"type":"string","title":"Name"},"credits":{"type":"integer","title":"Credits"},"price_cents":{"type":"integer","title":"Price Cents"},"currency":{"type":"string","title":"Currency"},"subscriber_price_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Subscriber Price Cents"},"tax_included":{"type":"boolean","title":"Tax Included","default":false},"tax_amount_cents":{"type":"integer","title":"Tax Amount Cents","default":0},"total_cents":{"type":"integer","title":"Total Cents","default":0},"subscriber_total_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Subscriber Total Cents"},"subscriber_prices_cents":{"additionalProperties":{"type":"integer"},"type":"object","title":"Subscriber Prices Cents","default":{}}},"type":"object","required":["price_id","name","credits","price_cents","currency"],"title":"CreditPackProduct","description":"One-time credit pack purchase."},"CreditScoreResponse":{"properties":{"paid_credits_remaining":{"type":"integer","title":"Paid Credits Remaining","description":"Paid credits spendable in the acting context: the organization allocation when acting in an organization, the user's own credits otherwise; 0 while frozen"},"preview_credits_remaining":{"type":"integer","title":"Preview Credits Remaining","description":"Number of preview/free credits remaining"},"user_has_paid_credits":{"type":"boolean","title":"User Has Paid Credits","description":"Whether user has any paid credits"},"user_email":{"type":"string","title":"User Email","description":"Email of the user"},"credit_source":{"type":"string","title":"Credit Source","description":"Source of credits: 'personal' or 'organization'"},"personal_credits":{"type":"integer","title":"Personal Credits","description":"The user's own paid credits, regardless of acting context (0 for an organization member)"},"organization_credits":{"type":"integer","title":"Organization Credits","description":"Paid credits the user's organization has allocated to them, regardless of acting context (0 for a personal account)"},"organization_frozen":{"type":"boolean","title":"Organization Frozen","description":"True acting in an organization whose plan is `unpaid` or `canceled`: its credits are frozen and a review is refused with `organization-frozen`. False acting personally","default":false},"tier":{"$ref":"#/components/schemas/UserTier","description":"Plan label for the acting context: 'extended' in an organization, the user's own tier otherwise. The limits below come from the acting subject's terms, not from this label"},"max_document_words":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Document Words","description":"Max words per document, null=unlimited"},"max_file_size_mb":{"type":"integer","title":"Max File Size Mb","description":"Max file size in MB for upload"},"max_supplementary_material":{"type":"integer","title":"Max Supplementary Material","description":"Max supplementary material documents attachable to a main document"},"max_chat_message_length":{"type":"integer","title":"Max Chat Message Length","description":"Max characters in one chat message"},"features":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Features","description":"Every boolean feature by key, and whether it is on; the numeric features are the named limits"},"chatbot_quota":{"$ref":"#/components/schemas/QuotaStatus","description":"Current chatbot usage over the rolling 24h window; used_fraction=0.0 if the user has no messages in the window (or cache is unavailable, fail-open). resets_at is the moment the oldest counted message ages out (now + remaining TTL), not a fixed clock time."},"next_allowance_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Next Allowance At","description":"In an organization with a credit allowance: the earliest time more organization credits can arrive. Null in personal context, without an allowance, or at the maximum."}},"type":"object","required":["paid_credits_remaining","preview_credits_remaining","user_has_paid_credits","user_email","credit_source","personal_credits","organization_credits","tier","max_document_words","max_file_size_mb","max_supplementary_material","max_chat_message_length","features","chatbot_quota"],"title":"CreditScoreResponse","description":"Response for credit score endpoint.","examples":[{"paid_credits_remaining":4,"preview_credits_remaining":1,"user_has_paid_credits":true,"user_email":"author@example.edu","credit_source":"personal","personal_credits":4,"organization_credits":0,"organization_frozen":false,"tier":"default","max_document_words":100000,"max_file_size_mb":50,"max_supplementary_material":3,"max_chat_message_length":32000,"features":{"sharing_controls":false,"member_visibility":false,"data_retention":false,"verified_domains":false,"enterprise_sso":false},"chatbot_quota":{"used_fraction":0.25,"resets_at":"2026-08-01T10:17:43.611699Z"},"next_allowance_at":null},{"paid_credits_remaining":250,"preview_credits_remaining":0,"user_has_paid_credits":true,"user_email":"researcher@example.edu","credit_source":"organization","personal_credits":0,"organization_credits":250,"organization_frozen":false,"tier":"extended","max_document_words":120000,"max_file_size_mb":100,"max_supplementary_material":5,"max_chat_message_length":48000,"features":{"sharing_controls":false,"member_visibility":false,"data_retention":false,"verified_domains":false,"enterprise_sso":false},"chatbot_quota":{"used_fraction":0.25,"resets_at":"2026-08-01T10:17:43.611699Z"},"next_allowance_at":"2026-11-01T00:00:00+00:00"},{"paid_credits_remaining":0,"preview_credits_remaining":0,"user_has_paid_credits":false,"user_email":"researcher@example.edu","credit_source":"organization","personal_credits":0,"organization_credits":250,"organization_frozen":true,"tier":"extended","max_document_words":120000,"max_file_size_mb":100,"max_supplementary_material":5,"max_chat_message_length":48000,"features":{"sharing_controls":false,"member_visibility":false,"data_retention":false,"verified_domains":false,"enterprise_sso":false},"chatbot_quota":{"used_fraction":0.25,"resets_at":"2026-08-01T10:17:43.611699Z"},"next_allowance_at":null},{"paid_credits_remaining":0,"preview_credits_remaining":0,"user_has_paid_credits":false,"user_email":"newcomer@example.edu","credit_source":"personal","personal_credits":0,"organization_credits":0,"organization_frozen":false,"tier":"default","max_document_words":100000,"max_file_size_mb":50,"max_supplementary_material":3,"max_chat_message_length":32000,"features":{"sharing_controls":false,"member_visibility":false,"data_retention":false,"verified_domains":false,"enterprise_sso":false},"chatbot_quota":{"used_fraction":0.0,"resets_at":"2026-08-01T10:17:43.611699Z"},"next_allowance_at":null}]},"DeallocateCreditsRequest":{"properties":{"user_email":{"type":"string","format":"email","title":"User Email","description":"Email of user to deallocate from"},"amount":{"type":"integer","exclusiveMinimum":0.0,"title":"Amount","description":"Number of credits to return to pool"}},"type":"object","required":["user_email","amount"],"title":"DeallocateCreditsRequest","description":"Request to return credits from user to pool.","examples":[{"user_email":"researcher@example.edu","amount":20}]},"DeallocateCreditsResponse":{"properties":{"organization_id":{"type":"string","title":"Organization Id","description":"ID of the organization"},"user_email":{"type":"string","title":"User Email","description":"Email of the user credits were returned from"},"new_user_balance":{"type":"integer","title":"New User Balance","description":"User's new credit balance"},"pool_total":{"type":"integer","title":"Pool Total","description":"New total credits in the organization pool"}},"type":"object","required":["organization_id","user_email","new_user_balance","pool_total"],"title":"DeallocateCreditsResponse","description":"Response for credit deallocation.","examples":[{"organization_id":"org_2fK9xLmQpR3sT","user_email":"researcher@example.edu","new_user_balance":150,"pool_total":500}]},"DocumentUploadResponse":{"properties":{"task_id":{"type":"string","title":"Task Id","description":"UUID for SSE progress tracking"},"document_id":{"type":"string","title":"Document Id","description":"UUID of the uploaded document; its content is readable once conversion completes"},"filename":{"type":"string","title":"Filename","description":"Original filename"},"format":{"type":"string","title":"Format","description":"Document format (PDF, DOCX, etc.)"},"parent_document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Document Id","description":"UUID of parent document if this is a supplement"}},"type":"object","required":["task_id","document_id","filename","format"],"title":"DocumentUploadResponse","description":"Response from document upload (202 Accepted).\n\nThe document upload is processed asynchronously. Connect to the SSE\nendpoint at /documents/upload/events/{task_id} for progress updates.\nThe converted content is available once the SSE 'complete' event arrives.","examples":[{"task_id":"a1c4f9e2-6d70-4b83-91ac-5f2e8d0b7c31","document_id":"3eef6ca5-9388-45b4-92a8-c144347ad6ec","filename":"manuscript.pdf","format":"pdf","parent_document_id":null},{"task_id":"b2d5a0f3-7e81-4c94-a2bd-6a3f9e1c8d42","document_id":"c3e6b1a4-8f92-4da5-b3ce-7b4f0a2d9e53","filename":"appendix.docx","format":"docx","parent_document_id":"3eef6ca5-9388-45b4-92a8-c144347ad6ec"}]},"DowngradeSubscriptionRequest":{"properties":{"new_price_id":{"type":"string","minLength":1,"title":"New Price Id","description":"Stripe price ID for the new subscription tier"}},"type":"object","required":["new_price_id"],"title":"DowngradeSubscriptionRequest","description":"Request schema for downgrading a subscription.\n\nNote: subscription_id, user_email, plan names, and credits are derived\nfrom JWT, database lookup, and pricing configuration.","examples":[{"new_price_id":"price_1QeXampleMonthly"}]},"DowngradeSubscriptionResponse":{"properties":{"new_plan_name":{"type":"string","title":"New Plan Name","description":"The plan the subscription now sits on"},"effective_at":{"type":"string","format":"date-time","title":"Effective At","description":"When the downgrade takes effect"}},"type":"object","required":["new_plan_name","effective_at"],"title":"DowngradeSubscriptionResponse","description":"Response schema for subscription downgrade.\n\nNote: Errors are returned as HTTP exceptions, not in the response body.\nA 200 response always indicates success.","examples":[{"new_plan_name":"Starter","effective_at":"2026-08-01T14:32:09+00:00"}]},"FeedbackDetailed":{"properties":{"comments":{"items":{"$ref":"#/components/schemas/CommentSchema"},"type":"array","title":"Comments","description":"List of comments"},"comments_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Comments Count","description":"Number of comments"}},"type":"object","title":"FeedbackDetailed","description":"Detailed feedback with comments."},"FeedbackResponse":{"properties":{"overall":{"$ref":"#/components/schemas/OverallFeedbackSchema","description":"Structured overall feedback"},"detailed":{"$ref":"#/components/schemas/FeedbackDetailed","description":"Detailed feedback with comments"}},"type":"object","required":["overall","detailed"],"title":"FeedbackResponse","description":"Feedback container."},"FixEffort":{"type":"string","enum":["edit_in_place","rework","new_work"],"title":"FixEffort"},"FixEffortCountsResponse":{"properties":{"edit_in_place":{"type":"integer","title":"Edit In Place","description":"Comments fixable by editing in place"},"rework":{"type":"integer","title":"Rework","description":"Comments that need rework"},"new_work":{"type":"integer","title":"New Work","description":"Comments that need new work"}},"type":"object","required":["edit_in_place","rework","new_work"],"title":"FixEffortCountsResponse","description":"Comments per fix effort."},"GeneralAccess":{"type":"string","enum":["restricted","organization","signed_in","anyone"],"title":"GeneralAccess","description":"A review's general-access level, from narrowest to widest.\n\n``RESTRICTED`` grants nothing beyond the default visibility rules.\n``ORGANIZATION`` opens it to the owning organization's members.\n``SIGNED_IN`` opens it to anyone signed in with the link, bounded by the\nowning organization's public-sharing setting: the reach a share had\nbefore the levels existed. ``ANYONE`` also opens it without sign-in,\nunder the same bound."},"MarkViewedResponse":{"properties":{"review_id":{"type":"string","title":"Review Id","description":"UUID of the review that was marked"},"user_email":{"type":"string","title":"User Email","description":"Email of the user"}},"type":"object","required":["review_id","user_email"],"title":"MarkViewedResponse","description":"Response for mark-viewed action.","examples":[{"review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf","user_email":"author@example.edu"}]},"MarkedCommentCountsResponse":{"properties":{"critical":{"type":"integer","title":"Critical","description":"Comments rated critical"},"major":{"type":"integer","title":"Major","description":"Comments rated major"},"minor":{"type":"integer","title":"Minor","description":"Comments rated minor"},"suggestion":{"type":"integer","title":"Suggestion","description":"Comments rated a suggestion"},"unrated":{"type":"integer","title":"Unrated","description":"Marked comments the tagger gave no severity"}},"type":"object","required":["critical","major","minor","suggestion","unrated"],"title":"MarkedCommentCountsResponse","description":"Comments currently marked, per severity."},"MarketingPreferencesResponse":{"properties":{"opt_in":{"type":"boolean","title":"Opt In","description":"True if the user is opted in to marketing email."},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated At","description":"When the value was last changed. Null if never touched (default opt-out)."}},"type":"object","required":["opt_in"],"title":"MarketingPreferencesResponse","description":"Current marketing email opt-in state for the authenticated user.","examples":[{"opt_in":true,"updated_at":"2026-07-20T08:30:00+00:00"},{"opt_in":false,"updated_at":null}]},"OrganizationBooleanSetting":{"properties":{"value":{"type":"boolean","title":"Value","description":"Whether the setting is on"},"included":{"type":"boolean","title":"Included","description":"Whether the organization's plan includes changing this setting; when false, only Refine staff can"}},"type":"object","required":["value","included"],"title":"OrganizationBooleanSetting","description":"An on/off setting of an organization: what it is now, and whether the organization's plan lets its admins change it."},"OrganizationConsumptionResponse":{"properties":{"users":{"items":{"$ref":"#/components/schemas/UserConsumptionResponse"},"type":"array","title":"Users","description":"Per-member consumption, highest first"},"organization_total":{"type":"integer","title":"Organization Total","description":"Credits the organization consumed in the window"},"starts_at":{"type":"string","format":"date-time","title":"Starts At","description":"Start of the window reported on, inclusive"},"ends_at":{"type":"string","format":"date-time","title":"Ends At","description":"End of the window reported on, exclusive"}},"type":"object","required":["users","organization_total","starts_at","ends_at"],"title":"OrganizationConsumptionResponse","description":"Credit consumption across an organization's members.","examples":[{"users":[{"user_email":"researcher@example.edu","events":[{"occurred_at":"2026-07-28T09:14:02+00:00","credit_type":"paid","review_id":"8f1d9c44-2b70-4f0e-9a2f-6d1c53e0b7aa","amount":1,"filename":"thesis-chapter-3.pdf"}],"total_consumed":1}],"organization_total":1,"starts_at":"2026-07-01T00:00:00+00:00","ends_at":"2026-08-01T00:00:00+00:00"}]},"OrganizationCreditPoolResponse":{"properties":{"organization_id":{"type":"string","title":"Organization Id"},"organization_name":{"type":"string","title":"Organization Name"},"total_pool_credits":{"type":"integer","title":"Total Pool Credits","description":"Unallocated credits in pool"},"user_allocations":{"additionalProperties":{"type":"integer"},"type":"object","title":"User Allocations","description":"Per-user allocated credits"},"total_allocated":{"type":"integer","title":"Total Allocated","description":"Sum of all user allocations"},"welcome_credits":{"type":"integer","title":"Welcome Credits","description":"Credits each new member gets once, when they join; 0 when off"},"credit_allowance":{"anyOf":[{"$ref":"#/components/schemas/CreditAllowanceResponse"},{"type":"null"}],"description":"The organization's credit allowance; null when it is off"}},"type":"object","required":["organization_id","organization_name","total_pool_credits","user_allocations","total_allocated","welcome_credits"],"title":"OrganizationCreditPoolResponse","description":"Response model for organization credit pool status.","examples":[{"organization_id":"org_2fK9xLmQpR3sT","organization_name":"Example University Research Group","total_pool_credits":500,"user_allocations":{"researcher@example.edu":120,"author@example.edu":80},"total_allocated":200,"welcome_credits":5,"credit_allowance":{"amount":2,"max_balance":6,"period":"month","next_allowance_at":"2026-11-01T00:00:00+00:00"}}]},"OrganizationCreditsRequest":{"properties":{"message":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Message","description":"Optional note for the org admins"}},"type":"object","title":"OrganizationCreditsRequest","description":"Request body for a member-initiated credit request.","examples":[{"message":"We are onboarding four new PhD students this term."},{"message":null}]},"OrganizationFeatureInclusion":{"properties":{"included":{"type":"boolean","title":"Included","description":"Whether the organization's plan includes this feature"}},"type":"object","required":["included"],"title":"OrganizationFeatureInclusion","description":"A feature that is not a setting yet: only whether the organization's plan includes it."},"OrganizationIntegerSetting":{"properties":{"value":{"type":"integer","title":"Value","description":"The setting's current value"},"included":{"type":"boolean","title":"Included","description":"Whether the organization's plan includes changing this setting; when false, only Refine staff can"}},"type":"object","required":["value","included"],"title":"OrganizationIntegerSetting","description":"A numeric setting of an organization: what it is now, and whether the organization's plan lets its admins change it."},"OrganizationMembershipResponse":{"properties":{"organization_id":{"type":"string","title":"Organization Id","description":"Clerk organization id. Send it as `X-Refine-Organization` to act for this organization."},"name":{"type":"string","title":"Name"},"slug":{"type":"string","title":"Slug"},"role":{"$ref":"#/components/schemas/OrganizationRole"}},"type":"object","required":["organization_id","name","slug","role"],"title":"OrganizationMembershipResponse","description":"One organization the caller belongs to.","examples":[{"organization_id":"org_2fK9xLmQpR3sT","name":"Example University Research Group","slug":"example-university","role":"member"},{"organization_id":"org_2fK9xLmQpR3sT","name":"Example University Research Group","slug":"example-university","role":"billing_admin"}]},"OrganizationPlanProduct":{"properties":{"tier":{"$ref":"#/components/schemas/PlanTier","description":"The plan: `team` and `department` are the University pair, `small` and `medium` the Enterprise pair"},"monthly":{"anyOf":[{"$ref":"#/components/schemas/OrganizationPrice"},{"type":"null"}],"description":"The plan's fee billed monthly; null when Stripe holds no such price to sell"},"yearly":{"anyOf":[{"$ref":"#/components/schemas/OrganizationPrice"},{"type":"null"}],"description":"The plan's fee billed yearly; null when Stripe holds no such price to sell"},"credit_rate":{"anyOf":[{"$ref":"#/components/schemas/OrganizationPrice"},{"type":"null"}],"description":"What one credit costs an organization on this plan; null when the plan has no rate of its own on sale"}},"type":"object","required":["tier","monthly","yearly","credit_rate"],"title":"OrganizationPlanProduct","description":"A self-serve organization plan: what its access costs each period and the credit rate it unlocks."},"OrganizationPrice":{"properties":{"price_cents":{"type":"integer","title":"Price Cents","description":"The amount in `currency`'s minor unit, before tax"},"currency":{"type":"string","title":"Currency","description":"Lowercase ISO currency code: the visitor's country's currency when the Stripe price holds an amount in it, else the price's own. Stripe's Checkout chooses the same way from the buyer's location"}},"type":"object","required":["price_cents","currency"],"title":"OrganizationPrice","description":"What an organization price charges, before tax, and the currency it is read in."},"OrganizationReviewFindingsResponse":{"properties":{"reviews":{"items":{"$ref":"#/components/schemas/ReviewFindingsResponse"},"type":"array","title":"Reviews","description":"Full reviews tagged in the window, newest first"},"tracking_started_at":{"type":"string","format":"date-time","title":"Tracking Started At","description":"When tagging started. No review before it carries findings"},"starts_at":{"type":"string","format":"date-time","title":"Starts At","description":"Start of the window asked for, inclusive"},"ends_at":{"type":"string","format":"date-time","title":"Ends At","description":"End of the window asked for, exclusive"}},"type":"object","required":["reviews","tracking_started_at","starts_at","ends_at"],"title":"OrganizationReviewFindingsResponse","description":"What an organization's reviews found over a window.","examples":[{"reviews":[{"review_id":"8f1d9c44-2b70-4f0e-9a2f-6d1c53e0b7aa","tagged_at":"2026-10-28T09:18:40+00:00","comment_count":48,"severity_counts":{"critical":1,"major":9,"minor":30,"suggestion":7},"category_counts":{"substance":33,"evidence":6,"presentation":7,"compliance":0,"other":1},"fix_effort_counts":{"edit_in_place":30,"rework":14,"new_work":3},"addressed_counts":{"critical":0,"major":2,"minor":1,"suggestion":0,"unrated":0},"dismissed_counts":{"critical":0,"major":0,"minor":0,"suggestion":1,"unrated":0}}],"tracking_started_at":"2026-10-21T00:00:00+00:00","starts_at":"2026-10-01T00:00:00+00:00","ends_at":"2026-11-01T00:00:00+00:00"}]},"OrganizationRole":{"type":"string","enum":["admin","billing_admin","member"],"title":"OrganizationRole","description":"Roles within an organization."},"OverallFeedbackSchema":{"properties":{"id":{"type":"string","title":"Id","description":"Stable identifier for the overall feedback section"},"content":{"type":"string","title":"Content","description":"Overall feedback summary text"}},"type":"object","required":["id","content"],"title":"OverallFeedbackSchema","description":"Overall feedback with ID. Reasoning is internal and never exposed."},"OwnOrganizationSettingsPatch":{"properties":{"public_sharing_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Public Sharing Enabled","description":"Whether reviews may be shared outside the organization"},"groups_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Groups Enabled","description":"Whether unshared reviews are visible only to their author and the organization's admins; false lets members see each other's reviews"},"session_retention_days":{"anyOf":[{"type":"integer","maximum":3650.0,"minimum":0.0},{"type":"null"}],"title":"Session Retention Days","description":"Days a session is kept before it is deleted; 0 keeps sessions without limit"}},"additionalProperties":false,"type":"object","title":"OwnOrganizationSettingsPatch","description":"Change the settings the organization's plan includes: only the fields sent change, and at least one must be sent.","examples":[{"public_sharing_enabled":false,"groups_enabled":null,"session_retention_days":null},{"public_sharing_enabled":null,"groups_enabled":null,"session_retention_days":365},{"public_sharing_enabled":null,"groups_enabled":true,"session_retention_days":0}]},"OwnOrganizationSettingsResponse":{"properties":{"public_sharing_enabled":{"$ref":"#/components/schemas/OrganizationBooleanSetting","description":"Whether reviews may be shared outside the organization"},"groups_enabled":{"$ref":"#/components/schemas/OrganizationBooleanSetting","description":"Whether unshared reviews are visible only to their author and the organization's admins; false lets members see each other's reviews"},"session_retention_days":{"$ref":"#/components/schemas/OrganizationIntegerSetting","description":"Days a session is kept before it is deleted; 0 keeps sessions without limit"},"verified_domains":{"$ref":"#/components/schemas/OrganizationFeatureInclusion","description":"Whether the plan includes verified domains (domain auto-join); shown only, not yet changeable here"},"enterprise_sso":{"$ref":"#/components/schemas/OrganizationFeatureInclusion","description":"Whether the plan includes enterprise single sign-on; shown only, not yet changeable here"}},"type":"object","required":["public_sharing_enabled","groups_enabled","session_retention_days","verified_domains","enterprise_sso"],"title":"OwnOrganizationSettingsResponse","description":"The settings an organization's admins see in Advanced settings, and which of them their plan lets them change.\n\nOverall feedback is not here: only Refine staff change it.","examples":[{"public_sharing_enabled":{"value":true,"included":false},"groups_enabled":{"value":false,"included":false},"session_retention_days":{"value":0,"included":false},"verified_domains":{"included":false},"enterprise_sso":{"included":false}},{"public_sharing_enabled":{"value":false,"included":true},"groups_enabled":{"value":true,"included":true},"session_retention_days":{"value":365,"included":true},"verified_domains":{"included":true},"enterprise_sso":{"included":true}}]},"PauseSubscriptionResponse":{"properties":{"resumes_at":{"type":"string","format":"date-time","title":"Resumes At","description":"When billing resumes"}},"type":"object","required":["resumes_at"],"title":"PauseSubscriptionResponse","description":"The save offer's pause (#1969): no invoice until ``resumes_at``, one month after the paid period ends.","examples":[{"resumes_at":"2026-09-12T00:00:00+00:00"}]},"PendingChange":{"properties":{"price_id":{"type":"string","title":"Price Id","description":"The price the subscription flips to"},"effective_at":{"type":"string","format":"date-time","title":"Effective At","description":"When it flips: the end of the paid period"},"kind":{"$ref":"#/components/schemas/TransitionKind","description":"Always `switch_at_period_end`","default":"switch_at_period_end"}},"type":"object","required":["price_id","effective_at"],"title":"PendingChange","description":"The one plan change scheduled for the end of the paid period, if any."},"PersonalTier":{"type":"string","enum":["enterprise"],"title":"PersonalTier","description":"A tier sold to one person by a B2C subscription product's ``personal_tier`` metadata, not by an organization.\n\nThe Enterprise tier sells access and a credit discount, not monthly credits.\nA credits plan (Starter, Professional, Advanced) sells no tier: its\nsubscription's ``personal_tier`` is None."},"PlanChangePreviewResponse":{"properties":{"kind":{"$ref":"#/components/schemas/TransitionKind"},"amount_due_today":{"type":"integer","title":"Amount Due Today","description":"Minor units due today: the new period minus unused time for an upgrade; 0 for a switch"},"currency":{"type":"string","title":"Currency","description":"Lowercase ISO currency the subscription bills, which every amount here is in"},"effective_at":{"type":"string","format":"date-time","title":"Effective At"},"next_renewal_amount":{"type":"integer","title":"Next Renewal Amount","description":"Minor units of the target plan's fee at the next renewal, in `currency`"},"next_renewal_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Next Renewal At","description":"When the next renewal bills; null when Stripe's preview does not say"}},"type":"object","required":["kind","amount_due_today","currency","effective_at","next_renewal_amount"],"title":"PlanChangePreviewResponse","description":"What the subscriber sees before confirming: the amount due today, the effective date and the next renewal (#1964).","examples":[{"kind":"upgrade_now","amount_due_today":2000,"currency":"usd","effective_at":"2026-08-01T14:32:09+00:00","next_renewal_amount":2999,"next_renewal_at":"2026-09-01T14:32:09+00:00"},{"kind":"switch_at_period_end","amount_due_today":0,"currency":"usd","effective_at":"2026-08-12T00:00:00+00:00","next_renewal_amount":999,"next_renewal_at":"2026-08-12T00:00:00+00:00"}]},"PlanChangeResponse":{"properties":{"kind":{"$ref":"#/components/schemas/TransitionKind"},"effective_at":{"type":"string","format":"date-time","title":"Effective At","description":"Now for an upgrade; the end of the paid period for a switch"},"amount_due_today":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Amount Due Today","description":"Minor units invoiced today for an upgrade (paid, or awaiting a card retry); null for a switch"},"currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Currency","description":"Lowercase ISO currency of `amount_due_today`"},"invoice_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Id","description":"The invoice an upgrade issued; null for a switch"},"paid":{"type":"boolean","title":"Paid","description":"False when an upgrade's invoice was not paid: the card was declined, or the payment awaits the customer's authentication (3DS). The plan did not change and the invoice stays open; asking for the same change again, after updating the card, pays it. True for a paid upgrade and for a switch, which charges nothing today"}},"type":"object","required":["kind","effective_at","paid"],"title":"PlanChangeResponse","description":"What the change did: an upgrade invoiced today, or a switch scheduled for `effective_at`.","examples":[{"kind":"upgrade_now","effective_at":"2026-08-01T14:32:09+00:00","amount_due_today":2000,"currency":"usd","invoice_id":"in_1QeXample","paid":true},{"kind":"upgrade_now","effective_at":"2026-08-01T14:32:09+00:00","amount_due_today":2000,"currency":"usd","invoice_id":"in_1QeXample","paid":false},{"kind":"switch_at_period_end","effective_at":"2026-08-12T00:00:00+00:00","amount_due_today":null,"currency":null,"invoice_id":null,"paid":true}]},"PlanFamily":{"type":"string","enum":["b2c","b2b"],"title":"PlanFamily","description":"Which catalogue a plan belongs to (the product's ``family`` metadata): the credit plans are ``b2c``; Individual, Team, Small, Department and Medium are ``b2b`` (#1963 P1)."},"PlanTier":{"type":"string","enum":["team","department","small","medium"],"title":"PlanTier","description":"A self-serve organization plan: its access prices, on the tier's own plan product, and the credit rate it unlocks, on the standard product.\n\nTwo families (D1, D2 on #1931): ``team`` and ``department`` are the University\npair, ``small`` and ``medium`` the Enterprise pair."},"Problem":{"properties":{"type":{"type":"string","title":"Type","description":"Stable slug identifying the error kind","enum":["admin-access-required","admin-user-email-not-found","admin-user-not-found","allocation-target-not-a-member","anonymous-read-rate-limited","api-key-scope","authenticated-user-not-found","authentication-configuration","authentication-failed","cancellation-not-pending","chat-daily-limit-reached","chat-generation-failed","chat-message-too-long","checkout-session-not-found","clerk-identity-conflict","comment-action-not-stored","comment-not-actionable","credit-adjustment-rejected","credit-allocation-failed","discussion-invite-outside-organization","discussion-invite-requires-sharing","discussion-note-missing","discussion-note-not-yours","discussion-share-not-owner","document-conversion","document-not-accessible","document-not-found","document-text-not-ready","document-token-limit","document-word-limit","empty-bulk-import","expired-token","flag-overrides-forbidden","general-access-unavailable","identity-provider-unavailable","image-not-found","incomplete-token","invalid-api-key","invalid-comment-action-type","invalid-flag-override","invalid-image-request","invalid-offer-quantity","invalid-terms-edit","invalid-uploaded-file","invalid-webhook-signature","malformed-document-id","malformed-referral-code","malformed-token","malformed-webhook-payload","marketing-state-unavailable","member-cap-follows-plan","mentioned-user-not-participant","missing-credentials","missing-filename","missing-identifier","missing-webhook-signature","negotiated-pricing","nested-supplementary-material","no-billing-history","no-credit-change-requested","no-credits","no-organization-credits","no-pending-plan-change","no-subscription","offer-not-available","openai-apps-challenge-not-configured","organization-credits-unavailable","organization-deletion-failed","organization-frozen","organization-intent-in-progress","organization-intent-not-found","organization-limit","organization-member-cap-not-set","organization-membership-required","organization-missing","organization-not-empty","organization-permission","organization-plan-cancellation-failed","organization-plan-changed","organization-pool-exhausted","organization-settings-not-saved","organization-settings-unavailable","organization-slug-missing","original-upload-storage","own-referral-code","parent-document-not-found","parent-document-not-owned","payment-system","pdf-service-unavailable","plan-already-active","plan-change-pending-exists","plan-change-refused-currency","plan-change-refused-custom","plan-change-refused-unpaid","plan-change-same-plan","plan-price-not-convertible","plan-switch-across-tiers","plan-unavailable","portal-unavailable","premature-token","processing-dispatch","processing-failed","processing-job-missing","processing-job-not-created","redirect-origin-mismatch","redirect-origin-required","referral-code-not-found","reprocess-refused","reprocess-user-missing","revision-session-not-accessible","session-already-accessible","session-missing","session-not-accessible","session-sharing-restricted","setting-not-included","short-document-text","slug-invalid","slug-taken","stream-connection","stream-not-yours","subscription-already-paused","subscription-pause-refused","subscription-terms-changed","supplementary-material-limit-reached","supplementary-material-not-ready","terms-need-live-subscription","unexpected-failure","unknown-discussion-comment","unknown-price","unknown-principal","unknown-prompt-set","unknown-steering-target","upgrade-buys-no-more-credits","upload-bundle-changed","validation-error","webhook-entity-creation","webhook-entity-not-found","webhook-payload-invalid","webhook-verification"]},"title":{"type":"string","title":"Title","description":"Stable human-readable summary; does not vary per occurrence"},"status":{"type":"integer","title":"Status","description":"HTTP status code"}},"additionalProperties":true,"type":"object","required":["type","title","status"],"title":"Problem","description":"RFC 9457 problem document. Additional members are error-specific.\n\nDeclared here rather than in ``errors.py`` so the examples gate in\n``tests/unit/infrastructure/api/test_openapi_examples.py`` discovers it and\nholds it to the same standard as every other API model.\n\nThe component name FastAPI publishes comes from ``__qualname__``, baked in at\nclass creation, so it can only be the class's real name -- hence ``Problem``."},"ProcessDocumentRequest":{"properties":{"preview":{"type":"boolean","title":"Preview","description":"Credit type to use. Set to false (default) for full proofreading (1 paid credit), or true for limited preview feedback (1 preview credit).","default":false},"previous_review_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Previous Review Id","description":"Optional UUID of a prior review this submission is a resubmission of. Must be a review the caller can access (own, public, or same-org per the access policy). When provided, the new review's comment refiner and overall-feedback second pass receive the prior review's comments and overall feedback as additional prompt context."},"steering_prompt":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Steering Prompt","description":"Do not set this unless the user has explicitly asked to steer the review. Leave it null by default. Never fill it on your own initiative or with focus areas you inferred from the document, the user's field, or the conversation. When the user does ask, pass their instruction in their own words. Advisory only: it never overrides document classification or the review rubric. Applies to the whole run, is persisted on the session, shown in history, and carried into revision re-runs. Capped at 2000 characters. Whitespace-only is treated as empty."},"supplementary_material_steering":{"anyOf":[{"additionalProperties":{"type":"string","maxLength":2000},"propertyNames":{"format":"uuid"},"type":"object"},{"type":"null"}],"title":"Supplementary Material Steering","description":"Relationship notes for supplementary material, keyed by supplementary material document ID (each must be supplementary material of this document). Each note says only what the item is and how it relates to the main document, e.g. {\"<supplementary material-id>\": \"Online appendix with the proofs of Propositions 2-4\"}. A note must never steer the review: no instructions on what to focus on, check, verify, ignore, or how to assess the paper. Write the relationship only. Provided keys are persisted on the supplementary material (empty/whitespace clears the stored note); omitted keys keep their stored note, which still applies to this run. Notes are returned by GET /documents/{id}/supplementary material. Each note is capped at 2000 characters."}},"additionalProperties":false,"type":"object","title":"ProcessDocumentRequest","description":"Request to start proofreading analysis on an uploaded document.\n\nConsumes 1 credit. The document must be fully converted before calling this — wait\nfor the upload SSE complete event at /documents/upload/events/{task_id}.","examples":[{"preview":false,"previous_review_id":null,"steering_prompt":null,"supplementary_material_steering":null},{"preview":true,"previous_review_id":null,"steering_prompt":null,"supplementary_material_steering":null},{"preview":false,"previous_review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf","steering_prompt":"Focus on the statistics in section 4.","supplementary_material_steering":null}]},"ProcessDocumentResponse":{"properties":{"review_id":{"type":"string","title":"Review Id","description":"UUID of the review"},"events_endpoint":{"type":"string","title":"Events Endpoint","description":"SSE endpoint for progress updates"}},"type":"object","required":["review_id","events_endpoint"],"title":"ProcessDocumentResponse","description":"Response from starting document processing.","examples":[{"review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf","events_endpoint":"/documents/3eef6ca5-9388-45b4-92a8-c144347ad6ec/process/events/7ab7324d-0968-40ac-9a0d-68fe4fbf11bf"}]},"ProcessingItem":{"properties":{"review_id":{"type":"string","title":"Review Id","description":"Review UUID; also the identifier for SSE reconnection"},"document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Id","description":"Associated document UUID"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title","description":"Document title"},"progress_percentage":{"type":"integer","title":"Progress Percentage","description":"Progress percentage (0-100)"},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"When processing started"}},"type":"object","required":["review_id","document_id","title","progress_percentage","created_at"],"title":"ProcessingItem","description":"An active processing task."},"ProcessingStatusResponse":{"properties":{"processing":{"items":{"$ref":"#/components/schemas/ProcessingItem"},"type":"array","title":"Processing","description":"Active processing tasks"},"unviewed_completed":{"anyOf":[{"$ref":"#/components/schemas/UnviewedCompletedItem"},{"type":"null"}],"description":"Most recent unviewed completed item"}},"type":"object","title":"ProcessingStatusResponse","description":"Response for GET /processing endpoint.","examples":[{"processing":[],"unviewed_completed":null},{"processing":[{"review_id":"c9b1f6d2-4a83-4f21-9c07-2e5b8a1d3f40","document_id":"3eef6ca5-9388-45b4-92a8-c144347ad6ec","title":"Targeting Interventions in Networks","progress_percentage":45,"created_at":"2026-07-24T12:45:39.418365+00:00"}],"unviewed_completed":null},{"processing":[],"unviewed_completed":{"review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf","document_id":"3eef6ca5-9388-45b4-92a8-c144347ad6ec","title":"Targeting Interventions in Networks","created_at":"2026-07-24T12:45:39.418365+00:00"}}]},"ProductsResponse":{"properties":{"credit_packs":{"items":{"$ref":"#/components/schemas/CreditPackProduct"},"type":"array","title":"Credit Packs"},"subscriptions":{"items":{"$ref":"#/components/schemas/SubscriptionProduct"},"type":"array","title":"Subscriptions"},"organization_plans":{"items":{"$ref":"#/components/schemas/OrganizationPlanProduct"},"type":"array","title":"Organization Plans","description":"The self-serve organization plans with a fee on sale, in tier order (team, department, small, medium); a tier without one is left out. Amounts are before tax"},"organization_credit_rate":{"anyOf":[{"$ref":"#/components/schemas/OrganizationPrice"},{"type":"null"}],"description":"What one credit costs an organization without a plan, before tax: the standard rate the plans' rates are compared with; null when not on sale"}},"type":"object","required":["credit_packs","subscriptions"],"title":"ProductsResponse","description":"Response containing all available products, ordered by price (ascending).","examples":[{"credit_packs":[{"price_id":"price_1QeXamplePack","name":"10 credits","credits":10,"price_cents":4900,"currency":"eur","subscriber_price_cents":3900,"tax_included":true,"tax_amount_cents":850,"total_cents":4900,"subscriber_total_cents":3900,"subscriber_prices_cents":{"enterprise":1000}},{"price_id":"price_1QeXampleSingle","name":"1 credit","credits":1,"price_cents":900,"currency":"eur","subscriber_price_cents":null,"tax_included":true,"tax_amount_cents":156,"total_cents":900,"subscriber_total_cents":null,"subscriber_prices_cents":{}}],"subscriptions":[{"price_id":"price_1QeXampleMonthly","name":"Refine Monthly","credits":20,"price_cents":2900,"currency":"eur","interval":"month","tax_included":true,"tax_amount_cents":503,"total_cents":2900,"personal_tier":null,"family":"b2c","tier_rank":20},{"price_id":"price_1QeXampleEnterprise","name":"Refine Enterprise","credits":0,"price_cents":10000,"currency":"usd","interval":"month","tax_included":false,"tax_amount_cents":0,"total_cents":10000,"personal_tier":"enterprise","family":"b2b","tier_rank":40}],"organization_plans":[{"tier":"team","monthly":{"price_cents":10000,"currency":"eur"},"yearly":{"price_cents":110000,"currency":"eur"},"credit_rate":{"price_cents":3900,"currency":"eur"}}],"organization_credit_rate":{"price_cents":4999,"currency":"eur"}}]},"QuotaStatus":{"properties":{"used_fraction":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Used Fraction","description":"Fraction of the daily budget consumed (0.0–1.0, clipped). Frontend renders as a progress bar or percentage."},"resets_at":{"type":"string","format":"date-time","title":"Resets At","description":"When the counter rolls over (UTC, ISO 8601). Literal Redis TTL expiry — the moment the user's budget is wiped."}},"type":"object","required":["used_fraction","resets_at"],"title":"QuotaStatus","description":"Live snapshot of the chatbot daily quota for the requesting user."},"ReferralStatusResponse":{"properties":{"own_referral_code":{"type":"string","title":"Own Referral Code","description":"The caller's own referral code, to hand out as `?ref=<code>`. Minted by the server on the first read and stable afterwards; it does not change when the caller's email does."},"has_referral":{"type":"boolean","title":"Has Referral","description":"Whether the user has been referred by someone"},"referrer_email":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}],"title":"Referrer Email","description":"Email of the user who referred this user"},"referral_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Referral Code","description":"Referral code that was used"},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At","description":"When the referral was registered (ISO datetime with UTC timezone)"},"first_payment_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"First Payment At","description":"When the referred user made their first payment (ISO datetime with UTC timezone)"},"rewards_issued_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Rewards Issued At","description":"When rewards were issued to both users (ISO datetime with UTC timezone)"}},"type":"object","required":["own_referral_code","has_referral"],"title":"ReferralStatusResponse","description":"Response schema for checking if user has a referral.","examples":[{"own_referral_code":"q7Yt3wPzR2kLm9Xa","has_referral":false,"referrer_email":null,"referral_code":null,"created_at":null,"first_payment_at":null,"rewards_issued_at":null},{"own_referral_code":"q7Yt3wPzR2kLm9Xa","has_referral":true,"referrer_email":"referrer@example.edu","referral_code":"REFINE-7K2QX","created_at":"2026-07-12T14:02:00+00:00","first_payment_at":null,"rewards_issued_at":null},{"own_referral_code":"q7Yt3wPzR2kLm9Xa","has_referral":true,"referrer_email":"referrer@example.edu","referral_code":"REFINE-7K2QX","created_at":"2026-07-12T14:02:00+00:00","first_payment_at":"2026-07-18T09:41:00+00:00","rewards_issued_at":"2026-07-18T09:41:30+00:00"}]},"RegisterReferralRequest":{"properties":{"referral_code":{"type":"string","minLength":1,"title":"Referral Code","description":"Referral code from the referrer"}},"type":"object","required":["referral_code"],"title":"RegisterReferralRequest","description":"Request schema for registering a referral.","examples":[{"referral_code":"REFINE-7K2QX"}]},"RegisterReferralResponse":{"properties":{"referrer_email":{"type":"string","format":"email","title":"Referrer Email","description":"Email of the user who referred you"}},"type":"object","required":["referrer_email"],"title":"RegisterReferralResponse","description":"Response schema for registering a referral.","examples":[{"referrer_email":"referrer@example.edu"}]},"ReviewAccessRequest":{"properties":{"message":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Message","description":"Optional message to include with the request"}},"type":"object","title":"ReviewAccessRequest","description":"Request body for requesting access to a private review.","examples":[{"message":"I am a co-author on this manuscript and would like to see the review."},{"message":null}]},"ReviewAccessRequestResponse":{"properties":{"review_id":{"type":"string","title":"Review Id","description":"The review ID for which access was requested"}},"type":"object","required":["review_id"],"title":"ReviewAccessRequestResponse","description":"Response for access request action.","examples":[{"review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf"}]},"ReviewFindingsResponse":{"properties":{"review_id":{"type":"string","title":"Review Id","description":"UUID of the review"},"tagged_at":{"type":"string","format":"date-time","title":"Tagged At","description":"When the review's comments were last tagged, a few minutes after its credit spend"},"comment_count":{"type":"integer","title":"Comment Count","description":"Comments the review has, as its owner sees them"},"severity_counts":{"$ref":"#/components/schemas/SeverityCountsResponse","description":"Comments per severity. May sum to less than `comment_count`: the rest were not rated"},"category_counts":{"$ref":"#/components/schemas/CategoryCountsResponse","description":"Comments per category"},"fix_effort_counts":{"$ref":"#/components/schemas/FixEffortCountsResponse","description":"Comments per fix effort"},"addressed_counts":{"$ref":"#/components/schemas/MarkedCommentCountsResponse","description":"Comments currently marked addressed, whenever they were marked"},"dismissed_counts":{"$ref":"#/components/schemas/MarkedCommentCountsResponse","description":"Comments currently marked dismissed, whenever they were marked"}},"type":"object","required":["review_id","tagged_at","comment_count","severity_counts","category_counts","fix_effort_counts","addressed_counts","dismissed_counts"],"title":"ReviewFindingsResponse","description":"What one tagged full review found."},"ReviewListItem":{"properties":{"review_id":{"type":"string","title":"Review Id","description":"UUID of the review"},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"When the record was created"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title","description":"Document title from metadata"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary","description":"Document summary from metadata"},"domain":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Domain","description":"Domain classification"},"taxonomy":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Taxonomy","description":"Taxonomy classification"},"document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Id","description":"UUID of uploaded document if any"},"original_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Original Url","description":"URL to original document"},"content_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content Url","description":"URL to processed content"},"comments_count":{"type":"integer","title":"Comments Count","description":"Total number of comments"},"addressed_count":{"type":"integer","title":"Addressed Count","description":"Number of addressed comments"},"dismissed_count":{"type":"integer","title":"Dismissed Count","description":"Number of dismissed comments"},"is_preview":{"type":"boolean","title":"Is Preview","description":"Whether processed in preview mode"},"general_access":{"$ref":"#/components/schemas/GeneralAccess","description":"How far the owner has opened the review: restricted, organization, signed_in (anyone signed in with the link) or anyone (no account needed)"},"viewed":{"type":"boolean","title":"Viewed","description":"Whether the user has viewed this record"}},"type":"object","required":["review_id","created_at","title","summary","domain","taxonomy","comments_count","addressed_count","dismissed_count","is_preview","general_access","viewed"],"title":"ReviewListItem","description":"A single review in the list.","examples":[{"review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf","created_at":"2026-07-24T12:45:39.418365+00:00","title":"Targeting Interventions in Networks","summary":"Studies how a planner optimally targets interventions in a network game with strategic spillovers, decomposing interventions into principal components.","domain":"social_sciences/economics","taxonomy":"academic/research_paper","document_id":"3eef6ca5-9388-45b4-92a8-c144347ad6ec","original_url":"/documents/3eef6ca5-9388-45b4-92a8-c144347ad6ec/original","content_url":"/documents/3eef6ca5-9388-45b4-92a8-c144347ad6ec/content","comments_count":19,"addressed_count":2,"dismissed_count":1,"is_preview":false,"general_access":"restricted","viewed":true},{"review_id":"e681ed2d-b844-48d4-81d7-8d499813c157","created_at":"2026-07-24T12:45:39.418365+00:00","title":null,"summary":null,"domain":null,"taxonomy":null,"document_id":"ff12d34a-ba00-4943-b25e-c23f92e68295","original_url":"/documents/ff12d34a-ba00-4943-b25e-c23f92e68295/original","content_url":"/documents/ff12d34a-ba00-4943-b25e-c23f92e68295/content","comments_count":0,"addressed_count":0,"dismissed_count":0,"is_preview":false,"general_access":"restricted","viewed":true}]},"ReviewResponse":{"properties":{"review_id":{"type":"string","title":"Review Id","description":"UUID of the review; also the identifier for SSE reconnection"},"previous_review_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Previous Review Id","description":"UUID of the prior review this run is a revision of; null when it is not a resubmission"},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"When the record was created"},"completed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Completed At","description":"When processing completed"},"user_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Email","description":"Email of the review's owner; null for a viewer with no account"},"feedback":{"$ref":"#/components/schemas/FeedbackResponse","description":"Feedback data"},"progress_percentage":{"type":"integer","title":"Progress Percentage","description":"Progress percentage (0-100)"},"processing_status":{"type":"string","title":"Processing Status","description":"Processing status string"},"is_processing":{"type":"boolean","title":"Is Processing","description":"Whether processing is in progress"},"is_preview":{"type":"boolean","title":"Is Preview","description":"Whether processed in preview mode"},"comment_actions":{"items":{"$ref":"#/components/schemas/CommentActionItem"},"type":"array","title":"Comment Actions","description":"List of comment actions"},"comment_action_summary":{"additionalProperties":{"additionalProperties":{"type":"boolean"},"type":"object"},"type":"object","title":"Comment Action Summary","description":"Summary of actions per comment ID"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title","description":"Document title from metadata"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary","description":"Document summary from metadata"},"domain":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Domain","description":"Domain classification"},"taxonomy":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Taxonomy","description":"Taxonomy classification"},"steering_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Steering Prompt","description":"The user-provided steering prompt attached at submission, if any."},"document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Id","description":"UUID of uploaded document if any"},"original_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Original Url","description":"URL to original document"},"content_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content Url","description":"URL to processed content"},"filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Filename","description":"Original filename of uploaded document"},"general_access":{"$ref":"#/components/schemas/GeneralAccess","description":"How far the owner has opened the review: restricted, organization, signed_in (anyone signed in with the link) or anyone (no account needed)"},"general_access_options":{"items":{"$ref":"#/components/schemas/GeneralAccess"},"type":"array","title":"General Access Options","description":"The levels the owner may pick for this review, narrowest first; empty for anyone but the owner"},"restricted_reaches_organization":{"type":"boolean","title":"Restricted Reaches Organization","description":"For the owner: whether restricted still lets the owning organization see the review, because it does not restrict what members see of each other","default":false},"is_owner":{"type":"boolean","title":"Is Owner","description":"Whether the current user owns this review"},"discussions_enabled":{"type":"boolean","title":"Discussions Enabled","description":"Whether the review's owner has discussions (the review-discussions flag), deciding whether clients show Discuss on it. Chat and the discussion endpoints serve every review regardless"},"viewed":{"type":"boolean","title":"Viewed","description":"Whether the user has viewed this record"},"revision_check":{"anyOf":[{"$ref":"#/components/schemas/RevisionCheckResponse"},{"type":"null"}],"description":"Per-comment verdicts when this review is a resubmission and the revision-check pipeline produced verdicts. Null otherwise."}},"type":"object","required":["review_id","created_at","completed_at","user_email","feedback","progress_percentage","processing_status","is_processing","is_preview","comment_actions","comment_action_summary","title","summary","domain","taxonomy","general_access","is_owner","discussions_enabled","viewed"],"title":"ReviewResponse","description":"Full review response.","examples":[{"review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf","previous_review_id":null,"created_at":"2026-07-24T12:45:39.418365+00:00","completed_at":"2026-07-24T12:59:06.387687+00:00","user_email":"author@example.edu","feedback":{"overall":{"id":"overall-feedback","content":"**Scope of the benchmark assumptions**\n\nThe abstract frames the analysis more broadly than the core results support: the headline claims rely on the quadratic cost specification. Delimiting which claims belong to that benchmark would help the reader place the contribution."},"detailed":{"comments":[{"id":"1792a726-5a83-4d20-ad59-0cf0f72c7faf","title":"Large-budget claim is stated more strongly than shown","paragraph":"The intervention raises welfare for large budgets, which follows directly from the spectral decomposition of the network.","message":"The one-principal-component limit holds for the complements case, not for every environment. Qualify the claim, or state the condition it depends on.","quote":"The intervention raises welfare for large budgets, which follows directly from the spectral decomposition of the network.","score":0.34,"is_dismissed":false,"is_addressed":false,"types":["general"],"severity":"major","kind":"substance/reasoning","fix_effort":"edit_in_place"},{"id":"broad-2","title":"Citation does not support the attributed result","paragraph":"As shown by Kingma and Ba (2015), adaptive methods converge on convex objectives.","message":"The cited work introduces the optimiser but does not prove this convergence result. Attribute the claim to its actual source or soften it.","quote":"As shown by Kingma and Ba (2015), adaptive methods converge on convex objectives.","score":0.71,"is_dismissed":false,"is_addressed":false,"types":["external_references"],"severity":"minor","kind":"evidence/citation","fix_effort":"edit_in_place"}],"comments_count":2}},"progress_percentage":100,"processing_status":"completed","is_processing":false,"is_preview":false,"comment_actions":[],"comment_action_summary":{},"title":"Targeting Interventions in Networks","summary":"Studies how a planner optimally targets interventions in a network game with strategic spillovers.","domain":"social_sciences/economics","taxonomy":"academic/research_paper","steering_prompt":null,"document_id":"3eef6ca5-9388-45b4-92a8-c144347ad6ec","original_url":"/documents/3eef6ca5-9388-45b4-92a8-c144347ad6ec/original","content_url":"/documents/3eef6ca5-9388-45b4-92a8-c144347ad6ec/content","filename":"manuscript.pdf","general_access":"restricted","general_access_options":[],"restricted_reaches_organization":false,"is_owner":true,"discussions_enabled":false,"viewed":true,"revision_check":null},{"review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf","previous_review_id":null,"created_at":"2026-07-24T12:45:39.418365+00:00","completed_at":"2026-07-24T12:59:06.387687+00:00","user_email":"author@example.edu","feedback":{"overall":{"id":"overall-feedback","content":"**Scope of the benchmark assumptions**\n\nThe abstract frames the analysis more broadly than the core results support: the headline claims rely on the quadratic cost specification. Delimiting which claims belong to that benchmark would help the reader place the contribution."},"detailed":{"comments":[{"id":"1792a726-5a83-4d20-ad59-0cf0f72c7faf","title":"Large-budget claim is stated more strongly than shown","paragraph":"The intervention raises welfare for large budgets, which follows directly from the spectral decomposition of the network.","message":"The one-principal-component limit holds for the complements case, not for every environment. Qualify the claim, or state the condition it depends on.","quote":"The intervention raises welfare for large budgets, which follows directly from the spectral decomposition of the network.","score":0.34,"is_dismissed":false,"is_addressed":false,"types":["general"],"severity":"major","kind":"substance/reasoning","fix_effort":"edit_in_place"},{"id":"broad-2","title":"Citation does not support the attributed result","paragraph":"As shown by Kingma and Ba (2015), adaptive methods converge on convex objectives.","message":"The cited work introduces the optimiser but does not prove this convergence result. Attribute the claim to its actual source or soften it.","quote":"As shown by Kingma and Ba (2015), adaptive methods converge on convex objectives.","score":0.71,"is_dismissed":false,"is_addressed":false,"types":["external_references"],"severity":"minor","kind":"evidence/citation","fix_effort":"edit_in_place"}],"comments_count":2}},"progress_percentage":100,"processing_status":"completed","is_processing":false,"is_preview":true,"comment_actions":[],"comment_action_summary":{},"title":"Targeting Interventions in Networks","summary":"Studies how a planner optimally targets interventions in a network game with strategic spillovers.","domain":"social_sciences/economics","taxonomy":"academic/research_paper","steering_prompt":null,"document_id":"3eef6ca5-9388-45b4-92a8-c144347ad6ec","original_url":"/documents/3eef6ca5-9388-45b4-92a8-c144347ad6ec/original","content_url":"/documents/3eef6ca5-9388-45b4-92a8-c144347ad6ec/content","filename":"manuscript.pdf","general_access":"restricted","general_access_options":[],"restricted_reaches_organization":false,"is_owner":true,"discussions_enabled":false,"viewed":false,"revision_check":null},{"review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf","previous_review_id":null,"created_at":"2026-07-24T12:45:39.418365+00:00","completed_at":null,"user_email":"author@example.edu","feedback":{"overall":{"id":"overall-feedback","content":""},"detailed":{"comments":[],"comments_count":0}},"progress_percentage":45,"processing_status":"processing","is_processing":true,"is_preview":false,"comment_actions":[],"comment_action_summary":{},"title":null,"summary":null,"domain":null,"taxonomy":null,"steering_prompt":null,"document_id":"3eef6ca5-9388-45b4-92a8-c144347ad6ec","original_url":"/documents/3eef6ca5-9388-45b4-92a8-c144347ad6ec/original","content_url":"/documents/3eef6ca5-9388-45b4-92a8-c144347ad6ec/content","filename":"manuscript.pdf","general_access":"restricted","general_access_options":[],"restricted_reaches_organization":false,"is_owner":true,"discussions_enabled":false,"viewed":false,"revision_check":null}]},"RevisionCheckResponse":{"properties":{"verdicts":{"items":{"$ref":"#/components/schemas/VerdictSchema"},"type":"array","title":"Verdicts","description":"Per-prior-comment verdicts"},"overall_verdict":{"anyOf":[{"$ref":"#/components/schemas/VerdictSchema"},{"type":"null"}],"description":"Single overall-feedback verdict, or null when unavailable"},"counts":{"$ref":"#/components/schemas/VerdictCounts","description":"Per-status counts"}},"type":"object","required":["counts"],"title":"RevisionCheckResponse","description":"Per-comment + overall verdicts for a resubmission review.\n\nReturned as ``null`` on the parent ``ReviewResponse`` when the\nreview is not a resubmission or the secondary pipeline degraded."},"Severity":{"type":"string","enum":["critical","major","minor","suggestion"],"title":"Severity"},"SeverityCountsResponse":{"properties":{"critical":{"type":"integer","title":"Critical","description":"Comments rated critical"},"major":{"type":"integer","title":"Major","description":"Comments rated major"},"minor":{"type":"integer","title":"Minor","description":"Comments rated minor"},"suggestion":{"type":"integer","title":"Suggestion","description":"Comments rated a suggestion"}},"type":"object","required":["critical","major","minor","suggestion"],"title":"SeverityCountsResponse","description":"Comments per severity."},"SubscriptionProduct":{"properties":{"price_id":{"type":"string","title":"Price Id"},"name":{"type":"string","title":"Name"},"credits":{"type":"integer","title":"Credits"},"price_cents":{"type":"integer","title":"Price Cents"},"currency":{"type":"string","title":"Currency"},"interval":{"type":"string","title":"Interval"},"tax_included":{"type":"boolean","title":"Tax Included","default":false},"tax_amount_cents":{"type":"integer","title":"Tax Amount Cents","default":0},"total_cents":{"type":"integer","title":"Total Cents","default":0},"personal_tier":{"anyOf":[{"$ref":"#/components/schemas/PersonalTier"},{"type":"null"}],"description":"The personal tier the subscription sells (`enterprise`: access and a credit discount, no monthly credits); null for a credits plan"},"family":{"anyOf":[{"$ref":"#/components/schemas/PlanFamily"},{"type":"null"}],"description":"The plan's family (`b2c`: credit plans; `b2b`: the personal Enterprise tier); null until the product carries it"},"tier_rank":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tier Rank","description":"Display order of the plan within its family, lowest first; never a direction"}},"type":"object","required":["price_id","name","credits","price_cents","currency","interval"],"title":"SubscriptionProduct","description":"Recurring subscription product."},"SubscriptionStatusResponse":{"properties":{"has_active_subscription":{"type":"boolean","title":"Has Active Subscription","description":"Whether user has an active subscription"},"subscription_tier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subscription Tier","description":"Current subscription plan name"},"subscription_credits_remaining":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Subscription Credits Remaining","description":"Credits granted by each monthly renewal; this is not a remaining balance"},"next_credit_renewal_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Next Credit Renewal At","description":"When credits will be renewed"},"stripe_subscription_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Subscription Id","description":"Stripe subscription ID"},"cancel_at_period_end":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Cancel At Period End","description":"Whether subscription will cancel at period end"},"current_period_ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Current Period Ends At","description":"End of the current billing period"},"stripe_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Customer Id","description":"Stripe customer ID (null if user has never paid)"},"personal_tier":{"anyOf":[{"$ref":"#/components/schemas/PersonalTier"},{"type":"null"}],"description":"The personal tier the user's live personal-tier subscription sells (`enterprise`): the one whose limits and pack prices apply, also while trialing or past due, even beside a newer credits plan; null without one"},"allowed_actions":{"items":{"$ref":"#/components/schemas/AllowedAction"},"type":"array","title":"Allowed Actions","description":"The plan changes the policy allows from the current plan (#1963): render these, never rank plans client-side. Empty without a subscription or while the renewal is unpaid."},"pending_change":{"anyOf":[{"$ref":"#/components/schemas/PendingChange"},{"type":"null"}],"description":"The one change scheduled for the end of the paid period; null when none"},"pause_resumes_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Pause Resumes At","description":"When billing resumes after the save offer's pause (#1969); null when not paused"}},"type":"object","required":["has_active_subscription"],"title":"SubscriptionStatusResponse","description":"Response schema for subscription status endpoint.","examples":[{"has_active_subscription":true,"subscription_tier":"monthly","subscription_credits_remaining":14,"next_credit_renewal_at":"2026-08-12T00:00:00+00:00","stripe_subscription_id":"sub_1QeXampleActive","cancel_at_period_end":false,"current_period_ends_at":"2026-08-12T00:00:00+00:00","stripe_customer_id":"cus_QeXample123","personal_tier":null,"allowed_actions":[{"price_id":"price_1QeXampleAdvanced","kind":"upgrade_now","label":"Upgrade now"},{"price_id":"price_1QeXampleStarter","kind":"switch_at_period_end","label":"Switch at period end"}],"pending_change":null,"pause_resumes_at":null},{"has_active_subscription":true,"subscription_tier":"monthly","subscription_credits_remaining":14,"next_credit_renewal_at":"2026-08-12T00:00:00+00:00","stripe_subscription_id":"sub_1QeXampleActive","cancel_at_period_end":false,"current_period_ends_at":"2026-08-12T00:00:00+00:00","stripe_customer_id":"cus_QeXample123","personal_tier":null,"allowed_actions":[],"pending_change":{"price_id":"price_1QeXampleStarter","effective_at":"2026-08-12T00:00:00+00:00","kind":"switch_at_period_end"},"pause_resumes_at":null},{"has_active_subscription":true,"subscription_tier":"monthly","subscription_credits_remaining":6,"next_credit_renewal_at":null,"stripe_subscription_id":"sub_1QeXampleActive","cancel_at_period_end":true,"current_period_ends_at":"2026-08-12T00:00:00+00:00","stripe_customer_id":"cus_QeXample123","personal_tier":null,"allowed_actions":[],"pending_change":null,"pause_resumes_at":null},{"has_active_subscription":true,"subscription_tier":"monthly","subscription_credits_remaining":14,"next_credit_renewal_at":"2026-08-12T00:00:00+00:00","stripe_subscription_id":"sub_1QeXampleActive","cancel_at_period_end":false,"current_period_ends_at":"2026-08-12T00:00:00+00:00","stripe_customer_id":"cus_QeXample123","personal_tier":null,"allowed_actions":[],"pending_change":null,"pause_resumes_at":"2026-09-12T00:00:00+00:00"},{"has_active_subscription":false,"subscription_tier":null,"subscription_credits_remaining":null,"next_credit_renewal_at":null,"stripe_subscription_id":null,"cancel_at_period_end":null,"current_period_ends_at":null,"stripe_customer_id":null,"personal_tier":null,"allowed_actions":[],"pending_change":null,"pause_resumes_at":null}]},"SupplementaryMaterialResponse":{"properties":{"document_id":{"type":"string","title":"Document Id","description":"UUID of the supplementary material document"},"filename":{"type":"string","title":"Filename","description":"Original filename"},"display_order":{"type":"integer","title":"Display Order","description":"Ordering position among supplementary material"},"steering_note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Steering Note","description":"The author's note describing how this supplementary material relates to the main document"}},"type":"object","required":["document_id","filename","display_order"],"title":"SupplementaryMaterialResponse","description":"Metadata for a supplement document.","examples":[{"document_id":"b2d5a0f3-7e81-4c94-a2bd-6a3f9e1c8d42","filename":"appendix.docx","display_order":1,"steering_note":"Reference tables for section 4."}]},"TransitionKind":{"type":"string","enum":["upgrade_now","switch_at_period_end","same","refused"],"title":"TransitionKind","description":"What a change from one plan to another is."},"UnviewedCompletedItem":{"properties":{"review_id":{"type":"string","title":"Review Id","description":"Review UUID"},"document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Id","description":"Associated document UUID"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title","description":"Document title"},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"When processing completed"}},"type":"object","required":["review_id","document_id","title","created_at"],"title":"UnviewedCompletedItem","description":"A completed item that hasn't been viewed yet."},"UpdateMarketingPreferencesRequest":{"properties":{"opt_in":{"type":"boolean","title":"Opt In","description":"Desired opt-in state."}},"type":"object","required":["opt_in"],"title":"UpdateMarketingPreferencesRequest","description":"Body for PUT /marketing/preferences.","examples":[{"opt_in":true},{"opt_in":false}]},"UpdateVisibilityRequest":{"properties":{"general_access":{"$ref":"#/components/schemas/GeneralAccess","description":"The level to set; it must be one of the review's general_access_options"}},"type":"object","required":["general_access"],"title":"UpdateVisibilityRequest","description":"Request body for updating review visibility.","examples":[{"general_access":"signed_in"},{"general_access":"anyone"},{"general_access":"restricted"}]},"UpdateVisibilityResponse":{"properties":{"review_id":{"type":"string","title":"Review Id","description":"The review ID that was updated"},"general_access":{"$ref":"#/components/schemas/GeneralAccess","description":"The review's general-access level after the call"},"changed":{"type":"boolean","title":"Changed","description":"False when the review already had this level and nothing was written"}},"type":"object","required":["review_id","general_access","changed"],"title":"UpdateVisibilityResponse","description":"Response for visibility update.","examples":[{"review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf","general_access":"anyone","changed":true},{"review_id":"7ab7324d-0968-40ac-9a0d-68fe4fbf11bf","general_access":"restricted","changed":false}]},"UpgradeSubscriptionRequest":{"properties":{"new_price_id":{"type":"string","minLength":1,"title":"New Price Id","description":"Stripe price ID for the new subscription tier"},"success_url":{"type":"string","minLength":1,"title":"Success Url","description":"URL to redirect to after successful payment"},"cancel_url":{"type":"string","minLength":1,"title":"Cancel Url","description":"URL to redirect to if payment is canceled"}},"type":"object","required":["new_price_id","success_url","cancel_url"],"title":"UpgradeSubscriptionRequest","description":"Request schema for upgrading a subscription.\n\nNote: subscription_id, user_email, plan names, and credits are derived\nfrom JWT, database lookup, and pricing configuration.","examples":[{"new_price_id":"price_1QeXampleAnnual","success_url":"https://refine.ink/account/billing?upgraded=1","cancel_url":"https://refine.ink/account/billing"}]},"UpgradeSubscriptionResponse":{"properties":{"checkout_url":{"type":"string","title":"Checkout Url","description":"Stripe checkout URL for the upgrade payment"},"session_id":{"type":"string","title":"Session Id","description":"Stripe checkout session ID"}},"type":"object","required":["checkout_url","session_id"],"title":"UpgradeSubscriptionResponse","description":"Response schema for subscription upgrade.\n\nNote: Errors are returned as HTTP exceptions, not in the response body.\nA 200 response always indicates success.","examples":[{"checkout_url":"https://checkout.stripe.com/c/pay/cs_test_upgrade123","session_id":"cs_test_upgrade123"}]},"UserChatMessage":{"properties":{"role":{"type":"string","const":"user","title":"Role","description":"Always 'user'"},"content":{"type":"string","title":"Content"},"comment_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Comment Id","description":"Optional: the comment ID the user focused this message on"},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"When the message was stored"}},"type":"object","required":["role","content","created_at"],"title":"UserChatMessage","description":"A user message in conversation history."},"UserConsumptionResponse":{"properties":{"user_email":{"type":"string","title":"User Email","description":"Email of the member"},"events":{"items":{"$ref":"#/components/schemas/CreditConsumptionEventResponse"},"type":"array","title":"Events","description":"Individual spends, newest first"},"total_consumed":{"type":"integer","title":"Total Consumed","description":"Credits this member consumed in the window"}},"type":"object","required":["user_email","events","total_consumed"],"title":"UserConsumptionResponse","description":"One member's credit consumption over the reporting window."},"UserTier":{"type":"string","enum":["default","extended","unlimited"],"title":"UserTier","description":"Tier defining per-user document size limits.\n\nEach tier controls:\n- Maximum word count (primary, user-facing limit)\n- Maximum token count (secondary safety net, 4x word limit)\n- Maximum file size for upload"},"VerdictCounts":{"properties":{"fully_addressed":{"type":"integer","minimum":0.0,"title":"Fully Addressed"},"partially_addressed":{"type":"integer","minimum":0.0,"title":"Partially Addressed"},"not_addressed":{"type":"integer","minimum":0.0,"title":"Not Addressed"},"indeterminate":{"type":"integer","minimum":0.0,"title":"Indeterminate"},"dismissed":{"type":"integer","minimum":0.0,"title":"Dismissed"},"error":{"type":"integer","minimum":0.0,"title":"Error"}},"type":"object","required":["fully_addressed","partially_addressed","not_addressed","indeterminate","dismissed","error"],"title":"VerdictCounts","description":"Per-status counts across all verdicts (including the overall verdict)."},"VerdictSchema":{"properties":{"id":{"type":"string","title":"Id","description":"Stable verdict identifier"},"source_comment_id":{"type":"string","title":"Source Comment Id","description":"ID of the comment in the prior review this verdict scores"},"status":{"type":"string","title":"Status","description":"Whether the prior concern was addressed in the revised version: fully_addressed | partially_addressed | not_addressed | indeterminate (could not be determined from the comments) | dismissed (user dismissed it in the prior version; not re-evaluated) | error (pipeline failure)"},"comment":{"type":"string","title":"Comment","description":"User-facing explanation in Refine voice"}},"type":"object","required":["id","source_comment_id","status","comment"],"title":"VerdictSchema","description":"Public-facing verdict from the revision-check (rerun) pipeline.\n\nReasoning is internal — stripped via ``extra=\"ignore\"``."},"WelcomeCreditsRequest":{"properties":{"amount":{"type":"integer","maximum":10000.0,"minimum":1.0,"title":"Amount","description":"Credits each new member gets once, when they join"}},"type":"object","required":["amount"],"title":"WelcomeCreditsRequest","description":"Welcome credits: each new member gets `amount` credits from the pool once, when they join.","examples":[{"amount":5}]},"WelcomeCreditsResponse":{"properties":{"welcome_credits":{"type":"integer","title":"Welcome Credits","description":"Credits each new member gets once, when they join; 0 when off"}},"type":"object","required":["welcome_credits"],"title":"WelcomeCreditsResponse","description":"An organization's welcome credits.","examples":[{"welcome_credits":5}]},"DocumentUploadForm":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File","description":"Document file to upload"},"parent_document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Document Id","description":"UUID of parent document. When provided, this upload is a supplement attached to the parent."}},"type":"object","required":["file"],"title":"Body_documents_uploadDocument"}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"API key or JWT token. Pass as: Authorization: Bearer <your-api-key>"},"OAuth2":{"type":"oauth2","description":"Log in with your account","flows":{"authorizationCode":{"authorizationUrl":"https://clerk.refine.ink/oauth/authorize","tokenUrl":"https://clerk.refine.ink/oauth/token","scopes":{"openid":"OpenID Connect","profile":"User profile","email":"Email address"}}}}},"responses":{"ProblemUnprocessableChatMessageTooLong":{"description":"Validation failed","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"chat-message-too-long":{"$ref":"#/components/examples/chat-message-too-long"},"validation-error":{"$ref":"#/components/examples/validation-error"}}}}},"ProblemInternalServerErrorAuthenticationConfigurationAuthenticationFailedUnexpectedFailure":{"description":"Internal server error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"authentication-configuration":{"$ref":"#/components/examples/authentication-configuration"},"authentication-failed":{"$ref":"#/components/examples/authentication-failed"},"unexpected-failure":{"$ref":"#/components/examples/unexpected-failure"}}}}},"ProblemUnauthenticated":{"description":"Unauthenticated","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"api-key-scope":{"$ref":"#/components/examples/api-key-scope"},"expired-token":{"$ref":"#/components/examples/expired-token"},"incomplete-token":{"$ref":"#/components/examples/incomplete-token"},"invalid-api-key":{"$ref":"#/components/examples/invalid-api-key"},"malformed-token":{"$ref":"#/components/examples/malformed-token"},"missing-credentials":{"$ref":"#/components/examples/missing-credentials"},"premature-token":{"$ref":"#/components/examples/premature-token"},"unknown-principal":{"$ref":"#/components/examples/unknown-principal"}}}}},"ProblemForbiddenOrganizationMembershipRequired":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"organization-membership-required":{"$ref":"#/components/examples/organization-membership-required"}}}}},"ProblemServiceUnavailable":{"description":"Service unavailable","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"identity-provider-unavailable":{"$ref":"#/components/examples/identity-provider-unavailable"}}}}},"ProblemUnprocessable":{"description":"Validation failed","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"validation-error":{"$ref":"#/components/examples/validation-error"}}}}},"ProblemNotFoundSessionMissing":{"description":"Not found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"session-missing":{"$ref":"#/components/examples/session-missing"}}}}},"ProblemBadRequestMalformedReferralCodeOwnReferralCode":{"description":"Bad request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"malformed-referral-code":{"$ref":"#/components/examples/malformed-referral-code"},"own-referral-code":{"$ref":"#/components/examples/own-referral-code"}}}}},"ProblemNotFoundReferralCodeNotFound":{"description":"Not found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"referral-code-not-found":{"$ref":"#/components/examples/referral-code-not-found"}}}}},"ProblemForbiddenOrganizationMembershipRequiredSessionNotAccessible":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"organization-membership-required":{"$ref":"#/components/examples/organization-membership-required"},"session-not-accessible":{"$ref":"#/components/examples/session-not-accessible"}}}}},"ProblemTooManyRequestsAnonymousReadRateLimited":{"description":"Too many requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"anonymous-read-rate-limited":{"$ref":"#/components/examples/anonymous-read-rate-limited"}}}}},"ProblemBadRequestMissingIdentifier":{"description":"Bad request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"missing-identifier":{"$ref":"#/components/examples/missing-identifier"}}}}},"ProblemInternalServerErrorCommentActionNotStored":{"description":"Internal server error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"authentication-configuration":{"$ref":"#/components/examples/authentication-configuration"},"authentication-failed":{"$ref":"#/components/examples/authentication-failed"},"comment-action-not-stored":{"$ref":"#/components/examples/comment-action-not-stored"},"unexpected-failure":{"$ref":"#/components/examples/unexpected-failure"}}}}},"ProblemBadRequestCommentNotActionableMissingIdentifier":{"description":"Bad request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"comment-not-actionable":{"$ref":"#/components/examples/comment-not-actionable"},"missing-identifier":{"$ref":"#/components/examples/missing-identifier"}}}}},"ProblemBadRequestCommentNotActionableInvalidCommentActionTypeMissingIdentifier":{"description":"Bad request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"comment-not-actionable":{"$ref":"#/components/examples/comment-not-actionable"},"invalid-comment-action-type":{"$ref":"#/components/examples/invalid-comment-action-type"},"missing-identifier":{"$ref":"#/components/examples/missing-identifier"}}}}},"ProblemForbiddenGeneralAccessUnavailableOrganizationMembershipRequired":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"general-access-unavailable":{"$ref":"#/components/examples/general-access-unavailable"},"organization-membership-required":{"$ref":"#/components/examples/organization-membership-required"}}}}},"ProblemBadRequestSessionAlreadyAccessible":{"description":"Bad request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"session-already-accessible":{"$ref":"#/components/examples/session-already-accessible"}}}}},"ProblemForbiddenOrganizationMembershipRequiredSessionSharingRestricted":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"organization-membership-required":{"$ref":"#/components/examples/organization-membership-required"},"session-sharing-restricted":{"$ref":"#/components/examples/session-sharing-restricted"}}}}},"ProblemInternalServerErrorUnexpectedFailure":{"description":"Internal server error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"unexpected-failure":{"$ref":"#/components/examples/unexpected-failure"}}}}},"ProblemBadGatewayPaymentSystem":{"description":"Bad gateway","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"payment-system":{"$ref":"#/components/examples/payment-system"}}}}},"ProblemInternalServerErrorOriginalUploadStorage":{"description":"Internal server error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"authentication-configuration":{"$ref":"#/components/examples/authentication-configuration"},"authentication-failed":{"$ref":"#/components/examples/authentication-failed"},"original-upload-storage":{"$ref":"#/components/examples/original-upload-storage"},"unexpected-failure":{"$ref":"#/components/examples/unexpected-failure"}}}}},"ProblemBadRequestInvalidUploadedFileMalformedDocumentIdMissingFilenameNestedSupplementaryMaterialSupplementaryMaterialLimitReached":{"description":"Bad request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"invalid-uploaded-file":{"$ref":"#/components/examples/invalid-uploaded-file"},"malformed-document-id":{"$ref":"#/components/examples/malformed-document-id"},"missing-filename":{"$ref":"#/components/examples/missing-filename"},"nested-supplementary-material":{"$ref":"#/components/examples/nested-supplementary-material"},"supplementary-material-limit-reached":{"$ref":"#/components/examples/supplementary-material-limit-reached"}}}}},"ProblemForbiddenOrganizationMembershipRequiredParentDocumentNotOwned":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"organization-membership-required":{"$ref":"#/components/examples/organization-membership-required"},"parent-document-not-owned":{"$ref":"#/components/examples/parent-document-not-owned"}}}}},"ProblemNotFoundAuthenticatedUserNotFoundParentDocumentNotFound":{"description":"Not found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"authenticated-user-not-found":{"$ref":"#/components/examples/authenticated-user-not-found"},"parent-document-not-found":{"$ref":"#/components/examples/parent-document-not-found"}}}}},"ProblemConflictUploadBundleChanged":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"upload-bundle-changed":{"$ref":"#/components/examples/upload-bundle-changed"}}}}},"ProblemUnprocessableDocumentTokenLimitDocumentWordLimitInvalidFlagOverrideShortDocumentTextUnknownPromptSetUnknownSteeringTarget":{"description":"Validation failed","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"document-token-limit":{"$ref":"#/components/examples/document-token-limit"},"document-word-limit":{"$ref":"#/components/examples/document-word-limit"},"invalid-flag-override":{"$ref":"#/components/examples/invalid-flag-override"},"short-document-text":{"$ref":"#/components/examples/short-document-text"},"unknown-prompt-set":{"$ref":"#/components/examples/unknown-prompt-set"},"unknown-steering-target":{"$ref":"#/components/examples/unknown-steering-target"},"validation-error":{"$ref":"#/components/examples/validation-error"}}}}},"ProblemInternalServerErrorProcessingJobNotCreated":{"description":"Internal server error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"authentication-configuration":{"$ref":"#/components/examples/authentication-configuration"},"authentication-failed":{"$ref":"#/components/examples/authentication-failed"},"processing-job-not-created":{"$ref":"#/components/examples/processing-job-not-created"},"unexpected-failure":{"$ref":"#/components/examples/unexpected-failure"}}}}},"ProblemBadRequestMalformedDocumentId":{"description":"Bad request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"malformed-document-id":{"$ref":"#/components/examples/malformed-document-id"}}}}},"ProblemForbiddenDocumentNotAccessibleFlagOverridesForbiddenNoCreditsNoOrganizationCreditsOrganizationMembershipRequired":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"document-not-accessible":{"$ref":"#/components/examples/document-not-accessible"},"flag-overrides-forbidden":{"$ref":"#/components/examples/flag-overrides-forbidden"},"no-credits":{"$ref":"#/components/examples/no-credits"},"no-organization-credits":{"$ref":"#/components/examples/no-organization-credits"},"organization-membership-required":{"$ref":"#/components/examples/organization-membership-required"}}}}},"ProblemNotFoundAuthenticatedUserNotFoundDocumentNotFoundDocumentTextNotReadyRevisionSessionNotAccessible":{"description":"Not found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"authenticated-user-not-found":{"$ref":"#/components/examples/authenticated-user-not-found"},"document-not-found":{"$ref":"#/components/examples/document-not-found"},"document-text-not-ready":{"$ref":"#/components/examples/document-text-not-ready"},"revision-session-not-accessible":{"$ref":"#/components/examples/revision-session-not-accessible"}}}}},"ProblemConflictOrganizationFrozenSupplementaryMaterialNotReadyUploadBundleChanged":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"organization-frozen":{"$ref":"#/components/examples/organization-frozen"},"supplementary-material-not-ready":{"$ref":"#/components/examples/supplementary-material-not-ready"},"upload-bundle-changed":{"$ref":"#/components/examples/upload-bundle-changed"}}}}},"ProblemServiceUnavailableProcessingDispatch":{"description":"Service unavailable","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"identity-provider-unavailable":{"$ref":"#/components/examples/identity-provider-unavailable"},"processing-dispatch":{"$ref":"#/components/examples/processing-dispatch"}}}}},"ProblemForbiddenDocumentNotAccessibleOrganizationMembershipRequired":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"document-not-accessible":{"$ref":"#/components/examples/document-not-accessible"},"organization-membership-required":{"$ref":"#/components/examples/organization-membership-required"}}}}},"ProblemNotFoundDocumentNotFoundDocumentTextNotReady":{"description":"Not found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"document-not-found":{"$ref":"#/components/examples/document-not-found"},"document-text-not-ready":{"$ref":"#/components/examples/document-text-not-ready"}}}}},"ProblemNotFoundDocumentNotFound":{"description":"Not found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"document-not-found":{"$ref":"#/components/examples/document-not-found"}}}}},"ProblemBadRequestInvalidImageRequestMalformedDocumentId":{"description":"Bad request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"invalid-image-request":{"$ref":"#/components/examples/invalid-image-request"},"malformed-document-id":{"$ref":"#/components/examples/malformed-document-id"}}}}},"ProblemNotFoundImageNotFound":{"description":"Not found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"image-not-found":{"$ref":"#/components/examples/image-not-found"}}}}},"ProblemBadRequestUnknownPrice":{"description":"Bad request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"unknown-price":{"$ref":"#/components/examples/unknown-price"}}}}},"ProblemNotFoundNoSubscription":{"description":"Not found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"no-subscription":{"$ref":"#/components/examples/no-subscription"}}}}},"ProblemConflictPlanChangeRefusedCurrencyPlanChangeRefusedCustomPlanChangeRefusedUnpaidPlanChangeSamePlan":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"plan-change-refused-currency":{"$ref":"#/components/examples/plan-change-refused-currency"},"plan-change-refused-custom":{"$ref":"#/components/examples/plan-change-refused-custom"},"plan-change-refused-unpaid":{"$ref":"#/components/examples/plan-change-refused-unpaid"},"plan-change-same-plan":{"$ref":"#/components/examples/plan-change-same-plan"}}}}},"ProblemBadRequestRedirectOriginMismatchRedirectOriginRequiredUnknownPrice":{"description":"Bad request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"redirect-origin-mismatch":{"$ref":"#/components/examples/redirect-origin-mismatch"},"redirect-origin-required":{"$ref":"#/components/examples/redirect-origin-required"},"unknown-price":{"$ref":"#/components/examples/unknown-price"}}}}},"ProblemConflictPlanSwitchAcrossTiersUpgradeBuysNoMoreCredits":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"plan-switch-across-tiers":{"$ref":"#/components/examples/plan-switch-across-tiers"},"upgrade-buys-no-more-credits":{"$ref":"#/components/examples/upgrade-buys-no-more-credits"}}}}},"ProblemConflictPlanSwitchAcrossTiers":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"plan-switch-across-tiers":{"$ref":"#/components/examples/plan-switch-across-tiers"}}}}},"ProblemConflictPlanChangePendingExistsPlanChangeRefusedCustomPlanChangeRefusedUnpaidPlanChangeSamePlanPlanSwitchAcrossTiers":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"plan-change-pending-exists":{"$ref":"#/components/examples/plan-change-pending-exists"},"plan-change-refused-custom":{"$ref":"#/components/examples/plan-change-refused-custom"},"plan-change-refused-unpaid":{"$ref":"#/components/examples/plan-change-refused-unpaid"},"plan-change-same-plan":{"$ref":"#/components/examples/plan-change-same-plan"},"plan-switch-across-tiers":{"$ref":"#/components/examples/plan-switch-across-tiers"}}}}},"ProblemNotFoundNoPendingPlanChangeNoSubscription":{"description":"Not found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"no-pending-plan-change":{"$ref":"#/components/examples/no-pending-plan-change"},"no-subscription":{"$ref":"#/components/examples/no-subscription"}}}}},"ProblemNotFoundCancellationNotPendingNoSubscription":{"description":"Not found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"cancellation-not-pending":{"$ref":"#/components/examples/cancellation-not-pending"},"no-subscription":{"$ref":"#/components/examples/no-subscription"}}}}},"ProblemConflictSubscriptionAlreadyPausedSubscriptionPauseRefused":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"subscription-already-paused":{"$ref":"#/components/examples/subscription-already-paused"},"subscription-pause-refused":{"$ref":"#/components/examples/subscription-pause-refused"}}}}},"ProblemInternalServerErrorOrganizationCreditsUnavailable":{"description":"Internal server error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"authentication-configuration":{"$ref":"#/components/examples/authentication-configuration"},"authentication-failed":{"$ref":"#/components/examples/authentication-failed"},"organization-credits-unavailable":{"$ref":"#/components/examples/organization-credits-unavailable"},"unexpected-failure":{"$ref":"#/components/examples/unexpected-failure"}}}}},"ProblemForbiddenOrganizationMembershipRequiredOrganizationPermission":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"organization-membership-required":{"$ref":"#/components/examples/organization-membership-required"},"organization-permission":{"$ref":"#/components/examples/organization-permission"}}}}},"ProblemNotFoundOrganizationMissing":{"description":"Not found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"organization-missing":{"$ref":"#/components/examples/organization-missing"}}}}},"ProblemBadRequestAllocationTargetNotAMemberCreditAllocationFailedOrganizationPoolExhausted":{"description":"Bad request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"allocation-target-not-a-member":{"$ref":"#/components/examples/allocation-target-not-a-member"},"credit-allocation-failed":{"$ref":"#/components/examples/credit-allocation-failed"},"organization-pool-exhausted":{"$ref":"#/components/examples/organization-pool-exhausted"}}}}},"ProblemBadRequestAllocationTargetNotAMemberCreditAllocationFailed":{"description":"Bad request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"allocation-target-not-a-member":{"$ref":"#/components/examples/allocation-target-not-a-member"},"credit-allocation-failed":{"$ref":"#/components/examples/credit-allocation-failed"}}}}},"ProblemConflictOrganizationNotEmptyOrganizationPlanChanged":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"organization-not-empty":{"$ref":"#/components/examples/organization-not-empty"},"organization-plan-changed":{"$ref":"#/components/examples/organization-plan-changed"}}}}},"ProblemBadGatewayOrganizationDeletionFailedOrganizationPlanCancellationFailed":{"description":"Bad gateway","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"organization-deletion-failed":{"$ref":"#/components/examples/organization-deletion-failed"},"organization-plan-cancellation-failed":{"$ref":"#/components/examples/organization-plan-cancellation-failed"}}}}},"ProblemForbiddenOrganizationMembershipRequiredOrganizationPermissionSettingNotIncluded":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"organization-membership-required":{"$ref":"#/components/examples/organization-membership-required"},"organization-permission":{"$ref":"#/components/examples/organization-permission"},"setting-not-included":{"$ref":"#/components/examples/setting-not-included"}}}}},"ProblemBadGatewayOrganizationSettingsNotSaved":{"description":"Bad gateway","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"organization-settings-not-saved":{"$ref":"#/components/examples/organization-settings-not-saved"}}}}},"ProblemNotFoundAuthenticatedUserNotFound":{"description":"Not found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"},"examples":{"authenticated-user-not-found":{"$ref":"#/components/examples/authenticated-user-not-found"}}}}}},"examples":{"chat-message-too-long":{"summary":"Chat message exceeds the maximum length","value":{"type":"chat-message-too-long","title":"Chat message exceeds the maximum length","status":422,"max_length":32000,"message_length":45210}},"validation-error":{"summary":"Request validation failed","value":{"type":"validation-error","title":"Request validation failed","status":422,"errors":[{"field":"body -> count","message":"Input should be a valid integer","type":"int_parsing"}]}},"authentication-configuration":{"summary":"Server is not configured for token validation","value":{"type":"authentication-configuration","title":"Server is not configured for token validation","status":500}},"authentication-failed":{"summary":"Authentication failed unexpectedly","value":{"type":"authentication-failed","title":"Authentication failed unexpectedly","status":500}},"unexpected-failure":{"summary":"The request could not be completed","value":{"type":"unexpected-failure","title":"The request could not be completed","status":500}},"api-key-scope":{"summary":"API key must be scoped to a user","value":{"type":"api-key-scope","title":"API key must be scoped to a user","status":401}},"expired-token":{"summary":"Authentication token has expired","value":{"type":"expired-token","title":"Authentication token has expired","status":401}},"incomplete-token":{"summary":"Authentication token is missing required claims","value":{"type":"incomplete-token","title":"Authentication token is missing required claims","status":401,"claim":"email"}},"invalid-api-key":{"summary":"API key is not valid","value":{"type":"invalid-api-key","title":"API key is not valid","status":401}},"malformed-token":{"summary":"Authentication token is malformed","value":{"type":"malformed-token","title":"Authentication token is malformed","status":401}},"missing-credentials":{"summary":"Authentication token required","value":{"type":"missing-credentials","title":"Authentication token required","status":401}},"premature-token":{"summary":"Authentication token is not yet valid","value":{"type":"premature-token","title":"Authentication token is not yet valid","status":401}},"unknown-principal":{"summary":"No user found for the credentials","value":{"type":"unknown-principal","title":"No user found for the credentials","status":401}},"organization-membership-required":{"summary":"You are not a member of this organization","value":{"type":"organization-membership-required","title":"You are not a member of this organization","status":403,"organization_id":"org_2abcDEF456"}},"identity-provider-unavailable":{"summary":"Identity provider is temporarily unavailable","value":{"type":"identity-provider-unavailable","title":"Identity provider is temporarily unavailable","status":503}},"session-missing":{"summary":"Session not found","value":{"type":"session-missing","title":"Session not found","status":404,"review_id":"3fa85f64-5717-4562-b3fc-2c963f66afa6"}},"malformed-referral-code":{"summary":"Referral code format is not valid","value":{"type":"malformed-referral-code","title":"Referral code format is not valid","status":400}},"own-referral-code":{"summary":"You cannot use your own referral code","value":{"type":"own-referral-code","title":"You cannot use your own referral code","status":400}},"referral-code-not-found":{"summary":"Referral code does not match any user","value":{"type":"referral-code-not-found","title":"Referral code does not match any user","status":404}},"session-not-accessible":{"summary":"Access denied to this session","value":{"type":"session-not-accessible","title":"Access denied to this session","status":403,"review_id":"3fa85f64-5717-4562-b3fc-2c963f66afa6"}},"anonymous-read-rate-limited":{"summary":"Too many anonymous requests","value":{"type":"anonymous-read-rate-limited","title":"Too many anonymous requests","status":429}},"missing-identifier":{"summary":"A required identifier was not provided","value":{"type":"missing-identifier","title":"A required identifier was not provided","status":400,"field":"review_id"}},"comment-action-not-stored":{"summary":"Recording the comment action failed","value":{"type":"comment-action-not-stored","title":"Recording the comment action failed","status":500,"comment_id":"3fa85f64-5717-4562-b3fc-2c963f66afa6"}},"comment-not-actionable":{"summary":"Comment cannot be actioned","value":{"type":"comment-not-actionable","title":"Comment cannot be actioned","status":400,"comment_id":"3fa85f64-5717-4562-b3fc-2c963f66afa6"}},"invalid-comment-action-type":{"summary":"Comment action type is not valid","value":{"type":"invalid-comment-action-type","title":"Comment action type is not valid","status":400,"accepted":["dismissed","addressed"],"action_type":"resolved"}},"general-access-unavailable":{"summary":"General access level not available","value":{"type":"general-access-unavailable","title":"General access level not available","status":403,"review_id":"3fa85f64-5717-4562-b3fc-2c963f66afa6","general_access":"anyone"}},"session-already-accessible":{"summary":"You already have access to this session","value":{"type":"session-already-accessible","title":"You already have access to this session","status":400,"review_id":"3fa85f64-5717-4562-b3fc-2c963f66afa6"}},"session-sharing-restricted":{"summary":"This session cannot be shared outside its organization","value":{"type":"session-sharing-restricted","title":"This session cannot be shared outside its organization","status":403,"review_id":"3fa85f64-5717-4562-b3fc-2c963f66afa6"}},"payment-system":{"summary":"Payment system error","value":{"type":"payment-system","title":"Payment system error","status":502}},"original-upload-storage":{"summary":"Storing the uploaded file failed","value":{"type":"original-upload-storage","title":"Storing the uploaded file failed","status":500}},"invalid-uploaded-file":{"summary":"Uploaded file was rejected","value":{"type":"invalid-uploaded-file","title":"Uploaded file was rejected","status":400,"max_megabytes":100,"reason":"file_too_large"}},"malformed-document-id":{"summary":"Document ID is not a valid UUID","value":{"type":"malformed-document-id","title":"Document ID is not a valid UUID","status":400,"field":"document_id"}},"missing-filename":{"summary":"A filename is required","value":{"type":"missing-filename","title":"A filename is required","status":400}},"nested-supplementary-material":{"summary":"Supplementary material cannot be nested","value":{"type":"nested-supplementary-material","title":"Supplementary material cannot be nested","status":400,"parent_document_id":"3fa85f64-5717-4562-b3fc-2c963f66afa6"}},"supplementary-material-limit-reached":{"summary":"Supplementary material limit reached","value":{"type":"supplementary-material-limit-reached","title":"Supplementary material limit reached","status":400,"max_supplementary_material":5}},"parent-document-not-owned":{"summary":"Parent document belongs to another user","value":{"type":"parent-document-not-owned","title":"Parent document belongs to another user","status":403,"parent_document_id":"3fa85f64-5717-4562-b3fc-2c963f66afa6"}},"authenticated-user-not-found":{"summary":"User not found","value":{"type":"authenticated-user-not-found","title":"User not found","status":404}},"parent-document-not-found":{"summary":"Parent document not found","value":{"type":"parent-document-not-found","title":"Parent document not found","status":404,"parent_document_id":"3fa85f64-5717-4562-b3fc-2c963f66afa6"}},"upload-bundle-changed":{"summary":"The upload bundle changed; reload and retry","value":{"type":"upload-bundle-changed","title":"The upload bundle changed; reload and retry","status":409}},"document-token-limit":{"summary":"Document exceeds the size limit for your plan","value":{"type":"document-token-limit","title":"Document exceeds the size limit for your plan","status":422,"max_tokens":200000,"token_count":243118}},"document-word-limit":{"summary":"Document exceeds the word limit for your plan","value":{"type":"document-word-limit","title":"Document exceeds the word limit for your plan","status":422,"max_document_words":40000,"word_count":52310}},"invalid-flag-override":{"summary":"Flag override rejected","value":{"type":"invalid-flag-override","title":"Flag override rejected","status":422,"flag":"not_a_flag","reason":"unknown_flag"}},"short-document-text":{"summary":"Document does not contain enough text","value":{"type":"short-document-text","title":"Document does not contain enough text","status":422,"minimum_length":500,"text_length":218}},"unknown-prompt-set":{"summary":"Prompt set does not exist","value":{"type":"unknown-prompt-set","title":"Prompt set does not exist","status":422,"prompt_set":"verbose"}},"unknown-steering-target":{"summary":"Steering targets are not supplementary material of this document","value":{"type":"unknown-steering-target","title":"Steering targets are not supplementary material of this document","status":422,"unknown_supplementary_material_ids":["3fa85f64-5717-4562-b3fc-2c963f66afa6"]}},"processing-job-not-created":{"summary":"Creating the processing task failed","value":{"type":"processing-job-not-created","title":"Creating the processing task failed","status":500}},"document-not-accessible":{"summary":"Access denied to this document","value":{"type":"document-not-accessible","title":"Access denied to this document","status":403,"document_id":"3fa85f64-5717-4562-b3fc-2c963f66afa6"}},"flag-overrides-forbidden":{"summary":"Flag overrides are restricted to Refine admins","value":{"type":"flag-overrides-forbidden","title":"Flag overrides are restricted to Refine admins","status":403}},"no-credits":{"summary":"No credits remaining","value":{"type":"no-credits","title":"No credits remaining","status":403,"credit_type":"paid"}},"no-organization-credits":{"summary":"No organization credits allocated to you","value":{"type":"no-organization-credits","title":"No organization credits allocated to you","status":403,"organization_id":"org_2fK9xLmQpR3sT"}},"document-not-found":{"summary":"Document not found","value":{"type":"document-not-found","title":"Document not found","status":404,"document_id":"3fa85f64-5717-4562-b3fc-2c963f66afa6"}},"document-text-not-ready":{"summary":"Document has not finished converting","value":{"type":"document-text-not-ready","title":"Document has not finished converting","status":404,"document_id":"3fa85f64-5717-4562-b3fc-2c963f66afa6"}},"revision-session-not-accessible":{"summary":"Previous revision session is not accessible","value":{"type":"revision-session-not-accessible","title":"Previous revision session is not accessible","status":404,"previous_review_id":"3fa85f64-5717-4562-b3fc-2c963f66afa6"}},"organization-frozen":{"summary":"The organization's plan has ended or is unpaid, so its credits are frozen","value":{"type":"organization-frozen","title":"The organization's plan has ended or is unpaid, so its credits are frozen","status":409,"organization_id":"org_2abcDEF456","plan_status":"canceled"}},"supplementary-material-not-ready":{"summary":"Supplementary material is still being converted","value":{"type":"supplementary-material-not-ready","title":"Supplementary material is still being converted","status":409,"unconverted_document_ids":["3fa85f64-5717-4562-b3fc-2c963f66afa6"]}},"processing-dispatch":{"summary":"Processing service is temporarily unavailable","value":{"type":"processing-dispatch","title":"Processing service is temporarily unavailable","status":503,"credit_refunded":true}},"invalid-image-request":{"summary":"Image name is not valid","value":{"type":"invalid-image-request","title":"Image name is not valid","status":400}},"image-not-found":{"summary":"Image not found","value":{"type":"image-not-found","title":"Image not found","status":404,"image_name":"figure-3.png"}},"unknown-price":{"summary":"Price ID is not recognised","value":{"type":"unknown-price","title":"Price ID is not recognised","status":400,"price_id":"price_1AbCdEfGhIjKlMnO"}},"no-subscription":{"summary":"No active subscription found","value":{"type":"no-subscription","title":"No active subscription found","status":404}},"plan-change-refused-currency":{"summary":"The plan is not sold in the subscription's currency","value":{"type":"plan-change-refused-currency","title":"The plan is not sold in the subscription's currency","status":409,"currency":"eur"}},"plan-change-refused-custom":{"summary":"A custom or negotiated plan is changed through support","value":{"type":"plan-change-refused-custom","title":"A custom or negotiated plan is changed through support","status":409}},"plan-change-refused-unpaid":{"summary":"Pay the outstanding renewal invoice before changing plan","value":{"type":"plan-change-refused-unpaid","title":"Pay the outstanding renewal invoice before changing plan","status":409}},"plan-change-same-plan":{"summary":"The subscription is already on that plan","value":{"type":"plan-change-same-plan","title":"The subscription is already on that plan","status":409}},"redirect-origin-mismatch":{"summary":"Redirect URL must match the request origin","value":{"type":"redirect-origin-mismatch","title":"Redirect URL must match the request origin","status":400}},"redirect-origin-required":{"summary":"Origin or Referer header is required","value":{"type":"redirect-origin-required","title":"Origin or Referer header is required","status":400}},"plan-switch-across-tiers":{"summary":"A credits plan and a personal tier are not switched by upgrade or downgrade","value":{"type":"plan-switch-across-tiers","title":"A credits plan and a personal tier are not switched by upgrade or downgrade","status":409}},"upgrade-buys-no-more-credits":{"summary":"The plan buys no more credits than the current one","value":{"type":"upgrade-buys-no-more-credits","title":"The plan buys no more credits than the current one","status":409}},"plan-change-pending-exists":{"summary":"A plan change is already scheduled for the end of the period","value":{"type":"plan-change-pending-exists","title":"A plan change is already scheduled for the end of the period","status":409,"pending_price_id":"price_1AbCdEfGhIjKlMnO"}},"no-pending-plan-change":{"summary":"No plan change is scheduled","value":{"type":"no-pending-plan-change","title":"No plan change is scheduled","status":404}},"cancellation-not-pending":{"summary":"The subscription is not set to cancel","value":{"type":"cancellation-not-pending","title":"The subscription is not set to cancel","status":404}},"subscription-already-paused":{"summary":"The subscription is already paused","value":{"type":"subscription-already-paused","title":"The subscription is already paused","status":409}},"subscription-pause-refused":{"summary":"The subscription cannot be paused","value":{"type":"subscription-pause-refused","title":"The subscription cannot be paused","status":409,"reason":"pending_change"}},"organization-credits-unavailable":{"summary":"Organization credit data is unavailable","value":{"type":"organization-credits-unavailable","title":"Organization credit data is unavailable","status":500,"organization_id":"org_2abcDEF456"}},"organization-permission":{"summary":"Insufficient permissions for this organization","value":{"type":"organization-permission","title":"Insufficient permissions for this organization","status":403,"action":"view_credits","organization_id":"org_2abcDEF456"}},"organization-missing":{"summary":"Organization not found","value":{"type":"organization-missing","title":"Organization not found","status":404,"organization_id":"org_2abcDEF456"}},"allocation-target-not-a-member":{"summary":"Target user is not a member of this organization","value":{"type":"allocation-target-not-a-member","title":"Target user is not a member of this organization","status":400,"organization_id":"org_2abcDEF456"}},"credit-allocation-failed":{"summary":"Credit allocation could not be completed","value":{"type":"credit-allocation-failed","title":"Credit allocation could not be completed","status":400,"organization_id":"org_2abcDEF456"}},"organization-pool-exhausted":{"summary":"Organization credit pool has insufficient credits","value":{"type":"organization-pool-exhausted","title":"Organization credit pool has insufficient credits","status":400,"organization_id":"org_2abcDEF456"}},"organization-not-empty":{"summary":"Organization still has other members","value":{"type":"organization-not-empty","title":"Organization still has other members","status":409,"organization_id":"org_2abcDEF456","members":2}},"organization-plan-changed":{"summary":"Organization plan changed during its deletion","value":{"type":"organization-plan-changed","title":"Organization plan changed during its deletion","status":409,"organization_id":"org_2abcDEF456"}},"organization-deletion-failed":{"summary":"Organization could not be deleted at the identity provider","value":{"type":"organization-deletion-failed","title":"Organization could not be deleted at the identity provider","status":502,"organization_id":"org_2abcDEF456"}},"organization-plan-cancellation-failed":{"summary":"Organization plan could not be canceled at the payment provider","value":{"type":"organization-plan-cancellation-failed","title":"Organization plan could not be canceled at the payment provider","status":502,"organization_id":"org_2abcDEF456"}},"setting-not-included":{"summary":"The organization's plan doesn't include this setting","value":{"type":"setting-not-included","title":"The organization's plan doesn't include this setting","status":403,"setting":"session_retention_days"}},"organization-settings-not-saved":{"summary":"The organization's settings could not be saved at the identity provider","value":{"type":"organization-settings-not-saved","title":"The organization's settings could not be saved at the identity provider","status":502,"organization_id":"org_2abcDEF456"}}}},"security":[{"BearerAuth":[]},{"OAuth2":["openid","profile","email"]}]}