{"openapi":"3.1.0","info":{"title":"ClaimKit API","description":"AI-powered GitHub, Linear, and Jira integration API","version":"0.1.0"},"paths":{"/auth/signup/precheck":{"post":{"tags":["auth"],"summary":"Signup Precheck","description":"Check whether an email may sign up, before any Firebase account is created.\n\nThe signup page calls this before createUserWithEmailAndPassword so emails\nthat would be rejected at login never get an orphaned Firebase account\n(CARP-428). Mirrors the new-user gate in /auth/login.","operationId":"signup_precheck_auth_signup_precheck_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignupPrecheckRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignupPrecheckResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/login":{"post":{"tags":["auth"],"summary":"Login","description":"Authenticate with Firebase ID token and establish session.\n\nThe frontend obtains an ID token after Firebase authentication (e.g., Google Sign-In)\nand sends it here. We verify the token with Firebase, create or find the user,\nand establish a server-side session.","operationId":"login_auth_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/logout":{"post":{"tags":["auth"],"summary":"Logout","operationId":"logout_auth_logout_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/me":{"get":{"tags":["auth"],"summary":"Get Current User","description":"Get the current authenticated user.\n\nReturns user info if authenticated, 401 if not.\nIf admin is impersonating, returns the target user with impersonation context.","operationId":"get_current_user_auth_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserResponse"}}}}}},"patch":{"tags":["auth"],"summary":"Update Current User","description":"Update the current authenticated user's profile.","operationId":"update_current_user_auth_me_patch","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUserRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/users":{"get":{"tags":["admin"],"summary":"List Users","description":"List all users. Admin only.","operationId":"list_users_admin_users_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Page Size"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminUsersResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/impersonate/{user_id}":{"post":{"tags":["admin"],"summary":"Start Impersonation","description":"Start impersonating a user. Admin only.","operationId":"start_impersonation_admin_impersonate__user_id__post","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"integer","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImpersonateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/stop-impersonation":{"post":{"tags":["admin"],"summary":"Stop Impersonation","description":"Stop impersonating a user. Admin only.","operationId":"stop_impersonation_admin_stop_impersonation_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImpersonateResponse"}}}}}}},"/admin/workspaces/{workspace_id}/settings":{"patch":{"tags":["admin"],"summary":"Update Workspace Settings","description":"Update settings for a workspace. Admin only.","operationId":"update_workspace_settings_admin_workspaces__workspace_id__settings_patch","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"integer","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateWorkspaceSettingsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceSettingsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/claims":{"get":{"tags":["admin"],"summary":"List Admin Claims","description":"List all claims across all workspaces. Admin only.","operationId":"list_admin_claims_admin_claims_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","default":25,"title":"Page Size"}},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Workspace Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"order_by","in":"query","required":false,"schema":{"type":"string","default":"updated_at","title":"Order By"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminClaimsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/claims/{claim_id}/sources":{"get":{"tags":["admin"],"summary":"List Claim Sources","description":"List all data sources for a claim. Admin only.","operationId":"list_claim_sources_admin_claims__claim_id__sources_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/claims/{claim_id}/sources/{source_id}/browse":{"get":{"tags":["admin"],"summary":"Browse Claim Source","description":"Browse source data for a claim. Admin only.\n\nsource_id=0 for uploaded files, source_id=-1 for monthly reports.","operationId":"browse_claim_source_admin_claims__claim_id__sources__source_id__browse_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"source_id","in":"path","required":true,"schema":{"type":"integer","title":"Source Id"}},{"name":"item_type","in":"query","required":false,"schema":{"type":"string","default":"items","title":"Item Type"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Page Size"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"name":"fy_filter","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Fy Filter"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/claims/{claim_id}/sources/{source_id}/notion-pages/{page_id}/content":{"get":{"tags":["admin"],"summary":"Get Notion Page Content","description":"Fetch Notion page content via API. Admin only.","operationId":"get_notion_page_content_admin_claims__claim_id__sources__source_id__notion_pages__page_id__content_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"source_id","in":"path","required":true,"schema":{"type":"integer","title":"Source Id"}},{"name":"page_id","in":"path","required":true,"schema":{"type":"string","title":"Page Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/claims/{claim_id}/sources/{source_id}/confluence-pages/{page_id}/content":{"get":{"tags":["admin"],"summary":"Get Confluence Page Content","description":"Fetch Confluence page content via API. Admin only.","operationId":"get_confluence_page_content_admin_claims__claim_id__sources__source_id__confluence_pages__page_id__content_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"source_id","in":"path","required":true,"schema":{"type":"integer","title":"Source Id"}},{"name":"page_id","in":"path","required":true,"schema":{"type":"string","title":"Page Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/claims/{claim_id}/sources/{source_id}/xero-payruns/{pay_run_id}/payslips":{"get":{"tags":["admin"],"summary":"Get Xero Pay Run Payslips","description":"Fetch per-employee payslip breakdown for a Xero pay run. Admin only.","operationId":"get_xero_pay_run_payslips_admin_claims__claim_id__sources__source_id__xero_payruns__pay_run_id__payslips_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"source_id","in":"path","required":true,"schema":{"type":"integer","title":"Source Id"}},{"name":"pay_run_id","in":"path","required":true,"schema":{"type":"string","title":"Pay Run Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/claims/{claim_id}/sources/{source_id}/xero/export":{"post":{"tags":["admin"],"summary":"Start Xero Export Job","description":"Kick off (or attach to) an async Xero XLSX export.\n\nIdempotent on (claim_id, source_id): returns an existing pending/running\njob, or a succeeded job whose finished_at is within the last hour.\nOtherwise creates a new job row and dispatches the background task.","operationId":"start_xero_export_job_admin_claims__claim_id__sources__source_id__xero_export_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"source_id","in":"path","required":true,"schema":{"type":"integer","title":"Source Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/XeroExportJobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/xero-export-jobs/{job_id}":{"get":{"tags":["admin"],"summary":"Get Xero Export Job Status","description":"Poll the status of an in-flight or completed Xero export job.","operationId":"get_xero_export_job_status_admin_xero_export_jobs__job_id__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/XeroExportJobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/xero-export-jobs/{job_id}/download":{"get":{"tags":["admin"],"summary":"Download Xero Export Job","description":"Stream the XLSX of a succeeded job from GCS to the admin browser.","operationId":"download_xero_export_job_admin_xero_export_jobs__job_id__download_get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/claims/{claim_id}/reset-to-sources":{"post":{"tags":["admin"],"summary":"Reset Claim To Sources","description":"Reset a claim back to the sources page by deleting all discovery data. Admin only.","operationId":"reset_claim_to_sources_admin_claims__claim_id__reset_to_sources_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"force","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Force"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/claims/{claim_id}/is-consultant-claim":{"put":{"tags":["admin"],"summary":"Set Is Consultant Claim","description":"Mark or unmark a claim as a consultant claim. Admin only.\n\nMarking restricts the claim's available pages to sources / discovery /\ntracking for everyone on the claim (the AI generation, review, and submit\npages are hidden, and the corresponding endpoints 403). Unmarking reverses\nthe restriction without wiping any generated answers, review state, or\ntracking data — it also removes all consultant rows and any pending\nconsultant invitations for this claim.\n\nRefuses on submitted/archived claims (terminal states).","operationId":"set_is_consultant_claim_admin_claims__claim_id__is_consultant_claim_put","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetConsultantClaimRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IsConsultantClaimResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/claims/{claim_id}/nango-providers":{"get":{"tags":["admin"],"summary":"Get Nango Providers","description":"Which providers route through Nango on this claim, and why. Admin only.","operationId":"get_nango_providers_admin_claims__claim_id__nango_providers_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NangoProvidersResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["admin"],"summary":"Set Nango Providers","description":"Replace the claim's per-claim Nango list. Admin only.\n\nEach entry must be a Nango-migrated provider the claim type supports\n(400 otherwise). Providers already on globally via NANGO_PROVIDERS may be\nlisted too (harmless — the OR keeps them on) but need not be. Idempotent:\nan unchanged list writes nothing and no audit entry.\n\nTurning a provider ON: new connects on this claim mint a Nango Connect\nsession, and rows this claim links that already carry a\nnango_connection_id (imported with ``nango_import_connections.py --claim``\nor bound via the Connect UI) refresh through Nango from the next token\nfetch. Turning it OFF: new connects fall back to the legacy popup; rows\nalready bound to Nango are NOT moved back (see ``connections`` in the\nresponse for how many there are).","operationId":"set_nango_providers_admin_claims__claim_id__nango_providers_put","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetNangoProvidersRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NangoProvidersResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/claims/{claim_id}/offset-settings":{"put":{"tags":["admin"],"summary":"Set Offset Settings","description":"Set a claim's R&D tax offset type for the expenditure-page estimate.\n\n``non_refundable`` (aggregated turnover >= $20m) requires corporate_tax_rate\nin {25, 30} plus exactly one of:\n\n- ``total_expenses`` (> 0) — preferred: the UI computes the tiered offset\n  (corporate rate + 8.5 points on R&D spend up to 2% of total expenses,\n  + 16.5 points on the portion above);\n- ``premium_rate`` in {8.5, 16.5} — legacy flat estimate applied to the\n  whole R&D spend.\n\n``refundable`` (the default) clears all three fields and restores the flat\n43.5% display. Admin only. Refuses on submitted/archived claims (terminal\nstates).","operationId":"set_offset_settings_admin_claims__claim_id__offset_settings_put","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetOffsetSettingsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OffsetSettingsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/claims/{claim_id}/period":{"put":{"tags":["admin"],"summary":"Set Claim Period","description":"Set or clear a claim's custom period start month. Admin only.\n\nQuarter starts only (1/4/7/10); null reverts to the claim type's standard\nfiscal year. Changing the period does NOT re-run imports — date-windowed\ndata (work items, Xero/QBO expenditure items) must be re-imported to match\nthe new window; query-time consumers pick it up immediately. Refuses on\nsubmitted/archived claims (terminal states).","operationId":"set_claim_period_admin_claims__claim_id__period_put","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetClaimPeriodRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimPeriodResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/claims/{claim_id}/regenerate":{"post":{"tags":["admin"],"summary":"Regenerate Claim Discovery","description":"Wipe discovery/tracking data and re-run discovery.\n\nSaves admins from the four-step manual flow (reset → impersonate → continue\n→ approve in tracking) when re-running discovery is the goal. Behaves like\nreset-to-sources for the wipe, then immediately spawns a new discovery\nexecution as the claim creator. By default re-uses ``claim.discovery_prompt``\nverbatim; if ``payload.prompt`` is supplied it overwrites the stored prompt\nbefore discovery is spawned (empty string is allowed).","operationId":"regenerate_claim_discovery_admin_claims__claim_id__regenerate_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"force","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Force"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/RegenerateClaimRequest"},{"type":"null"}],"title":"Payload"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/claims/{claim_id}/regenerate-review":{"post":{"tags":["admin"],"summary":"Regenerate Claim Review","description":"Regenerate a claim's end-of-year report (the Review-tab narrative answers).\n\nRe-runs the same AI writer that produced the report initially, against the\n*current* tracking structure — so changes like merging two projects on the\ntracking page are reflected. Unlike the discovery ``/regenerate`` endpoint this\nis non-destructive to tracking data: it only reconciles answer instances\norphaned by merges, then regenerates all AI-answerable questions in place\n(``regenerate=True``), overwriting existing answers.","operationId":"regenerate_claim_review_admin_claims__claim_id__regenerate_review_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/agent-executions/{execution_id}":{"get":{"tags":["admin"],"summary":"Get Agent Execution Status","description":"Return the terminal status of an agent execution (admin only).\n\nThe regenerate-review flow polls this to learn the *actual* workflow outcome.\nThe answer-count-based ``/claims/{id}/generate/status`` can't be trusted for a\nregenerate: the answers already exist, so it reports ``completed`` as soon as\nthe claim leaves ``ai_processing`` — even when the run failed and reverted.\nThe execution row carries the real ``failed``/``completed`` verdict.","operationId":"get_agent_execution_status_admin_agent_executions__execution_id__get","parameters":[{"name":"execution_id","in":"path","required":true,"schema":{"type":"integer","title":"Execution Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentExecutionStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/claims/{claim_id}/reset-to-review":{"post":{"tags":["admin"],"summary":"Reset Claim To Review","description":"Reset a submitted claim back to review, clearing submission state. Admin only.\n\nEscape hatch for when a submitted claim genuinely needs fixing. Nulls out\n``submitted_at``, ``submitted_by_id``, and ``submitted_snapshot`` so the\nclaim can be edited and re-submitted. Records the action in the audit log.","operationId":"reset_claim_to_review_admin_claims__claim_id__reset_to_review_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"force","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Force"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/claims/{claim_id}/answers/{answer_id}/internal-notes":{"get":{"tags":["admin"],"summary":"List Internal Notes","description":"List admin-only internal notes on a claim answer, oldest first.","operationId":"list_internal_notes_admin_claims__claim_id__answers__answer_id__internal_notes_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"answer_id","in":"path","required":true,"schema":{"type":"integer","title":"Answer Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalNotesListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["admin"],"summary":"Create Internal Note","description":"Add an internal note to a claim answer. Never shown to the customer.","operationId":"create_internal_note_admin_claims__claim_id__answers__answer_id__internal_notes_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"answer_id","in":"path","required":true,"schema":{"type":"integer","title":"Answer Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalNoteBody"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalNoteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/claims/{claim_id}/internal-notes/{note_id}":{"patch":{"tags":["admin"],"summary":"Update Internal Note","description":"Edit an internal note. Only the author may edit it.","operationId":"update_internal_note_admin_claims__claim_id__internal_notes__note_id__patch","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"note_id","in":"path","required":true,"schema":{"type":"integer","title":"Note Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalNoteBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalNoteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["admin"],"summary":"Delete Internal Note","description":"Delete an internal note. Only the author may delete it.","operationId":"delete_internal_note_admin_claims__claim_id__internal_notes__note_id__delete","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"note_id","in":"path","required":true,"schema":{"type":"integer","title":"Note Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/claims/{claim_id}/review-versions":{"post":{"tags":["admin"],"summary":"Create Review Version","description":"Save the current review answers as the claim's next version, with a comment.","operationId":"create_review_version_admin_claims__claim_id__review_versions_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewVersionBody"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewVersionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["admin"],"summary":"List Review Versions","description":"List a claim's review versions, newest first. Snapshots are never loaded here.","operationId":"list_review_versions_admin_claims__claim_id__review_versions_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewVersionsListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/claims/{claim_id}/review-versions/{version_id}/restore":{"post":{"tags":["admin"],"summary":"Restore Review Version","description":"Put a saved version's answers back into the review, after saving the current answers as a version.\n\nAfterwards the page shows what the version holds: its answers are written,\nand visible answers it doesn't hold are cleared. Calculated, fixed and\ncustomer-only answers are left alone, as are projects/activities no longer\nin the report (named in ``skipped_instances``). A version built from the\nother report methodology is refused: its project/activity ids are another\ntable's.","operationId":"restore_review_version_admin_claims__claim_id__review_versions__version_id__restore_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"version_id","in":"path","required":true,"schema":{"type":"integer","title":"Version Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewVersionRestoreResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/claims/{claim_id}/review-versions/diff":{"get":{"tags":["admin"],"summary":"Diff Review Versions","description":"What changed from one version to another version, or to the current answers (``to=current``).","operationId":"diff_review_versions_admin_claims__claim_id__review_versions_diff_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"from","in":"query","required":true,"schema":{"type":"integer","title":"From"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","default":"current","title":"To"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewDiffResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/active-users":{"get":{"tags":["admin"],"summary":"Get Active Users","description":"List users with authenticated activity in the last 5 minutes. Admin only.","operationId":"get_active_users_admin_active_users_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/admin/allowed-emails":{"get":{"tags":["admin"],"summary":"List Allowed Emails","description":"List all allowed email addresses.","operationId":"list_allowed_emails_admin_allowed_emails_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["admin"],"summary":"Add Allowed Email","description":"Add an email to the allow-list.","operationId":"add_allowed_email_admin_allowed_emails_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AllowedEmailCreate"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/allowed-emails/{email_id}":{"delete":{"tags":["admin"],"summary":"Delete Allowed Email","description":"Remove an email from the allow-list. Only affects future signups.","operationId":"delete_allowed_email_admin_allowed_emails__email_id__delete","parameters":[{"name":"email_id","in":"path","required":true,"schema":{"type":"integer","title":"Email Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/users/{user_id}":{"delete":{"tags":["admin"],"summary":"Delete User","description":"Hard-delete a user. Cascades to claims they own, OAuth integrations,\nworkspace memberships, and sessions via DB-level ON DELETE rules. Audit\nlog authorship is preserved via SET NULL. Self-deletion is blocked; if\nthe target is an admin, at least one other active admin must remain.","operationId":"delete_user_admin_users__user_id__delete","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"integer","title":"User Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/jobs":{"get":{"tags":["admin"],"summary":"List Running Jobs","description":"List background jobs currently queued or running, across all claims. Admin only.\n\nUnions the four job stores: agent_executions (discovery, sync,\napportionment, generation, MCP workflows), claim_monthly_reports,\naurd_expenditure_categorise_jobs, and xero_export_jobs.","operationId":"list_running_jobs_admin_jobs_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminJobsResponse"}}}}}}},"/claim-types":{"get":{"tags":["claim-types"],"summary":"List Claim Types","description":"List active claim types, optionally filtered by country and/or category.","operationId":"list_claim_types_claim_types_get","parameters":[{"name":"country_code","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country Code"}},{"name":"category","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimTypesListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/sources":{"get":{"tags":["claims"],"summary":"List Sources","description":"List all data sources for a claim with connection status.\n\nReturns all supported source types, whether connected or not.","operationId":"list_sources_claims__claim_id__sources_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourcesListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/sources/readiness":{"get":{"tags":["claims"],"summary":"Get Source Readiness","description":"Check if the claim has sufficient sources to proceed to the next step.\n\nReturns per-category readiness status based on the claim type's requirements.","operationId":"get_source_readiness_claims__claim_id__sources_readiness_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourceReadinessResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/source-browser":{"get":{"tags":["claims"],"summary":"List Source Browser Sources","description":"List integration sources, file count, and report count for a claim.\n\nAccounting sources are left out for users who can't see salary, since\nbrowsing them is refused (see ``browse_source_browser_source``).","operationId":"list_source_browser_sources_claims__claim_id__source_browser_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/source-browser/{source_id}/browse":{"get":{"tags":["claims"],"summary":"Browse Source Browser Source","description":"Browse source data for a claim.\n\nsource_id=0 for uploaded files, source_id=-1 for monthly reports.\n\nWhen the requester can't see salary, accounting sources (Xero, QBO) are\nrefused outright and monthly-report summaries come back with their dollar\nfigures nulled, matching the Tracking page's monthly-reports list.","operationId":"browse_source_browser_source_claims__claim_id__source_browser__source_id__browse_get","parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"integer","title":"Source Id"}},{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"item_type","in":"query","required":false,"schema":{"type":"string","default":"items","title":"Item Type"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Page Size"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"name":"fy_filter","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Fy Filter"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/source-browser/{source_id}/notion-pages/{page_id}/content":{"get":{"tags":["claims"],"summary":"Get Source Browser Notion Page Content","description":"Fetch Notion page content via API.","operationId":"get_source_browser_notion_page_content_claims__claim_id__source_browser__source_id__notion_pages__page_id__content_get","parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"integer","title":"Source Id"}},{"name":"page_id","in":"path","required":true,"schema":{"type":"string","title":"Page Id"}},{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/source-browser/{source_id}/confluence-pages/{page_id}/content":{"get":{"tags":["claims"],"summary":"Get Source Browser Confluence Page Content","description":"Fetch Confluence page content via API.","operationId":"get_source_browser_confluence_page_content_claims__claim_id__source_browser__source_id__confluence_pages__page_id__content_get","parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"integer","title":"Source Id"}},{"name":"page_id","in":"path","required":true,"schema":{"type":"string","title":"Page Id"}},{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/source-browser/{source_id}/xero-payruns/{pay_run_id}/payslips":{"get":{"tags":["claims"],"summary":"Get Source Browser Xero Pay Run Payslips","description":"Fetch per-employee payslip breakdown for a Xero pay run.\n\nSalary-gated (not just full-access): payslips are payroll data, so a\nworkspace member with ``can_view_salary = False`` is refused too.","operationId":"get_source_browser_xero_pay_run_payslips_claims__claim_id__source_browser__source_id__xero_payruns__pay_run_id__payslips_get","parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"integer","title":"Source Id"}},{"name":"pay_run_id","in":"path","required":true,"schema":{"type":"string","title":"Pay Run Id"}},{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/sources/{source_type}/connect":{"post":{"tags":["claims"],"summary":"Connect Source","description":"Connect a data source to a claim.\n\nIf user has no OAuth token for this source, returns oauth_url to redirect to.\nIf they do, creates the ClaimDataSource link.","operationId":"connect_source_claims__claim_id__sources__source_type__connect_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"source_type","in":"path","required":true,"schema":{"type":"string","title":"Source Type"}},{"name":"force_oauth","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Force Oauth"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/sources/gitlab/self-managed":{"post":{"tags":["claims"],"summary":"Connect Self Managed Gitlab Source","description":"Connect a self-managed GitLab instance with a personal/group access token.\n\nThe OAuth flow behind ``connect_source`` only reaches GitLab.com; see\n``app/services/gitlab_self_managed.py``.","operationId":"connect_self_managed_gitlab_source_claims__claim_id__sources_gitlab_self_managed_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitLabSelfManagedConnectRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/sources/{source_type}":{"delete":{"tags":["claims"],"summary":"Disconnect Source","description":"Disconnect a data source from a claim.\n\nThis removes the ClaimDataSource link but does not revoke the OAuth token.\nOnly the user who connected the source, the claim owner, or an admin can disconnect.","operationId":"disconnect_source_claims__claim_id__sources__source_type__delete","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"source_type","in":"path","required":true,"schema":{"type":"string","title":"Source Type"}},{"name":"source_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Specific data source row (multi-connector sources)","title":"Source Id"},"description":"Specific data source row (multi-connector sources)"}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/sources/{source_type}/available":{"get":{"tags":["claims"],"summary":"List Available Items","description":"List available items for the scope picker.\n\nReturns repos (GitHub), teams (Linear), or projects (Jira) that can be selected.","operationId":"list_available_items_claims__claim_id__sources__source_type__available_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"source_type","in":"path","required":true,"schema":{"type":"string","title":"Source Type"}},{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Optional search query (Notion only)","title":"Q"},"description":"Optional search query (Notion only)"},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Pagination cursor (Notion only)","title":"Cursor"},"description":"Pagination cursor (Notion only)"},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Number of items to return","default":50,"title":"Page Size"},"description":"Number of items to return"},{"name":"source_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Specific data source row (multi-connector sources)","title":"Source Id"},"description":"Specific data source row (multi-connector sources)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AvailableItemsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/sources/{source_type}/scope":{"put":{"tags":["claims"],"summary":"Update Scope","description":"Update the scope for a connected data source.\n\nThe scope determines which repos/teams/projects are included for AI processing.","operationId":"update_scope_claims__claim_id__sources__source_type__scope_put","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"source_type","in":"path","required":true,"schema":{"type":"string","title":"Source Type"}},{"name":"source_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Specific data source row (multi-connector sources)","title":"Source Id"},"description":"Specific data source row (multi-connector sources)"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateScopeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/sources/notion/items/{item_id}":{"patch":{"tags":["claims"],"summary":"Update Notion Item Category","description":"Manually override category for a selected Notion item.","operationId":"update_notion_item_category_claims__claim_id__sources_notion_items__item_id__patch","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"string","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateItemCategoryRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/sources/google-drive/items/{item_id}":{"patch":{"tags":["claims"],"summary":"Update Google Drive Item Category","description":"Manually override category for a Google Drive item.","operationId":"update_google_drive_item_category_claims__claim_id__sources_google_drive_items__item_id__patch","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"string","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateItemCategoryRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["claims"],"summary":"Delete Google Drive Item","description":"Remove an imported Google Drive file: its scope item, file record and stored copy.","operationId":"delete_google_drive_item_claims__claim_id__sources_google_drive_items__item_id__delete","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"string","title":"Item Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims":{"post":{"tags":["claims"],"summary":"Create Claim","description":"Create a new claim.","operationId":"create_claim_claims_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateClaimRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["claims"],"summary":"List Claims","description":"List claims for the user.","operationId":"list_claims_claims_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"claim_type_code","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Claim Type Code"}},{"name":"category","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"}},{"name":"country_code","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country Code"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimsListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}":{"get":{"tags":["claims"],"summary":"Get Claim","description":"Get a single claim with details.","operationId":"get_claim_claims__claim_id__get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimDetailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["claims"],"summary":"Update Claim","description":"Update a claim's basic info.","operationId":"update_claim_claims__claim_id__patch","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateClaimRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["claims"],"summary":"Delete Claim","description":"Delete a claim. Cannot delete submitted claims (archive instead).","operationId":"delete_claim_claims__claim_id__delete","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/status":{"patch":{"tags":["claims"],"summary":"Update Claim Status","description":"Update a claim's status with validation of allowed transitions.\n\nNote: ``submitted`` cannot be set through this endpoint. Submission has\nside effects (snapshot freeze, audit log, Discord notification, submitter\nattribution) that only ``POST /claims/{id}/submit`` handles. Callers\ntargeting ``submitted`` via this handler used to silently get a\nhalf-submitted claim; we now reject them up-front.","operationId":"update_claim_status_claims__claim_id__status_patch","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateStatusRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/submit":{"post":{"tags":["claims"],"summary":"Submit Claim","description":"Finalise a claim: freeze its answers, lock further edits, and notify.\n\nChecks, in order:\n  1. Current status allows transition to ``submitted`` per the claim\n     type's transition table.\n  2. No unresolved root review comments.\n  3. Company is not a subsidiary of a consolidated/MEC group\n     (eligibility rule for AU R&D Tax Incentive).\n  4. No unanswered required questions.\n\nOn success the handler sets ``status``, ``submitted_at``, ``submitted_by_id``,\nand freezes the current questions payload into ``submitted_snapshot``.\nWrites a ``ClaimAuditLog`` entry and dispatches a ``claim.submitted``\nnotification. Discord failures are swallowed — the submission commits\nregardless.\n\nScope of the v1 edit lock: ``get_editable_claim_for_user`` blocks answer\nwrites, comment writes, and renames on a submitted claim. It does **not**\nblock uploads in ``api/files.py`` or AURD tracking mutations in\n``api/aurd_tracking.py`` — those endpoints use different auth paths.\nThe ``submitted_snapshot`` is therefore the record of which answers were\nfiled, not of supporting material state at submission. See CLA-127\nfollow-ups.","operationId":"submit_claim_claims__claim_id__submit_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/questions":{"get":{"tags":["claims"],"summary":"Get Claim Questions","description":"Get all questions for a claim, grouped by section, with answers.\n\nRepeating groups are returned as nested structures with template questions\nand existing instances.\n\nTracking-only collaborators get the form with every financial question\nremoved (``_is_financial_question``); the Review page is read-only for\nthem and the answer writes 403 regardless.","operationId":"get_claim_questions_claims__claim_id__questions_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"section","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Section"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuestionsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/answers":{"put":{"tags":["claims"],"summary":"Save Answers","description":"Save answers for a claim.\n\nSupports instance_id and parent_instance_id for repeating groups.","operationId":"save_answers_claims__claim_id__answers_put","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveAnswersRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveAnswersResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/answers/{answer_id}/evidence":{"get":{"tags":["claims"],"summary":"Get Answer Evidence","description":"Get AI reasoning and evidence citations for a specific answer.","operationId":"get_answer_evidence_claims__claim_id__answers__answer_id__evidence_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"answer_id","in":"path","required":true,"schema":{"type":"integer","title":"Answer Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnswerEvidenceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/groups/{group_code}/instances":{"post":{"tags":["claims"],"summary":"Add Group Instance","description":"Add a new instance of a repeating group.\n\nReturns the new instance_id. For nested groups, provide parent_instance_id.\nProject/activity groups also create the matching Tracking row when Review\nand Tracking use the same discovery methodology.","operationId":"add_group_instance_claims__claim_id__groups__group_code__instances_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"group_code","in":"path","required":true,"schema":{"type":"string","title":"Group Code"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AddInstanceRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddInstanceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/groups/{group_code}/instances/{instance_id}":{"delete":{"tags":["claims"],"summary":"Delete Group Instance","description":"Delete an instance of a repeating group.\n\nThis deletes all answers for the instance and any nested group instances.","operationId":"delete_group_instance_claims__claim_id__groups__group_code__instances__instance_id__delete","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"group_code","in":"path","required":true,"schema":{"type":"string","title":"Group Code"}},{"name":"instance_id","in":"path","required":true,"schema":{"type":"integer","title":"Instance Id"}},{"name":"parent_instance_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Parent Instance Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/generate":{"post":{"tags":["claims"],"summary":"Trigger Generation","description":"Trigger AI generation for a claim's questions.\n\nIf question_codes is provided, only generate for those questions.\nIf regenerate is True, regenerate even if answers exist.\n\nReturns immediately with a job_id. Poll /generate/status for progress.","operationId":"trigger_generation_claims__claim_id__generate_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/GenerateRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/generate/status":{"get":{"tags":["claims"],"summary":"Get Generation Status","description":"Get the status of AI generation for a claim.","operationId":"get_generation_status_claims__claim_id__generate_status_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/collaborators":{"get":{"tags":["claims"],"summary":"List Collaborators","description":"List everyone with access to this claim, plus pending invitations.\n\nTwo access populations, distinguished by ``scope`` (CARP-349):\n  * ``workspace`` — workspace members of ``claim.workspace_id``.\n  * ``claim`` — per-claim ``ClaimCollaborator`` rows (claim-scope invite\n    acceptances). A user who is both is listed once, as ``workspace``.\n\nPending invitations follow the same split: workspace-scope invites for\nthe claim's workspace, claim-scope invites for this claim only.\nConsultant invitations are excluded — they're listed by\n``GET /{claim_id}/consultants``.","operationId":"list_collaborators_claims__claim_id__collaborators_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollaboratorsListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["claims"],"summary":"Add Collaborator","description":"Invite a user to the claim's workspace or to this claim only.\n\nThe invite records a ``ClaimInvitation`` carrying ``body.scope``;\nacceptance is what creates the access row — a ``WorkspaceMember`` for\n``scope='workspace'`` (pre-CARP-349 behaviour, still the default) or a\n``ClaimCollaborator`` for ``scope='claim'``. ``body.tracking_only``\n(claim scope only) makes that collaborator tracking-only.\n\nOwner-gated: only the claim creator can invite.","operationId":"add_collaborator_claims__claim_id__collaborators_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddCollaboratorRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollaboratorsListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/viewed":{"post":{"tags":["claims"],"summary":"Record Claim Viewed","description":"Record that the current user viewed a page of this claim.\n\nSide-effect only. Emits ``claim.viewed`` unless an admin is impersonating.\nReturns 204 — no body, no persistence.","operationId":"record_claim_viewed_claims__claim_id__viewed_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordViewRequest"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/invitations/{token}/accept":{"post":{"tags":["claims"],"summary":"Accept Invitation","description":"Accept a claim collaboration invitation.","operationId":"accept_invitation_claims_invitations__token__accept_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/consultants":{"get":{"tags":["claims"],"summary":"List Consultants","description":"List consultants on a claim plus pending consultant invitations.\n\nVisible to admins, the claim owner, and existing consultants on the\nclaim itself (so a consultant can verify their access). Anyone else\nwith claim access (regular workspace member / collaborator) gets an\nempty list — they don't manage consultants.","operationId":"list_consultants_claims__claim_id__consultants_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsultantsListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["claims"],"summary":"Add Consultant","description":"Invite a consultant to the claim by email.\n\nGated to admins and the claim owner. Refuses if the claim is not\nflagged ``is_consultant_claim`` — only admins can flip the flag, so\nconsultant invites strictly follow that toggle. Creates a\n``ClaimInvitation(is_consultant=True)`` and reuses the existing\ninvitation email / signup plumbing; on accept, the invitee gets a\n``ClaimConsultant`` row (and NOT a ``WorkspaceMember`` row).","operationId":"add_consultant_claims__claim_id__consultants_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddConsultantRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsultantsListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/consultants/invitations/{invitation_id}/resend":{"post":{"tags":["claims"],"summary":"Resend Consultant Invitation","description":"Resend a consultant invite. Admins and the claim owner only.\n\nRegenerates the token (invalidating any previously emailed link) and\nresets the 30-day expiry. Works on ``pending`` or ``expired`` invites;\nrejects ``accepted`` invites with 409.","operationId":"resend_consultant_invitation_claims__claim_id__consultants_invitations__invitation_id__resend_post","parameters":[{"name":"invitation_id","in":"path","required":true,"schema":{"type":"integer","title":"Invitation Id"}},{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsultantsListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/consultants/invitations/{invitation_id}":{"delete":{"tags":["claims"],"summary":"Revoke Consultant Invitation","description":"Revoke (hard-delete) a consultant invite. Admins and the claim owner only.\n\nThe matching ``AllowedEmail`` row is intentionally left in place — it may\nhave been added for other reasons and we don't own it.","operationId":"revoke_consultant_invitation_claims__claim_id__consultants_invitations__invitation_id__delete","parameters":[{"name":"invitation_id","in":"path","required":true,"schema":{"type":"integer","title":"Invitation Id"}},{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/consultants/{user_id}":{"delete":{"tags":["claims"],"summary":"Remove Consultant","description":"Remove a consultant from a claim. Admins and the claim owner only.","operationId":"remove_consultant_claims__claim_id__consultants__user_id__delete","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"integer","title":"User Id"}},{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/export":{"post":{"tags":["claims"],"summary":"Export Claim","description":"Export claim as a zip containing all uploaded files and a summary PDF.\n\nSalary-gated: the summary PDF lists every employee's annual salary.","operationId":"export_claim_claims__claim_id__export_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/review-export":{"post":{"tags":["claims"],"summary":"Export Review Pdf","description":"Export the claim's narrative Q&A (review section content) as a PDF.\n\nSeparate from /export, which bundles tracking data + uploaded files into a zip.\nThe filename identifies the company, financial year, and generation date.","operationId":"export_review_pdf_claims__claim_id__review_export_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/review-export-json":{"post":{"tags":["claims"],"summary":"Export Review Json","description":"Export the claim's review answers as ``claimkit-rdti/2`` JSON.","operationId":"export_review_json_claims__claim_id__review_export_json_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/comments":{"post":{"tags":["claims"],"summary":"Create Comment","description":"Create a review comment on a claim.\n\nHandles three cases:\n- Root comment (no parent_id): Admin only, claim must be in \"tracking\" or \"review\" status.\n- Reply (has parent_id): Anyone with claim access, thread must be open.\n- Confirm action (is_confirmation=True): Non-admin only, root must be confirm-type.\n\nTracking-only collaborators pass the gate but may only reply or confirm\non threads about non-financial questions — the ones ``list_comments``\nshows them (``_assert_thread_open_to_tracking_only``).","operationId":"create_comment_claims__claim_id__comments_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCommentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["claims"],"summary":"List Comments","description":"List all comment threads for a claim with nested replies and summary.\n\nReturns root comments (parent_id IS NULL) with replies eagerly loaded,\na summary of total/open/resolved counts, and a by_section map of\nneeds_response/awaiting_review counts for the frontend SectionNav badges.\n\nComments on unrenderable group-parent answers are excluded — see\n``_unrenderable_answer_ids_stmt`` / CLA-129.\n\nTracking-only collaborators see only the threads on questions Review\nshows them: threads anchored to ``_is_financial_question`` answers are\nwithheld (``_financial_answer_ids_stmt``), since they discuss the figures\nthe role never sees. They may reply on the rest — ``create_comment``.","operationId":"list_comments_claims__claim_id__comments_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListCommentsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/comments/{comment_id}":{"delete":{"tags":["claims"],"summary":"Delete Comment","description":"Permanently delete a comment. Admin only.\n\nDeleting a root comment removes the entire thread through the\n``parent_id`` foreign key's ``ON DELETE CASCADE``. Deleting a reply only\nremoves that reply (and any descendants).","operationId":"delete_comment_claims__claim_id__comments__comment_id__delete","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"comment_id","in":"path","required":true,"schema":{"type":"integer","title":"Comment Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["claims"],"summary":"Edit Comment","description":"Edit own comment text.\n\nTracking-only collaborators may edit their own replies, which only ever\nsit on non-financial threads; the check mirrors ``create_comment``.","operationId":"edit_comment_claims__claim_id__comments__comment_id__patch","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"comment_id","in":"path","required":true,"schema":{"type":"integer","title":"Comment Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EditCommentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/comments/{comment_id}/resolve":{"patch":{"tags":["claims"],"summary":"Resolve Comment","description":"Resolve an open comment thread. Admin only.","operationId":"resolve_comment_claims__claim_id__comments__comment_id__resolve_patch","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"comment_id","in":"path","required":true,"schema":{"type":"integer","title":"Comment Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/comments/{comment_id}/reopen":{"patch":{"tags":["claims"],"summary":"Reopen Comment","description":"Reopen a resolved comment thread (admin only).","operationId":"reopen_comment_claims__claim_id__comments__comment_id__reopen_patch","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"comment_id","in":"path","required":true,"schema":{"type":"integer","title":"Comment Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/workspaces":{"get":{"tags":["workspaces"],"summary":"List Workspaces","description":"List workspaces linked to the current user by membership.","operationId":"list_workspaces_workspaces_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspacesListResponse"}}}}}},"post":{"tags":["workspaces"],"summary":"Create Workspace","description":"Create a workspace and add the current user as owner in one transaction.","operationId":"create_workspace_workspaces_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWorkspaceRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/workspaces/{workspace_id}":{"patch":{"tags":["workspaces"],"summary":"Update Workspace","description":"Update a workspace if the current user is a member.\n\nMembers can rename the workspace. Feature flags (``enable_ai_generation``,\n``enable_monthly_contemporaneous_reports``) and other privileged settings\n(``ai_context``) are admin-only and live on the admin endpoint in\n``app/api/admin.py``.","operationId":"update_workspace_workspaces__workspace_id__patch","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"integer","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateWorkspaceRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/workspaces/{workspace_id}/members":{"get":{"tags":["workspaces"],"summary":"List Workspace Members","description":"List workspace members. Any member can view the roster.","operationId":"list_workspace_members_workspaces__workspace_id__members_get","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"integer","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceMembersListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/workspaces/{workspace_id}/members/{user_id}":{"patch":{"tags":["workspaces"],"summary":"Update Workspace Member","description":"Change a member's role. Owner-only.\n\nReturns 409 if demoting the last owner — every workspace must have at\nleast one owner so the workspace stays administrable.","operationId":"update_workspace_member_workspaces__workspace_id__members__user_id__patch","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"integer","title":"Workspace Id"}},{"name":"user_id","in":"path","required":true,"schema":{"type":"integer","title":"User Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateMemberRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceMemberResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["workspaces"],"summary":"Remove Workspace Member","description":"Remove a member from the workspace.\n\nA member can always remove **themselves** (i.e. leave the workspace).\nRemoving *another* member is owner-only.\n\nReturns 409 if removing the last owner — every workspace must have at\nleast one owner.","operationId":"remove_workspace_member_workspaces__workspace_id__members__user_id__delete","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"integer","title":"Workspace Id"}},{"name":"user_id","in":"path","required":true,"schema":{"type":"integer","title":"User Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/workspaces/{workspace_id}/companies":{"get":{"tags":["companies"],"summary":"List Companies","description":"List companies in the workspace, with the number of claims referencing each.\n\nThe settings UI uses ``claim_count`` to disable the delete button (deleting\na company still referenced by a claim is a 409 — see ``delete_company``).","operationId":"list_companies_workspaces__workspace_id__companies_get","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"integer","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListCompaniesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["companies"],"summary":"Create Company","description":"Create a company in the workspace. Caller must be a workspace member.","operationId":"create_company_workspaces__workspace_id__companies_post","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"integer","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCompanyRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompanyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/workspaces/{workspace_id}/companies/{company_id}":{"patch":{"tags":["companies"],"summary":"Update Company","description":"Update a company's mutable fields. Caller must be a workspace member.","operationId":"update_company_workspaces__workspace_id__companies__company_id__patch","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"integer","title":"Workspace Id"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"integer","title":"Company Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCompanyRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompanyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["companies"],"summary":"Delete Company","description":"Delete a company. Caller must be a workspace member.\n\nThe Postgres FK from ``claims.company_id`` is ``ON DELETE RESTRICT``, so\ndeleting a company still referenced by any claim raises ``IntegrityError``.\nTranslate that into a 409 with a helpful message rather than a raw 500.","operationId":"delete_company_workspaces__workspace_id__companies__company_id__delete","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"integer","title":"Workspace Id"}},{"name":"company_id","in":"path","required":true,"schema":{"type":"integer","title":"Company Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/files/upload-url":{"post":{"tags":["files"],"summary":"Request Upload Url","description":"Request a signed URL for uploading a file to GCS.\n\nCreates a pending ClaimFile record and returns a signed URL that\nexpires in 15 minutes.","operationId":"request_upload_url_claims__claim_id__files_upload_url_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadUrlRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadUrlResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/files/{file_id}/confirm":{"post":{"tags":["files"],"summary":"Confirm Upload","description":"Confirm that a file was successfully uploaded to GCS.\n\nVerifies the file exists in GCS and updates the status to 'uploaded'.\nAlso triggers background AI summarization for supported file types.","operationId":"confirm_upload_claims__claim_id__files__file_id__confirm_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"file_id","in":"path","required":true,"schema":{"type":"integer","title":"File Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmUploadResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/files":{"get":{"tags":["files"],"summary":"List Files","description":"List the uploaded files shown in Documents & Files for a claim.","operationId":"list_files_claims__claim_id__files_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FilesListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/files/{file_id}/download-url":{"get":{"tags":["files"],"summary":"Get File Download Url","description":"Get a signed URL for downloading a file from GCS.","operationId":"get_file_download_url_claims__claim_id__files__file_id__download_url_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"file_id","in":"path","required":true,"schema":{"type":"integer","title":"File Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DownloadUrlResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/files/{file_id}":{"delete":{"tags":["files"],"summary":"Delete File Endpoint","description":"Delete a file from GCS and database.","operationId":"delete_file_endpoint_claims__claim_id__files__file_id__delete","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"file_id","in":"path","required":true,"schema":{"type":"integer","title":"File Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["files"],"summary":"Update File","description":"Update a file's category (manual override of LLM classification).","operationId":"update_file_claims__claim_id__files__file_id__patch","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"file_id","in":"path","required":true,"schema":{"type":"integer","title":"File Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateFileCategoryRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/files/{file_id}/retry-processing":{"post":{"tags":["files"],"summary":"Retry File Processing","description":"Reset processing state and re-enqueue the background task.\n\nDoes NOT re-upload; re-processes what's already in GCS.\n\nReturns 200 with the updated row.\nReturns 404 if the file doesn't exist.\nReturns 409 if the file is already in 'processing' state.","operationId":"retry_file_processing_claims__claim_id__files__file_id__retry_processing_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"file_id","in":"path","required":true,"schema":{"type":"integer","title":"File Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/files/{file_id}/unlock":{"post":{"tags":["files"],"summary":"Unlock File","description":"Re-process a password-protected file using the supplied password.\n\nResets processing state and re-enqueues the background task with the password\nheld transiently in memory. The password is never persisted to the DB nor\nwritten to logs.\n\nReturns 200 with the updated row; 404 if missing; 409 if already processing.","operationId":"unlock_file_claims__claim_id__files__file_id__unlock_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"file_id","in":"path","required":true,"schema":{"type":"integer","title":"File Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnlockFileRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/files/import-google-drive":{"post":{"tags":["files"],"summary":"Import Google Drive Files","description":"Import files from Google Drive.\n\nDownloads files using the provided OAuth token (from Google Picker)\nand stores them like regular uploaded files.","operationId":"import_google_drive_files_claims__claim_id__files_import_google_drive_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportGoogleDriveRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportGoogleDriveResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/imports/xero":{"post":{"tags":["expenditures"],"summary":"Trigger Xero Import","description":"Kick off a background Xero import for the claim's financial year.","operationId":"trigger_xero_import_claims__claim_id__expenditures_imports_xero_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/imports/qbo":{"post":{"tags":["expenditures"],"summary":"Trigger Qbo Import","description":"Kick off a background QBO import for the claim's financial year.","operationId":"trigger_qbo_import_claims__claim_id__expenditures_imports_qbo_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/imports":{"get":{"tags":["expenditures"],"summary":"List Imports","operationId":"list_imports_claims__claim_id__expenditures_imports_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ImportResponse"},"title":"Response List Imports Claims  Claim Id  Expenditures Imports Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/items":{"get":{"tags":["expenditures"],"summary":"List Items","description":"List expenditure items for the claim, filtered by tab.\n\nTabs:\n* ``raw`` — every item (Phase 1 default)\n* ``categorized`` — items with an AI- or user-assigned category\n\nThe All-expenses list is journal/transaction-only. ``include_salaries`` is\nreserved for the page-wide summary request, which still needs salary in\nits claim totals without putting synthetic salary rows back in the table.","operationId":"list_items_claims__claim_id__expenditures_items_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"tab","in":"query","required":false,"schema":{"enum":["raw","categorized"],"type":"string","default":"raw","title":"Tab"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":2000,"minimum":1,"default":500,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"from_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"From Date"}},{"name":"to_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"To Date"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"sort","in":"query","required":false,"schema":{"enum":["date","source","department","account_code","account_name","name","category","rd","rd_percentage","gst","amount"],"type":"string","default":"date","title":"Sort"}},{"name":"direction","in":"query","required":false,"schema":{"enum":["asc","desc"],"type":"string","default":"desc","title":"Direction"}},{"name":"include_salaries","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Salaries"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemsListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["expenditures"],"summary":"Create Item","description":"Admin-only: create a single expenditure item by hand. Used by the\n\"Add expense\" popup on the expenditure page to plug gaps between\nbookkeeping imports. Rows are grouped under a per-claim \"Manual entries\"\n:class:`AURDExpenditureImport` and are marked ``manual_override=True``.","operationId":"create_item_claims__claim_id__expenditures_items_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/items/ids":{"get":{"tags":["expenditures"],"summary":"List Item Ids","description":"Return the ids of every selectable item matching the All-expenses filters.\n\nBacks the \"select all expenses\" header checkbox, which materialises the\nfull matching id set into its selection so the existing bulk-by-ids actions\napply across every page, not just the visible 200. Uses the same filter\nbuilder (and the same read auth) as :func:`list_items`.\n\nJournal-only by design: synthesised salary rows are read-only / never\nselectable, so they're excluded here — and skipping the salary synthesis pass\nkeeps this endpoint a single cheap query.","operationId":"list_item_ids_claims__claim_id__expenditures_items_ids_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"tab","in":"query","required":false,"schema":{"enum":["raw","categorized"],"type":"string","default":"raw","title":"Tab"}},{"name":"from_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"From Date"}},{"name":"to_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"To Date"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemIdsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/export.csv":{"get":{"tags":["expenditures"],"summary":"Export Items Csv","description":"Export every active expenditure item for the claim as a CSV file.\n\nAdmin-only. Returns the reviewer-focused column set defined by\n``_EXPORT_CSV_COLUMNS`` — one row per ``AURDExpenditureItem``. Ignores any\non-screen filter (tab, date range, eligibility) so the output is a stable\nsnapshot of the imported journal items reviewers can reconcile against\nsource records.\n\nSynthesised salary rows (from ``_fetch_salary_rows``) are intentionally\nnot included — they're a UI projection over ``aurd_employee_expenses``,\nnot transactions on this table.\n\nAuth is intentionally a *pair* of dependencies: ``get_admin_user`` checks\nthe real session owner (so an admin impersonating a non-admin still passes,\nand a non-admin can never reach this regardless of impersonation), and\n``get_released_salary_visible_claim_for_user`` checks claim access on the\nactive identity. Don't collapse them.","operationId":"export_items_csv_claims__claim_id__expenditures_export_csv_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/imports/csv":{"post":{"tags":["expenditures"],"summary":"Import Csv","description":"Import a CSV of expenditure items into the claim.\n\nAdmin-only. Accepts a multipart upload with ``file`` (the CSV), ``mode``\n(``append`` | ``replace``), and ``column_mapping`` (JSON object mapping\ntarget field names to CSV header names — see ``_CSV_IMPORT_TARGET_FIELDS``).\n\n* ``append``: keeps every existing item; creates a new import record and\n  inserts the parsed rows alongside.\n* ``replace``: soft-deletes every active item on the claim across **every**\n  prior import (Xero/QBO included) before inserting the CSV rows. The\n  caller signed off on this scope. Re-running Xero/QBO will un-soft-delete\n  matching rows from those sources, but any prior manual category edits on\n  the wiped rows are lost.\n\nRows whose ``eligibility`` cell is a valid value (``r_and_d``/\n``non_eligible``) are inserted with ``manual_override=True``. Rows with\nblank/invalid eligibility are inserted uncategorised for the user to\ncategorise manually on the categorised page.\n\nActivity-name lookup is by exact name within the claim's projects. Misses\nare surfaced in ``skip_reasons`` and the row is inserted with\n``activity_id = NULL``.\n\nAuth is intentionally a *pair* of dependencies: ``get_admin_user`` checks\nthe real session owner (so impersonation can't elevate), and\n``get_released_editable_salary_visible_claim_for_user`` checks claim\naccess *and* editability on the active identity. Don't collapse them.","operationId":"import_csv_claims__claim_id__expenditures_imports_csv_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_import_csv_claims__claim_id__expenditures_imports_csv_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/orphaned-apportionments":{"get":{"tags":["expenditures"],"summary":"Get Orphaned Expenditure Apportionments","description":"Count live expenses, employee salary splits and depreciating assets\nallocated to legacy orphan activities.","operationId":"get_orphaned_expenditure_apportionments_claims__claim_id__expenditures_orphaned_apportionments_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrphanedExpenditureApportionmentsStatus"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/orphaned-apportionments/clear":{"post":{"tags":["expenditures"],"summary":"Clear Orphaned Expenditure Apportionments","description":"Remove legacy-orphan allocations from every live expense, employee\nsalary split and depreciating asset on the claim.\n\nValid current-tree allocations on a partially orphaned split are preserved.\nAn expense with no allocation left returns to the standard unassigned /\nnon-R&D state. Linked refunds are refreshed from their originals through\nthe normal inheritance mirror.","operationId":"clear_orphaned_expenditure_apportionments_claims__claim_id__expenditures_orphaned_apportionments_clear_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClearOrphanedExpenditureApportionmentsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/items/{item_id}":{"patch":{"tags":["expenditures"],"summary":"Update Item","description":"Inline edit / move an item. Any change marks ``manual_override=True``\nso subsequent AI re-runs don't undo the user's decision.\n\n``item_id`` may identify either an ``AURDExpenditureItem`` (real row) or\na synthesised salaries entry (when the id is at or above\n``_EMPLOYEE_RATE_ID_OFFSET``). Real items are editable as before; salary\nrows are read-only on this mixed-item surface — see\n``_update_salary_row``. To change an employee's R&D %, use the\nexpenditure Salary tab.","operationId":"update_item_claims__claim_id__expenditures_items__item_id__patch","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"integer","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["expenditures"],"summary":"Delete Item","description":"Admin-only: soft-delete a single expenditure item.\n\nStamps ``deleted_at``/``deleted_by`` plus ``removed_from_source_at``, so the\nrow leaves every listing and total through the same exclusion the re-import\nsoft-removal uses, while the dedicated columns stop the next re-import's\nun-soft-delete from resurrecting it (the source may well still carry the\nrow — see ``_upsert_items``) and keep \"admin deleted\" distinguishable from\n\"gone at source\". Reversible via the restore endpoint; the row and its\ncategorisation history stay in the table.\n\nRefund rows linked to this item are unlinked, mirroring the FK's\nSET-NULL-on-hard-delete semantics — the matcher may re-link them to another\ncandidate on a later import, but never back to a deleted row (it only\nconsiders active originals).","operationId":"delete_item_claims__claim_id__expenditures_items__item_id__delete","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"integer","title":"Item Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/items/{item_id}/admin-note":{"get":{"tags":["expenditures"],"summary":"Get Item Admin Note","description":"Admin-only: fetch the editable note value for a live expenditure item.\n\nClaim users receive the same value read-only on the shared list/grouped\nresponses; this endpoint remains admin-gated because it backs the editor.","operationId":"get_item_admin_note_claims__claim_id__expenditures_items__item_id__admin_note_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"integer","title":"Item Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemAdminNoteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["expenditures"],"summary":"Update Item Admin Note","description":"Admin-only: replace or clear an expenditure item's internal note.\n\nNotes are annotations, not expenditure classification edits, so saving one\nintentionally leaves manual-override and refund-mirroring state untouched.","operationId":"update_item_admin_note_claims__claim_id__expenditures_items__item_id__admin_note_put","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"integer","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemAdminNoteUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemAdminNoteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/subgroups/admin-note":{"get":{"tags":["expenditures"],"summary":"Get Subgroup Admin Note","description":"Admin-only: fetch the editable note for an ordinary subgroup.","operationId":"get_subgroup_admin_note_claims__claim_id__expenditures_subgroups_admin_note_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"category","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":50,"title":"Category"}},{"name":"subgroup_key","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":255,"title":"Subgroup Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScopedAdminNoteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["expenditures"],"summary":"Update Subgroup Admin Note","description":"Admin-only: replace or clear an ordinary subgroup's note.","operationId":"update_subgroup_admin_note_claims__claim_id__expenditures_subgroups_admin_note_put","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubgroupAdminNoteUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScopedAdminNoteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/salaries/payslips/{payslip_id}/admin-note":{"get":{"tags":["expenditures"],"summary":"Get Salary Payslip Admin Note","description":"Admin-only: fetch the editable note for one Xero payslip.","operationId":"get_salary_payslip_admin_note_claims__claim_id__expenditures_salaries_payslips__payslip_id__admin_note_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"payslip_id","in":"path","required":true,"schema":{"type":"integer","title":"Payslip Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScopedAdminNoteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["expenditures"],"summary":"Update Salary Payslip Admin Note","description":"Admin-only: replace or clear one Xero payslip's note.","operationId":"update_salary_payslip_admin_note_claims__claim_id__expenditures_salaries_payslips__payslip_id__admin_note_put","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"payslip_id","in":"path","required":true,"schema":{"type":"integer","title":"Payslip Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemAdminNoteUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScopedAdminNoteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/salaries/employees/{employee_identity_id}/admin-note":{"get":{"tags":["expenditures"],"summary":"Get Salary Subgroup Admin Note","description":"Admin-only: fetch the editable note for one employee salary subgroup.","operationId":"get_salary_subgroup_admin_note_claims__claim_id__expenditures_salaries_employees__employee_identity_id__admin_note_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"employee_identity_id","in":"path","required":true,"schema":{"type":"integer","title":"Employee Identity Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScopedAdminNoteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["expenditures"],"summary":"Update Salary Subgroup Admin Note","description":"Admin-only: replace or clear one employee salary subgroup's note.","operationId":"update_salary_subgroup_admin_note_claims__claim_id__expenditures_salaries_employees__employee_identity_id__admin_note_put","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"employee_identity_id","in":"path","required":true,"schema":{"type":"integer","title":"Employee Identity Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemAdminNoteUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScopedAdminNoteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/items/{item_id}/apportionments":{"put":{"tags":["expenditures"],"summary":"Set Item Apportionments","description":"Replace the full R&D-activity apportionment for one item.\n\nEach entry's ``percentage`` is that activity's R&D portion of the item; the\nlist may sum to <= 100 (any remainder is non-R&D). An empty list clears the\napportionment, sending the item back to the Ungrouped / non-R&D bucket. The\nitem's cached ``rd_percentage`` / ``eligibility`` / ``activity_id`` are kept\nin sync. Salary rows use the dedicated Salary-tab editor, not this\nmixed-item endpoint.","operationId":"set_item_apportionments_claims__claim_id__expenditures_items__item_id__apportionments_put","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"integer","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetItemApportionmentsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/employee-distributions":{"get":{"tags":["expenditures"],"summary":"Get Employee Distributions","description":"Current employee distributions, one per scope, ids in display space.\nAn unavailable scope (no rates / empty Engineering group) serves\n``available: false`` with empty shares — the UI disables that option.","operationId":"get_employee_distributions_claims__claim_id__expenditures_employee_distributions_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeDistributionsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/items/{item_id}/distribution-link":{"put":{"tags":["expenditures"],"summary":"Set Item Distribution Link","description":"Link this item to an employee distribution, or opt it out.\n\n'all' / 'engineering' link it (an unavailable scope is accepted — the\nlink persists and the sync no-ops until the aggregate exists; the UI's\ndisabled state is guidance, not an invariant). 'none' is the explicit\nopt-out — uniform for individually-linked items and subgroup-derived\nmembers; an opted-out item is not recaptured by a future subgroup link.\nNever writes NULL (the follow-subgroup default) — once toggled, the\nitem's state is its own. Documented permanence, not an oversight.\n\nOpting out also zeroes the row's R&D (see :func:`_zero_item_rd_for_unlink`):\nthe derived split goes with the link. Editing the split is the path that\nkeeps the numbers — it opts the item out on its own.","operationId":"set_item_distribution_link_claims__claim_id__expenditures_items__item_id__distribution_link_put","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"integer","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetItemDistributionLinkRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/items/{item_id}/restore":{"post":{"tags":["expenditures"],"summary":"Restore Item","description":"Admin-only: undo a soft delete. Backs the delete toast's Undo action.\n\nClears ``deleted_at``/``deleted_by`` and ``removed_from_source_at`` — the\ndelete only ever targets active rows, so the removal stamp is the delete's\nown; if the source row has genuinely disappeared since, the next re-import\nre-stamps it. Refunds unlinked by the delete stay unlinked (the matcher may\nre-link them on a later import).","operationId":"restore_item_claims__claim_id__expenditures_items__item_id__restore_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"integer","title":"Item Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/items/bulk":{"post":{"tags":["expenditures"],"summary":"Bulk Update Items","description":"Apply ``eligibility``, ``category``, and/or ``activity_id`` to every item\nin a subgroup. ``activity_id: null`` moves the group to the Ungrouped\nbucket. Each updated item gets ``manual_override=True``.","operationId":"bulk_update_items_claims__claim_id__expenditures_items_bulk_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkUpdateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/items/bulk-by-ids":{"post":{"tags":["expenditures"],"summary":"Bulk Update Items By Ids","description":"Apply ``eligibility`` / ``category`` / ``activity_id`` / ``subgroup_key``\nto every live item on this claim whose id is in ``item_ids``. Each changed\nitem gets ``manual_override=True``.\n\nIds that don't resolve to a live item on this claim — synthetic salary rows,\nitems on other claims, already-removed rows, linked refund rows (derived —\nthey follow their original via the mirror), or unknown ids — are silently\nskipped, so ``updated_count`` reflects only real changes. The\n``claim_id``-scoped query is the authorization boundary: ids belonging to\nanother claim match nothing.","operationId":"bulk_update_items_by_ids_claims__claim_id__expenditures_items_bulk_by_ids_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkUpdateByIdsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkUpdateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/items/bulk-apportionments-by-ids":{"post":{"tags":["expenditures"],"summary":"Bulk Set Item Apportionments By Ids","description":"Replace the R&D-activity split on every live item in ``item_ids`` with the\nsame ``apportionments``. Each changed item is flipped to R&D-eligible and gets\n``manual_override=True``.\n\nMirrors :func:`bulk_update_items_by_ids` for auth/scoping: the\n``claim_id``-scoped query is the authorization boundary (ids on another claim\nmatch nothing). Synthetic salary ids and real salary-category rows are skipped\n(employees are apportioned on the Salary tab), as are already-removed,\nlinked refund rows (derived — they follow their original via the mirror), or\nunknown ids — so ``updated_count`` reflects only real changes. Items whose\nsplit already equals the requested one are left untouched (idempotent).","operationId":"bulk_set_item_apportionments_by_ids_claims__claim_id__expenditures_items_bulk_apportionments_by_ids_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkSetApportionmentsByIdsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkUpdateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/items/bulk-distribution-link-by-ids":{"post":{"tags":["expenditures"],"summary":"Bulk Set Item Distribution Link By Ids","description":"Stamp ``scope`` onto every live item in ``item_ids`` and materialise the\nderived splits. Per-item semantics are exactly :func:`set_item_distribution_link`'s\n— 'all'/'engineering' link (an unavailable scope is accepted; the sync\nno-ops until the aggregate exists), 'none' is the explicit opt-out that\nkeeps the last computed split and is not recaptured by a future subgroup\nlink, and NULL (follow-subgroup) is never written. An item already\nfollowing via its subgroup is still stamped: the selection is an explicit\nper-item instruction, so the link outlives the subgroup's.\n\nMirrors :func:`bulk_set_item_apportionments_by_ids` for auth/scoping: the\n``claim_id``-scoped query is the authorization boundary (ids on another\nclaim match nothing). Synthetic salary ids and real salary-category rows\nare skipped (employees are apportioned on the Salary tab), as are\nalready-removed, asset-promoted, linked refund (derived — they follow their\noriginal via the mirror), and unknown ids. ``updated_count`` counts items\nwhose stored scope actually changed, so re-applying the same scope reports 0\n— except under 'none', which also counts rows whose R&D it zeroed (an\nalready-opted-out row can still be carrying a derived split to clear).","operationId":"bulk_set_item_distribution_link_by_ids_claims__claim_id__expenditures_items_bulk_distribution_link_by_ids_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkSetDistributionLinkByIdsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkUpdateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/auto-categorise":{"post":{"tags":["expenditures"],"summary":"Start Auto Categorise","description":"Start an AI auto-categorisation run over the selected items and return a\njob to poll.\n\nAdmin-only: AI categorisation is an internal review tool, so regular users\n(customers) are blocked at the API (``get_admin_user`` → 403), not just in\nthe UI. ``get_admin_user`` checks the real session user, so an admin\nimpersonating a customer can still run it.\n\nClassified rows get a ``category`` (and, when ``include_eligibility``, an R&D\n``eligibility``) and are flagged ``auto_categorised`` — the AI path never sets\n``manual_override`` and never assigns a project/activity. Synthetic salary ids\nand ids not resolving to a live item on this claim are dropped (the\nclaim-scoped query is the authorization boundary), so ``total`` reflects only\nreal, processable rows.","operationId":"start_auto_categorise_claims__claim_id__expenditures_auto_categorise_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoCategoriseRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoCategoriseJobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/auto-categorise/active":{"get":{"tags":["expenditures"],"summary":"Get Active Auto Categorise","description":"The latest non-terminal auto-categorise job for this claim, or ``null``.\n\nLets the UI re-attach its progress bar after a page refresh / navigation.","operationId":"get_active_auto_categorise_claims__claim_id__expenditures_auto_categorise_active_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AutoCategoriseJobResponse"},{"type":"null"}],"title":"Response Get Active Auto Categorise Claims  Claim Id  Expenditures Auto Categorise Active Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/auto-categorise/{job_id}":{"get":{"tags":["expenditures"],"summary":"Get Auto Categorise Job","description":"Poll progress for one auto-categorise job. The claim scope is the\nauthorization boundary — a job on another claim 404s.","operationId":"get_auto_categorise_job_claims__claim_id__expenditures_auto_categorise__job_id__get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"job_id","in":"path","required":true,"schema":{"type":"integer","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoCategoriseJobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/ai-suggestions":{"get":{"tags":["expenditures"],"summary":"List Ai Suggestions","description":"Admin-only: pending AI categorisation proposals for this claim, each paired\nwith the live item's current values for side-by-side display.\n\nScoped to the claim (the authorization boundary) and to live items only — a\nsuggestion whose item was removed/promoted since the run is filtered out.","operationId":"list_ai_suggestions_claims__claim_id__expenditures_ai_suggestions_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiSuggestionsListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/ai-suggestions/approve":{"post":{"tags":["expenditures"],"summary":"Approve Ai Suggestions","description":"Admin-only: apply each selected pending proposal to its live item and mark\nit approved. Per-item (one id), bulk (many ids), or approve-all (``all=True``).\n\nApplies the same writes the old inline AI path did: sets category, sets\nsubgroup unless the item was hand-curated (NULL proposed_subgroup_key),\nsets eligibility, clears the R&D split / rd_percentage / activity on a\nnon-eligible proposal, sets ``auto_categorised`` and clears\n``manual_override_by_admin``. Never sets ``manual_override`` — provenance is\nstill the AI. A suggestion whose item no longer resolves is skipped.","operationId":"approve_ai_suggestions_claims__claim_id__expenditures_ai_suggestions_approve_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiSuggestionDecisionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiSuggestionDecisionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/ai-suggestions/reject":{"post":{"tags":["expenditures"],"summary":"Reject Ai Suggestions","description":"Admin-only: discard each selected pending proposal (``status='rejected'``),\nleaving the live item unchanged. Per-item, bulk, or reject-all.","operationId":"reject_ai_suggestions_claims__claim_id__expenditures_ai_suggestions_reject_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiSuggestionDecisionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiSuggestionDecisionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/subgroups/merge":{"post":{"tags":["expenditures"],"summary":"Merge Subgroups","description":"Merge every item in ``source`` into ``target``. Each moved item picks\nup ``target.category`` + ``target.subgroup_key`` and is flagged\n``manual_override=True``.\n\nLinked refunds are excluded from the sweep (derived rows) and instead follow\ntheir original via the mirror — in both directions: the mirror here re-flows\nthe merged originals onto their refunds, and ``reverse_subgroup_merge`` mirrors\nagain on restore so the refunds come back out of the target too.\n\nRecords an :class:`AURDExpenditureSubgroupMergeEvent` capturing each\nmoved item's pre-merge tuple so an admin can later reverse the merge.","operationId":"merge_subgroups_claims__claim_id__expenditures_subgroups_merge_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MergeSubgroupRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkUpdateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/subgroups/rename":{"post":{"tags":["expenditures"],"summary":"Rename Subgroup","description":"Rename a subgroup by rewriting ``subgroup_key`` on every active item in\n``(category, subgroup_key)`` to ``new_subgroup_key``. Each touched item is\nflagged ``manual_override=True``, and any subgroup-scoped query threads on\nthe old key are carried over so their open-query badge follows the rename.\n\nRejected (400) for the salaries bucket — its keys are synthesised per\nemployee identity. Rejected (409) if the new name already exists in the\ncategory, to avoid a rename silently becoming a merge.","operationId":"rename_subgroup_claims__claim_id__expenditures_subgroups_rename_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenameSubgroupRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkUpdateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/subgroups/distribution-link":{"post":{"tags":["expenditures"],"summary":"Set Subgroup Distribution Link","description":"Link a whole subgroup to an employee distribution (NULL-scope members\nfollow it, including items imported later), rescope it, or unlink it.\nKeys are stored verbatim — sentinels included — matching how\nassign_subgroup_to_activity addresses subgroups. Unlink zeroes the R&D of\nthe members that were following the link, matching the per-item opt-out;\n``updated_count`` is that many rows.","operationId":"set_subgroup_distribution_link_claims__claim_id__expenditures_subgroups_distribution_link_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetSubgroupDistributionLinkRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkUpdateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/subgroups/assign-activity":{"post":{"tags":["expenditures"],"summary":"Assign Subgroup To Activity","description":"Set ``activity_id`` on every item in ``source`` to the requested\nactivity (or NULL to send the subgroup back to Ungrouped). Items whose\nsplit actually changes are flagged ``manual_override=True`` (via the\napportionment writer); every matched item — including those already at\nthe target — is additionally stamped out of distribution links, WITHOUT\n``manual_override`` when the stamp is the only change. ``updated_count``\ntherefore means \"splits changed or stopped following a distribution\".\n\nSalaries are rejected on the same grounds as :func:`merge_subgroups` —\nthey're synthesised from ``aurd_employee_rates`` and apportioned via\n:class:`AURDEmployeeCostApportionment`, not stored on the expenditure\nitems table.","operationId":"assign_subgroup_to_activity_claims__claim_id__expenditures_subgroups_assign_activity_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssignSubgroupToActivityRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkUpdateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/subgroup-merge-events":{"get":{"tags":["expenditures"],"summary":"List Subgroup Merge Events","description":"List un-reversed subgroup merge events for this claim, newest first.","operationId":"list_subgroup_merge_events_claims__claim_id__expenditures_subgroup_merge_events_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SubgroupMergeEventSummary"},"title":"Response List Subgroup Merge Events Claims  Claim Id  Expenditures Subgroup Merge Events Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/subgroup-merge-events/{event_id}/reverse":{"post":{"tags":["expenditures"],"summary":"Reverse Subgroup Merge","description":"Reverse the merge recorded in ``event_id`` for this claim.\n\nRestores every item still parked at the event's target back to its\npre-merge ``(category, subgroup_key, manual_override)`` tuple. Items\nmoved on or deleted since the merge are skipped (counted in the\nresponse). 404 if no open event with that id; 409 if a later\nun-reversed event must be reversed first (LIFO chain guard).","operationId":"reverse_subgroup_merge_claims__claim_id__expenditures_subgroup_merge_events__event_id__reverse_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"event_id","in":"path","required":true,"schema":{"type":"integer","title":"Event Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReverseSubgroupMergeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/salaries/payslips":{"get":{"tags":["expenditures"],"summary":"List Salary Payslips","description":"Return all Xero payslips grouped by employee for the claim FY.","operationId":"list_salary_payslips_claims__claim_id__expenditures_salaries_payslips_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalaryPayslipsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/salaries/payslips/{payslip_id}/allocation":{"put":{"tags":["expenditures"],"summary":"Set Salary Payslip Allocation","description":"Set the R&D percentage and full activity split for one Xero payslip.","operationId":"set_salary_payslip_allocation_claims__claim_id__expenditures_salaries_payslips__payslip_id__allocation_put","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"payslip_id","in":"path","required":true,"schema":{"type":"integer","title":"Payslip Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetSalaryPayslipAllocationRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalaryPayslipRow"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/grouped":{"get":{"tags":["expenditures"],"summary":"List Items Grouped","description":"Return expenditures grouped by R&D activity.","operationId":"list_items_grouped_claims__claim_id__expenditures_grouped_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"eligibility","in":"query","required":false,"schema":{"enum":["all","r_and_d","non_eligible"],"type":"string","default":"all","title":"Eligibility"}},{"name":"from_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"From Date"}},{"name":"to_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"To Date"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GroupedItemsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/status":{"get":{"tags":["expenditures"],"summary":"Get Expenditures Status","description":"Release status for the expenditures tab. Bypasses the release gate so\nthe customer page can poll it to decide whether to render the sub-tab.\n\nOnce approved, the response also carries the same full R&D expenditure\ntotal used by the expenditures page and review-answer prefill. Keeping it\nbehind the approval branch means unreleased financial totals stay hidden.","operationId":"get_expenditures_status_claims__claim_id__expenditures_status_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpendituresStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/internal/expenditures/{claim_id}/approve":{"post":{"tags":["expenditures"],"summary":"Approve Expenditures Internal","description":"Release the curated expenditures to the customer.","operationId":"approve_expenditures_internal_claims_internal_expenditures__claim_id__approve_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/internal/expenditures/{claim_id}/reject":{"post":{"tags":["expenditures"],"summary":"Reject Expenditures Internal","description":"Mark the curated expenditures as rejected and hide them from the customer.\n\nUnlike tracking reject, no destructive data reset — the imported items\nstay in place so the admin can re-categorise and re-approve.","operationId":"reject_expenditures_internal_claims_internal_expenditures__claim_id__reject_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/internal/expenditures/{claim_id}/query-items/preview":{"post":{"tags":["expenditures"],"summary":"Preview Query Items","description":"Return live table rows for the bulk query composer.","operationId":"preview_query_items_claims_internal_expenditures__claim_id__query_items_preview_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueryItemSelectionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/_QuerySubgroupItemSummary"},"title":"Response Preview Query Items Claims Internal Expenditures  Claim Id  Query Items Preview Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/internal/expenditures/{claim_id}/selection-queries":{"post":{"tags":["expenditures"],"summary":"Create Items Query","description":"Admin raises one query against an arbitrary transaction selection.","operationId":"create_items_query_claims_internal_expenditures__claim_id__selection_queries_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateItemsQueryRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/internal/expenditures/{claim_id}/items/{item_id}/queries":{"post":{"tags":["expenditures"],"summary":"Create Item Query","description":"Admin raises a query against a specific expenditure line item.\n\nFor synthesised salary rows (``item_id >= _EMPLOYEE_RATE_ID_OFFSET``) the\nquery is recorded against the employee subgroup instead — there's no\n``aurd_expenditure_items`` row to anchor to. The DB row uses the same\n``aurd_expenditure_item_queries`` table with ``category='salaries'`` and\n``subgroup_key=<employee>`` (already supported by the scope-extension\nmigration ``exp_query_scope``).","operationId":"create_item_query_claims_internal_expenditures__claim_id__items__item_id__queries_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"integer","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateQueryRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/internal/expenditures/{claim_id}/salary-payslips/{payslip_id}/queries":{"post":{"tags":["expenditures"],"summary":"Create Salary Payslip Query","description":"Admin raises a query against one Xero salary payslip.","operationId":"create_salary_payslip_query_claims_internal_expenditures__claim_id__salary_payslips__payslip_id__queries_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"payslip_id","in":"path","required":true,"schema":{"type":"integer","title":"Payslip Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateQueryRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/internal/expenditures/{claim_id}/group-queries":{"post":{"tags":["expenditures"],"summary":"Create Group Query","description":"Admin raises a query against a whole subgroup under a claim.","operationId":"create_group_query_claims_internal_expenditures__claim_id__group_queries_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateGroupQueryRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/internal/expenditures/{claim_id}/general-queries":{"post":{"tags":["expenditures"],"summary":"Create General Query","description":"Admin raises a general query against a claim, not tied to any expense.\n\nThe query row has neither ``expenditure_item_id`` nor ``subgroup_key`` set,\nwhich the scope check constraint allows — its ``scope`` resolves to\n``\"general\"``.","operationId":"create_general_query_claims_internal_expenditures__claim_id__general_queries_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateQueryRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/queries/{query_id}/respond":{"post":{"tags":["expenditures"],"summary":"Respond To Query","description":"Customer (or claim collaborator with edit rights) appends a message.\n\nWorks for both item-scoped and group-scoped queries. Allowed from any\nnon-resolved state, so customers can post several messages in a row.","operationId":"respond_to_query_claims__claim_id__expenditures_queries__query_id__respond_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"query_id","in":"path","required":true,"schema":{"type":"integer","title":"Query Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddMessageRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/internal/expenditures/{claim_id}/queries/{query_id}/messages":{"post":{"tags":["expenditures"],"summary":"Add Admin Message","description":"Admin appends a follow-up message to an existing query thread.","operationId":"add_admin_message_claims_internal_expenditures__claim_id__queries__query_id__messages_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"query_id","in":"path","required":true,"schema":{"type":"integer","title":"Query Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddMessageRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/internal/expenditures/{claim_id}/queries/{query_id}/messages/{message_id}":{"patch":{"tags":["expenditures"],"summary":"Edit Query Message","description":"Admin edits an admin-authored message in a query thread.\n\nAdmins edit admin messages only — editing a customer message returns 403.\nResolved threads are locked.","operationId":"edit_query_message_claims_internal_expenditures__claim_id__queries__query_id__messages__message_id__patch","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"query_id","in":"path","required":true,"schema":{"type":"integer","title":"Query Id"}},{"name":"message_id","in":"path","required":true,"schema":{"type":"integer","title":"Message Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EditMessageRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/internal/expenditures/{claim_id}/queries/{query_id}/resolve":{"post":{"tags":["expenditures"],"summary":"Resolve Query","description":"Admin marks a query resolved. Allowed from ``open`` or ``answered``.","operationId":"resolve_query_claims_internal_expenditures__claim_id__queries__query_id__resolve_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"query_id","in":"path","required":true,"schema":{"type":"integer","title":"Query Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/internal/expenditures/{claim_id}/queries/{query_id}":{"delete":{"tags":["expenditures"],"summary":"Delete Query","description":"Admin deletes a query that the customer has not engaged with yet.\n\nAllowed only when the thread contains nothing but the seed admin message.\nOnce anyone has appended another message, the thread is no longer\ndeletable — even if a later admin reply puts the status back to ``open``.","operationId":"delete_query_claims_internal_expenditures__claim_id__queries__query_id__delete","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"query_id","in":"path","required":true,"schema":{"type":"integer","title":"Query Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/queries":{"get":{"tags":["expenditures"],"summary":"List Queries","description":"List all expenditure queries for a claim, optionally filtered by status.","operationId":"list_queries_claims__claim_id__expenditures_queries_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"enum":["open","answered","resolved"],"type":"string"},{"type":"null"}],"title":"Status"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/QueryResponse"},"title":"Response List Queries Claims  Claim Id  Expenditures Queries Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/assets":{"get":{"tags":["expenditures"],"summary":"List Assets","description":"List the claim's depreciating assets with their computed FY decline in\nvalue and R&D-eligible portion.","operationId":"list_assets_claims__claim_id__expenditures_assets_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["expenditures"],"summary":"Create Asset","description":"Admin-only: add a depreciating R&D asset by hand.","operationId":"create_asset_claims__claim_id__expenditures_assets_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/items/{item_id}/promote-to-asset":{"post":{"tags":["expenditures"],"summary":"Promote Item To Asset","description":"Admin-only: promote an expenditure transaction into a depreciating asset.\n\nSeeds a new ``AURDDepreciatingAsset`` (source \"transaction\", linked by\n``source_item_id``) from the item, and flags the item ``promoted_to_asset_at``\nso it drops out of the expenses list/totals — the spend is now claimed as\ndepreciation, not as an immediate expense. Reverse by deleting the asset.","operationId":"promote_item_to_asset_claims__claim_id__expenditures_items__item_id__promote_to_asset_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"integer","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PromoteToAssetPayload"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/assets/{asset_id}":{"patch":{"tags":["expenditures"],"summary":"Update Asset","description":"Admin-only: edit a depreciating asset. PATCH semantics — only the fields\npresent in the JSON change.","operationId":"update_asset_claims__claim_id__expenditures_assets__asset_id__patch","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"asset_id","in":"path","required":true,"schema":{"type":"integer","title":"Asset Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["expenditures"],"summary":"Delete Asset","description":"Admin-only: delete a depreciating asset.\n\nIf the asset was promoted from a transaction (source \"transaction\"), the\nsource transaction is restored to the expenses list — deleting the asset is\nthe reverse of \"Mark as depreciating asset\".","operationId":"delete_asset_claims__claim_id__expenditures_assets__asset_id__delete","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"asset_id","in":"path","required":true,"schema":{"type":"integer","title":"Asset Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/credit-notes":{"get":{"tags":["expenditures"],"summary":"List Credit Notes","description":"List the claim's supplier credit notes (newest first). Amounts are\nGST-exclusive AUD, matching the expenditure items they offset.","operationId":"list_credit_notes_claims__claim_id__expenditures_credit_notes_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditNoteListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/profit-loss":{"get":{"tags":["expenditures"],"summary":"Get Profit Loss Report","description":"The stored claim-period Xero P&L report (Profit & loss tab).\n\nAdmin-only consultant reference — auth is the same dependency pair as\n``export_items_csv`` (see its docstring; don't collapse them). Returns\n``synced=False`` (not 404) when no report has been imported so the\nfrontend can distinguish \"not synced yet\" from errors.","operationId":"get_profit_loss_report_claims__claim_id__expenditures_profit_loss_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfitLossResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/profit-loss.xlsx":{"get":{"tags":["expenditures"],"summary":"Export Profit Loss Xlsx","description":"Download the stored claim-period Xero P&L as an XLSX workbook.\n\nAdmin-only. XLSX opens natively in Excel and can be imported directly into\nGoogle Sheets. The auth dependency pair intentionally matches\n``get_profit_loss_report`` and ``export_items_csv``: the real session owner\nmust be an admin, and the active identity must be able to access the claim.","operationId":"export_profit_loss_xlsx_claims__claim_id__expenditures_profit_loss_xlsx_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/expenditures/ledger":{"get":{"tags":["expenditures"],"summary":"List Ledger Transactions","description":"Paginated claim-period document ledger (Transaction history tab).\n\nAdmin-only consultant reference — auth is the same dependency pair as\n``export_items_csv`` (see its docstring; don't collapse them). Money-in/out\ntotals are computed over the CURRENT filter (not the page); rows with\n``direction IS NULL`` (manual journals) are excluded from both totals.\nNote payments duplicate the invoices they settle, so all-types totals\ndouble-count — the type filter is the tool for clean sums.","operationId":"list_ledger_transactions_claims__claim_id__expenditures_ledger_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":100,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"source_type","in":"query","required":false,"schema":{"anyOf":[{"enum":["invoice_accrec","invoice_accpay","bank_transaction","credit_note","payment","overpayment","prepayment","manual_journal"],"type":"string"},{"type":"null"}],"title":"Source Type"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LedgerListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/rd-schedule":{"get":{"tags":["rd-schedule"],"summary":"Get Rd Schedule","operationId":"get_rd_schedule_claims__claim_id__rd_schedule_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Rd Schedule Claims  Claim Id  Rd Schedule Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["rd-schedule"],"summary":"Update Rd Schedule","operationId":"update_rd_schedule_claims__claim_id__rd_schedule_put","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RDScheduleUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update Rd Schedule Claims  Claim Id  Rd Schedule Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/rd-schedule/release":{"post":{"tags":["rd-schedule"],"summary":"Release Rd Schedule","description":"Make the prepared schedule visible (read-only) to the customer.","operationId":"release_rd_schedule_claims__claim_id__rd_schedule_release_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Release Rd Schedule Claims  Claim Id  Rd Schedule Release Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/rd-schedule/unrelease":{"post":{"tags":["rd-schedule"],"summary":"Unrelease Rd Schedule","description":"Hide the schedule from the customer again while it is reworked.","operationId":"unrelease_rd_schedule_claims__claim_id__rd_schedule_unrelease_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Unrelease Rd Schedule Claims  Claim Id  Rd Schedule Unrelease Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claims/{claim_id}/rd-schedule/export":{"post":{"tags":["rd-schedule"],"summary":"Export Rd Schedule","operationId":"export_rd_schedule_claims__claim_id__rd_schedule_export_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/github-app/webhook":{"post":{"tags":["auth"],"summary":"Github App Webhook","description":"Handle GitHub App webhook events (installation, etc.).\n\nThis endpoint receives events when:\n- App is installed on an organization\n- App is uninstalled\n- Installation permissions are changed","operationId":"github_app_webhook_auth_github_app_webhook_post","parameters":[{"name":"x-hub-signature-256","in":"header","required":false,"schema":{"type":"string","title":"X-Hub-Signature-256"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/github-app/connect":{"get":{"tags":["auth"],"summary":"Connect Github App","operationId":"connect_github_app_auth_github_app_connect_get","parameters":[{"name":"claim_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/github-app/callback":{"get":{"tags":["auth"],"summary":"Github App Callback","description":"Handle the GitHub user-authorization callback (legacy, non-Nango path).\n\nExchanges the code for a user-to-server token and checks for installations.\nGitHub also appends ``installation_id``/``setup_action`` when the\nauthorization was triggered by an App install; both are ignored here — the\ninstall itself is bookkept by the webhook, and the install prompt is driven\nby ``has_installations`` below.","operationId":"github_app_callback_auth_github_app_callback_get","parameters":[{"name":"code","in":"query","required":false,"schema":{"type":"string","title":"Code"}},{"name":"state","in":"query","required":false,"schema":{"type":"string","title":"State"}},{"name":"error","in":"query","required":false,"schema":{"type":"string","title":"Error"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/github-app/disconnect":{"delete":{"tags":["auth"],"summary":"Disconnect Github App","description":"Disconnect GitHub App integration.","operationId":"disconnect_github_app_auth_github_app_disconnect_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/google-drive/connect":{"get":{"tags":["auth"],"summary":"Connect Google Drive","description":"Initiate Google Drive OAuth flow.\n\nRedirects user to Google OAuth page.","operationId":"connect_google_drive_auth_google_drive_connect_get","parameters":[{"name":"claim_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/google-drive/callback":{"get":{"tags":["auth"],"summary":"Google Drive Callback","description":"Handle Google Drive OAuth callback.\n\nGoogle redirects here after user authorizes.","operationId":"google_drive_callback_auth_google_drive_callback_get","parameters":[{"name":"code","in":"query","required":false,"schema":{"type":"string","title":"Code"}},{"name":"state","in":"query","required":false,"schema":{"type":"string","title":"State"}},{"name":"error","in":"query","required":false,"schema":{"type":"string","title":"Error"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/google-drive/disconnect":{"delete":{"tags":["auth"],"summary":"Disconnect Google Drive","description":"Disconnect Google Drive integration.","operationId":"disconnect_google_drive_auth_google_drive_disconnect_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/jira/connect":{"get":{"tags":["auth"],"summary":"Connect Jira","description":"Initiate Jira OAuth flow.\n\nRedirects user to Jira OAuth page.","operationId":"connect_jira_auth_jira_connect_get","parameters":[{"name":"claim_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/jira/callback":{"get":{"tags":["auth"],"summary":"Jira Callback","description":"Handle Jira OAuth callback.\n\nJira redirects here after user authorizes.","operationId":"jira_callback_auth_jira_callback_get","parameters":[{"name":"code","in":"query","required":false,"schema":{"type":"string","title":"Code"}},{"name":"state","in":"query","required":false,"schema":{"type":"string","title":"State"}},{"name":"error","in":"query","required":false,"schema":{"type":"string","title":"Error"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/jira/disconnect":{"delete":{"tags":["auth"],"summary":"Disconnect Jira","description":"Disconnect Jira integration.","operationId":"disconnect_jira_auth_jira_disconnect_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/confluence/connect":{"get":{"tags":["auth"],"summary":"Connect Confluence","description":"Initiate Confluence OAuth flow.","operationId":"connect_confluence_auth_confluence_connect_get","parameters":[{"name":"claim_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/confluence/callback":{"get":{"tags":["auth"],"summary":"Confluence Callback","description":"Handle Confluence OAuth callback.","operationId":"confluence_callback_auth_confluence_callback_get","parameters":[{"name":"code","in":"query","required":false,"schema":{"type":"string","title":"Code"}},{"name":"state","in":"query","required":false,"schema":{"type":"string","title":"State"}},{"name":"error","in":"query","required":false,"schema":{"type":"string","title":"Error"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/confluence/disconnect":{"delete":{"tags":["auth"],"summary":"Disconnect Confluence","description":"Disconnect Confluence integration.","operationId":"disconnect_confluence_auth_confluence_disconnect_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/linear/connect":{"get":{"tags":["auth"],"summary":"Connect Linear","description":"Initiate Linear OAuth flow.\n\nRedirects user to Linear OAuth page.","operationId":"connect_linear_auth_linear_connect_get","parameters":[{"name":"claim_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/linear/callback":{"get":{"tags":["auth"],"summary":"Linear Callback","description":"Handle Linear OAuth callback.\n\nLinear redirects here after user authorizes.","operationId":"linear_callback_auth_linear_callback_get","parameters":[{"name":"code","in":"query","required":false,"schema":{"type":"string","title":"Code"}},{"name":"state","in":"query","required":false,"schema":{"type":"string","title":"State"}},{"name":"error","in":"query","required":false,"schema":{"type":"string","title":"Error"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/linear/disconnect":{"delete":{"tags":["auth"],"summary":"Disconnect Linear","description":"Disconnect Linear integration.","operationId":"disconnect_linear_auth_linear_disconnect_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/nango/session":{"post":{"tags":["auth"],"summary":"Create Session","operationId":"create_session_auth_nango_session_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/nango/finalize":{"post":{"tags":["auth"],"summary":"Finalize","operationId":"finalize_auth_nango_finalize_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FinalizeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/nango/reconnect":{"post":{"tags":["auth"],"summary":"Reconnect","operationId":"reconnect_auth_nango_reconnect_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReconnectRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/webhooks/nango":{"post":{"tags":["webhooks"],"summary":"Nango Webhook","operationId":"nango_webhook_webhooks_nango_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/trello/connect":{"get":{"tags":["auth"],"summary":"Connect Trello","description":"Initiate the Trello token authorize flow.\n\nRedirects the user to Trello's authorize page. Trello returns the token in\nthe fragment of ``return_url`` (the frontend ``/auth/trello/finish`` page).","operationId":"connect_trello_auth_trello_connect_get","parameters":[{"name":"claim_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/trello/callback":{"post":{"tags":["auth"],"summary":"Trello Callback","description":"Finalize the Trello connection.\n\nCalled by the frontend ``/auth/trello/finish`` page with the ``state`` and the\n``token`` extracted from the URL fragment. Returns JSON (the caller is an XHR).","operationId":"trello_callback_auth_trello_callback_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrelloCallbackRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/trello/disconnect":{"delete":{"tags":["auth"],"summary":"Disconnect Trello","description":"Disconnect Trello integration.","operationId":"disconnect_trello_auth_trello_disconnect_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/notion/connect":{"get":{"tags":["auth"],"summary":"Connect Notion","description":"Initiate Notion OAuth flow.\n\nRedirects user to Notion OAuth page.","operationId":"connect_notion_auth_notion_connect_get","parameters":[{"name":"claim_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/notion/callback":{"get":{"tags":["auth"],"summary":"Notion Callback","description":"Handle Notion OAuth callback.\n\nNotion redirects here after user authorizes.","operationId":"notion_callback_auth_notion_callback_get","parameters":[{"name":"code","in":"query","required":false,"schema":{"type":"string","title":"Code"}},{"name":"state","in":"query","required":false,"schema":{"type":"string","title":"State"}},{"name":"error","in":"query","required":false,"schema":{"type":"string","title":"Error"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/notion/disconnect":{"delete":{"tags":["auth"],"summary":"Disconnect Notion","description":"Disconnect Notion integration.","operationId":"disconnect_notion_auth_notion_disconnect_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/gitlab/connect":{"get":{"tags":["auth"],"summary":"Connect Gitlab","description":"Initiate GitLab OAuth flow.\n\nRedirects user to GitLab OAuth page.","operationId":"connect_gitlab_auth_gitlab_connect_get","parameters":[{"name":"claim_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/gitlab/callback":{"get":{"tags":["auth"],"summary":"Gitlab Callback","description":"Handle GitLab OAuth callback.\n\nGitLab redirects here after user authorizes.","operationId":"gitlab_callback_auth_gitlab_callback_get","parameters":[{"name":"code","in":"query","required":false,"schema":{"type":"string","title":"Code"}},{"name":"state","in":"query","required":false,"schema":{"type":"string","title":"State"}},{"name":"error","in":"query","required":false,"schema":{"type":"string","title":"Error"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/gitlab/disconnect":{"delete":{"tags":["auth"],"summary":"Disconnect Gitlab","description":"Disconnect GitLab integration.","operationId":"disconnect_gitlab_auth_gitlab_disconnect_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/bitbucket/connect":{"get":{"tags":["bitbucket"],"summary":"Connect Bitbucket","description":"Initiate Bitbucket OAuth flow.\n\nRedirects user to Bitbucket OAuth page.","operationId":"connect_bitbucket_auth_bitbucket_connect_get","parameters":[{"name":"claim_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/bitbucket/callback":{"get":{"tags":["bitbucket"],"summary":"Bitbucket Callback","description":"Handle Bitbucket OAuth callback.\n\nBitbucket redirects here after user authorizes.","operationId":"bitbucket_callback_auth_bitbucket_callback_get","parameters":[{"name":"code","in":"query","required":false,"schema":{"type":"string","title":"Code"}},{"name":"state","in":"query","required":false,"schema":{"type":"string","title":"State"}},{"name":"error","in":"query","required":false,"schema":{"type":"string","title":"Error"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/bitbucket/disconnect":{"delete":{"tags":["bitbucket"],"summary":"Disconnect Bitbucket","description":"Disconnect Bitbucket integration.","operationId":"disconnect_bitbucket_auth_bitbucket_disconnect_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/xero/connect":{"get":{"tags":["auth"],"summary":"Connect Xero","description":"Initiate Xero OAuth flow.","operationId":"connect_xero_auth_xero_connect_get","parameters":[{"name":"claim_id","in":"query","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/xero/callback":{"get":{"tags":["auth"],"summary":"Xero Callback","description":"Handle Xero OAuth callback.","operationId":"xero_callback_auth_xero_callback_get","parameters":[{"name":"code","in":"query","required":false,"schema":{"type":"string","title":"Code"}},{"name":"state","in":"query","required":false,"schema":{"type":"string","title":"State"}},{"name":"error","in":"query","required":false,"schema":{"type":"string","title":"Error"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/xero/select-tenant":{"post":{"tags":["auth"],"summary":"Select Tenant","description":"Select only the organisation of the explicitly connected project.","operationId":"select_tenant_auth_xero_select_tenant_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SelectTenantRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/xero/status":{"get":{"tags":["auth"],"summary":"Xero Status","description":"Status of this project's connection, including when another user connected it.","operationId":"xero_status_auth_xero_status_get","parameters":[{"name":"claim_id","in":"query","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/xero/disconnect":{"delete":{"tags":["auth"],"summary":"Disconnect Xero","description":"Disconnect Xero integration.","operationId":"disconnect_xero_auth_xero_disconnect_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/qbo/connect":{"get":{"tags":["auth"],"summary":"Connect Qbo","description":"Initiate QBO OAuth flow.","operationId":"connect_qbo_auth_qbo_connect_get","parameters":[{"name":"claim_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/qbo/callback":{"get":{"tags":["auth"],"summary":"Qbo Callback","description":"Handle QBO OAuth callback.\n\nIntuit redirects here with ?code=...&state=...&realmId=... after the user\nauthorises the app. We exchange the code for tokens, fetch CompanyInfo to\nresolve the company name/country, upsert the QBOIntegration row, and bind\nthe integration to the claim that initiated the flow.","operationId":"qbo_callback_auth_qbo_callback_get","parameters":[{"name":"code","in":"query","required":false,"schema":{"type":"string","title":"Code"}},{"name":"state","in":"query","required":false,"schema":{"type":"string","title":"State"}},{"name":"realmId","in":"query","required":false,"schema":{"type":"string","title":"Realmid"}},{"name":"error","in":"query","required":false,"schema":{"type":"string","title":"Error"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/qbo/status":{"get":{"tags":["auth"],"summary":"Qbo Status","description":"Return QBO connection state for the current user (optionally in claim context).\n\nWhen ``claim_id`` is provided, resolves the connector via ``ClaimDataSource.connected_by_id``\nso the response reports the connecting user's display name (not the viewing user's).\nWithout ``claim_id``, reports the viewing user's own integration.","operationId":"qbo_status_auth_qbo_status_get","parameters":[{"name":"claim_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/qbo/intuit-disconnect":{"get":{"tags":["auth"],"summary":"Qbo Intuit Disconnect","description":"Handle Intuit-initiated disconnect (user disconnected from inside QuickBooks).\n\nProduction URL: https://api.claimkit.co/auth/qbo/intuit-disconnect\nRegister this in Intuit Developer -> Keys & Credentials -> Production tab -> Disconnect URL.\n\nIntuit calls this as a GET with ?realmId=... in the query string when a user clicks\n\"Disconnect\" on the \"My Apps\" page inside QuickBooks Online. There is no signed header\nor shared secret — verification relies on the realmId being non-public and the endpoint\nbeing idempotent (cleanup only; always 200).\n\nUnlike ``DELETE /auth/qbo/disconnect`` (user-initiated from our side, requires ClaimKit\nauth), this endpoint is unauthenticated — it is Intuit notifying us server-to-server.\n\nBecause ``realm_id`` is not unique across ``QBOIntegration`` rows (two ClaimKit users\ncould connect the same QBO company), we clean up EVERY row matching the realm.","operationId":"qbo_intuit_disconnect_auth_qbo_intuit_disconnect_get","parameters":[{"name":"realmId","in":"query","required":true,"schema":{"type":"string","title":"Realmid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/qbo/disconnect":{"delete":{"tags":["auth"],"summary":"Qbo Disconnect","description":"Revoke QBO tokens at Intuit and remove integration + data-source rows for this user.","operationId":"qbo_disconnect_auth_qbo_disconnect_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/qbo/select-realm":{"post":{"tags":["auth"],"summary":"Qbo Select Realm","description":"Return the currently-bound realm for the user (v1 is single-realm).","operationId":"qbo_select_realm_auth_qbo_select_realm_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SelectRealmRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/leads":{"get":{"tags":["leads"],"summary":"List Leads","operationId":"list_leads_leads_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/LeadRead"},"type":"array","title":"Response List Leads Leads Get"}}}}}},"post":{"tags":["leads"],"summary":"Create Lead","operationId":"create_lead_leads_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadCreate"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Create Lead Leads Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/notifications":{"get":{"tags":["notifications"],"summary":"List Notifications","description":"One page of the session user's notifications, newest first, plus the total unread count.\n\nPass the last item's id as ``before_id`` to fetch the next (older) page;\n``has_more`` says whether there is one. ``unread_count`` covers every\npage, so an unread item past the first page is still counted and can be\nreached by paging.","operationId":"list_notifications_notifications_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"before_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"title":"Before Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/notifications/unread-count":{"get":{"tags":["notifications"],"summary":"Get Unread Count","description":"Unread total for the bell badge: the cheap call the dashboard polls.","operationId":"get_unread_count_notifications_unread_count_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnreadCountResponse"}}}}}}},"/notifications/read-all":{"post":{"tags":["notifications"],"summary":"Mark All Notifications Read","description":"Mark every unread notification for the session user as read.","operationId":"mark_all_notifications_read_notifications_read_all_post","responses":{"204":{"description":"Successful Response"}}}},"/notifications/{notification_id}/read":{"post":{"tags":["notifications"],"summary":"Mark Notification Read","description":"Mark one of the session user's notifications as read. Idempotent.","operationId":"mark_notification_read_notifications__notification_id__read_post","parameters":[{"name":"notification_id","in":"path","required":true,"schema":{"type":"integer","title":"Notification Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/activity-map-discovery/trigger":{"post":{"tags":["au-rd-tracking"],"summary":"Trigger Activity Map Discovery","description":"Manually fire (or re-fire) the activity-map pipeline on this claim.\n\nAdmin-only. Idempotent: if a run is already in flight, returns the\nexisting execution status without spawning a second.\n\nRequires the discovery_methodology toggle to be set on the claim —\notherwise the activity-map output isn't surfaced anywhere and the\nmulti-hour LLM cost would be wasted. Toggle off → 400.","operationId":"trigger_activity_map_discovery_aurd_tracking__claim_id__activity_map_discovery_trigger_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivityMapDiscoveryStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/activity-map-discovery/status":{"get":{"tags":["au-rd-tracking"],"summary":"Get Activity Map Discovery Status","description":"Status of the most recent activity-map run on this claim.\n\nRead-only; non-admins included so the UI can render the badge for\neveryone viewing a claim that's been opted in.","operationId":"get_activity_map_discovery_status_aurd_tracking__claim_id__activity_map_discovery_status_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivityMapDiscoveryStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/discovery-methodology":{"get":{"tags":["au-rd-tracking"],"summary":"Get Discovery Methodology","description":"Return the claim's current discovery methodology setting.\n\nRead-only; does not require admin. Frontend uses this to decide which\ntoggle state to render (legacy vs activity-map). The actual flip\nrequires the admin-gated /activate or /deactivate endpoints.","operationId":"get_discovery_methodology_aurd_tracking__claim_id__discovery_methodology_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DiscoveryMethodologyToggleResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/activate-discovery-methodology":{"post":{"tags":["au-rd-tracking"],"summary":"Activate Discovery Methodology","description":"Switch the claim to the activity-map (CLA-218) discovery pipeline.\n\nAdmin-only. After this, ``GET /{claim_id}/projects`` and\n``GET /{claim_id}/work-items`` (and any other reads gated on\n``effective_discovery_source``) read from the ``activity_map_*`` tables\ninstead of the legacy ``aurd_*`` tables. Reversible via /deactivate.\nActivating on a claim where activity-map hasn't yet run produces empty\nproject/work-item responses until the orchestrator is invoked\nseparately — the toggle is read-side only.","operationId":"activate_discovery_methodology_aurd_tracking__claim_id__activate_discovery_methodology_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DiscoveryMethodologyToggleResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/deactivate-discovery-methodology":{"post":{"tags":["au-rd-tracking"],"summary":"Deactivate Discovery Methodology","description":"Revert the claim to the legacy discovery pipeline.\n\nAdmin-only. Activity-map data remains in the ``activity_map_*`` tables\n(visible only via ``?source=activity-map`` admin override); the read\nendpoints stop returning it. Reversible via /activate.","operationId":"deactivate_discovery_methodology_aurd_tracking__claim_id__deactivate_discovery_methodology_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DiscoveryMethodologyToggleResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/projects":{"get":{"tags":["au-rd-tracking"],"summary":"List Projects","description":"List all projects for a claim with nested activities.\n\n`source` selects the data source. When omitted, the claim's\n``discovery_methodology`` decides:\n\n* ``NULL`` (default) -> ``legacy`` (read from the original AURD tables\n  via ``_build_project_list_response``).\n* non-null (e.g. ``\"activity-map.v1\"``) -> ``activity-map`` (read from\n  ``activity_map_*`` tables via\n  ``_build_project_list_response_from_activity_map``).\n\nPass an explicit ``?source=legacy|activity-map`` to override the claim\nsetting (admin dogfooding / dev testing). The status_filter argument is\nmapped to the activity-map builder's ``status_filter`` semantics\n(``active`` / ``all``); ``None`` becomes ``active``.\n\nNote: projects and activities with ``status='merged'`` (soft-deleted by\na reverse-mergeable merge) are always filtered out of this response. Use\n``GET …/projects/merged`` and ``GET …/activities/merged`` to enumerate\nthem; ``?status=merged`` here will return an empty list.","operationId":"list_projects_aurd_tracking__claim_id__projects_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"source","in":"query","required":false,"schema":{"anyOf":[{"enum":["legacy","activity-map"],"type":"string"},{"type":"null"}],"title":"Source"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["au-rd-tracking"],"summary":"Create Project","description":"Create a new project.\n\nLegacy claims insert an ``aurd_projects`` row. Activity-map claims\n(``request.source`` / ``discovery_methodology``) route to\n``_create_activity_map_project``, which audits the insert with an Edit row\nin a finalized human-edit version — see ``app.activity_map.edits.create``.","operationId":"create_project_aurd_tracking__claim_id__projects_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProjectRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/projects/{project_id}":{"patch":{"tags":["au-rd-tracking"],"summary":"Update Project","description":"Update a project.\n\nLegacy claims mutate the ``aurd_projects`` row in place. Activity-map\nclaims (``request.source`` / ``discovery_methodology``) route to\n``_update_activity_map_project``, which audits each changed field with an\nEdit row via ``app.activity_map.edits.labels``.","operationId":"update_project_aurd_tracking__claim_id__projects__project_id__patch","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateProjectRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["au-rd-tracking"],"summary":"Delete Project","description":"Delete a project.\n\nLegacy claims hard-delete the ``aurd_projects`` row. Activity-map claims\n(``?source=`` / ``discovery_methodology``) soft-delete the project and its\nactive/proposed activities (``status='deprecated'``), releasing their\nassignments — see ``app.activity_map.edits.delete``.","operationId":"delete_project_aurd_tracking__claim_id__projects__project_id__delete","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}},{"name":"source","in":"query","required":false,"schema":{"anyOf":[{"enum":["legacy","activity-map"],"type":"string"},{"type":"null"}],"title":"Source"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/projects/reorder":{"put":{"tags":["au-rd-tracking"],"summary":"Reorder Projects","description":"Reorder projects within a claim. Request must contain exactly all project IDs.","operationId":"reorder_projects_aurd_tracking__claim_id__projects_reorder_put","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReorderProjectsRequest"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/projects/{project_id}/activities":{"post":{"tags":["au-rd-tracking"],"summary":"Create Activity","description":"Create a new activity.\n\nLegacy claims insert into ``aurd_activities``. Activity-map claims\n(``request.source`` / ``discovery_methodology``) insert into\n``activity_map_activities`` via ``app.activity_map.edits.create`` — the\ninsert is audited with an Edit row and a finalized human-edit version.","operationId":"create_activity_aurd_tracking__claim_id__projects__project_id__activities_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateActivityRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivityResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/activities/{activity_id}":{"patch":{"tags":["au-rd-tracking"],"summary":"Update Activity","description":"Update an activity.\n\nLegacy claims mutate the ``aurd_activities`` row in place. Activity-map\nclaims (``request.source`` / ``discovery_methodology``) route to\n``_update_activity_map_activity``, which audits each changed field with an\nEdit row via ``app.activity_map.edits.labels``.","operationId":"update_activity_aurd_tracking__claim_id__activities__activity_id__patch","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"activity_id","in":"path","required":true,"schema":{"type":"integer","title":"Activity Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateActivityRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivityResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["au-rd-tracking"],"summary":"Delete Activity","description":"Delete an activity.\n\nLegacy claims: the ``aurd_activities`` row is hard-deleted; work items\nbecome uncategorized via the SET NULL FK.\n\nActivity-map claims (``?source=`` / ``discovery_methodology``): the\n``activity_map_activities`` row is soft-deleted (``status='deprecated'``),\nits current assignments are released so the items re-enter the\nuncategorized queue, and the delete is audited via an Edit row. See\n``app.activity_map.edits.delete``. The frontend echoes the tree's resolved\nsource (``?source=``) so an admin view override can't aim one id space at\nthe other's tables.","operationId":"delete_activity_aurd_tracking__claim_id__activities__activity_id__delete","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"activity_id","in":"path","required":true,"schema":{"type":"integer","title":"Activity Id"}},{"name":"source","in":"query","required":false,"schema":{"anyOf":[{"enum":["legacy","activity-map"],"type":"string"},{"type":"null"}],"title":"Source"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/projects/{project_id}/activities/reorder":{"put":{"tags":["au-rd-tracking"],"summary":"Reorder Activities","description":"Reorder activities within a project. Request must contain exactly all activity IDs.","operationId":"reorder_activities_aurd_tracking__claim_id__projects__project_id__activities_reorder_put","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReorderActivitiesRequest"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/activities/{activity_id}/move":{"post":{"tags":["au-rd-tracking"],"summary":"Move Activity","description":"Move an activity to a different project within the same claim.","operationId":"move_activity_aurd_tracking__claim_id__activities__activity_id__move_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"activity_id","in":"path","required":true,"schema":{"type":"integer","title":"Activity Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveActivityRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/activities/merge":{"post":{"tags":["au-rd-tracking"],"summary":"Merge Activities","description":"Merge source activities into a target activity.\n\nLegacy claims: sources are soft-deleted (``status='merged'``); the snapshot\nin ``aurd_activity_merge_events`` lets ``POST …/activities/{id}/unmerge``\nrestore them. See ``shared.activity_merge``.\n\nActivity-map claims (``request.source`` / ``discovery_methodology``):\noperates on the ``activity_map_*`` tables instead — current assignments are\nsuperseded onto the target and the merge is audited via an Edit row. See\n``app.activity_map.edits.merge``. No reverse endpoint yet.","operationId":"merge_activities_aurd_tracking__claim_id__activities_merge_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MergeActivitiesRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/projects/merge":{"post":{"tags":["au-rd-tracking"],"summary":"Merge Projects","description":"Merge source projects into a target project.\n\nLegacy claims record a reversible snapshot (see ``shared.activity_merge``);\nactivity-map claims operate on the ``activity_map_*`` tables via\n``app.activity_map.edits.merge`` (audited, no reverse endpoint yet).","operationId":"merge_projects_aurd_tracking__claim_id__projects_merge_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MergeProjectsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/activities/merged":{"get":{"tags":["au-rd-tracking"],"summary":"List Merged Activities","description":"List activities soft-deleted by a merge, with the target's name.\n\nLegacy claims read ``aurd_activities``; activity-map claims reconstruct the\nlisting from the open (not-yet-reversed) merge Edit rows.","operationId":"list_merged_activities_aurd_tracking__claim_id__activities_merged_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"source","in":"query","required":false,"schema":{"anyOf":[{"enum":["legacy","activity-map"],"type":"string"},{"type":"null"}],"title":"Source"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MergedActivitySummary"},"title":"Response List Merged Activities Aurd Tracking  Claim Id  Activities Merged Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/activities/{activity_id}/unmerge":{"post":{"tags":["au-rd-tracking"],"summary":"Unmerge Activity Endpoint","description":"Reverse the most recent merge that absorbed ``activity_id``.\n\nRestores every source activity in that merge event. 404 if no reversible\nmerge exists; 409 if the target has since been merged again. Activity-map\nclaims reverse via ``app.activity_map.edits.merge.unmerge_activities``\n(``event_id`` in the response is the reversal's Edit row id).","operationId":"unmerge_activity_endpoint_aurd_tracking__claim_id__activities__activity_id__unmerge_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"activity_id","in":"path","required":true,"schema":{"type":"integer","title":"Activity Id"}},{"name":"source","in":"query","required":false,"schema":{"anyOf":[{"enum":["legacy","activity-map"],"type":"string"},{"type":"null"}],"title":"Source"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/projects/merged":{"get":{"tags":["au-rd-tracking"],"summary":"List Merged Projects","description":"List projects soft-deleted by a merge, with the target's name.","operationId":"list_merged_projects_aurd_tracking__claim_id__projects_merged_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"source","in":"query","required":false,"schema":{"anyOf":[{"enum":["legacy","activity-map"],"type":"string"},{"type":"null"}],"title":"Source"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MergedProjectSummary"},"title":"Response List Merged Projects Aurd Tracking  Claim Id  Projects Merged Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/projects/{project_id}/unmerge":{"post":{"tags":["au-rd-tracking"],"summary":"Unmerge Project Endpoint","description":"Reverse the most recent merge that absorbed ``project_id``.","operationId":"unmerge_project_endpoint_aurd_tracking__claim_id__projects__project_id__unmerge_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"project_id","in":"path","required":true,"schema":{"type":"integer","title":"Project Id"}},{"name":"source","in":"query","required":false,"schema":{"anyOf":[{"enum":["legacy","activity-map"],"type":"string"},{"type":"null"}],"title":"Source"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/work-items":{"get":{"tags":["au-rd-tracking"],"summary":"List Work Items","description":"List work items with filtering. When `limit` is omitted, returns every matching row.\n\n`source` selects the data source. When omitted, the claim's\n``discovery_methodology`` decides (NULL=legacy, non-null=activity-map).\nPass an explicit ``?source=legacy|activity-map`` to override the claim\nsetting for admin/dev comparisons.","operationId":"list_work_items_aurd_tracking__claim_id__work_items_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"activity_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Activity Id"}},{"name":"uncategorized_only","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Uncategorized Only"}},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":50000,"minimum":1},{"type":"null"}],"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"ids","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated work item ids; filters to exactly these.","title":"Ids"},"description":"Comma-separated work item ids; filters to exactly these."},{"name":"source","in":"query","required":false,"schema":{"anyOf":[{"enum":["legacy","activity-map"],"type":"string"},{"type":"null"}],"title":"Source"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkItemListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/work-items/{work_item_id}":{"patch":{"tags":["au-rd-tracking"],"summary":"Update Work Item","description":"Reassign a work item to a different activity.","operationId":"update_work_item_aurd_tracking__claim_id__work_items__work_item_id__patch","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"work_item_id","in":"path","required":true,"schema":{"type":"integer","title":"Work Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateWorkItemRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkItemResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/discover":{"post":{"tags":["au-rd-tracking"],"summary":"Discover Projects","description":"Trigger AI discovery of R&D projects and activities as a background task.","operationId":"discover_projects_aurd_tracking__claim_id__discover_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/discover/status":{"get":{"tags":["au-rd-tracking"],"summary":"Get Discovery Status","description":"Get the status of the most recent discovery run.","operationId":"get_discovery_status_aurd_tracking__claim_id__discover_status_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/sync":{"post":{"tags":["au-rd-tracking"],"summary":"Sync Work Items","description":"Trigger background import, then queue categorization of work items.","operationId":"sync_work_items_aurd_tracking__claim_id__sync_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/sync/status":{"get":{"tags":["au-rd-tracking"],"summary":"Get Sync Status","description":"Get the status of the most recent sync run.","operationId":"get_sync_status_aurd_tracking__claim_id__sync_status_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/monthly-reports":{"get":{"tags":["au-rd-tracking"],"summary":"List Monthly Reports","description":"List monthly contemporaneous reports for a claim.","operationId":"list_monthly_reports_aurd_tracking__claim_id__monthly_reports_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonthlyReportListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/monthly-reports/{report_id}/download-url":{"get":{"tags":["au-rd-tracking"],"summary":"Get Monthly Report Download Url","description":"Generate a signed download URL for a monthly report PDF.","operationId":"get_monthly_report_download_url_aurd_tracking__claim_id__monthly_reports__report_id__download_url_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"report_id","in":"path","required":true,"schema":{"type":"integer","title":"Report Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonthlyReportDownloadUrlResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/internal/monthly-reports/run-due":{"post":{"tags":["au-rd-tracking"],"summary":"Run Due Monthly Reports Internal","description":"Internal endpoint: queue due monthly report runs for flagged companies.","operationId":"run_due_monthly_reports_internal_aurd_tracking_internal_monthly_reports_run_due_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/aurd-tracking/internal/monthly-reports/{claim_id}/run-latest":{"post":{"tags":["au-rd-tracking"],"summary":"Run Latest Monthly Report Internal","description":"Internal admin endpoint to queue generation for the latest due monthly report.","operationId":"run_latest_monthly_report_internal_aurd_tracking_internal_monthly_reports__claim_id__run_latest_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonthlyReportRunResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/internal/monthly-reports/{claim_id}/backfill":{"post":{"tags":["au-rd-tracking"],"summary":"Backfill Monthly Reports","description":"Internal admin endpoint: generate all monthly reports for a claim's fiscal year.","operationId":"backfill_monthly_reports_aurd_tracking_internal_monthly_reports__claim_id__backfill_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BackfillResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/internal/monthly-reports/review-queue":{"get":{"tags":["au-rd-tracking"],"summary":"List Monthly Report Review Queue","description":"Internal admin queue of monthly reports pending approval.\n\nOptionally filter by claim_id to show reports for a specific claim.","operationId":"list_monthly_report_review_queue_aurd_tracking_internal_monthly_reports_review_queue_get","parameters":[{"name":"claim_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalMonthlyReportQueueResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/internal/monthly-reports/{report_id}":{"get":{"tags":["au-rd-tracking"],"summary":"Get Monthly Report Internal Detail","description":"Internal admin detail for a monthly report review.","operationId":"get_monthly_report_internal_detail_aurd_tracking_internal_monthly_reports__report_id__get","parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"integer","title":"Report Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalMonthlyReportDetailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/internal/monthly-reports/{report_id}/approve":{"post":{"tags":["au-rd-tracking"],"summary":"Approve Monthly Report Internal","description":"Approve a pending monthly report, making it visible and sending notification email.","operationId":"approve_monthly_report_internal_aurd_tracking_internal_monthly_reports__report_id__approve_post","parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"integer","title":"Report Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApproveMonthlyReportRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonthlyReportResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/internal/monthly-reports/{report_id}/reject":{"post":{"tags":["au-rd-tracking"],"summary":"Reject Monthly Report Internal","description":"Reject a pending monthly report and keep it internal-only.","operationId":"reject_monthly_report_internal_aurd_tracking_internal_monthly_reports__report_id__reject_post","parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"integer","title":"Report Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RejectMonthlyReportRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonthlyReportResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/expenses":{"get":{"tags":["au-rd-tracking"],"summary":"Get Expense Report","description":"Generate expense report for a period using salary apportionments.\n\nEmployee costs are computed from annual_salary * rd_percentage / 100,\nthen apportioned across activities via AURDEmployeeCostApportionment records.\nWork item hours are still included for evidence but no longer drive cost.","operationId":"get_expense_report_aurd_tracking__claim_id__expenses_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"period_start","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Period Start"}},{"name":"period_end","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Period End"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpenseReportResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/employee-identities":{"get":{"tags":["au-rd-tracking"],"summary":"List Employee Identities","description":"List employee identities and their identifiers for a claim.\n\nBy default, identities with `status == \"excluded\"` are omitted. Pass\n`?include_excluded=true` to receive them (used by the \"Show excluded\"\nsection of the tracking UI so users can restore them).","operationId":"list_employee_identities_aurd_tracking__claim_id__employee_identities_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"include_excluded","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Excluded"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeIdentityListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/employee-identities/merge":{"post":{"tags":["au-rd-tracking"],"summary":"Merge Employee Identities Endpoint","description":"Merge multiple employee identities into a target identity.","operationId":"merge_employee_identities_endpoint_aurd_tracking__claim_id__employee_identities_merge_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MergeEmployeeIdentitiesRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/employee-identities/{identity_id}/unmerge":{"post":{"tags":["au-rd-tracking"],"summary":"Unmerge Employee Identity Endpoint","description":"Reverse the most recent merge that absorbed ``identity_id``.\n\nRestores every source identity in the merge event (a single event can\ncover multiple sources). 404 if no reversible merge exists; 409 if the\ntarget has itself been merged again or is excluded.","operationId":"unmerge_employee_identity_endpoint_aurd_tracking__claim_id__employee_identities__identity_id__unmerge_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"identity_id","in":"path","required":true,"schema":{"type":"integer","title":"Identity Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/employee-identities/{identity_id}/inclusion":{"patch":{"tags":["au-rd-tracking"],"summary":"Set Employee Inclusion","description":"Unified admin endpoint to exclude or restore an employee identity.\n\n``action='exclude'`` applies a manual exclusion lock (inclusion_status,\nexclusion_reason, exclusion_source, excluded_at, excluded_by_user_id) and\nmirrors to the legacy ``status`` column.\n\n``action='restore'`` clears all five inclusion-related fields and resets\nthe legacy ``status`` / ``is_rd_contributor`` mirrors so the row is\neligible for automatic re-evaluation.\n\nThe legacy mirror writes will be removed in a follow-up PR once the\ncallers (and downstream filters) have been migrated to read from\n``inclusion_status``.","operationId":"set_employee_inclusion_aurd_tracking__claim_id__employee_identities__identity_id__inclusion_patch","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"identity_id","in":"path","required":true,"schema":{"type":"integer","title":"Identity Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetEmployeeInclusionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeIdentitySummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/employee-identities/{identity_id}/engineering-group":{"patch":{"tags":["au-rd-tracking"],"summary":"Set Employee Engineering Group","description":"Admin-only toggle for the built-in Engineering distribution group.\nThe next sync-carrying read recalculates engineering-linked expenses.","operationId":"set_employee_engineering_group_aurd_tracking__claim_id__employee_identities__identity_id__engineering_group_patch","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"identity_id","in":"path","required":true,"schema":{"type":"integer","title":"Identity Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetEngineeringGroupRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeIdentitySummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/employee-identities/{identity_id}":{"delete":{"tags":["au-rd-tracking"],"summary":"Exclude Employee Identity","description":"Legacy shim: delegates to set_employee_inclusion(action='exclude').","operationId":"exclude_employee_identity_aurd_tracking__claim_id__employee_identities__identity_id__delete","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"identity_id","in":"path","required":true,"schema":{"type":"integer","title":"Identity Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeIdentitySummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/employee-identities/{identity_id}/restore":{"post":{"tags":["au-rd-tracking"],"summary":"Restore Employee Identity","description":"Legacy shim: delegates to set_employee_inclusion(action='restore').","operationId":"restore_employee_identity_aurd_tracking__claim_id__employee_identities__identity_id__restore_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"identity_id","in":"path","required":true,"schema":{"type":"integer","title":"Identity Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeIdentitySummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/employee-identities/{identity_id}/rd-contributor-status":{"patch":{"tags":["au-rd-tracking"],"summary":"Set Employee Rd Contributor Status","description":"Legacy shim: maps is_rd_contributor flag onto exclude/restore.\n\n``is_rd_contributor=False`` -> exclude; ``True`` -> restore.","operationId":"set_employee_rd_contributor_status_aurd_tracking__claim_id__employee_identities__identity_id__rd_contributor_status_patch","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"identity_id","in":"path","required":true,"schema":{"type":"integer","title":"Identity Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetRDContributorRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeIdentitySummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/activities/{activity_id}/employees/{identity_id}":{"delete":{"tags":["au-rd-tracking"],"summary":"Remove Employee From Activity","description":"Remove an employee from a single activity.\n\nTwo atomic operations:\n1. Set activity_id = NULL on every work item belonging to this\n   employee under this activity (items go to the \"Unassigned\" bucket).\n2. Delete the cost apportionment row(s) that allocate any % of this\n   employee's salary to this activity.\n\nThe employee and their other activity associations are untouched.","operationId":"remove_employee_from_activity_aurd_tracking__claim_id__activities__activity_id__employees__identity_id__delete","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"activity_id","in":"path","required":true,"schema":{"type":"integer","title":"Activity Id"}},{"name":"identity_id","in":"path","required":true,"schema":{"type":"integer","title":"Identity Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RemoveEmployeeFromActivityResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/employee-rates":{"get":{"tags":["au-rd-tracking"],"summary":"List Employee Rates","description":"List all employee rates for a claim, plus identity IDs found in work items with no rate.","operationId":"list_employee_rates_aurd_tracking__claim_id__employee_rates_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeRateListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["au-rd-tracking"],"summary":"Create Employee Rate","description":"Create or update an employee salary rate for a claim.","operationId":"create_employee_rate_aurd_tracking__claim_id__employee_rates_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeRateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeRateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/employee-rates/{rate_id}":{"delete":{"tags":["au-rd-tracking"],"summary":"Delete Employee Rate","description":"Delete an employee rate.","operationId":"delete_employee_rate_aurd_tracking__claim_id__employee_rates__rate_id__delete","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"rate_id","in":"path","required":true,"schema":{"type":"integer","title":"Rate Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/other-costs":{"get":{"tags":["au-rd-tracking"],"summary":"List Other Costs","description":"List all other costs for a claim.","operationId":"list_other_costs_aurd_tracking__claim_id__other_costs_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OtherCostListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/cost-pools":{"get":{"tags":["au-rd-tracking"],"summary":"List Cost Pools","description":"List the claim's cost pools — a read-only mirror of its expenditures.\n\nThe persisted pools are rebuilt from the categorised expenditure data on\nevery read (see ``rebuild_cost_pools_from_expenditures``): one pool per\nnon-salary expenditure category, with per-activity apportionment derived\nfrom the expenditure apportionments. There is no manual add/edit/sync.","operationId":"list_cost_pools_aurd_tracking__claim_id__cost_pools_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CostPoolListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/{claim_id}/tracking-status":{"get":{"tags":["au-rd-tracking"],"summary":"Get Tracking Status","description":"Get the tracking review status for a claim (bypasses approval gate).","operationId":"get_tracking_status_aurd_tracking__claim_id__tracking_status_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrackingStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/internal/tracking/{claim_id}/approve":{"post":{"tags":["au-rd-tracking"],"summary":"Approve Tracking Internal","description":"Approve tracking data, making it visible to the customer.","operationId":"approve_tracking_internal_aurd_tracking_internal_tracking__claim_id__approve_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/internal/tracking/{claim_id}/reject":{"post":{"tags":["au-rd-tracking"],"summary":"Reject Tracking Internal","description":"Reject tracking data, keeping it hidden from the customer.","operationId":"reject_tracking_internal_aurd_tracking_internal_tracking__claim_id__reject_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RejectTrackingRequest","default":{}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-tracking/internal/discovery/{claim_id}/submit-prompt":{"post":{"tags":["au-rd-tracking"],"summary":"Submit Discovery Prompt","description":"Submit a discovery prompt and trigger discovery for a claim (admin only).","operationId":"submit_discovery_prompt_aurd_tracking_internal_discovery__claim_id__submit_prompt_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmitDiscoveryPromptRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-apportionment/{claim_id}/compute":{"post":{"tags":["au-rd-apportionment"],"summary":"Trigger Compute","description":"Kick off an async compute run for the claim.\n\nAdmin-only. The compute itself is non-destructive (writes only to the\nshadow `proposed_rd_percentage` column), but it consumes a background\nexecution slot, replaces per-activity apportionment splits, and\nmutates the methodology_version annotation — so we gate it to admins\nto mirror the activate / deactivate toggle. Returns 202 with the\nAgentExecution id; clients poll the GET endpoint for completion.","operationId":"trigger_compute_aurd_apportionment__claim_id__compute_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApportionmentRunStatus"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-apportionment/{claim_id}/compute/status":{"get":{"tags":["au-rd-apportionment"],"summary":"Get Compute Status","description":"Status of the most recent apportionment compute for the claim.","operationId":"get_compute_status_aurd_apportionment__claim_id__compute_status_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApportionmentRunStatus"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-apportionment/{claim_id}/stretch":{"post":{"tags":["au-rd-apportionment"],"summary":"Stretch Apportionment","description":"Stretch the most recent computed apportionment for the claim (CLA-257).\n\nAdmin-only. Synchronous and atomic — applies the per-employee Stretch\ntransform to the computed day classifications + employee rates, then\nreturns the updated summary in the same shape as GET /employees.\n\nBody (CLA-259):\n    * exponent (optional, default DEFAULT_STRETCH_EXPONENT): curve\n      strength k in (0, 1]. Lower = more aggressive. Out-of-range values\n      return 422 via Pydantic validation.\n\nPre-conditions (all return 409):\n    * methodology_not_computed: no AURDEmployeeRate rows with a computed\n      proposed_rd_percentage exist for this claim.\n    * already_stretched: at least one rate's methodology_version already\n      ends in '+stretch'. Recompute first to clear.\n    * compute_in_progress: a 'running' AgentExecution exists for this\n      claim's compute workflow. (Note: a stale-running execution older\n      than APPORTIONMENT_STALE_MINUTES still blocks — recompute to clear.)\n    * stretch_in_progress: another stretch is holding the advisory lock.","operationId":"stretch_apportionment_aurd_apportionment__claim_id__stretch_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StretchRequest","default":{"exponent":0.3}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeApportionmentSummaryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-apportionment/{claim_id}/activate":{"post":{"tags":["au-rd-apportionment"],"summary":"Activate Apportionment Methodology","description":"Switch the claim to use methodology-derived rates for cost calculation.\n\nAdmin-only. After this, cost calc reads `proposed_rd_percentage` (the\nworkflow's output) for any rate that has one, falling back to manual\n`rd_percentage` for out-of-scope employees and any rate the workflow\nhasn't computed.","operationId":"activate_apportionment_methodology_aurd_apportionment__claim_id__activate_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApportionmentMethodologyToggleResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-apportionment/{claim_id}/deactivate":{"post":{"tags":["au-rd-apportionment"],"summary":"Deactivate Apportionment Methodology","description":"Revert the claim to manual rates for cost calculation.\n\nAdmin-only. Computed rates remain in `proposed_rd_percentage` (visible\non the evidence page); they just stop feeding cost calculations.\nReversible — call /activate again to switch back.","operationId":"deactivate_apportionment_methodology_aurd_apportionment__claim_id__deactivate_post","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApportionmentMethodologyToggleResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-apportionment/{claim_id}/employees":{"get":{"tags":["au-rd-apportionment"],"summary":"List Employee Apportionment","description":"Per-employee apportionment summary for the claim.\n\nBuilt from persisted state — does NOT trigger a compute. Each row reports\nwhichever methodology produced its current rd_percentage; rows where the\nmost recent compute marked the employee out-of-scope appear with\nrequires_manual_handling=True and rd_percentage=None.","operationId":"list_employee_apportionment_aurd_apportionment__claim_id__employees_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeApportionmentSummaryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/aurd-apportionment/{claim_id}/employee/{identity_id}/days":{"get":{"tags":["au-rd-apportionment"],"summary":"List Employee Days","description":"Per-day classification trail for a single employee.\n\nReturns the audit substantiation rows from AURDDayClassification — every\nclassified business day in chronological order, each carrying the work\nitem IDs and per-activity breakdown that justify it.","operationId":"list_employee_days_aurd_apportionment__claim_id__employee__identity_id__days_get","parameters":[{"name":"claim_id","in":"path","required":true,"schema":{"type":"integer","title":"Claim Id"}},{"name":"identity_id","in":"path","required":true,"schema":{"type":"integer","title":"Identity Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeDaysResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/":{"get":{"summary":"Root","description":"Root endpoint.","operationId":"root__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/health":{"get":{"summary":"Health","description":"Health check endpoint with database connectivity verification.","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"ActivityEmployeeSummary":{"properties":{"employee_identity_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Employee Identity Id"},"work_item_count":{"type":"integer","title":"Work Item Count"},"total_hours":{"type":"number","title":"Total Hours"},"total_expenditure_cost":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Total Expenditure Cost"}},"type":"object","required":["employee_identity_id","work_item_count","total_hours"],"title":"ActivityEmployeeSummary"},"ActivityGroup":{"properties":{"project_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Project Id"},"project_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Name"},"activity_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Activity Id"},"activity_name":{"type":"string","title":"Activity Name"},"activity_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Activity Type"},"legacy_orphan":{"type":"boolean","title":"Legacy Orphan","default":false},"categories":{"items":{"$ref":"#/components/schemas/CategoryGroup"},"type":"array","title":"Categories"},"salaries":{"items":{"$ref":"#/components/schemas/ActivitySalaryRow"},"type":"array","title":"Salaries"},"assets":{"items":{"$ref":"#/components/schemas/AssetResponse"},"type":"array","title":"Assets","default":[]},"total_amount":{"type":"number","title":"Total Amount"},"total_rd_amount":{"type":"number","title":"Total Rd Amount"},"item_count":{"type":"integer","title":"Item Count"}},"type":"object","required":["project_id","project_name","activity_id","activity_name","activity_type","categories","salaries","total_amount","total_rd_amount","item_count"],"title":"ActivityGroup","description":"A drop-target on the categorised expenditures page.\n\nEvery active (non-merged) activity on the claim gets one entry — even\nempty ones — so the UI can render it as a drop target. The last entry\nin ``GroupedItemsResponse.activities`` is the synthetic Ungrouped\nentry (``activity_id == None``) carrying everything that hasn't been\nassigned to an activity yet."},"ActivityMapDiscoveryStatusResponse":{"properties":{"claim_id":{"type":"integer","title":"Claim Id"},"job_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Job Id"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"stage":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stage"},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Started At"},"completed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Completed At"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"current_run":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Current Run"},"total_runs":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total Runs"},"n_input_runs":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"N Input Runs"},"merger_tool_calls":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Merger Tool Calls"},"discovery_version_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Discovery Version Id"},"categorize_version_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Categorize Version Id"},"categorize_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Categorize Count"},"categorize_failed":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Categorize Failed"}},"type":"object","required":["claim_id","job_id","status","stage","started_at","completed_at","error_message","current_run","total_runs","n_input_runs","merger_tool_calls","discovery_version_id","categorize_version_id","categorize_count","categorize_failed"],"title":"ActivityMapDiscoveryStatusResponse","description":"Activity-map pipeline status for a claim, polled by the UI status badge.\n\n``status`` mirrors the AgentExecution status column. ``stage`` is the\nsub-stage within a running execution so the UI can render the right\nbadge: ``fetch_and_discover`` (one of the N consensus runs is in flight),\n``merge_discovery`` (consolidating the N drafts), ``categorize``, or\n``done``. ``current_run`` / ``total_runs`` track progress through the\nconsensus pass."},"ActivityResponse":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"activity_type":{"type":"string","title":"Activity Type"},"status":{"type":"string","title":"Status"},"ai_reasoning":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ai Reasoning"},"work_item_count":{"type":"integer","title":"Work Item Count","default":0},"total_hours":{"type":"number","title":"Total Hours","default":0},"total_expenditure_cost":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Total Expenditure Cost"},"sort_order":{"type":"integer","title":"Sort Order","default":0},"created_at":{"type":"string","title":"Created At"},"employee_summaries":{"items":{"$ref":"#/components/schemas/ActivityEmployeeSummary"},"type":"array","title":"Employee Summaries","default":[]}},"type":"object","required":["id","name","description","activity_type","status","created_at"],"title":"ActivityResponse"},"ActivitySalaryRow":{"properties":{"employee_identity_id":{"type":"integer","title":"Employee Identity Id"},"employee_name":{"type":"string","title":"Employee Name"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"},"rd_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Rd Percentage"},"percentage":{"type":"number","title":"Percentage"},"apportioned_amount":{"type":"number","title":"Apportioned Amount"},"apportioned_rd_amount":{"type":"number","title":"Apportioned Rd Amount"},"fy_paid_total":{"type":"number","title":"Fy Paid Total"},"payslip_count":{"type":"integer","title":"Payslip Count","default":0},"subgroup_key":{"type":"string","title":"Subgroup Key"},"open_query_count":{"type":"integer","title":"Open Query Count"},"needs_activity_apportionment":{"type":"boolean","title":"Needs Activity Apportionment","default":false}},"type":"object","required":["employee_identity_id","employee_name","rd_percentage","percentage","apportioned_amount","apportioned_rd_amount","fy_paid_total","subgroup_key","open_query_count"],"title":"ActivitySalaryRow","description":"One employee's salary contribution to a single activity or Ungrouped.\n\nActivity rows are derived from :class:`AURDEmployeeCostApportionment`.\nAny remaining percentage is emitted in the synthetic Ungrouped activity\nwith ``needs_activity_apportionment`` set. Mutations live on the\nexpenditure Salary tab."},"ActivityType":{"type":"string","enum":["core","supporting"],"title":"ActivityType"},"AddCollaboratorRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"},"scope":{"type":"string","enum":["workspace","claim"],"title":"Scope","default":"workspace"},"tracking_only":{"type":"boolean","title":"Tracking Only","default":false}},"type":"object","required":["email"],"title":"AddCollaboratorRequest"},"AddConsultantRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"}},"type":"object","required":["email"],"title":"AddConsultantRequest"},"AddInstanceRequest":{"properties":{"parent_instance_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Parent Instance Id"}},"type":"object","title":"AddInstanceRequest"},"AddInstanceResponse":{"properties":{"instance_id":{"type":"integer","title":"Instance Id"},"group_code":{"type":"string","title":"Group Code"},"parent_instance_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Parent Instance Id"}},"type":"object","required":["instance_id","group_code"],"title":"AddInstanceResponse"},"AddMessageRequest":{"properties":{"body":{"type":"string","title":"Body"}},"type":"object","required":["body"],"title":"AddMessageRequest"},"AdminClaimCompany":{"properties":{"id":{"type":"integer","title":"Id"},"legal_name":{"type":"string","title":"Legal Name"}},"type":"object","required":["id","legal_name"],"title":"AdminClaimCompany"},"AdminClaimCreator":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"email":{"type":"string","title":"Email"}},"type":"object","required":["id","name","email"],"title":"AdminClaimCreator"},"AdminClaimDataSource":{"properties":{"source_type":{"type":"string","title":"Source Type"},"connected":{"type":"boolean","title":"Connected"}},"type":"object","required":["source_type","connected"],"title":"AdminClaimDataSource"},"AdminClaimItem":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"status":{"type":"string","title":"Status"},"claim_type":{"$ref":"#/components/schemas/AdminClaimType"},"workspace":{"anyOf":[{"$ref":"#/components/schemas/AdminClaimWorkspace"},{"type":"null"}]},"company":{"anyOf":[{"$ref":"#/components/schemas/AdminClaimCompany"},{"type":"null"}]},"created_by":{"anyOf":[{"$ref":"#/components/schemas/AdminClaimCreator"},{"type":"null"}]},"data_sources":{"items":{"$ref":"#/components/schemas/AdminClaimDataSource"},"type":"array","title":"Data Sources"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","name","status","claim_type","workspace","created_by","data_sources","created_at","updated_at"],"title":"AdminClaimItem"},"AdminClaimType":{"properties":{"code":{"type":"string","title":"Code"},"name":{"type":"string","title":"Name"}},"type":"object","required":["code","name"],"title":"AdminClaimType"},"AdminClaimWorkspace":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"enable_ai_generation":{"type":"boolean","title":"Enable Ai Generation"},"enable_monthly_contemporaneous_reports":{"type":"boolean","title":"Enable Monthly Contemporaneous Reports"}},"type":"object","required":["id","name","enable_ai_generation","enable_monthly_contemporaneous_reports"],"title":"AdminClaimWorkspace"},"AdminClaimsResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AdminClaimItem"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"}},"type":"object","required":["items","total","page","page_size"],"title":"AdminClaimsResponse"},"AdminJobItem":{"properties":{"key":{"type":"string","title":"Key"},"job_id":{"type":"string","title":"Job Id"},"source":{"type":"string","title":"Source"},"job_type":{"type":"string","title":"Job Type"},"workflow_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workflow Name"},"status":{"type":"string","title":"Status"},"claim_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Claim Id"},"claim_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Claim Name"},"workspace_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Name"},"user_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Email"},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Started At"},"runtime_seconds":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Runtime Seconds"},"detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detail"},"is_stale":{"type":"boolean","title":"Is Stale","default":false}},"type":"object","required":["key","job_id","source","job_type","status"],"title":"AdminJobItem"},"AdminJobsResponse":{"properties":{"jobs":{"items":{"$ref":"#/components/schemas/AdminJobItem"},"type":"array","title":"Jobs"},"generated_at":{"type":"string","title":"Generated At"}},"type":"object","required":["jobs","generated_at"],"title":"AdminJobsResponse"},"AdminUserItem":{"properties":{"id":{"type":"integer","title":"Id"},"email":{"type":"string","title":"Email"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"company_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company Name"},"is_active":{"type":"boolean","title":"Is Active"},"is_admin":{"type":"boolean","title":"Is Admin"},"created_at":{"type":"string","title":"Created At"},"claim_count":{"type":"integer","title":"Claim Count"},"submitted_claim_count":{"type":"integer","title":"Submitted Claim Count"}},"type":"object","required":["id","email","name","company_name","is_active","is_admin","created_at","claim_count","submitted_claim_count"],"title":"AdminUserItem"},"AdminUsersResponse":{"properties":{"users":{"items":{"$ref":"#/components/schemas/AdminUserItem"},"type":"array","title":"Users"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"}},"type":"object","required":["users","total","page","page_size"],"title":"AdminUsersResponse"},"AgentExecutionStatusResponse":{"properties":{"id":{"type":"integer","title":"Id"},"status":{"type":"string","title":"Status"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"}},"type":"object","required":["id","status"],"title":"AgentExecutionStatusResponse"},"AiSuggestionDecisionRequest":{"properties":{"item_ids":{"items":{"type":"integer"},"type":"array","title":"Item Ids","default":[]},"all":{"type":"boolean","title":"All","default":false}},"type":"object","title":"AiSuggestionDecisionRequest","description":"Selector for approve/reject: an explicit list of item ids, or ``all`` for\nevery pending suggestion on the claim. There is at most one pending suggestion\nper item, so item ids unambiguously identify the rows. An empty list with\n``all=False`` is a 400."},"AiSuggestionDecisionResponse":{"properties":{"approved_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Approved Count"},"rejected_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rejected Count"},"skipped_count":{"type":"integer","title":"Skipped Count","default":0}},"type":"object","title":"AiSuggestionDecisionResponse"},"AiSuggestionResponse":{"properties":{"id":{"type":"integer","title":"Id"},"item_id":{"type":"integer","title":"Item Id"},"job_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Job Id"},"name":{"type":"string","title":"Name"},"source_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Source Amount"},"source_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Date"},"current_category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Category"},"current_subgroup_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Subgroup Key"},"current_eligibility":{"type":"string","title":"Current Eligibility"},"proposed_category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Proposed Category"},"proposed_subgroup_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Proposed Subgroup Key"},"proposed_eligibility":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Proposed Eligibility"},"rationale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rationale"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","item_id","job_id","name","source_amount","source_date","current_category","current_subgroup_key","current_eligibility","proposed_category","proposed_subgroup_key","proposed_eligibility","rationale","created_at"],"title":"AiSuggestionResponse","description":"One pending AI categorisation proposal plus the live item's current values,\nso the admin \"Needs approval\" tab can render current-vs-proposed side by side.\n\n``proposed_subgroup_key`` / ``proposed_eligibility`` are NULL when the AI left\nthat field alone (a hand-curated group, or a category-only run) — approve then\nleaves the live value unchanged."},"AiSuggestionsListResponse":{"properties":{"suggestions":{"items":{"$ref":"#/components/schemas/AiSuggestionResponse"},"type":"array","title":"Suggestions"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["suggestions","total"],"title":"AiSuggestionsListResponse"},"AllowedEmailCreate":{"properties":{"email":{"type":"string","title":"Email"}},"type":"object","required":["email"],"title":"AllowedEmailCreate"},"AnswerEvidenceResponse":{"properties":{"answer_id":{"type":"integer","title":"Answer Id"},"ai_reasoning":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ai Reasoning"},"ai_raw_data":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Ai Raw Data"},"evidence":{"items":{"$ref":"#/components/schemas/EvidenceItemResponse"},"type":"array","title":"Evidence","default":[]}},"type":"object","required":["answer_id"],"title":"AnswerEvidenceResponse"},"AnswerInput":{"properties":{"question_code":{"type":"string","title":"Question Code"},"value":{"type":"string","maxLength":50000,"title":"Value"},"instance_id":{"type":"integer","title":"Instance Id","default":0},"parent_instance_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Parent Instance Id"},"expected_value":{"anyOf":[{"type":"string","maxLength":50000},{"type":"null"}],"title":"Expected Value"}},"type":"object","required":["question_code","value"],"title":"AnswerInput"},"AnswerResponse":{"properties":{"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"value":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Value"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"},"ai_reasoning":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ai Reasoning"},"instance_id":{"type":"integer","title":"Instance Id","default":0},"parent_instance_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Parent Instance Id"}},"type":"object","title":"AnswerResponse"},"ApportionmentMethodologyToggleResponse":{"properties":{"claim_id":{"type":"integer","title":"Claim Id"},"apportionment_methodology":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Apportionment Methodology"},"methodology_version":{"type":"string","title":"Methodology Version"}},"type":"object","required":["claim_id","apportionment_methodology","methodology_version"],"title":"ApportionmentMethodologyToggleResponse","description":"Response for /activate and /deactivate endpoints."},"ApportionmentOut":{"properties":{"activity_id":{"type":"integer","title":"Activity Id"},"activity_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Activity Name"},"percentage":{"type":"number","title":"Percentage"}},"type":"object","required":["activity_id","percentage"],"title":"ApportionmentOut","description":"One activity's slice of an item's R&D apportionment.\n\n``percentage`` is the R&D portion of the item allocated to ``activity_id``\n(e.g. 20 means $200 of a $1,000 item). A list of these sums to the item's\ntotal R&D% (<= 100); the remainder is non-R&D."},"ApportionmentRunStatus":{"properties":{"status":{"type":"string","title":"Status"},"job_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Job Id"},"methodology_version":{"type":"string","title":"Methodology Version"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Started At"},"completed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Completed At"},"in_scope_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"In Scope Count"},"out_of_scope_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Out Of Scope Count"}},"type":"object","required":["status","methodology_version"],"title":"ApportionmentRunStatus","description":"Status payload returned by both the POST (immediately) and the GET\n(when polling for completion)."},"ApproveMonthlyReportRequest":{"properties":{"review_notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Review Notes"}},"type":"object","title":"ApproveMonthlyReportRequest"},"AssetCreate":{"properties":{"name":{"type":"string","title":"Name"},"cost":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Cost"},"acquisition_date":{"type":"string","format":"date","title":"Acquisition Date"},"effective_life_years":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Effective Life Years"},"method":{"type":"string","title":"Method","default":"prime_cost"},"rd_percentage":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Rd Percentage"},"activity_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Activity Id"},"apportionments":{"anyOf":[{"items":{"$ref":"#/components/schemas/ItemApportionmentInput"},"type":"array"},{"type":"null"}],"title":"Apportionments"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"}},"type":"object","required":["name","cost","acquisition_date","effective_life_years"],"title":"AssetCreate","description":"Payload for the admin \"Add asset\" dialog. ``method`` is validated in the\nhandler (not at the schema layer) so it returns a clean 400."},"AssetListResponse":{"properties":{"assets":{"items":{"$ref":"#/components/schemas/AssetResponse"},"type":"array","title":"Assets"},"count":{"type":"integer","title":"Count"},"total_fy_decline":{"type":"number","title":"Total Fy Decline"},"total_rd_amount":{"type":"number","title":"Total Rd Amount"},"fy_label":{"type":"string","title":"Fy Label"}},"type":"object","required":["assets","count","total_fy_decline","total_rd_amount","fy_label"],"title":"AssetListResponse"},"AssetResponse":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"cost":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Cost"},"acquisition_date":{"type":"string","title":"Acquisition Date"},"effective_life_years":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Effective Life Years"},"method":{"type":"string","title":"Method"},"rd_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Rd Percentage"},"percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Percentage"},"activity_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Activity Id"},"apportionments":{"items":{"$ref":"#/components/schemas/ApportionmentOut"},"type":"array","title":"Apportionments","default":[]},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"source":{"type":"string","title":"Source"},"source_item_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Source Item Id"},"fy_decline":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Fy Decline"},"rd_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Rd Amount"}},"type":"object","required":["id","name","cost","acquisition_date","effective_life_years","method","rd_percentage","activity_id","description","source","fy_decline","rd_amount"],"title":"AssetResponse"},"AssetUpdate":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"cost":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Cost"},"acquisition_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Acquisition Date"},"effective_life_years":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Effective Life Years"},"method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Method"},"rd_percentage":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Rd Percentage"},"activity_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Activity Id"},"apportionments":{"anyOf":[{"items":{"$ref":"#/components/schemas/ItemApportionmentInput"},"type":"array"},{"type":"null"}],"title":"Apportionments"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"}},"type":"object","title":"AssetUpdate","description":"PATCH payload. Only fields present in the JSON are applied; explicit null\nclears ``rd_percentage`` / ``activity_id`` / ``description``. When present,\n``apportionments`` replaces the full activity split and is authoritative\nover the legacy cache fields. Required fields\n(name, cost, acquisition_date, effective_life_years, method) cannot be\ncleared — distinguish \"absent\" from \"null\" via ``model_fields_set``."},"AssignSubgroupToActivityRequest":{"properties":{"source":{"$ref":"#/components/schemas/_SubgroupRef"},"activity_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Activity Id"}},"type":"object","required":["source","activity_id"],"title":"AssignSubgroupToActivityRequest","description":"Assign every item in ``source`` to ``activity_id``.\n\n``activity_id`` of ``None`` moves the subgroup back to the synthetic\nUngrouped bucket on the categorised expenditures page."},"AutoCategoriseJobResponse":{"properties":{"job_id":{"type":"integer","title":"Job Id"},"status":{"type":"string","title":"Status"},"total":{"type":"integer","title":"Total"},"processed":{"type":"integer","title":"Processed"},"updated_count":{"type":"integer","title":"Updated Count"},"failed_count":{"type":"integer","title":"Failed Count"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"item_ids":{"items":{"type":"integer"},"type":"array","title":"Item Ids","default":[]}},"type":"object","required":["job_id","status","total","processed","updated_count","failed_count"],"title":"AutoCategoriseJobResponse"},"AutoCategoriseRequest":{"properties":{"item_ids":{"items":{"type":"integer"},"type":"array","title":"Item Ids"},"include_eligibility":{"type":"boolean","title":"Include Eligibility","default":false}},"type":"object","required":["item_ids"],"title":"AutoCategoriseRequest"},"AvailableItem":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"owner":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner"},"object_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Object Type"},"parent_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Id"},"parent_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Type"},"selected":{"type":"boolean","title":"Selected","default":false}},"type":"object","required":["id","name"],"title":"AvailableItem"},"AvailableItemsResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AvailableItem"},"type":"array","title":"Items"},"has_more":{"type":"boolean","title":"Has More","default":false},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"AvailableItemsResponse"},"BackfillMonthStatus":{"properties":{"year":{"type":"integer","title":"Year"},"month":{"type":"integer","title":"Month"},"period_label":{"type":"string","title":"Period Label"},"report_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Report Id"},"status":{"type":"string","title":"Status"}},"type":"object","required":["year","month","period_label","status"],"title":"BackfillMonthStatus"},"BackfillResponse":{"properties":{"claim_id":{"type":"integer","title":"Claim Id"},"fiscal_year":{"type":"integer","title":"Fiscal Year"},"total_months":{"type":"integer","title":"Total Months"},"months":{"items":{"$ref":"#/components/schemas/BackfillMonthStatus"},"type":"array","title":"Months"},"status":{"type":"string","title":"Status"}},"type":"object","required":["claim_id","fiscal_year","total_months","months","status"],"title":"BackfillResponse"},"Body_import_csv_claims__claim_id__expenditures_imports_csv_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"mode":{"type":"string","enum":["append","replace"],"title":"Mode","default":"append"},"column_mapping":{"type":"string","title":"Column Mapping"}},"type":"object","required":["file","column_mapping"],"title":"Body_import_csv_claims__claim_id__expenditures_imports_csv_post"},"BulkSetApportionmentsByIdsRequest":{"properties":{"item_ids":{"items":{"type":"integer"},"type":"array","title":"Item Ids"},"apportionments":{"items":{"$ref":"#/components/schemas/ItemApportionmentInput"},"type":"array","title":"Apportionments"}},"type":"object","required":["item_ids","apportionments"],"title":"BulkSetApportionmentsByIdsRequest","description":"Apply the same R&D-activity split to an explicit list of item ids.\n\nBacks the All-expenses \"Set R&D split\" button and the per-subgroup menu\noption (the frontend resolves a subgroup to its item ids). A non-empty\n``apportionments`` list flips every matched item to R&D-eligible, matching\nthe single-item PUT endpoint — clearing a split is the eligibility menu's\njob, so an empty list is rejected here."},"BulkSetDistributionLinkByIdsRequest":{"properties":{"item_ids":{"items":{"type":"integer"},"type":"array","title":"Item Ids"},"scope":{"type":"string","enum":["all","engineering","none"],"title":"Scope"}},"type":"object","required":["item_ids","scope"],"title":"BulkSetDistributionLinkByIdsRequest","description":"Link an explicit list of item ids to an employee distribution, or opt\nthem out.\n\nBacks the checkbox toolbars' \"Follow employee distribution\" action on both\nexpenditure tabs, where the ticked rows may span categories/subgroups — so\nneither the per-item PUT nor the subgroup-scoped POST can express the\nselection."},"BulkUpdateByIdsRequest":{"properties":{"item_ids":{"items":{"type":"integer"},"type":"array","title":"Item Ids"},"update":{"$ref":"#/components/schemas/_BulkItemUpdate"}},"type":"object","required":["item_ids","update"],"title":"BulkUpdateByIdsRequest","description":"Apply a bulk update to an explicit list of item ids.\n\nBacks the checkbox multi-select on the All-expenses tab, where the user\nticks arbitrary rows that may span categories/subgroups — so the\nsubgroup-scoped :class:`BulkUpdateRequest` can't express the selection.\nReuses :class:`_BulkItemUpdate` (the UI sends ``eligibility``, ``category``,\nor ``subgroup_key`` — the categorised tree's bulk \"Move to / New subgroup\")."},"BulkUpdateRequest":{"properties":{"scope":{"$ref":"#/components/schemas/_GroupScope"},"update":{"$ref":"#/components/schemas/_BulkItemUpdate"}},"type":"object","required":["scope","update"],"title":"BulkUpdateRequest"},"BulkUpdateResponse":{"properties":{"updated_count":{"type":"integer","title":"Updated Count"}},"type":"object","required":["updated_count"],"title":"BulkUpdateResponse"},"CategoryGroup":{"properties":{"category":{"type":"string","title":"Category"},"subgroups":{"items":{"$ref":"#/components/schemas/SubGroup"},"type":"array","title":"Subgroups"},"total_amount":{"type":"number","title":"Total Amount"},"total_rd_amount":{"type":"number","title":"Total Rd Amount"},"item_count":{"type":"integer","title":"Item Count"}},"type":"object","required":["category","subgroups","total_amount","total_rd_amount","item_count"],"title":"CategoryGroup"},"ClaimDetailResponse":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"status":{"type":"string","title":"Status"},"claim_type":{"$ref":"#/components/schemas/ClaimTypeEmbedded"},"workspace":{"anyOf":[{"$ref":"#/components/schemas/WorkspaceEmbedded"},{"type":"null"}]},"company":{"anyOf":[{"$ref":"#/components/schemas/CompanyEmbedded"},{"type":"null"}]},"data_sources":{"items":{"$ref":"#/components/schemas/SourceResponse"},"type":"array","title":"Data Sources"},"progress":{"$ref":"#/components/schemas/ProgressResponse"},"submitted_by":{"anyOf":[{"$ref":"#/components/schemas/CreatedByEmbedded"},{"type":"null"}]},"submitted_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Submitted At"},"declaration_completed_by":{"anyOf":[{"$ref":"#/components/schemas/CreatedByEmbedded"},{"type":"null"}]},"declaration_completed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Declaration Completed At"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"discovery_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Discovery Prompt"},"discovery_methodology":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Discovery Methodology"},"report_generated_methodology":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Report Generated Methodology"},"tracking_refreshed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tracking Refreshed At"},"expenditures_imported_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expenditures Imported At"},"review_generated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Review Generated At"},"role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Role"},"tracking_only":{"type":"boolean","title":"Tracking Only","default":false},"is_consultant_claim":{"type":"boolean","title":"Is Consultant Claim","default":false},"is_first_year_of_operation":{"type":"boolean","title":"Is First Year Of Operation","default":false},"can_view_salary":{"type":"boolean","title":"Can View Salary","default":true},"rd_schedule_released":{"type":"boolean","title":"Rd Schedule Released","default":false},"rd_schedule_released_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rd Schedule Released At"},"offset_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Offset Type","default":"refundable"},"offset_corporate_tax_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Offset Corporate Tax Rate"},"offset_premium_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Offset Premium Rate"},"offset_total_expenses":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Offset Total Expenses"},"fiscal_year_start_month":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Fiscal Year Start Month"},"period_start":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Period Start"},"period_end":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Period End"},"period_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Period Label"}},"type":"object","required":["id","name","status","claim_type","data_sources","progress","created_at","updated_at"],"title":"ClaimDetailResponse"},"ClaimPeriodResponse":{"properties":{"claim_id":{"type":"integer","title":"Claim Id"},"fiscal_year_start_month":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Fiscal Year Start Month"},"period_start":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Period Start"},"period_end":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Period End"},"period_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Period Label"}},"type":"object","required":["claim_id","fiscal_year_start_month","period_start","period_end","period_label"],"title":"ClaimPeriodResponse"},"ClaimResponse":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"status":{"type":"string","title":"Status"},"claim_type":{"$ref":"#/components/schemas/ClaimTypeEmbedded"},"workspace":{"anyOf":[{"$ref":"#/components/schemas/WorkspaceEmbedded"},{"type":"null"}]},"company":{"anyOf":[{"$ref":"#/components/schemas/CompanyEmbedded"},{"type":"null"}]},"created_by":{"anyOf":[{"$ref":"#/components/schemas/CreatedByEmbedded"},{"type":"null"}]},"submitted_by":{"anyOf":[{"$ref":"#/components/schemas/CreatedByEmbedded"},{"type":"null"}]},"submitted_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Submitted At"},"declaration_completed_by":{"anyOf":[{"$ref":"#/components/schemas/CreatedByEmbedded"},{"type":"null"}]},"declaration_completed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Declaration Completed At"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Role"},"tracking_only":{"type":"boolean","title":"Tracking Only","default":false},"is_consultant_claim":{"type":"boolean","title":"Is Consultant Claim","default":false},"is_first_year_of_operation":{"type":"boolean","title":"Is First Year Of Operation","default":false},"fiscal_year_start_month":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Fiscal Year Start Month"}},"type":"object","required":["id","name","status","claim_type","created_at","updated_at"],"title":"ClaimResponse"},"ClaimTypeEmbedded":{"properties":{"code":{"type":"string","title":"Code"},"name":{"type":"string","title":"Name"},"category":{"type":"string","title":"Category"},"country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country Code"},"tax_year":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tax Year"},"fiscal_year_start_month":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Fiscal Year Start Month"},"fiscal_year_start_day":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Fiscal Year Start Day"}},"type":"object","required":["code","name","category"],"title":"ClaimTypeEmbedded"},"ClaimTypeResponse":{"properties":{"id":{"type":"integer","title":"Id"},"code":{"type":"string","title":"Code"},"name":{"type":"string","title":"Name"},"category":{"type":"string","title":"Category"},"country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country Code"},"tax_year":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tax Year"},"fiscal_year_start_month":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Fiscal Year Start Month"},"fiscal_year_start_day":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Fiscal Year Start Day"}},"type":"object","required":["id","code","name","category"],"title":"ClaimTypeResponse"},"ClaimTypesListResponse":{"properties":{"claim_types":{"items":{"$ref":"#/components/schemas/ClaimTypeResponse"},"type":"array","title":"Claim Types"}},"type":"object","required":["claim_types"],"title":"ClaimTypesListResponse"},"ClaimsListResponse":{"properties":{"claims":{"items":{"$ref":"#/components/schemas/ClaimResponse"},"type":"array","title":"Claims"}},"type":"object","required":["claims"],"title":"ClaimsListResponse"},"ClearOrphanedExpenditureApportionmentsResponse":{"properties":{"updated_count":{"type":"integer","title":"Updated Count"},"removed_apportionment_count":{"type":"integer","title":"Removed Apportionment Count"},"updated_salary_count":{"type":"integer","title":"Updated Salary Count","default":0},"updated_asset_count":{"type":"integer","title":"Updated Asset Count","default":0}},"type":"object","required":["updated_count","removed_apportionment_count"],"title":"ClearOrphanedExpenditureApportionmentsResponse"},"CollaboratorResponse":{"properties":{"user_id":{"type":"integer","title":"User Id"},"email":{"type":"string","title":"Email"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"added_by_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Added By Name"},"created_at":{"type":"string","title":"Created At"},"scope":{"type":"string","enum":["workspace","claim"],"title":"Scope","default":"workspace"},"tracking_only":{"type":"boolean","title":"Tracking Only","default":false}},"type":"object","required":["user_id","email","created_at"],"title":"CollaboratorResponse"},"CollaboratorsListResponse":{"properties":{"collaborators":{"items":{"$ref":"#/components/schemas/CollaboratorResponse"},"type":"array","title":"Collaborators"},"invitations":{"items":{"$ref":"#/components/schemas/InvitationResponse"},"type":"array","title":"Invitations"}},"type":"object","required":["collaborators","invitations"],"title":"CollaboratorsListResponse"},"CommentReplyResponse":{"properties":{"id":{"type":"integer","title":"Id"},"comment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Comment"},"is_confirmation":{"type":"boolean","title":"Is Confirmation","default":false},"user":{"$ref":"#/components/schemas/CommentUserEmbedded"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated At"}},"type":"object","required":["id","user","created_at"],"title":"CommentReplyResponse"},"CommentResponse":{"properties":{"id":{"type":"integer","title":"Id"},"answer_id":{"type":"integer","title":"Answer Id"},"comment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Comment"},"comment_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Comment Type"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"parent_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Parent Id"},"is_confirmation":{"type":"boolean","title":"Is Confirmation","default":false},"user":{"$ref":"#/components/schemas/CommentUserEmbedded"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated At"}},"type":"object","required":["id","answer_id","user","created_at"],"title":"CommentResponse"},"CommentThreadResponse":{"properties":{"id":{"type":"integer","title":"Id"},"answer_id":{"type":"integer","title":"Answer Id"},"comment_type":{"type":"string","title":"Comment Type"},"status":{"type":"string","title":"Status"},"comment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Comment"},"user":{"$ref":"#/components/schemas/CommentUserEmbedded"},"created_at":{"type":"string","title":"Created At"},"resolved_by":{"anyOf":[{"$ref":"#/components/schemas/CommentUserEmbedded"},{"type":"null"}]},"resolved_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Resolved At"},"replies":{"items":{"$ref":"#/components/schemas/CommentReplyResponse"},"type":"array","title":"Replies","default":[]},"latest_commenter_is_admin":{"type":"boolean","title":"Latest Commenter Is Admin","default":false}},"type":"object","required":["id","answer_id","comment_type","status","user","created_at"],"title":"CommentThreadResponse"},"CommentUserEmbedded":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"}},"type":"object","required":["id"],"title":"CommentUserEmbedded"},"CommentsSummary":{"properties":{"total":{"type":"integer","title":"Total"},"open":{"type":"integer","title":"Open"},"resolved":{"type":"integer","title":"Resolved"},"needs_response":{"type":"integer","title":"Needs Response","default":0},"awaiting_review":{"type":"integer","title":"Awaiting Review","default":0},"to_be_determined":{"type":"integer","title":"To Be Determined","default":0}},"type":"object","required":["total","open","resolved"],"title":"CommentsSummary"},"CompanyEmbedded":{"properties":{"id":{"type":"integer","title":"Id"},"legal_name":{"type":"string","title":"Legal Name"}},"type":"object","required":["id","legal_name"],"title":"CompanyEmbedded","description":"The legal entity a claim is filed for (subset for claim payloads)."},"CompanyResponse":{"properties":{"id":{"type":"integer","title":"Id"},"workspace_id":{"type":"integer","title":"Workspace Id"},"legal_name":{"type":"string","title":"Legal Name"},"registration_number":{"type":"string","title":"Registration Number"},"country_code":{"type":"string","title":"Country Code"},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website"},"address":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Address"},"claim_count":{"type":"integer","title":"Claim Count","default":0},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","workspace_id","legal_name","registration_number","country_code","website","address","created_at","updated_at"],"title":"CompanyResponse"},"ConfirmUploadResponse":{"properties":{"file":{"$ref":"#/components/schemas/FileResponse"}},"type":"object","required":["file"],"title":"ConfirmUploadResponse","description":"Response after confirming upload."},"ConnectResponse":{"properties":{"status":{"type":"string","title":"Status"},"oauth_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Oauth Url"},"account_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Name"},"connected_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Connected At"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"session_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Token"},"gitlab_instance_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Gitlab Instance Url"},"gitlab_com_blocked":{"type":"boolean","title":"Gitlab Com Blocked","default":false}},"type":"object","required":["status"],"title":"ConnectResponse"},"ConsultantInvitationResponse":{"properties":{"id":{"type":"integer","title":"Id"},"email":{"type":"string","title":"Email"},"invited_by_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invited By Name"},"created_at":{"type":"string","title":"Created At"},"expires_at":{"type":"string","title":"Expires At"},"status":{"type":"string","enum":["pending","expired"],"title":"Status"}},"type":"object","required":["id","email","created_at","expires_at","status"],"title":"ConsultantInvitationResponse"},"ConsultantResponse":{"properties":{"user_id":{"type":"integer","title":"User Id"},"email":{"type":"string","title":"Email"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"invited_by_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invited By Name"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["user_id","email","created_at"],"title":"ConsultantResponse"},"ConsultantsListResponse":{"properties":{"consultants":{"items":{"$ref":"#/components/schemas/ConsultantResponse"},"type":"array","title":"Consultants"},"invitations":{"items":{"$ref":"#/components/schemas/ConsultantInvitationResponse"},"type":"array","title":"Invitations"}},"type":"object","required":["consultants","invitations"],"title":"ConsultantsListResponse"},"CostPoolApportionmentInput":{"properties":{"activity_id":{"type":"integer","title":"Activity Id"},"percentage":{"type":"number","title":"Percentage"}},"type":"object","required":["activity_id","percentage"],"title":"CostPoolApportionmentInput"},"CostPoolApportionmentResponse":{"properties":{"id":{"type":"integer","title":"Id"},"activity_id":{"type":"integer","title":"Activity Id"},"activity_name":{"type":"string","title":"Activity Name"},"project_id":{"type":"integer","title":"Project Id"},"project_name":{"type":"string","title":"Project Name"},"percentage":{"type":"number","title":"Percentage"},"amount":{"type":"number","title":"Amount"},"reasoning":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reasoning"}},"type":"object","required":["id","activity_id","activity_name","project_id","project_name","percentage","amount"],"title":"CostPoolApportionmentResponse"},"CostPoolListResponse":{"properties":{"cost_pools":{"items":{"$ref":"#/components/schemas/CostPoolResponse"},"type":"array","title":"Cost Pools"},"total_amount":{"type":"number","title":"Total Amount"}},"type":"object","required":["cost_pools","total_amount"],"title":"CostPoolListResponse"},"CostPoolResponse":{"properties":{"id":{"type":"integer","title":"Id"},"description":{"type":"string","title":"Description"},"total_amount":{"type":"number","title":"Total Amount"},"source":{"type":"string","title":"Source"},"expenditure_category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expenditure Category"},"period_start":{"type":"string","title":"Period Start"},"period_end":{"type":"string","title":"Period End"},"evidence":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Evidence"},"source_ids":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Source Ids"},"apportionments":{"items":{"$ref":"#/components/schemas/CostPoolApportionmentResponse"},"type":"array","title":"Apportionments"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","description","total_amount","source","period_start","period_end","evidence","source_ids","apportionments","created_at"],"title":"CostPoolResponse"},"CreateActivityRequest":{"properties":{"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"activity_type":{"$ref":"#/components/schemas/ActivityType"},"source":{"anyOf":[{"type":"string","enum":["legacy","activity-map"]},{"type":"null"}],"title":"Source"}},"type":"object","required":["name","activity_type"],"title":"CreateActivityRequest"},"CreateClaimRequest":{"properties":{"name":{"type":"string","title":"Name"},"claim_type_code":{"type":"string","title":"Claim Type Code"},"workspace_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Workspace Id"},"company_id":{"type":"integer","title":"Company Id"},"fiscal_year_start_month":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Fiscal Year Start Month"}},"type":"object","required":["name","claim_type_code","company_id"],"title":"CreateClaimRequest"},"CreateCommentRequest":{"properties":{"answer_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Answer Id"},"question_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Question Id"},"instance_id":{"type":"integer","title":"Instance Id","default":0},"parent_instance_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Parent Instance Id"},"comment_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Comment Type"},"parent_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Parent Id"},"comment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Comment"},"is_confirmation":{"type":"boolean","title":"Is Confirmation","default":false}},"type":"object","title":"CreateCommentRequest"},"CreateCompanyRequest":{"properties":{"legal_name":{"type":"string","maxLength":255,"minLength":1,"title":"Legal Name"},"registration_number":{"type":"string","maxLength":100,"minLength":1,"title":"Registration Number"},"country_code":{"type":"string","maxLength":2,"minLength":2,"title":"Country Code"},"website":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Website"},"address":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Address"}},"type":"object","required":["legal_name","registration_number","country_code"],"title":"CreateCompanyRequest"},"CreateGroupQueryRequest":{"properties":{"category":{"type":"string","title":"Category"},"subgroup_key":{"type":"string","title":"Subgroup Key"},"question":{"type":"string","title":"Question"}},"type":"object","required":["category","subgroup_key","question"],"title":"CreateGroupQueryRequest"},"CreateItemsQueryRequest":{"properties":{"item_ids":{"items":{"type":"integer"},"type":"array","title":"Item Ids"},"question":{"type":"string","title":"Question"}},"type":"object","required":["item_ids","question"],"title":"CreateItemsQueryRequest"},"CreateProjectRequest":{"properties":{"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"source":{"anyOf":[{"type":"string","enum":["legacy","activity-map"]},{"type":"null"}],"title":"Source"}},"type":"object","required":["name"],"title":"CreateProjectRequest"},"CreateQueryRequest":{"properties":{"question":{"type":"string","title":"Question"}},"type":"object","required":["question"],"title":"CreateQueryRequest"},"CreateWorkspaceRequest":{"properties":{"name":{"type":"string","title":"Name"}},"type":"object","required":["name"],"title":"CreateWorkspaceRequest"},"CreatedByEmbedded":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"email":{"type":"string","title":"Email"}},"type":"object","required":["id","email"],"title":"CreatedByEmbedded"},"CreditNoteListResponse":{"properties":{"credit_notes":{"items":{"$ref":"#/components/schemas/CreditNoteResponse"},"type":"array","title":"Credit Notes"},"count":{"type":"integer","title":"Count"},"total_aud":{"type":"number","title":"Total Aud"},"fy_label":{"type":"string","title":"Fy Label"}},"type":"object","required":["credit_notes","count","total_aud","fy_label"],"title":"CreditNoteListResponse"},"CreditNoteResponse":{"properties":{"id":{"type":"integer","title":"Id"},"credit_note_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Credit Note Number"},"contact_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Name"},"date":{"type":"string","format":"date","title":"Date"},"status":{"type":"string","title":"Status"},"total_aud":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Total Aud"},"total_tax_aud":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Total Tax Aud"},"remaining_credit_aud":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Remaining Credit Aud"},"currency_code":{"type":"string","title":"Currency Code"},"allocations":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Allocations"}},"type":"object","required":["id","credit_note_number","contact_name","date","status","total_aud","total_tax_aud","remaining_credit_aud","currency_code","allocations"],"title":"CreditNoteResponse"},"DayClassificationResponse":{"properties":{"date":{"type":"string","title":"Date"},"classification":{"type":"string","title":"Classification"},"r_and_d_fraction":{"type":"number","title":"R And D Fraction"},"work_item_ids":{"additionalProperties":{"items":{"type":"integer"},"type":"array"},"type":"object","title":"Work Item Ids"},"activity_breakdown":{"anyOf":[{"additionalProperties":{"type":"integer"},"type":"object"},{"type":"null"}],"title":"Activity Breakdown"},"methodology_version":{"type":"string","title":"Methodology Version"}},"type":"object","required":["date","classification","r_and_d_fraction","work_item_ids","activity_breakdown","methodology_version"],"title":"DayClassificationResponse"},"DiscoveryMethodologyToggleResponse":{"properties":{"claim_id":{"type":"integer","title":"Claim Id"},"discovery_methodology":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Discovery Methodology"},"methodology_version":{"type":"string","title":"Methodology Version"}},"type":"object","required":["claim_id","discovery_methodology","methodology_version"],"title":"DiscoveryMethodologyToggleResponse","description":"Response for /activate-discovery and /deactivate-discovery endpoints."},"DistributionBasisOut":{"properties":{"employee_count":{"type":"integer","title":"Employee Count"},"total_rd_cost":{"type":"number","title":"Total Rd Cost"}},"type":"object","required":["employee_count","total_rd_cost"],"title":"DistributionBasisOut"},"DistributionShareOut":{"properties":{"activity_id":{"type":"integer","title":"Activity Id"},"activity_name":{"type":"string","title":"Activity Name"},"percentage":{"type":"number","title":"Percentage"}},"type":"object","required":["activity_id","activity_name","percentage"],"title":"DistributionShareOut"},"DownloadUrlResponse":{"properties":{"download_url":{"type":"string","title":"Download Url"},"expires_in":{"type":"integer","title":"Expires In"}},"type":"object","required":["download_url","expires_in"],"title":"DownloadUrlResponse","description":"Response with signed download URL."},"EditCommentRequest":{"properties":{"comment":{"type":"string","title":"Comment"}},"type":"object","required":["comment"],"title":"EditCommentRequest"},"EditMessageRequest":{"properties":{"body":{"type":"string","title":"Body"}},"type":"object","required":["body"],"title":"EditMessageRequest"},"EligibilityCounts":{"properties":{"r_and_d":{"type":"integer","title":"R And D","default":0},"non_eligible":{"type":"integer","title":"Non Eligible","default":0}},"type":"object","title":"EligibilityCounts"},"EmployeeApportionmentSummary":{"properties":{"employee_identity_id":{"type":"integer","title":"Employee Identity Id"},"canonical_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Canonical Name"},"rd_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Rd Percentage"},"proposed_rd_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Proposed Rd Percentage"},"methodology_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Methodology Version"},"inclusion_status":{"type":"string","enum":["included","excluded"],"title":"Inclusion Status"},"exclusion_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Exclusion Reason"},"requires_manual_handling":{"type":"boolean","title":"Requires Manual Handling"},"commit_count":{"type":"integer","title":"Commit Count"},"classified_day_count":{"type":"integer","title":"Classified Day Count"},"employment_start_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Employment Start Date"},"employment_end_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Employment End Date"}},"type":"object","required":["employee_identity_id","canonical_name","rd_percentage","proposed_rd_percentage","methodology_version","inclusion_status","exclusion_reason","requires_manual_handling","commit_count","classified_day_count","employment_start_date","employment_end_date"],"title":"EmployeeApportionmentSummary"},"EmployeeApportionmentSummaryResponse":{"properties":{"claim_id":{"type":"integer","title":"Claim Id"},"methodology_version":{"type":"string","title":"Methodology Version"},"claim_business_day_count":{"type":"integer","title":"Claim Business Day Count"},"period_start":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Period Start"},"period_end":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Period End"},"apportionment_methodology":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Apportionment Methodology"},"employees":{"items":{"$ref":"#/components/schemas/EmployeeApportionmentSummary"},"type":"array","title":"Employees"}},"type":"object","required":["claim_id","methodology_version","claim_business_day_count","employees"],"title":"EmployeeApportionmentSummaryResponse"},"EmployeeDaysResponse":{"properties":{"claim_id":{"type":"integer","title":"Claim Id"},"employee_identity_id":{"type":"integer","title":"Employee Identity Id"},"methodology_version":{"type":"string","title":"Methodology Version"},"days":{"items":{"$ref":"#/components/schemas/DayClassificationResponse"},"type":"array","title":"Days"}},"type":"object","required":["claim_id","employee_identity_id","methodology_version","days"],"title":"EmployeeDaysResponse"},"EmployeeDistributionOut":{"properties":{"scope":{"type":"string","title":"Scope"},"available":{"type":"boolean","title":"Available"},"shares":{"items":{"$ref":"#/components/schemas/DistributionShareOut"},"type":"array","title":"Shares"},"basis":{"$ref":"#/components/schemas/DistributionBasisOut"}},"type":"object","required":["scope","available","shares","basis"],"title":"EmployeeDistributionOut"},"EmployeeDistributionsResponse":{"properties":{"distributions":{"items":{"$ref":"#/components/schemas/EmployeeDistributionOut"},"type":"array","title":"Distributions"}},"type":"object","required":["distributions"],"title":"EmployeeDistributionsResponse"},"EmployeeIdentifierSummary":{"properties":{"identifier_type":{"type":"string","title":"Identifier Type"},"identifier_value":{"type":"string","title":"Identifier Value"},"source_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Type"},"source_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Id"}},"type":"object","required":["identifier_type","identifier_value","source_type","source_id"],"title":"EmployeeIdentifierSummary"},"EmployeeIdentityListResponse":{"properties":{"identities":{"items":{"$ref":"#/components/schemas/EmployeeIdentitySummary"},"type":"array","title":"Identities"}},"type":"object","required":["identities"],"title":"EmployeeIdentityListResponse"},"EmployeeIdentitySummary":{"properties":{"id":{"type":"integer","title":"Id"},"canonical_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Canonical Name"},"status":{"type":"string","title":"Status"},"excluded_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Excluded At"},"is_rd_contributor":{"type":"boolean","title":"Is Rd Contributor"},"identifiers":{"items":{"$ref":"#/components/schemas/EmployeeIdentifierSummary"},"type":"array","title":"Identifiers"},"employment_start_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Employment Start Date"},"employment_end_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Employment End Date"},"eligible_for_period":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Eligible For Period"},"inclusion_status":{"type":"string","title":"Inclusion Status"},"exclusion_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Exclusion Reason"},"exclusion_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Exclusion Source"},"merged_into_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Merged Into Id"},"merged_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Merged At"},"in_engineering_group":{"type":"boolean","title":"In Engineering Group","default":false}},"type":"object","required":["id","canonical_name","status","is_rd_contributor","identifiers","inclusion_status"],"title":"EmployeeIdentitySummary"},"EmployeeRateApportionmentResponse":{"properties":{"id":{"type":"integer","title":"Id"},"activity_id":{"type":"integer","title":"Activity Id"},"activity_name":{"type":"string","title":"Activity Name"},"project_id":{"type":"integer","title":"Project Id"},"project_name":{"type":"string","title":"Project Name"},"percentage":{"type":"number","title":"Percentage"},"amount":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Amount"}},"type":"object","required":["id","activity_id","activity_name","project_id","project_name","percentage","amount"],"title":"EmployeeRateApportionmentResponse"},"EmployeeRateListResponse":{"properties":{"rates":{"items":{"$ref":"#/components/schemas/EmployeeRateResponse"},"type":"array","title":"Rates"},"missing_identity_ids":{"items":{"type":"integer"},"type":"array","title":"Missing Identity Ids"},"missing_apportionment_ids":{"items":{"type":"integer"},"type":"array","title":"Missing Apportionment Ids"},"incomplete_apportionment_ids":{"items":{"type":"integer"},"type":"array","title":"Incomplete Apportionment Ids","default":[]},"salary_visible":{"type":"boolean","title":"Salary Visible","default":true}},"type":"object","required":["rates","missing_identity_ids","missing_apportionment_ids"],"title":"EmployeeRateListResponse"},"EmployeeRateRequest":{"properties":{"employee_identity_id":{"type":"integer","title":"Employee Identity Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"annual_salary":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"null"}],"title":"Annual Salary"},"rd_percentage":{"anyOf":[{"type":"number","maximum":100.0,"minimum":0.0},{"type":"null"}],"title":"Rd Percentage"},"apportionments":{"anyOf":[{"items":{"$ref":"#/components/schemas/CostPoolApportionmentInput"},"type":"array"},{"type":"null"}],"title":"Apportionments"}},"type":"object","required":["employee_identity_id"],"title":"EmployeeRateRequest"},"EmployeeRateResponse":{"properties":{"id":{"type":"integer","title":"Id"},"annual_salary":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Annual Salary"},"rd_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Rd Percentage"},"paid_wages":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Paid Wages"},"wages_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Wages Source"},"rd_cost":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Rd Cost"},"employee_identity_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Employee Identity Id"},"apportionments":{"items":{"$ref":"#/components/schemas/EmployeeRateApportionmentResponse"},"type":"array","title":"Apportionments"}},"type":"object","required":["id","annual_salary","rd_percentage","rd_cost","apportionments"],"title":"EmployeeRateResponse"},"EmployeeSalaryPayslipsResponse":{"properties":{"employee_identity_id":{"type":"integer","title":"Employee Identity Id"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"},"payslips":{"items":{"$ref":"#/components/schemas/SalaryPayslipRow"},"type":"array","title":"Payslips"},"total_wages":{"type":"number","title":"Total Wages"},"total_super":{"type":"number","title":"Total Super"},"total_employer_cost":{"type":"number","title":"Total Employer Cost"}},"type":"object","required":["employee_identity_id","payslips","total_wages","total_super","total_employer_cost"],"title":"EmployeeSalaryPayslipsResponse"},"EvidenceItemResponse":{"properties":{"id":{"type":"integer","title":"Id"},"source_type":{"type":"string","title":"Source Type"},"source_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Id"},"source_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Url"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"snippet":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Snippet"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","source_type","created_at"],"title":"EvidenceItemResponse"},"ExpendituresStatusResponse":{"properties":{"status":{"type":"string","title":"Status"},"reviewed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reviewed At"},"total_rd_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Total Rd Amount"}},"type":"object","required":["status"],"title":"ExpendituresStatusResponse"},"ExpenseReportResponse":{"properties":{"expenses":{"items":{"$ref":"#/components/schemas/ExpenseSummary"},"type":"array","title":"Expenses"},"grand_total":{"type":"number","title":"Grand Total"},"period_start":{"type":"string","title":"Period Start"},"period_end":{"type":"string","title":"Period End"},"missing_identity_ids":{"items":{"type":"integer"},"type":"array","title":"Missing Identity Ids"},"missing_apportionment_ids":{"items":{"type":"integer"},"type":"array","title":"Missing Apportionment Ids"},"incomplete_apportionment_ids":{"items":{"type":"integer"},"type":"array","title":"Incomplete Apportionment Ids","default":[]}},"type":"object","required":["expenses","grand_total","period_start","period_end","missing_identity_ids","missing_apportionment_ids"],"title":"ExpenseReportResponse"},"ExpenseSummary":{"properties":{"activity_id":{"type":"integer","title":"Activity Id"},"activity_name":{"type":"string","title":"Activity Name"},"activity_type":{"type":"string","title":"Activity Type"},"project_id":{"type":"integer","title":"Project Id"},"project_name":{"type":"string","title":"Project Name"},"employee_hours":{"type":"number","title":"Employee Hours"},"salary_cost":{"type":"number","title":"Salary Cost"},"other_costs":{"type":"number","title":"Other Costs"},"total":{"type":"number","title":"Total"}},"type":"object","required":["activity_id","activity_name","activity_type","project_id","project_name","employee_hours","salary_cost","other_costs","total"],"title":"ExpenseSummary"},"FileResponse":{"properties":{"id":{"type":"integer","title":"Id"},"filename":{"type":"string","title":"Filename"},"file_type":{"type":"string","title":"File Type"},"file_size":{"type":"integer","title":"File Size"},"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"},"report_year":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Report Year"},"status":{"type":"string","title":"Status"},"uploaded_at":{"type":"string","title":"Uploaded At"},"ai_summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ai Summary"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"},"processing_status":{"type":"string","title":"Processing Status"},"processing_error_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Processing Error Code"},"processing_error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Processing Error Message"},"extracted_qa":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Extracted Qa"},"tax_return_details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Tax Return Details"},"tax_return_mismatches":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Tax Return Mismatches"}},"type":"object","required":["id","filename","file_type","file_size","category","status","uploaded_at","processing_status"],"title":"FileResponse","description":"File details response."},"FilesListResponse":{"properties":{"files":{"items":{"$ref":"#/components/schemas/FileResponse"},"type":"array","title":"Files"}},"type":"object","required":["files"],"title":"FilesListResponse","description":"List of files response."},"FinalizeRequest":{"properties":{"provider":{"type":"string","title":"Provider"},"connection_id":{"type":"string","title":"Connection Id"},"claim_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Claim Id"}},"type":"object","required":["provider","connection_id"],"title":"FinalizeRequest"},"GenerateProgressResponse":{"properties":{"total":{"type":"integer","title":"Total"},"completed":{"type":"integer","title":"Completed"}},"type":"object","required":["total","completed"],"title":"GenerateProgressResponse"},"GenerateRequest":{"properties":{"question_codes":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Question Codes"},"regenerate":{"type":"boolean","title":"Regenerate","default":false}},"type":"object","title":"GenerateRequest"},"GenerateResponse":{"properties":{"status":{"type":"string","title":"Status"},"job_id":{"type":"string","title":"Job Id"},"questions_to_generate":{"type":"integer","title":"Questions To Generate"}},"type":"object","required":["status","job_id","questions_to_generate"],"title":"GenerateResponse"},"GenerateStatusResponse":{"properties":{"status":{"type":"string","title":"Status"},"progress":{"anyOf":[{"$ref":"#/components/schemas/GenerateProgressResponse"},{"type":"null"}]}},"type":"object","required":["status"],"title":"GenerateStatusResponse"},"GitLabSelfManagedConnectRequest":{"properties":{"instance_url":{"type":"string","maxLength":512,"title":"Instance Url"},"access_token":{"type":"string","maxLength":1024,"title":"Access Token"}},"type":"object","required":["instance_url","access_token"],"title":"GitLabSelfManagedConnectRequest"},"GoogleDriveFileInfo":{"properties":{"id":{"type":"string","title":"Id","description":"Google Drive file ID"},"name":{"type":"string","title":"Name","description":"File name"},"mimeType":{"type":"string","title":"Mimetype","description":"MIME type"}},"type":"object","required":["id","name","mimeType"],"title":"GoogleDriveFileInfo","description":"Info about a file selected from Google Drive Picker."},"GroupInstanceResponse":{"properties":{"instance_id":{"type":"integer","title":"Instance Id"},"parent_instance_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Parent Instance Id"},"answers":{"additionalProperties":{"$ref":"#/components/schemas/AnswerResponse"},"type":"object","title":"Answers"}},"type":"object","required":["instance_id","answers"],"title":"GroupInstanceResponse"},"GroupItem":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"},"source_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Source Amount"},"source_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Date"},"source_account_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Account Code"},"source_account_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Account Name"},"source_employee_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Employee Name"},"source_department":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Department"},"rd_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Rd Percentage"},"percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Percentage"},"rd_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Rd Amount"},"eligibility":{"type":"string","title":"Eligibility"},"manual_override":{"type":"boolean","title":"Manual Override"},"manual_override_by_admin":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Manual Override By Admin"},"auto_categorised":{"type":"boolean","title":"Auto Categorised","default":false},"import_source_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Import Source Type"},"open_query_count":{"type":"integer","title":"Open Query Count","default":0},"refund_of_item_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Refund Of Item Id"},"distribution_linked":{"type":"boolean","title":"Distribution Linked","default":false},"distribution_link_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Distribution Link Source"},"distribution_scope":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Distribution Scope"},"apportionments":{"items":{"$ref":"#/components/schemas/ApportionmentOut"},"type":"array","title":"Apportionments","default":[]}},"type":"object","required":["id","name","description","source_amount","source_date","source_account_code","source_account_name","source_employee_name","source_department","rd_percentage","rd_amount","eligibility","manual_override"],"title":"GroupItem","description":"A single line within the deepest level of the hierarchy.\n\nWhen an item is apportioned across activities it is fanned out — one\n``GroupItem`` per activity it touches. On each fanned copy ``percentage`` is\nthat activity's slice of the item's R&D and ``rd_amount`` is the slice's\ndollars — within a cent of ``source_amount * percentage / 100``, reconciled\nso the fanned copies sum exactly to the item's whole-cent R&D total;\n``rd_percentage`` is the item's total R&D% (same on every copy) and\n``apportionments`` is the full split (also repeated on every copy) so the\neditor can seed itself from any one of them. Unapportioned (Ungrouped)\nitems carry ``percentage = None``."},"GroupedItemsResponse":{"properties":{"activities":{"items":{"$ref":"#/components/schemas/ActivityGroup"},"type":"array","title":"Activities"},"total_amount":{"type":"number","title":"Total Amount"},"total_gross_amount":{"type":"number","title":"Total Gross Amount"},"total_rd_amount":{"type":"number","title":"Total Rd Amount"},"total_items":{"type":"integer","title":"Total Items"}},"type":"object","required":["activities","total_amount","total_gross_amount","total_rd_amount","total_items"],"title":"GroupedItemsResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ImpersonateResponse":{"properties":{"user_id":{"type":"integer","title":"User Id"},"email":{"type":"string","title":"Email"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"is_admin":{"type":"boolean","title":"Is Admin"},"impersonating":{"anyOf":[{"$ref":"#/components/schemas/ImpersonationInfo"},{"type":"null"}]}},"type":"object","required":["user_id","email","name","is_admin"],"title":"ImpersonateResponse"},"ImpersonationInfo":{"properties":{"admin_email":{"type":"string","title":"Admin Email"},"admin_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Admin Name"},"target_email":{"type":"string","title":"Target Email"},"target_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target Name"}},"type":"object","required":["admin_email","admin_name","target_email","target_name"],"title":"ImpersonationInfo","description":"Impersonation context returned by /auth/me."},"ImportGoogleDriveRequest":{"properties":{"files":{"items":{"$ref":"#/components/schemas/GoogleDriveFileInfo"},"type":"array","maxItems":10,"minItems":1,"title":"Files"},"oauth_token":{"type":"string","title":"Oauth Token","description":"OAuth token from Google Picker"}},"type":"object","required":["files","oauth_token"],"title":"ImportGoogleDriveRequest","description":"Request to import files from Google Drive."},"ImportGoogleDriveResponse":{"properties":{"files":{"items":{"$ref":"#/components/schemas/FileResponse"},"type":"array","title":"Files"},"errors":{"items":{"type":"string"},"type":"array","title":"Errors","default":[]}},"type":"object","required":["files"],"title":"ImportGoogleDriveResponse","description":"Response after importing Google Drive files."},"ImportResponse":{"properties":{"id":{"type":"integer","title":"Id"},"filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Filename"},"source_type":{"type":"string","title":"Source Type"},"source_realm":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Realm"},"last_synced_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Synced At"},"raw_row_count":{"type":"integer","title":"Raw Row Count"},"skipped_count":{"type":"integer","title":"Skipped Count"},"skip_reasons":{"anyOf":[{"additionalProperties":{"anyOf":[{"type":"integer"},{"type":"string"}]},"type":"object"},{"type":"null"}],"title":"Skip Reasons"},"status":{"type":"string","title":"Status"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","filename","source_type","source_realm","last_synced_at","raw_row_count","skipped_count","skip_reasons","status","created_at"],"title":"ImportResponse"},"InternalMonthlyReportDetailResponse":{"properties":{"report":{"$ref":"#/components/schemas/MonthlyReportResponse"},"claim_id":{"type":"integer","title":"Claim Id"},"claim_name":{"type":"string","title":"Claim Name"},"company_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company Name"},"template_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Template Path"},"template_sha256":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Template Sha256"},"app_git_sha":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"App Git Sha"}},"type":"object","required":["report","claim_id","claim_name","company_name","template_path","template_sha256","app_git_sha"],"title":"InternalMonthlyReportDetailResponse"},"InternalMonthlyReportQueueItem":{"properties":{"id":{"type":"integer","title":"Id"},"claim_id":{"type":"integer","title":"Claim Id"},"claim_name":{"type":"string","title":"Claim Name"},"company_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company Name"},"period_start":{"type":"string","title":"Period Start"},"period_end":{"type":"string","title":"Period End"},"timezone":{"type":"string","title":"Timezone"},"status":{"type":"string","title":"Status"},"trigger_type":{"type":"string","title":"Trigger Type"},"run_started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Run Started At"},"run_finished_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Run Finished At"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"has_pdf":{"type":"boolean","title":"Has Pdf"}},"type":"object","required":["id","claim_id","claim_name","company_name","period_start","period_end","timezone","status","trigger_type","run_started_at","run_finished_at","error_message","has_pdf"],"title":"InternalMonthlyReportQueueItem"},"InternalMonthlyReportQueueResponse":{"properties":{"reports":{"items":{"$ref":"#/components/schemas/InternalMonthlyReportQueueItem"},"type":"array","title":"Reports"}},"type":"object","required":["reports"],"title":"InternalMonthlyReportQueueResponse"},"InternalNoteBody":{"properties":{"body":{"type":"string","title":"Body"}},"type":"object","required":["body"],"title":"InternalNoteBody"},"InternalNoteResponse":{"properties":{"id":{"type":"integer","title":"Id"},"answer_id":{"type":"integer","title":"Answer Id"},"body":{"type":"string","title":"Body"},"user":{"anyOf":[{"$ref":"#/components/schemas/InternalNoteUser"},{"type":"null"}]},"created_at":{"type":"string","title":"Created At"},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated At"}},"type":"object","required":["id","answer_id","body","created_at"],"title":"InternalNoteResponse"},"InternalNoteUser":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"}},"type":"object","required":["id"],"title":"InternalNoteUser"},"InternalNotesListResponse":{"properties":{"notes":{"items":{"$ref":"#/components/schemas/InternalNoteResponse"},"type":"array","title":"Notes"}},"type":"object","required":["notes"],"title":"InternalNotesListResponse"},"InvitationResponse":{"properties":{"id":{"type":"integer","title":"Id"},"email":{"type":"string","title":"Email"},"status":{"type":"string","title":"Status"},"invited_by_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invited By Name"},"created_at":{"type":"string","title":"Created At"},"expires_at":{"type":"string","title":"Expires At"},"scope":{"type":"string","enum":["workspace","claim"],"title":"Scope","default":"workspace"},"tracking_only":{"type":"boolean","title":"Tracking Only","default":false}},"type":"object","required":["id","email","status","created_at","expires_at"],"title":"InvitationResponse"},"IsConsultantClaimResponse":{"properties":{"claim_id":{"type":"integer","title":"Claim Id"},"is_consultant_claim":{"type":"boolean","title":"Is Consultant Claim"}},"type":"object","required":["claim_id","is_consultant_claim"],"title":"IsConsultantClaimResponse"},"ItemAdminNoteResponse":{"properties":{"item_id":{"type":"integer","title":"Item Id"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"}},"type":"object","required":["item_id","note"],"title":"ItemAdminNoteResponse","description":"Internal note attached to one expenditure item."},"ItemAdminNoteUpdate":{"properties":{"note":{"anyOf":[{"type":"string","maxLength":10000},{"type":"null"}],"title":"Note"}},"type":"object","title":"ItemAdminNoteUpdate","description":"Replace (or clear) an expenditure item's internal admin note."},"ItemApportionmentInput":{"properties":{"activity_id":{"type":"integer","title":"Activity Id"},"percentage":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Percentage"}},"type":"object","required":["activity_id","percentage"],"title":"ItemApportionmentInput"},"ItemCreate":{"properties":{"name":{"type":"string","title":"Name"},"source_amount":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Source Amount"},"source_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Source Date"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"},"eligibility":{"type":"string","enum":["r_and_d","non_eligible"],"title":"Eligibility","default":"non_eligible"},"rd_percentage":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Rd Percentage"},"activity_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Activity Id"}},"type":"object","required":["name","source_amount"],"title":"ItemCreate","description":"Payload for manually creating a single expenditure item via the\nadmin \"Add expense\" dialog. All rows created through this surface get\n``manual_override=True``."},"ItemIdsResponse":{"properties":{"ids":{"items":{"type":"integer"},"type":"array","title":"Ids"}},"type":"object","required":["ids"],"title":"ItemIdsResponse","description":"Ids of every selectable item matching the All-expenses filters."},"ItemResponse":{"properties":{"id":{"type":"integer","title":"Id"},"import_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Import Id"},"source_sheet":{"type":"string","title":"Source Sheet"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"},"source_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Source Amount"},"source_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Date"},"source_account_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Account Code"},"source_account_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Account Name"},"source_employee_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Employee Name"},"source_department":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Department"},"source_tax_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Source Tax Amount"},"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"},"subgroup_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subgroup Key"},"activity_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Activity Id"},"eligibility":{"type":"string","title":"Eligibility"},"rd_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Rd Percentage"},"rd_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Rd Amount"},"manual_override":{"type":"boolean","title":"Manual Override"},"manual_override_by_admin":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Manual Override By Admin"},"auto_categorised":{"type":"boolean","title":"Auto Categorised","default":false},"import_source_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Import Source Type"},"open_query_count":{"type":"integer","title":"Open Query Count","default":0},"apportionments":{"items":{"$ref":"#/components/schemas/ApportionmentOut"},"type":"array","title":"Apportionments","default":[]},"refund_of_item_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Refund Of Item Id"},"refund_of_item_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Refund Of Item Name"},"distribution_linked":{"type":"boolean","title":"Distribution Linked","default":false},"distribution_link_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Distribution Link Source"},"distribution_scope":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Distribution Scope"}},"type":"object","required":["id","import_id","source_sheet","name","description","source_amount","source_date","source_account_code","source_employee_name","source_department","category","subgroup_key","activity_id","eligibility","rd_percentage","rd_amount","manual_override"],"title":"ItemResponse"},"ItemUpdate":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"rd_percentage":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Rd Percentage"},"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"},"subgroup_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subgroup Key"},"activity_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Activity Id"},"eligibility":{"anyOf":[{"type":"string","enum":["r_and_d","non_eligible"]},{"type":"null"}],"title":"Eligibility"},"refund_of_item_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Refund Of Item Id"}},"type":"object","title":"ItemUpdate","description":"Partial update for an expenditure item.\n\nMost fields treat ``None`` as \"omitted, leave unchanged\" and use empty\nstring to clear (e.g. ``description``).\n\n``rd_percentage`` and ``activity_id`` are the exceptions and use\n\"explicit null = clear\" semantics — null ``activity_id`` moves the item\nback to the Ungrouped bucket. Distinguish \"absent from JSON\" from\n\"JSON null\" via ``model_fields_set`` in the handler."},"ItemsListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ItemResponse"},"type":"array","title":"Items"},"offset":{"type":"integer","title":"Offset"},"total":{"type":"integer","title":"Total"},"selectable_total":{"type":"integer","title":"Selectable Total"},"total_amount":{"type":"number","title":"Total Amount"},"total_rd_amount":{"type":"number","title":"Total Rd Amount"},"eligibility_counts":{"$ref":"#/components/schemas/EligibilityCounts"},"rd_items_with_percentage":{"type":"integer","title":"Rd Items With Percentage"}},"type":"object","required":["items","offset","total","selectable_total","total_amount","total_rd_amount","eligibility_counts","rd_items_with_percentage"],"title":"ItemsListResponse"},"LeadCreate":{"properties":{"name":{"type":"string","minLength":1,"title":"Name"},"email":{"type":"string","format":"email","title":"Email"},"claimed_rd_tax_before":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Claimed Rd Tax Before"},"company_name":{"type":"string","minLength":1,"title":"Company Name"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"hear_about_us_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hear About Us Source"},"notes":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Notes"},"details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Details"}},"type":"object","required":["name","email","company_name"],"title":"LeadCreate"},"LeadRead":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"email":{"type":"string","title":"Email"},"claimed_rd_tax_before":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Claimed Rd Tax Before"},"company_name":{"type":"string","title":"Company Name"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"hear_about_us_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hear About Us Source"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Details"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","name","email","claimed_rd_tax_before","company_name","phone","hear_about_us_source","notes","created_at"],"title":"LeadRead"},"LedgerListResponse":{"properties":{"transactions":{"items":{"$ref":"#/components/schemas/LedgerTransactionResponse"},"type":"array","title":"Transactions"},"total_count":{"type":"integer","title":"Total Count"},"money_in_aud":{"type":"number","title":"Money In Aud"},"money_out_aud":{"type":"number","title":"Money Out Aud"},"fy_label":{"type":"string","title":"Fy Label"}},"type":"object","required":["transactions","total_count","money_in_aud","money_out_aud","fy_label"],"title":"LedgerListResponse"},"LedgerTransactionResponse":{"properties":{"id":{"type":"integer","title":"Id"},"source_type":{"type":"string","title":"Source Type"},"date":{"type":"string","format":"date","title":"Date"},"contact_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Name"},"reference":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reference"},"status":{"type":"string","title":"Status"},"direction":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Direction"},"total_aud":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Total Aud"},"total_tax_aud":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Total Tax Aud"},"currency_code":{"type":"string","title":"Currency Code"}},"type":"object","required":["id","source_type","date","contact_name","reference","status","direction","total_aud","total_tax_aud","currency_code"],"title":"LedgerTransactionResponse"},"ListCommentsResponse":{"properties":{"comments":{"items":{"$ref":"#/components/schemas/CommentThreadResponse"},"type":"array","title":"Comments"},"summary":{"$ref":"#/components/schemas/CommentsSummary"},"by_section":{"additionalProperties":{"$ref":"#/components/schemas/SectionCommentCounts"},"type":"object","title":"By Section","default":{}}},"type":"object","required":["comments","summary"],"title":"ListCommentsResponse"},"ListCompaniesResponse":{"properties":{"companies":{"items":{"$ref":"#/components/schemas/CompanyResponse"},"type":"array","title":"Companies"}},"type":"object","required":["companies"],"title":"ListCompaniesResponse"},"LoginRequest":{"properties":{"id_token":{"type":"string","title":"Id Token"}},"type":"object","required":["id_token"],"title":"LoginRequest","description":"Request body for login endpoint."},"LoginResponse":{"properties":{"user_id":{"type":"integer","title":"User Id"},"email":{"type":"string","title":"Email"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"email_verified":{"type":"boolean","title":"Email Verified","default":true}},"type":"object","required":["user_id","email"],"title":"LoginResponse","description":"Response from login endpoint."},"MergeActivitiesRequest":{"properties":{"target_id":{"type":"integer","title":"Target Id"},"source_ids":{"items":{"type":"integer"},"type":"array","title":"Source Ids"},"source":{"anyOf":[{"type":"string","enum":["legacy","activity-map"]},{"type":"null"}],"title":"Source"}},"type":"object","required":["target_id","source_ids"],"title":"MergeActivitiesRequest"},"MergeEmployeeIdentitiesRequest":{"properties":{"target_id":{"type":"integer","title":"Target Id"},"source_ids":{"items":{"type":"integer"},"type":"array","title":"Source Ids"}},"type":"object","required":["target_id","source_ids"],"title":"MergeEmployeeIdentitiesRequest"},"MergeProjectsRequest":{"properties":{"target_id":{"type":"integer","title":"Target Id"},"source_ids":{"items":{"type":"integer"},"type":"array","title":"Source Ids"},"source":{"anyOf":[{"type":"string","enum":["legacy","activity-map"]},{"type":"null"}],"title":"Source"}},"type":"object","required":["target_id","source_ids"],"title":"MergeProjectsRequest"},"MergeSubgroupRequest":{"properties":{"source":{"$ref":"#/components/schemas/_SubgroupRef"},"target":{"$ref":"#/components/schemas/_SubgroupRef"}},"type":"object","required":["source","target"],"title":"MergeSubgroupRequest","description":"Move every item in ``source`` into ``target``. After this completes,\n``source`` no longer appears in the grouped view (no items left with that\n``(category, subgroup_key)`` pair) and ``target`` absorbs the items."},"MergedActivitySummary":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"merged_into_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Merged Into Id"},"merged_into_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Merged Into Name"},"merged_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Merged At"}},"type":"object","required":["id","name","merged_into_id","merged_into_name","merged_at"],"title":"MergedActivitySummary"},"MergedProjectSummary":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"merged_into_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Merged Into Id"},"merged_into_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Merged Into Name"},"merged_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Merged At"}},"type":"object","required":["id","name","merged_into_id","merged_into_name","merged_at"],"title":"MergedProjectSummary"},"MonthlyReportDownloadUrlResponse":{"properties":{"download_url":{"type":"string","title":"Download Url"},"filename":{"type":"string","title":"Filename"},"expires_in":{"type":"integer","title":"Expires In"}},"type":"object","required":["download_url","filename","expires_in"],"title":"MonthlyReportDownloadUrlResponse"},"MonthlyReportListResponse":{"properties":{"reports":{"items":{"$ref":"#/components/schemas/MonthlyReportResponse"},"type":"array","title":"Reports"}},"type":"object","required":["reports"],"title":"MonthlyReportListResponse"},"MonthlyReportResponse":{"properties":{"id":{"type":"integer","title":"Id"},"period_start":{"type":"string","title":"Period Start"},"period_end":{"type":"string","title":"Period End"},"timezone":{"type":"string","title":"Timezone"},"status":{"type":"string","title":"Status"},"trigger_type":{"type":"string","title":"Trigger Type"},"run_started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Run Started At"},"run_finished_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Run Finished At"},"sync_counts":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Sync Counts"},"discovery_counts":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Discovery Counts"},"categorization_counts":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Categorization Counts"},"report_summary":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Report Summary"},"has_pdf":{"type":"boolean","title":"Has Pdf"},"email_sent_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email Sent At"},"email_recipients":{"items":{"type":"string"},"type":"array","title":"Email Recipients"},"review_decision":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Review Decision"},"review_notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Review Notes"},"sent_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sent At"},"customer_visible_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Visible At"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"}},"type":"object","required":["id","period_start","period_end","timezone","status","trigger_type","run_started_at","run_finished_at","sync_counts","discovery_counts","categorization_counts","report_summary","has_pdf","email_sent_at","email_recipients","review_decision","review_notes","sent_at","customer_visible_at","error_message"],"title":"MonthlyReportResponse"},"MonthlyReportRunResponse":{"properties":{"status":{"type":"string","title":"Status"},"report_id":{"type":"integer","title":"Report Id"}},"type":"object","required":["status","report_id"],"title":"MonthlyReportRunResponse"},"MoveActivityRequest":{"properties":{"target_project_id":{"type":"integer","title":"Target Project Id"}},"type":"object","required":["target_project_id"],"title":"MoveActivityRequest"},"NangoProviderConnections":{"properties":{"total":{"type":"integer","title":"Total"},"on_nango":{"type":"integer","title":"On Nango"}},"type":"object","required":["total","on_nango"],"title":"NangoProviderConnections"},"NangoProvidersResponse":{"properties":{"claim_id":{"type":"integer","title":"Claim Id"},"nango_providers":{"items":{"type":"string"},"type":"array","title":"Nango Providers"},"global_nango_providers":{"items":{"type":"string"},"type":"array","title":"Global Nango Providers"},"available_providers":{"items":{"type":"string"},"type":"array","title":"Available Providers"},"connections":{"additionalProperties":{"$ref":"#/components/schemas/NangoProviderConnections"},"type":"object","title":"Connections"}},"type":"object","required":["claim_id","nango_providers","global_nango_providers","available_providers","connections"],"title":"NangoProvidersResponse"},"NotificationItem":{"properties":{"id":{"type":"integer","title":"Id"},"kind":{"type":"string","title":"Kind"},"title":{"type":"string","title":"Title"},"body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Body"},"claim_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Claim Id"},"answer_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Answer Id"},"comment_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Comment Id"},"read_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Read At"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"link":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Link"}},"type":"object","required":["id","kind","title","body","claim_id","answer_id","comment_id","read_at","created_at","link"],"title":"NotificationItem"},"NotificationListResponse":{"properties":{"notifications":{"items":{"$ref":"#/components/schemas/NotificationItem"},"type":"array","title":"Notifications"},"unread_count":{"type":"integer","title":"Unread Count"},"has_more":{"type":"boolean","title":"Has More"}},"type":"object","required":["notifications","unread_count","has_more"],"title":"NotificationListResponse"},"NotionScopeItemInput":{"properties":{"id":{"type":"string","title":"Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"object_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Object Type"}},"type":"object","required":["id"],"title":"NotionScopeItemInput"},"OffsetSettingsResponse":{"properties":{"claim_id":{"type":"integer","title":"Claim Id"},"offset_type":{"type":"string","title":"Offset Type"},"corporate_tax_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Corporate Tax Rate"},"premium_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Premium Rate"},"total_expenses":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Total Expenses"}},"type":"object","required":["claim_id","offset_type","corporate_tax_rate","premium_rate","total_expenses"],"title":"OffsetSettingsResponse"},"OrphanedExpenditureApportionmentsStatus":{"properties":{"orphaned_expenditure_count":{"type":"integer","title":"Orphaned Expenditure Count"},"orphaned_salary_count":{"type":"integer","title":"Orphaned Salary Count","default":0},"orphaned_asset_count":{"type":"integer","title":"Orphaned Asset Count","default":0}},"type":"object","required":["orphaned_expenditure_count"],"title":"OrphanedExpenditureApportionmentsStatus"},"OtherCostListResponse":{"properties":{"costs":{"items":{"$ref":"#/components/schemas/OtherCostResponse"},"type":"array","title":"Costs"},"total_amount":{"type":"number","title":"Total Amount"}},"type":"object","required":["costs","total_amount"],"title":"OtherCostListResponse"},"OtherCostResponse":{"properties":{"id":{"type":"integer","title":"Id"},"activity_id":{"type":"integer","title":"Activity Id"},"activity_name":{"type":"string","title":"Activity Name"},"project_id":{"type":"integer","title":"Project Id"},"project_name":{"type":"string","title":"Project Name"},"amount":{"type":"number","title":"Amount"},"description":{"type":"string","title":"Description"},"source":{"type":"string","title":"Source"},"period_start":{"type":"string","title":"Period Start"},"period_end":{"type":"string","title":"Period End"},"reasoning":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reasoning"},"evidence":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Evidence"},"cost_pool_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Cost Pool Id"},"apportionment_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Apportionment Pct"},"currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Currency"}},"type":"object","required":["id","activity_id","activity_name","project_id","project_name","amount","description","source","period_start","period_end","reasoning","evidence"],"title":"OtherCostResponse"},"ProfitLossResponse":{"properties":{"synced":{"type":"boolean","title":"Synced"},"period_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Period Label"},"currency_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Currency Code"},"last_synced_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Synced At"},"report_period_start":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Report Period Start"},"report_period_end":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Report Period End"},"report":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Report"}},"type":"object","required":["synced"],"title":"ProfitLossResponse"},"ProgressResponse":{"properties":{"total_questions":{"type":"integer","title":"Total Questions"},"answered":{"type":"integer","title":"Answered"},"required_remaining":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Required Remaining"}},"type":"object","required":["total_questions","answered"],"title":"ProgressResponse"},"ProjectListResponse":{"properties":{"projects":{"items":{"$ref":"#/components/schemas/ProjectResponse"},"type":"array","title":"Projects"},"source":{"type":"string","enum":["legacy","activity-map"],"title":"Source","default":"legacy"}},"type":"object","required":["projects"],"title":"ProjectListResponse"},"ProjectResponse":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"status":{"type":"string","title":"Status"},"ai_reasoning":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ai Reasoning"},"activities":{"items":{"$ref":"#/components/schemas/ActivityResponse"},"type":"array","title":"Activities","default":[]},"sort_order":{"type":"integer","title":"Sort Order","default":0},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","name","description","status","created_at","updated_at"],"title":"ProjectResponse"},"PromoteToAssetPayload":{"properties":{"effective_life_years":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Effective Life Years"},"method":{"type":"string","title":"Method","default":"prime_cost"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"cost":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Cost"},"acquisition_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Acquisition Date"},"rd_percentage":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Rd Percentage"},"activity_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Activity Id"},"apportionments":{"anyOf":[{"items":{"$ref":"#/components/schemas/ItemApportionmentInput"},"type":"array"},{"type":"null"}],"title":"Apportionments"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"}},"type":"object","required":["effective_life_years"],"title":"PromoteToAssetPayload","description":"Payload for \"Mark as depreciating asset\" — promote an expenditure item into\na linked depreciating asset. ``effective_life_years`` / ``method`` are the two\ninputs a transaction can't supply; the rest default to the item's values but\nmay be overridden in the dialog. ``method`` is validated in the handler so it\nreturns a clean 400."},"QueryItemSelectionRequest":{"properties":{"item_ids":{"items":{"type":"integer"},"type":"array","title":"Item Ids"}},"type":"object","required":["item_ids"],"title":"QueryItemSelectionRequest"},"QueryMessageResponse":{"properties":{"id":{"type":"integer","title":"Id"},"query_id":{"type":"integer","title":"Query Id"},"author_role":{"type":"string","enum":["admin","customer"],"title":"Author Role"},"author_user_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Author User Id"},"author_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Author Name"},"body":{"type":"string","title":"Body"},"created_at":{"type":"string","title":"Created At"},"edited_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Edited At"},"edited_by_user_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Edited By User Id"}},"type":"object","required":["id","query_id","author_role","author_user_id","author_name","body","created_at","edited_at","edited_by_user_id"],"title":"QueryMessageResponse"},"QueryResponse":{"properties":{"id":{"type":"integer","title":"Id"},"scope":{"type":"string","enum":["item","items","payslip","subgroup","general"],"title":"Scope"},"expenditure_item_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expenditure Item Id"},"employee_expense_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Employee Expense Id"},"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"},"subgroup_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subgroup Key"},"status":{"type":"string","title":"Status"},"asked_at":{"type":"string","title":"Asked At"},"resolved_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Resolved At"},"messages":{"items":{"$ref":"#/components/schemas/QueryMessageResponse"},"type":"array","title":"Messages"},"item":{"anyOf":[{"$ref":"#/components/schemas/_QueryItemSummary"},{"type":"null"}]},"payslip":{"anyOf":[{"$ref":"#/components/schemas/_QueryPayslipSummary"},{"type":"null"}]},"linked_refunds":{"items":{"$ref":"#/components/schemas/_QueryItemSummary"},"type":"array","title":"Linked Refunds"},"subgroup_items":{"items":{"$ref":"#/components/schemas/_QuerySubgroupItemSummary"},"type":"array","title":"Subgroup Items"},"selected_items":{"items":{"$ref":"#/components/schemas/_QuerySubgroupItemSummary"},"type":"array","title":"Selected Items"},"selected_items_missing":{"type":"integer","title":"Selected Items Missing","default":0}},"type":"object","required":["id","scope","expenditure_item_id","employee_expense_id","category","subgroup_key","status","asked_at","resolved_at","messages","item","payslip"],"title":"QueryResponse"},"QuestionResponse":{"properties":{"id":{"type":"integer","title":"Id"},"code":{"type":"string","title":"Code"},"question_text":{"type":"string","title":"Question Text"},"help_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Help Text"},"question_type":{"type":"string","title":"Question Type"},"required":{"type":"boolean","title":"Required"},"options":{"anyOf":[{"items":{},"type":"array"},{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Options"},"validation_rules":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Validation Rules"},"depends_on":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Depends On"},"group_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Group Code"},"group_min":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Group Min"},"group_max":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Group Max"},"parent_group_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Group Code"},"locked":{"type":"boolean","title":"Locked","default":false},"customer_only":{"type":"boolean","title":"Customer Only","default":false},"answer":{"anyOf":[{"$ref":"#/components/schemas/AnswerResponse"},{"type":"null"}]}},"type":"object","required":["id","code","question_text","question_type","required"],"title":"QuestionResponse"},"QuestionsProgressResponse":{"properties":{"total":{"type":"integer","title":"Total"},"answered":{"type":"integer","title":"Answered"},"required_remaining":{"type":"integer","title":"Required Remaining"}},"type":"object","required":["total","answered","required_remaining"],"title":"QuestionsProgressResponse"},"QuestionsResponse":{"properties":{"sections":{"items":{"$ref":"#/components/schemas/SectionResponse"},"type":"array","title":"Sections"},"progress":{"$ref":"#/components/schemas/QuestionsProgressResponse"},"gate_codes":{"items":{"type":"string"},"type":"array","title":"Gate Codes"},"hidden_gate_codes":{"items":{"type":"string"},"type":"array","title":"Hidden Gate Codes","default":[]}},"type":"object","required":["sections","progress","gate_codes"],"title":"QuestionsResponse"},"RDScheduleUpdate":{"properties":{"manual_values":{"additionalProperties":true,"type":"object","title":"Manual Values"},"overrides":{"additionalProperties":true,"type":"object","title":"Overrides"}},"type":"object","title":"RDScheduleUpdate"},"ReconnectRequest":{"properties":{"provider":{"type":"string","title":"Provider"},"claim_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Claim Id"}},"type":"object","required":["provider"],"title":"ReconnectRequest"},"RecordViewRequest":{"properties":{"page":{"type":"string","enum":["sources","tracking","expenditures","review","schedule","submit"],"title":"Page"}},"type":"object","required":["page"],"title":"RecordViewRequest"},"RegenerateClaimRequest":{"properties":{"prompt":{"anyOf":[{"type":"string","maxLength":50000},{"type":"null"}],"title":"Prompt"}},"type":"object","title":"RegenerateClaimRequest"},"RejectMonthlyReportRequest":{"properties":{"review_notes":{"type":"string","maxLength":2000,"minLength":1,"title":"Review Notes"}},"type":"object","required":["review_notes"],"title":"RejectMonthlyReportRequest"},"RejectTrackingRequest":{"properties":{"discovery_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Discovery Prompt"}},"type":"object","title":"RejectTrackingRequest"},"RemoveEmployeeFromActivityResponse":{"properties":{"work_items_unassigned":{"type":"integer","title":"Work Items Unassigned"},"apportionments_removed":{"type":"integer","title":"Apportionments Removed"}},"type":"object","required":["work_items_unassigned","apportionments_removed"],"title":"RemoveEmployeeFromActivityResponse"},"RenameSubgroupRequest":{"properties":{"category":{"type":"string","title":"Category"},"subgroup_key":{"type":"string","title":"Subgroup Key"},"new_subgroup_key":{"type":"string","title":"New Subgroup Key"}},"type":"object","required":["category","subgroup_key","new_subgroup_key"],"title":"RenameSubgroupRequest","description":"Relabel a subgroup in place: every active item in\n``(category, subgroup_key)`` picks up ``new_subgroup_key``.\n\nUnlike :class:`MergeSubgroupRequest` this is a pure rename — it stays\nwithin one category and is rejected (409) if ``new_subgroup_key`` already\nnames a subgroup in that category, so it never silently merges."},"ReorderActivitiesRequest":{"properties":{"activity_ids":{"items":{"type":"integer"},"type":"array","title":"Activity Ids"}},"type":"object","required":["activity_ids"],"title":"ReorderActivitiesRequest"},"ReorderProjectsRequest":{"properties":{"project_ids":{"items":{"type":"integer"},"type":"array","title":"Project Ids"}},"type":"object","required":["project_ids"],"title":"ReorderProjectsRequest"},"RepeatingGroupResponse":{"properties":{"code":{"type":"string","title":"Code"},"question_text":{"type":"string","title":"Question Text"},"min_instances":{"type":"integer","title":"Min Instances"},"max_instances":{"type":"integer","title":"Max Instances"},"parent_group_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Group Code"},"depends_on":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Depends On"},"questions":{"items":{"$ref":"#/components/schemas/QuestionResponse"},"type":"array","title":"Questions"},"instances":{"items":{"$ref":"#/components/schemas/GroupInstanceResponse"},"type":"array","title":"Instances"},"nested_groups":{"items":{"$ref":"#/components/schemas/RepeatingGroupResponse"},"type":"array","title":"Nested Groups","default":[]}},"type":"object","required":["code","question_text","min_instances","max_instances","questions","instances"],"title":"RepeatingGroupResponse"},"ReverseSubgroupMergeResponse":{"properties":{"status":{"type":"string","title":"Status"},"event_id":{"type":"integer","title":"Event Id"},"restored_count":{"type":"integer","title":"Restored Count"},"skipped_count":{"type":"integer","title":"Skipped Count"}},"type":"object","required":["status","event_id","restored_count","skipped_count"],"title":"ReverseSubgroupMergeResponse"},"ReviewDiffChange":{"properties":{"key":{"type":"string","title":"Key"},"status":{"type":"string","enum":["changed","added","removed"],"title":"Status"},"instance":{"type":"string","title":"Instance"},"path":{"items":{"$ref":"#/components/schemas/ReviewDiffPathItem"},"type":"array","title":"Path"},"question":{"type":"string","title":"Question"},"type":{"type":"string","title":"Type"},"old":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Old"},"new":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"New"}},"type":"object","required":["key","status","instance","path","question","type"],"title":"ReviewDiffChange"},"ReviewDiffInstance":{"properties":{"status":{"type":"string","enum":["added","removed"],"title":"Status"},"instance":{"type":"string","title":"Instance"},"path":{"items":{"$ref":"#/components/schemas/ReviewDiffPathItem"},"type":"array","title":"Path"},"answer_count":{"type":"integer","title":"Answer Count"},"changes":{"items":{"$ref":"#/components/schemas/ReviewDiffChange"},"type":"array","title":"Changes"}},"type":"object","required":["status","instance","path","answer_count","changes"],"title":"ReviewDiffInstance"},"ReviewDiffPathItem":{"properties":{"group":{"type":"string","title":"Group"},"name":{"type":"string","title":"Name"}},"type":"object","required":["group","name"],"title":"ReviewDiffPathItem"},"ReviewDiffResponse":{"properties":{"from_version":{"$ref":"#/components/schemas/ReviewVersionResponse"},"to_version":{"anyOf":[{"$ref":"#/components/schemas/ReviewVersionResponse"},{"type":"null"}]},"summary":{"$ref":"#/components/schemas/ReviewDiffSummary"},"sections":{"items":{"$ref":"#/components/schemas/ReviewDiffSection"},"type":"array","title":"Sections"}},"type":"object","required":["from_version","summary","sections"],"title":"ReviewDiffResponse"},"ReviewDiffSection":{"properties":{"section":{"type":"string","title":"Section"},"changes":{"items":{"$ref":"#/components/schemas/ReviewDiffChange"},"type":"array","title":"Changes"},"instances":{"items":{"$ref":"#/components/schemas/ReviewDiffInstance"},"type":"array","title":"Instances"}},"type":"object","required":["section","changes","instances"],"title":"ReviewDiffSection"},"ReviewDiffSummary":{"properties":{"changed":{"type":"integer","title":"Changed"},"added":{"type":"integer","title":"Added"},"removed":{"type":"integer","title":"Removed"}},"type":"object","required":["changed","added","removed"],"title":"ReviewDiffSummary"},"ReviewVersionAuthor":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"}},"type":"object","required":["id"],"title":"ReviewVersionAuthor"},"ReviewVersionBody":{"properties":{"comment":{"type":"string","title":"Comment"}},"type":"object","required":["comment"],"title":"ReviewVersionBody"},"ReviewVersionResponse":{"properties":{"id":{"type":"integer","title":"Id"},"version_number":{"type":"integer","title":"Version Number"},"kind":{"type":"string","title":"Kind"},"comment":{"type":"string","title":"Comment"},"entry_count":{"type":"integer","title":"Entry Count"},"created_by":{"anyOf":[{"$ref":"#/components/schemas/ReviewVersionAuthor"},{"type":"null"}]},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","version_number","kind","comment","entry_count","created_at"],"title":"ReviewVersionResponse"},"ReviewVersionRestoreResponse":{"properties":{"restored_version":{"$ref":"#/components/schemas/ReviewVersionResponse"},"pre_restore_version":{"anyOf":[{"$ref":"#/components/schemas/ReviewVersionResponse"},{"type":"null"}]},"answers_updated":{"type":"integer","title":"Answers Updated"},"skipped_instances":{"items":{"type":"string"},"type":"array","title":"Skipped Instances"}},"type":"object","required":["restored_version","answers_updated","skipped_instances"],"title":"ReviewVersionRestoreResponse"},"ReviewVersionsListResponse":{"properties":{"versions":{"items":{"$ref":"#/components/schemas/ReviewVersionResponse"},"type":"array","title":"Versions"},"has_unsaved_changes":{"type":"boolean","title":"Has Unsaved Changes"}},"type":"object","required":["versions","has_unsaved_changes"],"title":"ReviewVersionsListResponse"},"SalaryPayslipApportionment":{"properties":{"activity_id":{"type":"integer","title":"Activity Id"},"activity_name":{"type":"string","title":"Activity Name"},"project_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Name"},"percentage":{"type":"number","title":"Percentage"},"amount":{"type":"number","title":"Amount"}},"type":"object","required":["activity_id","activity_name","project_name","percentage","amount"],"title":"SalaryPayslipApportionment"},"SalaryPayslipRow":{"properties":{"id":{"type":"integer","title":"Id"},"source_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Id"},"pay_run_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pay Run Id"},"payment_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Payment Date"},"pay_period_start":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Pay Period Start"},"pay_period_end":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Pay Period End"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"},"wages":{"type":"number","title":"Wages"},"super":{"type":"number","title":"Super"},"employer_cost":{"type":"number","title":"Employer Cost"},"rd_percentage":{"type":"number","title":"Rd Percentage"},"rd_amount":{"type":"number","title":"Rd Amount"},"apportionments":{"items":{"$ref":"#/components/schemas/SalaryPayslipApportionment"},"type":"array","title":"Apportionments"},"overridden":{"type":"boolean","title":"Overridden"},"open_query_count":{"type":"integer","title":"Open Query Count","default":0}},"type":"object","required":["id","source_id","pay_run_id","payment_date","pay_period_start","pay_period_end","description","wages","super","employer_cost","rd_percentage","rd_amount","apportionments","overridden"],"title":"SalaryPayslipRow","description":"One Xero payslip contributing to an employee's salary expenditure."},"SalaryPayslipsResponse":{"properties":{"employees":{"items":{"$ref":"#/components/schemas/EmployeeSalaryPayslipsResponse"},"type":"array","title":"Employees"}},"type":"object","required":["employees"],"title":"SalaryPayslipsResponse"},"SaveAnswersRequest":{"properties":{"answers":{"items":{"$ref":"#/components/schemas/AnswerInput"},"type":"array","title":"Answers"}},"type":"object","required":["answers"],"title":"SaveAnswersRequest"},"SaveAnswersResponse":{"properties":{"saved":{"type":"integer","title":"Saved"},"answers":{"items":{"$ref":"#/components/schemas/AnswerResponse"},"type":"array","title":"Answers"}},"type":"object","required":["saved","answers"],"title":"SaveAnswersResponse"},"ScopedAdminNoteResponse":{"properties":{"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"}},"type":"object","required":["note"],"title":"ScopedAdminNoteResponse","description":"An admin-authored note attached to a non-item expenditure scope."},"SectionCommentCounts":{"properties":{"needs_response":{"type":"integer","title":"Needs Response","default":0},"awaiting_review":{"type":"integer","title":"Awaiting Review","default":0}},"type":"object","title":"SectionCommentCounts"},"SectionResponse":{"properties":{"title":{"type":"string","title":"Title"},"questions":{"items":{"$ref":"#/components/schemas/QuestionResponse"},"type":"array","title":"Questions"},"repeating_groups":{"items":{"$ref":"#/components/schemas/RepeatingGroupResponse"},"type":"array","title":"Repeating Groups","default":[]}},"type":"object","required":["title","questions"],"title":"SectionResponse"},"SelectRealmRequest":{"properties":{"realm_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Realm Id"}},"type":"object","title":"SelectRealmRequest","description":"Placeholder request body. ``realm_id`` is accepted but ignored in v1 (single-realm)."},"SelectTenantRequest":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"claim_id":{"type":"integer","title":"Claim Id"},"selection_version":{"type":"string","title":"Selection Version"}},"type":"object","required":["tenant_id","claim_id","selection_version"],"title":"SelectTenantRequest"},"SessionRequest":{"properties":{"provider":{"type":"string","title":"Provider"},"claim_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Claim Id"}},"type":"object","required":["provider"],"title":"SessionRequest"},"SetClaimPeriodRequest":{"properties":{"fiscal_year_start_month":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Fiscal Year Start Month"}},"type":"object","required":["fiscal_year_start_month"],"title":"SetClaimPeriodRequest"},"SetConsultantClaimRequest":{"properties":{"value":{"type":"boolean","title":"Value"}},"type":"object","required":["value"],"title":"SetConsultantClaimRequest"},"SetEmployeeInclusionRequest":{"properties":{"action":{"type":"string","enum":["exclude","restore"],"title":"Action"}},"type":"object","required":["action"],"title":"SetEmployeeInclusionRequest"},"SetEngineeringGroupRequest":{"properties":{"member":{"type":"boolean","title":"Member"}},"type":"object","required":["member"],"title":"SetEngineeringGroupRequest"},"SetItemApportionmentsRequest":{"properties":{"apportionments":{"items":{"$ref":"#/components/schemas/ItemApportionmentInput"},"type":"array","title":"Apportionments"}},"type":"object","required":["apportionments"],"title":"SetItemApportionmentsRequest","description":"Replace-all list of per-activity R&D allocations for one item."},"SetItemDistributionLinkRequest":{"properties":{"scope":{"type":"string","enum":["all","engineering","none"],"title":"Scope"}},"type":"object","required":["scope"],"title":"SetItemDistributionLinkRequest"},"SetNangoProvidersRequest":{"properties":{"providers":{"items":{"type":"string"},"type":"array","title":"Providers"}},"type":"object","required":["providers"],"title":"SetNangoProvidersRequest"},"SetOffsetSettingsRequest":{"properties":{"offset_type":{"type":"string","enum":["refundable","non_refundable"],"title":"Offset Type"},"corporate_tax_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Corporate Tax Rate"},"premium_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Premium Rate"},"total_expenses":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Total Expenses"}},"type":"object","required":["offset_type"],"title":"SetOffsetSettingsRequest"},"SetRDContributorRequest":{"properties":{"is_rd_contributor":{"type":"boolean","title":"Is Rd Contributor"}},"type":"object","required":["is_rd_contributor"],"title":"SetRDContributorRequest"},"SetSalaryPayslipAllocationRequest":{"properties":{"rd_percentage":{"anyOf":[{"type":"number","maximum":100.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Rd Percentage"},"apportionments":{"items":{"$ref":"#/components/schemas/ItemApportionmentInput"},"type":"array","title":"Apportionments"}},"type":"object","required":["rd_percentage","apportionments"],"title":"SetSalaryPayslipAllocationRequest"},"SetSubgroupDistributionLinkRequest":{"properties":{"source":{"$ref":"#/components/schemas/SubgroupDistributionSource"},"scope":{"anyOf":[{"type":"string","enum":["all","engineering"]},{"type":"null"}],"title":"Scope"}},"type":"object","required":["source","scope"],"title":"SetSubgroupDistributionLinkRequest"},"SignupPrecheckRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"}},"type":"object","required":["email"],"title":"SignupPrecheckRequest","description":"Request body for the pre-signup allowlist check.\n\nEmailStr (not str): the email is interpolated verbatim into Discord\nnotifications by the user.signup_blocked handler, so free-text input\nmust never reach it."},"SignupPrecheckResponse":{"properties":{"allowed":{"type":"boolean","title":"Allowed"}},"type":"object","required":["allowed"],"title":"SignupPrecheckResponse","description":"Response from the pre-signup allowlist check."},"SourceCategoryReadiness":{"properties":{"key":{"type":"string","title":"Key"},"label":{"type":"string","title":"Label"},"required":{"type":"boolean","title":"Required"},"satisfied":{"type":"boolean","title":"Satisfied"},"sources":{"items":{"type":"string"},"type":"array","title":"Sources"}},"type":"object","required":["key","label","required","satisfied","sources"],"title":"SourceCategoryReadiness"},"SourceReadinessResponse":{"properties":{"ready":{"type":"boolean","title":"Ready"},"categories":{"items":{"$ref":"#/components/schemas/SourceCategoryReadiness"},"type":"array","title":"Categories"},"pending":{"items":{"type":"string"},"type":"array","title":"Pending"}},"type":"object","required":["ready","categories"],"title":"SourceReadinessResponse"},"SourceResponse":{"properties":{"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"type":{"type":"string","title":"Type"},"connected":{"type":"boolean","title":"Connected"},"connected_by_me":{"type":"boolean","title":"Connected By Me","default":false},"can_manage":{"type":"boolean","title":"Can Manage","default":false},"account_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Name"},"account_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Email"},"connected_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Connected At"},"scope_summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scope Summary"},"scope":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Scope"},"connected_by_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Connected By Name"},"connected_by_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Connected By Email"},"needs_install":{"type":"boolean","title":"Needs Install","default":false},"install_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Install Url"},"needs_reconnect":{"type":"boolean","title":"Needs Reconnect","default":false},"tenant_selection_needed":{"type":"boolean","title":"Tenant Selection Needed","default":false},"instance_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Instance Url"}},"type":"object","required":["type","connected"],"title":"SourceResponse"},"SourcesListResponse":{"properties":{"sources":{"items":{"$ref":"#/components/schemas/SourceResponse"},"type":"array","title":"Sources"}},"type":"object","required":["sources"],"title":"SourcesListResponse"},"StretchRequest":{"properties":{"exponent":{"type":"number","maximum":1.0,"exclusiveMinimum":0.0,"title":"Exponent","description":"Stretch curve exponent in (0, 1]. Lower is more aggressive.","default":0.3}},"type":"object","title":"StretchRequest","description":"Admin-supplied parameters for the Stretch transform (CLA-259).\n\n`exponent` is the curve strength k in (0, 1]: target_pct = current_pct ** k.\nLower = more aggressive lift. Omit to use the server default."},"SubGroup":{"properties":{"subgroup_key":{"type":"string","title":"Subgroup Key"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"},"items":{"items":{"$ref":"#/components/schemas/GroupItem"},"type":"array","title":"Items"},"total_amount":{"type":"number","title":"Total Amount"},"total_rd_amount":{"type":"number","title":"Total Rd Amount"},"open_query_count":{"type":"integer","title":"Open Query Count","default":0},"distribution_linked":{"type":"boolean","title":"Distribution Linked","default":false},"distribution_scope":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Distribution Scope"}},"type":"object","required":["subgroup_key","items","total_amount","total_rd_amount"],"title":"SubGroup"},"SubgroupAdminNoteUpdate":{"properties":{"note":{"anyOf":[{"type":"string","maxLength":10000},{"type":"null"}],"title":"Note"},"category":{"type":"string","maxLength":50,"minLength":1,"title":"Category"},"subgroup_key":{"type":"string","maxLength":255,"minLength":1,"title":"Subgroup Key"}},"type":"object","required":["category","subgroup_key"],"title":"SubgroupAdminNoteUpdate","description":"Replace (or clear) an ordinary expenditure subgroup's admin note."},"SubgroupDistributionSource":{"properties":{"category":{"type":"string","title":"Category"},"subgroup_key":{"type":"string","title":"Subgroup Key"}},"type":"object","required":["category","subgroup_key"],"title":"SubgroupDistributionSource"},"SubgroupMergeEventSummary":{"properties":{"id":{"type":"integer","title":"Id"},"source":{"$ref":"#/components/schemas/_SubgroupRef"},"target":{"$ref":"#/components/schemas/_SubgroupRef"},"item_count":{"type":"integer","title":"Item Count"},"merged_at":{"type":"string","title":"Merged At"},"merged_by_user_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Merged By User Id"}},"type":"object","required":["id","source","target","item_count","merged_at","merged_by_user_id"],"title":"SubgroupMergeEventSummary"},"SubmitDiscoveryPromptRequest":{"properties":{"prompt":{"type":"string","title":"Prompt","default":""}},"type":"object","title":"SubmitDiscoveryPromptRequest"},"TrackingStatusResponse":{"properties":{"status":{"type":"string","title":"Status"},"reviewed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reviewed At"}},"type":"object","required":["status"],"title":"TrackingStatusResponse"},"TrelloCallbackRequest":{"properties":{"state":{"type":"string","title":"State"},"token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Token"}},"type":"object","required":["state"],"title":"TrelloCallbackRequest"},"UnlockFileRequest":{"properties":{"password":{"type":"string","maxLength":1024,"minLength":1,"title":"Password"}},"type":"object","required":["password"],"title":"UnlockFileRequest","description":"Password supplied to unlock a password-protected file."},"UnreadCountResponse":{"properties":{"unread_count":{"type":"integer","title":"Unread Count"}},"type":"object","required":["unread_count"],"title":"UnreadCountResponse"},"UpdateActivityRequest":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"activity_type":{"anyOf":[{"$ref":"#/components/schemas/ActivityType"},{"type":"null"}]},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"source":{"anyOf":[{"type":"string","enum":["legacy","activity-map"]},{"type":"null"}],"title":"Source"}},"type":"object","title":"UpdateActivityRequest"},"UpdateClaimRequest":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"is_first_year_of_operation":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is First Year Of Operation"}},"type":"object","title":"UpdateClaimRequest"},"UpdateCompanyRequest":{"properties":{"legal_name":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"null"}],"title":"Legal Name"},"registration_number":{"anyOf":[{"type":"string","maxLength":100,"minLength":1},{"type":"null"}],"title":"Registration Number"},"country_code":{"anyOf":[{"type":"string","maxLength":2,"minLength":2},{"type":"null"}],"title":"Country Code"},"website":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Website"},"address":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Address"}},"type":"object","title":"UpdateCompanyRequest"},"UpdateFileCategoryRequest":{"properties":{"category":{"type":"string","minLength":1,"title":"Category"},"report_year":{"anyOf":[{"type":"integer","maximum":2100.0,"minimum":1900.0},{"type":"null"}],"title":"Report Year"}},"type":"object","required":["category"],"title":"UpdateFileCategoryRequest","description":"Request to update a file's category."},"UpdateItemCategoryRequest":{"properties":{"category":{"type":"string","title":"Category"},"report_year":{"anyOf":[{"type":"integer","maximum":2100.0,"minimum":1900.0},{"type":"null"}],"title":"Report Year"}},"type":"object","required":["category"],"title":"UpdateItemCategoryRequest"},"UpdateMemberRequest":{"properties":{"role":{"type":"string","title":"Role"}},"type":"object","required":["role"],"title":"UpdateMemberRequest"},"UpdateProjectRequest":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"source":{"anyOf":[{"type":"string","enum":["legacy","activity-map"]},{"type":"null"}],"title":"Source"}},"type":"object","title":"UpdateProjectRequest"},"UpdateScopeRequest":{"properties":{"repos":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Repos"},"projects":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Projects"},"teams":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Teams"},"boards":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Boards"},"pages":{"anyOf":[{"items":{"anyOf":[{"type":"string"},{"$ref":"#/components/schemas/NotionScopeItemInput"}]},"type":"array"},{"type":"null"}],"title":"Pages"},"spaces":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Spaces"},"files":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Files"}},"type":"object","title":"UpdateScopeRequest"},"UpdateStatusRequest":{"properties":{"status":{"type":"string","title":"Status"}},"type":"object","required":["status"],"title":"UpdateStatusRequest"},"UpdateUserRequest":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"}},"type":"object","title":"UpdateUserRequest","description":"Request body for updating user profile."},"UpdateWorkItemRequest":{"properties":{"activity_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Activity Id"},"estimated_hours":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Estimated Hours"},"author_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Author Email"},"employee_identity_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Employee Identity Id"}},"type":"object","title":"UpdateWorkItemRequest"},"UpdateWorkspaceRequest":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"}},"type":"object","title":"UpdateWorkspaceRequest"},"UpdateWorkspaceSettingsRequest":{"properties":{"enable_ai_generation":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enable Ai Generation"},"enable_monthly_contemporaneous_reports":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enable Monthly Contemporaneous Reports"},"enable_custom_claim_periods":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enable Custom Claim Periods"},"ai_context":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ai Context"}},"type":"object","title":"UpdateWorkspaceSettingsRequest"},"UploadUrlRequest":{"properties":{"filename":{"type":"string","maxLength":255,"minLength":1,"title":"Filename"},"content_type":{"type":"string","minLength":1,"title":"Content Type"},"size":{"type":"integer","exclusiveMinimum":0.0,"title":"Size"}},"type":"object","required":["filename","content_type","size"],"title":"UploadUrlRequest","description":"Request for a signed upload URL."},"UploadUrlResponse":{"properties":{"file_id":{"type":"integer","title":"File Id"},"upload_url":{"type":"string","title":"Upload Url"},"expires_in":{"type":"integer","title":"Expires In"}},"type":"object","required":["file_id","upload_url","expires_in"],"title":"UploadUrlResponse","description":"Response with signed upload URL."},"UserResponse":{"properties":{"user_id":{"type":"integer","title":"User Id"},"email":{"type":"string","title":"Email"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"firebase_uid":{"type":"string","title":"Firebase Uid"},"created_at":{"type":"string","title":"Created At"},"is_admin":{"type":"boolean","title":"Is Admin","default":false},"email_verified":{"type":"boolean","title":"Email Verified","default":true},"enable_ai_generation":{"type":"boolean","title":"Enable Ai Generation","default":false},"is_consultant_only":{"type":"boolean","title":"Is Consultant Only","default":false},"is_tracking_only":{"type":"boolean","title":"Is Tracking Only","default":false},"impersonating":{"anyOf":[{"$ref":"#/components/schemas/ImpersonationInfo"},{"type":"null"}]}},"type":"object","required":["user_id","email","firebase_uid","created_at"],"title":"UserResponse","description":"Response from /me endpoint."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"WorkItemListItem":{"properties":{"id":{"type":"integer","title":"Id"},"title":{"type":"string","title":"Title"},"source_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Type"},"source_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Id"},"author_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Author Email"},"occurred_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Occurred At"},"estimated_hours":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Estimated Hours"},"activity_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Activity Id"},"activity_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Activity Name"},"project_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Name"},"confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Confidence"},"reasoning":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reasoning"},"employee_identity_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Employee Identity Id"}},"type":"object","required":["id","title","source_type","source_id","author_email","occurred_at","estimated_hours","activity_id","activity_name","project_name","confidence","reasoning","employee_identity_id"],"title":"WorkItemListItem"},"WorkItemListResponse":{"properties":{"work_items":{"items":{"$ref":"#/components/schemas/WorkItemListItem"},"type":"array","title":"Work Items"},"total":{"type":"integer","title":"Total"},"uncategorized":{"type":"integer","title":"Uncategorized"}},"type":"object","required":["work_items","total","uncategorized"],"title":"WorkItemListResponse"},"WorkItemResponse":{"properties":{"id":{"type":"integer","title":"Id"},"title":{"type":"string","title":"Title"},"source_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Type"},"source_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Id"},"source_data":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Source Data"},"author_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Author Email"},"occurred_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Occurred At"},"estimated_hours":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Estimated Hours"},"activity_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Activity Id"},"activity_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Activity Name"},"project_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Name"},"confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Confidence"},"reasoning":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reasoning"},"employee_identity_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Employee Identity Id"}},"type":"object","required":["id","title","source_type","source_id","source_data","author_email","occurred_at","estimated_hours","activity_id","activity_name","project_name","confidence","reasoning","employee_identity_id"],"title":"WorkItemResponse"},"WorkspaceEmbedded":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"enable_ai_generation":{"type":"boolean","title":"Enable Ai Generation","default":false},"enable_monthly_contemporaneous_reports":{"type":"boolean","title":"Enable Monthly Contemporaneous Reports","default":false},"enable_custom_claim_periods":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enable Custom Claim Periods"},"ai_context":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ai Context"}},"type":"object","required":["id","name"],"title":"WorkspaceEmbedded"},"WorkspaceMemberResponse":{"properties":{"user_id":{"type":"integer","title":"User Id"},"email":{"type":"string","title":"Email"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"role":{"type":"string","title":"Role"}},"type":"object","required":["user_id","email","name","role"],"title":"WorkspaceMemberResponse"},"WorkspaceMembersListResponse":{"properties":{"members":{"items":{"$ref":"#/components/schemas/WorkspaceMemberResponse"},"type":"array","title":"Members"}},"type":"object","required":["members"],"title":"WorkspaceMembersListResponse"},"WorkspaceResponse":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"enable_ai_generation":{"type":"boolean","title":"Enable Ai Generation"},"enable_monthly_contemporaneous_reports":{"type":"boolean","title":"Enable Monthly Contemporaneous Reports"},"enable_custom_claim_periods":{"type":"boolean","title":"Enable Custom Claim Periods"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","name","enable_ai_generation","enable_monthly_contemporaneous_reports","enable_custom_claim_periods","created_at","updated_at"],"title":"WorkspaceResponse"},"WorkspaceSettingsResponse":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"enable_ai_generation":{"type":"boolean","title":"Enable Ai Generation"},"enable_monthly_contemporaneous_reports":{"type":"boolean","title":"Enable Monthly Contemporaneous Reports"},"enable_custom_claim_periods":{"type":"boolean","title":"Enable Custom Claim Periods"},"ai_context":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ai Context"}},"type":"object","required":["id","name","enable_ai_generation","enable_monthly_contemporaneous_reports","enable_custom_claim_periods"],"title":"WorkspaceSettingsResponse"},"WorkspacesListResponse":{"properties":{"workspaces":{"items":{"$ref":"#/components/schemas/WorkspaceResponse"},"type":"array","title":"Workspaces"}},"type":"object","required":["workspaces"],"title":"WorkspacesListResponse"},"XeroExportJobResponse":{"properties":{"job_id":{"type":"string","format":"uuid","title":"Job Id"},"status":{"type":"string","title":"Status"},"filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Filename"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Finished At"}},"type":"object","required":["job_id","status"],"title":"XeroExportJobResponse","description":"Response shape for POST start + GET status."},"_BulkItemUpdate":{"properties":{"eligibility":{"anyOf":[{"type":"string","enum":["r_and_d","non_eligible"]},{"type":"null"}],"title":"Eligibility"},"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"},"activity_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Activity Id"},"subgroup_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subgroup Key"}},"type":"object","title":"_BulkItemUpdate","description":"Update fields applicable to a bulk operation across a group.\n\nMirrors the bulk-applicable subset of :class:`ItemUpdate`. ``rd_percentage``\nand ``description`` are intentionally excluded — they're meaningful per-item,\nnot per-group.\n\n``activity_id`` uses \"explicit null = Ungrouped\" semantics like its\n:class:`ItemUpdate` twin — keyed on ``model_fields_set`` in the handler.\n\n``subgroup_key`` moves every targeted item into a (possibly new) subgroup\nwithin its existing category. It's only sent by the by-ids path (the\ncategorised multi-select \"Move to / New subgroup\" action); unlike\n``activity_id`` there's no \"explicit null = clear\" semantic — a move always\nnames a non-empty target, validated in the handler."},"_GroupScope":{"properties":{"category":{"type":"string","title":"Category"},"subgroup_key":{"type":"string","title":"Subgroup Key"}},"type":"object","required":["category","subgroup_key"],"title":"_GroupScope","description":"Identifies a subgroup under a claim.\n\n``category`` is always required so cross-category subgroup-name collisions\ndon't bleed into each other."},"_QueryItemSummary":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"source_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Source Amount"},"source_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Date"},"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"},"eligibility":{"type":"string","title":"Eligibility"},"rd_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Rd Percentage"},"refund_of_item_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Refund Of Item Id"},"apportionments":{"items":{"$ref":"#/components/schemas/ApportionmentOut"},"type":"array","title":"Apportionments"}},"type":"object","required":["id","name","source_amount","source_date","category","eligibility","rd_percentage","refund_of_item_id","apportionments"],"title":"_QueryItemSummary"},"_QueryPayslipSummary":{"properties":{"id":{"type":"integer","title":"Id"},"employee_identity_id":{"type":"integer","title":"Employee Identity Id"},"employee_name":{"type":"string","title":"Employee Name"},"payment_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Payment Date"},"pay_period_start":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pay Period Start"},"pay_period_end":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pay Period End"},"employer_cost":{"type":"number","title":"Employer Cost"},"rd_percentage":{"type":"number","title":"Rd Percentage"},"rd_amount":{"type":"number","title":"Rd Amount"},"apportionments":{"items":{"$ref":"#/components/schemas/SalaryPayslipApportionment"},"type":"array","title":"Apportionments"}},"type":"object","required":["id","employee_identity_id","employee_name","payment_date","pay_period_start","pay_period_end","employer_cost","rd_percentage","rd_amount","apportionments"],"title":"_QueryPayslipSummary"},"_QuerySubgroupItemSummary":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"source_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Source Amount"},"source_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Date"},"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"},"eligibility":{"type":"string","title":"Eligibility"},"rd_percentage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Rd Percentage"},"refund_of_item_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Refund Of Item Id"},"apportionments":{"items":{"$ref":"#/components/schemas/ApportionmentOut"},"type":"array","title":"Apportionments"}},"type":"object","required":["id","name","source_amount","source_date","category","eligibility","rd_percentage","refund_of_item_id","apportionments"],"title":"_QuerySubgroupItemSummary","description":"Live transaction context for a subgroup-scoped or multi-item query.\n\nSubgroup query threads keep only the subgroup key in the database, and\nmulti-item threads keep only their item links, so these rows are resolved\nfrom the current ledger whenever the thread is returned rather than being\nsnapshotted when the reviewer asks the question.\n\n``category`` is constant across a subgroup thread but varies across an\narbitrary selection, which is the case that needs it rendered."},"_SubgroupRef":{"properties":{"category":{"type":"string","title":"Category"},"subgroup_key":{"type":"string","title":"Subgroup Key"}},"type":"object","required":["category","subgroup_key"],"title":"_SubgroupRef","description":"A single (category, subgroup_key) pair. ``subgroup_key`` is required —\nthe salaries bucket uses synthesised keys per identity and isn't a valid\nmerge target on either side."}}}}