{"openapi":"3.1.0","info":{"title":"Aikount","description":"Agent-first Spanish accounting SaaS — the API Holded should have.\n\nAll endpoints require `Authorization: Bearer <token>`. Tokens are\neither short-lived session JWTs (login flow) or long-lived API keys\nprefixed with `agl_` (mint at `POST /api/v1/auth/api-keys`).","version":"0.1.0"},"paths":{"/health":{"get":{"tags":["meta"],"summary":"Health","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Health Health Get"}}}}}}},"/api/v1/auth/login":{"post":{"tags":["auth"],"summary":"Login","operationId":"login_api_v1_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"}}}}}}},"/api/v1/auth/google":{"post":{"tags":["auth"],"summary":"Google Login","description":"Sign in or sign up with a Google ID token.\n\nThree paths, in order:\n\n1. ``google_sub`` already linked to a user → straight login.\n2. Email matches an existing password-based user → silent auto-link iff\n   Google says ``email_verified=true`` (otherwise we'd let anyone with\n   any Google account hijack any aikount account by claiming its email).\n   If the email is unverified, refuse and tell the user to log in with\n   their password first.\n3. No match anywhere → auto-create the user and send them to onboarding.\n\nReturns the same ``LoginResponse`` shape as ``/auth/login`` so the\nfrontend doesn't need to branch.","operationId":"google_login_api_v1_auth_google_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoogleLoginRequest"}}},"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"}}}}}}},"/api/v1/auth/change-password":{"post":{"tags":["auth"],"summary":"Change Password","operationId":"change_password_api_v1_auth_change_password_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangePasswordRequest"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/me":{"get":{"tags":["auth"],"summary":"Me","description":"Return the authenticated user + active tenant + all memberships.\n\nTolerant of the pre-onboarding window: if the user has no tenant yet, we\nreturn tenant=null and onboarding_required=true so the frontend can route\nthem to the wizard.\n\nThe \"active\" tenant is taken from the JWT's ``tid`` claim — that's what\nswitch-tenant updates. Falling back to the oldest membership (the\nprevious behaviour) made the TopBar switcher look frozen on the first\ntenant no matter which JWT the client was holding.","operationId":"me_api_v1_auth_me_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/register":{"post":{"tags":["auth"],"summary":"Register","operationId":"register_api_v1_auth_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/verify-email":{"get":{"tags":["auth"],"summary":"Verify Email","description":"Mark the user's email as verified and bounce them back to the frontend.\n\nAlways 302s — never returns JSON — because the user reaches this URL by\nclicking a link in their mailbox, so the response has to be a browser\nredirect.","operationId":"verify_email_api_v1_auth_verify_email_get","parameters":[{"name":"token","in":"query","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"}}}}}}},"/api/v1/auth/verify-email/resend":{"post":{"tags":["auth"],"summary":"Resend Verification","operationId":"resend_verification_api_v1_auth_verify_email_resend_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ResendVerificationRequest"},{"type":"null"}],"title":"Payload"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/onboarding/complete":{"post":{"tags":["auth"],"summary":"Complete Onboarding","operationId":"complete_onboarding_api_v1_auth_onboarding_complete_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingCompleteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingCompleteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/forgot-password":{"post":{"tags":["auth"],"summary":"Forgot Password","description":"Issue a password-reset token and email it. Returns 204 unconditionally\nso an attacker can't probe which emails are registered.","operationId":"forgot_password_api_v1_auth_forgot_password_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForgotPasswordRequest"}}},"required":true},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/reset-password":{"post":{"tags":["auth"],"summary":"Reset Password","operationId":"reset_password_api_v1_auth_reset_password_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetPasswordRequest"}}},"required":true},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/invitations/{token}":{"get":{"tags":["auth"],"summary":"Preview Invitation","operationId":"preview_invitation_api_v1_auth_invitations__token__get","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvitationPreview"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/invitations/{token}/accept":{"post":{"tags":["auth"],"summary":"Accept Invitation","operationId":"accept_invitation_api_v1_auth_invitations__token__accept_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptInvitationRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptInvitationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/tenants":{"post":{"tags":["auth"],"summary":"Create Additional Tenant","operationId":"create_additional_tenant_api_v1_auth_tenants_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTenantRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingCompleteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/switch-tenant":{"post":{"tags":["auth"],"summary":"Switch Tenant","description":"Re-issue a session JWT pointing to a different tenant the user belongs to.","operationId":"switch_tenant_api_v1_auth_switch_tenant_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SwitchTenantRequest"}}}},"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"}}}}}}},"/api/v1/auth/api-keys":{"post":{"tags":["auth"],"summary":"Create Api Key","operationId":"create_api_key_api_v1_auth_api_keys_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyCreateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["auth"],"summary":"List Api Keys","operationId":"list_api_keys_api_v1_auth_api_keys_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ApiKeyListItem"},"title":"Response List Api Keys Api V1 Auth Api Keys Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/api-keys/{key_id}":{"delete":{"tags":["auth"],"summary":"Revoke Api Key","operationId":"revoke_api_key_api_v1_auth_api_keys__key_id__delete","parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Key Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/mfa/status":{"get":{"tags":["auth","mfa"],"summary":"Mfa Status","operationId":"mfa_status_api_v1_auth_mfa_status_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MfaStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/mfa/setup":{"post":{"tags":["auth","mfa"],"summary":"Mfa Setup","description":"Generate (or regenerate) a TOTP secret and return the provisioning URI.\n\nDoes **not** enable MFA — the user must confirm a code at ``/activate``.\nRe-running before activation rotates the pending secret, which is safe.\nCalling it while MFA is already enabled is refused so an authenticated\nsession can't silently swap out an active second factor without re-proving\npossession via ``/disable`` first.","operationId":"mfa_setup_api_v1_auth_mfa_setup_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MfaSetupResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/mfa/activate":{"post":{"tags":["auth","mfa"],"summary":"Mfa Activate","description":"Confirm possession of the TOTP secret and turn MFA on.\n\nVerifies the submitted code against the pending secret, then enables MFA\nand mints N one-time recovery codes (returned in plaintext **once**; only\ntheir hashes are stored).","operationId":"mfa_activate_api_v1_auth_mfa_activate_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MfaActivateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MfaActivateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/mfa/disable":{"post":{"tags":["auth","mfa"],"summary":"Mfa Disable","description":"Turn MFA off after re-proving identity.\n\nRequires a valid password **or** a valid current TOTP/recovery code. A\npassword-less account (e.g. Google-only with a random placeholder hash)\ncan still disable via a TOTP/recovery code. Clears the secret and the\nrecovery codes so nothing sensitive lingers.","operationId":"mfa_disable_api_v1_auth_mfa_disable_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MfaDisableRequest"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/account/export":{"get":{"tags":["account"],"summary":"Export Account","description":"Download a comprehensive JSON export of the user's personal data plus\nthe data of every tenant they belong to (GDPR art. 20).","operationId":"export_account_api_v1_account_export_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/account/delete":{"post":{"tags":["account"],"summary":"Delete Account","description":"Erase the user account (GDPR art. 17).\n\nRe-verifies the password, then deletes the user + memberships. Tenants\nwhere the user is the sole owner are deleted with all their data (ON DELETE\nCASCADE); tenants with other owners just lose this user's membership.","operationId":"delete_account_api_v1_account_delete_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountDeleteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountDeleteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/team/members":{"get":{"tags":["team"],"summary":"List Members","operationId":"list_members_api_v1_team_members_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MemberOut"},"title":"Response List Members Api V1 Team Members Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/team/members/{user_id}":{"patch":{"tags":["team"],"summary":"Update Member","operationId":"update_member_api_v1_team_members__user_id__patch","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateMemberRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["team"],"summary":"Remove Member","operationId":"remove_member_api_v1_team_members__user_id__delete","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/team/invitations":{"post":{"tags":["team"],"summary":"Create Invitation","operationId":"create_invitation_api_v1_team_invitations_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvitationOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["team"],"summary":"List Invitations","operationId":"list_invitations_api_v1_team_invitations_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/InvitationOut"},"title":"Response List Invitations Api V1 Team Invitations Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/team/invitations/{inv_id}/resend":{"post":{"tags":["team"],"summary":"Resend Invitation","operationId":"resend_invitation_api_v1_team_invitations__inv_id__resend_post","parameters":[{"name":"inv_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Inv Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/team/invitations/{inv_id}":{"delete":{"tags":["team"],"summary":"Revoke Invitation","operationId":"revoke_invitation_api_v1_team_invitations__inv_id__delete","parameters":[{"name":"inv_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Inv Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/team/members/quick-create":{"post":{"tags":["team"],"summary":"Quick Create Member","description":"Create a new user + membership in one shot, without sending an email.\n\nReturns the temp password — admin must capture it.","operationId":"quick_create_member_api_v1_team_members_quick_create_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuickCreateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuickCreateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenant":{"get":{"tags":["tenants"],"summary":"Get Tenant Legacy","operationId":"get_tenant_legacy_api_v1_tenant_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Tenant Legacy Api V1 Tenant Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/me":{"get":{"tags":["tenants"],"summary":"Get Tenant Me","operationId":"get_tenant_me_api_v1_tenants_me_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantMe"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["tenants"],"summary":"Patch Tenant Me","operationId":"patch_tenant_me_api_v1_tenants_me_patch","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantMe"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/me/logo":{"post":{"tags":["tenants"],"summary":"Upload Logo","operationId":"upload_logo_api_v1_tenants_me_logo_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_logo_api_v1_tenants_me_logo_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LogoUploadResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["tenants"],"summary":"Delete Logo","operationId":"delete_logo_api_v1_tenants_me_logo_delete","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/contacts":{"get":{"tags":["contacts"],"summary":"List Contacts","operationId":"list_contacts_api_v1_contacts_get","parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"kind","in":"query","required":false,"schema":{"anyOf":[{"enum":["customer","supplier"],"type":"string"},{"type":"null"}],"title":"Kind"}},{"name":"country","in":"query","required":false,"schema":{"anyOf":[{"type":"string","minLength":2,"maxLength":2},{"type":"null"}],"title":"Country"}},{"name":"customer_type","in":"query","required":false,"schema":{"anyOf":[{"enum":["business","individual"],"type":"string"},{"type":"null"}],"title":"Customer Type"}},{"name":"has_vat","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Has Vat"}},{"name":"external_source","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"External Source"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse_ContactResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["contacts"],"summary":"Create Contact","operationId":"create_contact_api_v1_contacts_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/contacts/summary":{"get":{"tags":["contacts"],"summary":"Contacts Summary","description":"KPI counts (total / clientes / proveedores / sin NIF / Stripe) over the\nfull filtered set, so the stat boxes don't lie when the list is paginated.\nSame filter params as ``GET /contacts``.","operationId":"contacts_summary_api_v1_contacts_summary_get","parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"kind","in":"query","required":false,"schema":{"anyOf":[{"enum":["customer","supplier"],"type":"string"},{"type":"null"}],"title":"Kind"}},{"name":"country","in":"query","required":false,"schema":{"anyOf":[{"type":"string","minLength":2,"maxLength":2},{"type":"null"}],"title":"Country"}},{"name":"customer_type","in":"query","required":false,"schema":{"anyOf":[{"enum":["business","individual"],"type":"string"},{"type":"null"}],"title":"Customer Type"}},{"name":"has_vat","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Has Vat"}},{"name":"external_source","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"External Source"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactSummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/contacts/export":{"get":{"tags":["contacts"],"summary":"Export Contacts","description":"Export of clientes/proveedores in the chosen format. Same filters as\n``GET /contacts`` plus an optional alta (created_at) date range. Use\n``kind=supplier`` for proveedores, ``kind=customer`` for clientes, none for all.","operationId":"export_contacts_api_v1_contacts_export_get","parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"kind","in":"query","required":false,"schema":{"anyOf":[{"enum":["customer","supplier"],"type":"string"},{"type":"null"}],"title":"Kind"}},{"name":"country","in":"query","required":false,"schema":{"anyOf":[{"type":"string","minLength":2,"maxLength":2},{"type":"null"}],"title":"Country"}},{"name":"customer_type","in":"query","required":false,"schema":{"anyOf":[{"enum":["business","individual"],"type":"string"},{"type":"null"}],"title":"Customer Type"}},{"name":"has_vat","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Has Vat"}},{"name":"external_source","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"External Source"}},{"name":"from_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"description":"Alta desde (created_at)","title":"From Date"},"description":"Alta desde (created_at)"},{"name":"to_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"description":"Alta hasta (created_at)","title":"To Date"},"description":"Alta hasta (created_at)"},{"name":"format","in":"query","required":false,"schema":{"type":"string","description":"xlsx | csv | json | pdf","default":"xlsx","title":"Format"},"description":"xlsx | csv | json | pdf"},{"name":"columns","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated column keys; omit for all.","title":"Columns"},"description":"Comma-separated column keys; omit for all."},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/contacts/{contact_id}/stats":{"get":{"tags":["contacts"],"summary":"Get Contact Stats","operationId":"get_contact_stats_api_v1_contacts__contact_id__stats_get","parameters":[{"name":"contact_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Contact Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactStatsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/contacts/{contact_id}/tax-suggestion":{"get":{"tags":["contacts"],"summary":"Get Contact Tax Suggestion","description":"Suggest the VAT tax type to apply on an invoice line for this contact.\n\n``context=sale`` (default) classifies the *customer* (country + VAT + OSS\nregistration) the same way the 303/349/369 dashboard does and materialises\nthe matching ``TaxType`` so the invoice form can pre-fill the line tax (EU\nB2B → IVAINTRA entrega intracom. exenta, EU B2C → OSS or IVA21, extra-EU →\nEXPORT, domestic → IVA21).\n\n``context=purchase`` classifies the *supplier* for a purchase line (EU B2B →\nRCINTRACOM reverse charge, extra-UE → ISP/IMPORT, domestic → IVA21), reusing\nthe same logic as the AI purchase ingest. The user can always override it.","operationId":"get_contact_tax_suggestion_api_v1_contacts__contact_id__tax_suggestion_get","parameters":[{"name":"contact_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Contact Id"}},{"name":"context","in":"query","required":false,"schema":{"type":"string","default":"sale","title":"Context"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxSuggestionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/contacts/{contact_id}":{"get":{"tags":["contacts"],"summary":"Get Contact","operationId":"get_contact_api_v1_contacts__contact_id__get","parameters":[{"name":"contact_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Contact Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["contacts"],"summary":"Update Contact","operationId":"update_contact_api_v1_contacts__contact_id__patch","parameters":[{"name":"contact_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Contact Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["contacts"],"summary":"Delete Contact","operationId":"delete_contact_api_v1_contacts__contact_id__delete","parameters":[{"name":"contact_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Contact Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/contacts/{keep_id}/merge":{"post":{"tags":["contacts"],"summary":"Merge Contacts","description":"Fold the ``duplicate_ids`` Contacts into ``keep_id``.\n\nAll Documents pointing at any duplicate are re-pointed to keep, then\nthe duplicates are deleted. Runs in a single transaction so an error\nmid-flight leaves the DB consistent.\n\nBackfills ``keep.vat`` / ``keep.country`` from the first duplicate\nthat has them when ``keep`` is missing those fields. We never\noverwrite an existing non-null value on ``keep`` — same conservative\nrule the AI ingest follows when adopting a VAT-less Contact.\n\nRefuses to merge across tenants and refuses to include ``keep_id`` in\nits own duplicate list (would delete the survivor).","operationId":"merge_contacts_api_v1_contacts__keep_id__merge_post","parameters":[{"name":"keep_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Keep Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MergeContactsBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MergeContactsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/contacts-insights":{"get":{"tags":["contacts"],"summary":"Get Insights","operationId":"get_insights_api_v1_contacts_insights_get","parameters":[{"name":"months","in":"query","required":false,"schema":{"type":"integer","maximum":36,"minimum":1,"default":12,"title":"Months"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Insights Api V1 Contacts Insights Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboard/summary":{"get":{"tags":["dashboard"],"summary":"Summary","description":"Return the home-dashboard summary payload for the current tenant.","operationId":"summary_api_v1_dashboard_summary_get","parameters":[{"name":"year","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":2100,"minimum":2000},{"type":"null"}],"title":"Year"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Summary Api V1 Dashboard Summary Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboard/widget-types":{"get":{"tags":["dashboard"],"summary":"Widget Types","operationId":"widget_types_api_v1_dashboard_widget_types_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogResponse"}}}}}}},"/api/v1/dashboard/boards":{"get":{"tags":["dashboard"],"summary":"List Boards","operationId":"list_boards_api_v1_dashboard_boards_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DashboardListItem"},"title":"Response List Boards Api V1 Dashboard Boards Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["dashboard"],"summary":"Create Board","operationId":"create_board_api_v1_dashboard_boards_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboard/boards/{board_id}":{"get":{"tags":["dashboard"],"summary":"Get Board","operationId":"get_board_api_v1_dashboard_boards__board_id__get","parameters":[{"name":"board_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Board Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["dashboard"],"summary":"Update Board","operationId":"update_board_api_v1_dashboard_boards__board_id__put","parameters":[{"name":"board_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Board Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["dashboard"],"summary":"Delete Board","operationId":"delete_board_api_v1_dashboard_boards__board_id__delete","parameters":[{"name":"board_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Board Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboard/boards/{board_id}/append-recommended":{"post":{"tags":["dashboard"],"summary":"Append Recommended","description":"Append the default-template widgets whose type isn't on the board yet.\n\nNon-destructive: existing widgets keep their position; new ones are\nstacked in fresh rows at the bottom. Lets users who already had a board\npull in newer widget types (e.g. \"Ventas por país\") without losing\ntheir layout or recreating the board.","operationId":"append_recommended_api_v1_dashboard_boards__board_id__append_recommended_post","parameters":[{"name":"board_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Board Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboard/data":{"post":{"tags":["dashboard"],"summary":"Widget Data","operationId":"widget_data_api_v1_dashboard_data_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WidgetDataRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Widget Data Api V1 Dashboard Data Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboard/data/kpi":{"get":{"tags":["dashboard"],"summary":"Data Kpi","operationId":"data_kpi_api_v1_dashboard_data_kpi_get","parameters":[{"name":"metric","in":"query","required":false,"schema":{"type":"string","default":"sales","title":"Metric"}},{"name":"period","in":"query","required":false,"schema":{"type":"string","default":"this_month","title":"Period"}},{"name":"compare","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Compare"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Data Kpi Api V1 Dashboard Data Kpi Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboard/data/timeseries":{"get":{"tags":["dashboard"],"summary":"Data Timeseries","operationId":"data_timeseries_api_v1_dashboard_data_timeseries_get","parameters":[{"name":"metric","in":"query","required":false,"schema":{"type":"string","default":"sales","title":"Metric"}},{"name":"period","in":"query","required":false,"schema":{"type":"string","default":"last_12m","title":"Period"}},{"name":"chart_type","in":"query","required":false,"schema":{"type":"string","default":"bar","title":"Chart Type"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Data Timeseries Api V1 Dashboard Data Timeseries Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboard/data/top":{"get":{"tags":["dashboard"],"summary":"Data Top","operationId":"data_top_api_v1_dashboard_data_top_get","parameters":[{"name":"dim","in":"query","required":false,"schema":{"type":"string","default":"customer","title":"Dim"}},{"name":"period","in":"query","required":false,"schema":{"type":"string","default":"this_quarter","title":"Period"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":5,"title":"Limit"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Data Top Api V1 Dashboard Data Top Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboard/data/treasuries":{"get":{"tags":["dashboard"],"summary":"Data Treasuries","operationId":"data_treasuries_api_v1_dashboard_data_treasuries_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Data Treasuries Api V1 Dashboard Data Treasuries Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboard/data/pending-reconciliation":{"get":{"tags":["dashboard"],"summary":"Data Pending Reconciliation","operationId":"data_pending_reconciliation_api_v1_dashboard_data_pending_reconciliation_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Data Pending Reconciliation Api V1 Dashboard Data Pending Reconciliation Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboard/data/runway":{"get":{"tags":["dashboard"],"summary":"Data Runway","operationId":"data_runway_api_v1_dashboard_data_runway_get","parameters":[{"name":"burn_window_months","in":"query","required":false,"schema":{"type":"integer","default":3,"title":"Burn Window Months"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Data Runway Api V1 Dashboard Data Runway Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboard/data/top-expense-accounts":{"get":{"tags":["dashboard"],"summary":"Data Top Expense Accounts","operationId":"data_top_expense_accounts_api_v1_dashboard_data_top_expense_accounts_get","parameters":[{"name":"period","in":"query","required":false,"schema":{"type":"string","default":"this_month","title":"Period"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":8,"title":"Limit"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Data Top Expense Accounts Api V1 Dashboard Data Top Expense Accounts Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboard/data/upcoming-taxes":{"get":{"tags":["dashboard"],"summary":"Data Upcoming Taxes","operationId":"data_upcoming_taxes_api_v1_dashboard_data_upcoming_taxes_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Data Upcoming Taxes Api V1 Dashboard Data Upcoming Taxes Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboard/data/recent-invoices":{"get":{"tags":["dashboard"],"summary":"Data Recent Invoices","operationId":"data_recent_invoices_api_v1_dashboard_data_recent_invoices_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":8,"title":"Limit"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","default":"all","title":"Status"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Data Recent Invoices Api V1 Dashboard Data Recent Invoices Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboard/data/subscriptions":{"get":{"tags":["dashboard"],"summary":"Data Subscriptions","operationId":"data_subscriptions_api_v1_dashboard_data_subscriptions_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Data Subscriptions Api V1 Dashboard Data Subscriptions Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboard/data/uncategorized-movements":{"get":{"tags":["dashboard"],"summary":"Data Uncategorized","operationId":"data_uncategorized_api_v1_dashboard_data_uncategorized_movements_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Data Uncategorized Api V1 Dashboard Data Uncategorized Movements Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboard/data/sales-by-country":{"get":{"tags":["dashboard"],"summary":"Data Sales By Country","operationId":"data_sales_by_country_api_v1_dashboard_data_sales_by_country_get","parameters":[{"name":"period","in":"query","required":false,"schema":{"type":"string","default":"this_year","title":"Period"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":8,"title":"Limit"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Data Sales By Country Api V1 Dashboard Data Sales By Country Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboard/data/recent-purchases":{"get":{"tags":["dashboard"],"summary":"Data Recent Purchases","operationId":"data_recent_purchases_api_v1_dashboard_data_recent_purchases_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":8,"title":"Limit"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Data Recent Purchases Api V1 Dashboard Data Recent Purchases Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboard/ai/widget":{"post":{"tags":["dashboard"],"summary":"Ai Widget","operationId":"ai_widget_api_v1_dashboard_ai_widget_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiWidgetRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiWidgetResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboard/ai/board":{"post":{"tags":["dashboard"],"summary":"Ai Board","operationId":"ai_board_api_v1_dashboard_ai_board_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiBoardRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiBoardResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/products":{"get":{"tags":["master-data","products"],"summary":"List Products","operationId":"list_products_api_v1_products_get","parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse_ProductResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["master-data","products"],"summary":"Create Product","operationId":"create_product_api_v1_products_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/products/{product_id}":{"get":{"tags":["master-data","products"],"summary":"Get Product","operationId":"get_product_api_v1_products__product_id__get","parameters":[{"name":"product_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Product Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["master-data","products"],"summary":"Update Product","operationId":"update_product_api_v1_products__product_id__patch","parameters":[{"name":"product_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Product Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["master-data","products"],"summary":"Delete Product","operationId":"delete_product_api_v1_products__product_id__delete","parameters":[{"name":"product_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Product Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes":{"get":{"tags":["master-data","taxes"],"summary":"List Taxes","operationId":"list_taxes_api_v1_taxes_get","parameters":[{"name":"context","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by document context: 'purchase' or 'sale'. Omit for all types (admin view).","title":"Context"},"description":"Filter by document context: 'purchase' or 'sale'. Omit for all types (admin view)."},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TaxTypeResponse"},"title":"Response List Taxes Api V1 Taxes Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["master-data","taxes"],"summary":"Create Tax","operationId":"create_tax_api_v1_taxes_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxTypeCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxTypeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/{tax_id}":{"get":{"tags":["master-data","taxes"],"summary":"Get Tax","operationId":"get_tax_api_v1_taxes__tax_id__get","parameters":[{"name":"tax_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Tax Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxTypeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["master-data","taxes"],"summary":"Update Tax","operationId":"update_tax_api_v1_taxes__tax_id__patch","parameters":[{"name":"tax_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Tax Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxTypeUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxTypeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/numbering":{"get":{"tags":["master-data","numbering"],"summary":"List Numbering","operationId":"list_numbering_api_v1_numbering_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/NumberingSeriesResponse"},"title":"Response List Numbering Api V1 Numbering Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["master-data","numbering"],"summary":"Create Numbering","operationId":"create_numbering_api_v1_numbering_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NumberingSeriesCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NumberingSeriesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/numbering/{series_id}":{"patch":{"tags":["master-data","numbering"],"summary":"Update Numbering","operationId":"update_numbering_api_v1_numbering__series_id__patch","parameters":[{"name":"series_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Series Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NumberingSeriesUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NumberingSeriesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["master-data","numbering"],"summary":"Delete Numbering","operationId":"delete_numbering_api_v1_numbering__series_id__delete","parameters":[{"name":"series_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Series Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/numbering/{series_id}/next":{"post":{"tags":["master-data","numbering"],"summary":"Next Numbering","operationId":"next_numbering_api_v1_numbering__series_id__next_post","parameters":[{"name":"series_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Series Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NumberingNextResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/invoices":{"get":{"tags":["documents"],"summary":"List Invoices","operationId":"list_invoices_api_v1_invoices_get","parameters":[{"name":"doc_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Doc Type"}},{"name":"contact_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Contact Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"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":"country","in":"query","required":false,"schema":{"anyOf":[{"type":"string","minLength":2,"maxLength":2},{"type":"null"}],"title":"Country"}},{"name":"customer_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Type"}},{"name":"has_vat","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Has Vat"}},{"name":"regime","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}],"title":"Regime"}},{"name":"external_source","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"External Source"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse_DocumentListItem_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["documents"],"summary":"Create Invoice","operationId":"create_invoice_api_v1_invoices_post","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/invoices/export":{"get":{"tags":["documents"],"summary":"Export Invoices","description":"Export of the sales-invoice listing in the chosen format. Same filters as\n``GET /invoices`` (no pagination — exports the full filtered set).","operationId":"export_invoices_api_v1_invoices_export_get","parameters":[{"name":"doc_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Doc Type"}},{"name":"contact_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Contact Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"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":"country","in":"query","required":false,"schema":{"anyOf":[{"type":"string","minLength":2,"maxLength":2},{"type":"null"}],"title":"Country"}},{"name":"customer_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Type"}},{"name":"has_vat","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Has Vat"}},{"name":"regime","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}],"title":"Regime"}},{"name":"external_source","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"External Source"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","description":"xlsx | csv | json | pdf","default":"xlsx","title":"Format"},"description":"xlsx | csv | json | pdf"},{"name":"columns","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated column keys; omit for all.","title":"Columns"},"description":"Comma-separated column keys; omit for all."},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/invoices/{doc_id}":{"get":{"tags":["documents"],"summary":"Get Invoice","operationId":"get_invoice_api_v1_invoices__doc_id__get","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["documents"],"summary":"Update Invoice","operationId":"update_invoice_api_v1_invoices__doc_id__patch","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["documents"],"summary":"Delete Invoice","operationId":"delete_invoice_api_v1_invoices__doc_id__delete","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"force","in":"query","required":false,"schema":{"type":"boolean","description":"Confirma el borrado de una emitida pese al hueco de serie.","default":false,"title":"Force"},"description":"Confirma el borrado de una emitida pese al hueco de serie."},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/invoices/import-csv":{"post":{"tags":["documents"],"summary":"Import Invoices Csv Endpoint","description":"Bulk-import historical sales invoices from a CSV/XLSX (e.g. a Holded\nexport). ``dry_run=true`` parses + maps + validates without writing, so the\nUI can show a preview. Idempotent on the invoice number.","operationId":"import_invoices_csv_endpoint_api_v1_invoices_import_csv_post","parameters":[{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Dry Run"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_import_invoices_csv_endpoint_api_v1_invoices_import_csv_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Import Invoices Csv Endpoint Api V1 Invoices Import Csv Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/invoices/{doc_id}/duplicate":{"post":{"tags":["documents"],"summary":"Duplicate Invoice","description":"Duplicate an invoice into a fresh draft (recurring-billing shortcut).\n\nCopies the customer, lines, VAT and retention, but allocates a NEW invoice\nnumber, dates it today and starts as a draft with no payments. Ideal for\nclients billed the same concept every month: duplicate last month's invoice\nand just issue it.","operationId":"duplicate_invoice_api_v1_invoices__doc_id__duplicate_post","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/invoices/{doc_id}/rectify":{"post":{"tags":["documents"],"summary":"Rectify Invoice","description":"Generate a rectificativa (creditnote) from an issued invoice.\n\nClones the original's lines into a new draft ``creditnote`` linked back via\n``corrected_doc_id`` and carrying the rectification reason (RD 1619/2012).\nThe result is a draft the user reviews and then issues, so the rectificativa\nis always anchored to a real emitted invoice instead of being typed from\nscratch and forgetting the link.","operationId":"rectify_invoice_api_v1_invoices__doc_id__rectify_post","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RectifyRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/invoices/{doc_id}/issue":{"post":{"tags":["documents"],"summary":"Issue Invoice","operationId":"issue_invoice_api_v1_invoices__doc_id__issue_post","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/invoices/{doc_id}/send":{"post":{"tags":["documents"],"summary":"Send Invoice","operationId":"send_invoice_api_v1_invoices__doc_id__send_post","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/invoices/{doc_id}/payments":{"post":{"tags":["documents"],"summary":"Add Invoice Payment","operationId":"add_invoice_payment_api_v1_invoices__doc_id__payments_post","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/invoices/{doc_id}/attachment":{"post":{"tags":["documents"],"summary":"Upload Invoice Attachment","operationId":"upload_invoice_attachment_api_v1_invoices__doc_id__attachment_post","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_invoice_attachment_api_v1_invoices__doc_id__attachment_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["documents"],"summary":"Download Invoice Attachment","operationId":"download_invoice_attachment_api_v1_invoices__doc_id__attachment_get","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/quotes":{"get":{"tags":["documents"],"summary":"List Quotes","operationId":"list_quotes_api_v1_quotes_get","parameters":[{"name":"doc_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Doc Type"}},{"name":"contact_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Contact Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"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":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse_DocumentListItem_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["documents"],"summary":"Create Quote","operationId":"create_quote_api_v1_quotes_post","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/quotes/{doc_id}":{"get":{"tags":["documents"],"summary":"Get Quote","operationId":"get_quote_api_v1_quotes__doc_id__get","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["documents"],"summary":"Update Quote","operationId":"update_quote_api_v1_quotes__doc_id__patch","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["documents"],"summary":"Delete Quote","operationId":"delete_quote_api_v1_quotes__doc_id__delete","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/quotes/{doc_id}/send":{"post":{"tags":["documents"],"summary":"Send Quote","operationId":"send_quote_api_v1_quotes__doc_id__send_post","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/quotes/{doc_id}/accept":{"post":{"tags":["documents"],"summary":"Accept Quote","operationId":"accept_quote_api_v1_quotes__doc_id__accept_post","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/quotes/{doc_id}/reject":{"post":{"tags":["documents"],"summary":"Reject Quote","operationId":"reject_quote_api_v1_quotes__doc_id__reject_post","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/quotes/{doc_id}/convert":{"post":{"tags":["documents"],"summary":"Convert Quote","operationId":"convert_quote_api_v1_quotes__doc_id__convert_post","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"target","in":"query","required":true,"schema":{"type":"string","description":"Document type to create: 'invoice' or 'waybill'. Waybill is only allowed when converting an estimate.","title":"Target"},"description":"Document type to create: 'invoice' or 'waybill'. Waybill is only allowed when converting an estimate."},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/documents/{doc_id}/pdf":{"get":{"tags":["documents"],"summary":"Document Pdf","description":"Render a Document (invoice or purchase) to PDF.\n\nThe template defaults to the tenant's ``invoice_template`` setting and can\nbe overridden by passing ``?template=classic|modern|minimal``.","operationId":"document_pdf_api_v1_documents__doc_id__pdf_get","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"template","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Template"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/documents/{doc_id}/preview":{"get":{"tags":["documents"],"summary":"Document Preview","description":"Render a Document to standalone HTML (for iframe preview in the UI).","operationId":"document_preview_api_v1_documents__doc_id__preview_get","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"template","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Template"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/documents/{doc_id}/reconciliations":{"get":{"tags":["documents"],"summary":"Document Reconciliations","description":"List bank reconciliations that link a movement to this document.\n\nUsed by the UI drawers (Compras/Ventas) to surface \"this invoice was paid\nwith movement X on treasury Y\" without needing a separate page.","operationId":"document_reconciliations_api_v1_documents__doc_id__reconciliations_get","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Document Reconciliations Api V1 Documents  Doc Id  Reconciliations Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/purchases/import-csv":{"post":{"tags":["documents"],"summary":"Import Purchases Csv Endpoint","description":"Bulk-import received purchase/expense invoices from a CSV/XLSX. The CSV\n\"número\" is the supplier's invoice number; dedup is per supplier on it.\n``dry_run=true`` previews without writing. Supports an optional IRPF column.","operationId":"import_purchases_csv_endpoint_api_v1_purchases_import_csv_post","parameters":[{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Dry Run"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_import_purchases_csv_endpoint_api_v1_purchases_import_csv_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Import Purchases Csv Endpoint Api V1 Purchases Import Csv Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/purchases":{"get":{"tags":["documents"],"summary":"List Purchases","operationId":"list_purchases_api_v1_purchases_get","parameters":[{"name":"contact_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Contact Id"}},{"name":"doc_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter to a single purchase-side doc_type (purchase | purchaserefund | purchaseorder). Omit for all. The UI uses this to split the 'Rectificativas' tab (purchaserefund) from the rest.","title":"Doc Type"},"description":"Filter to a single purchase-side doc_type (purchase | purchaserefund | purchaseorder). Omit for all. The UI uses this to split the 'Rectificativas' tab (purchaserefund) from the rest."},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"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":"has_attachment","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"true: only purchases with a source PDF; false: only purchases missing it (reconciliation not yet justified).","title":"Has Attachment"},"description":"true: only purchases with a source PDF; false: only purchases missing it (reconciliation not yet justified)."},{"name":"pending","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"true: purchases that still need attention — either not paid yet (status != paid/cancelled) OR missing the source PDF. Combines what used to be two separate buckets ('Pendientes' + 'Falta factura').","title":"Pending"},"description":"true: purchases that still need attention — either not paid yet (status != paid/cancelled) OR missing the source PDF. Combines what used to be two separate buckets ('Pendientes' + 'Falta factura')."},{"name":"order","in":"query","required":false,"schema":{"type":"string","description":"Orden de la lista. Presets: 'date' (fecha de factura desc, por defecto), 'recent' (modificación más reciente desc). Orden por columna desde la UI: 'date_asc', 'total_desc'/'total_asc', 'number_asc'/'number_desc', 'supplier_asc'/'supplier_desc', 'supplier_number_asc'/'supplier_number_desc', 'status_asc'/'status_desc'. Un valor desconocido cae al orden por defecto (no es un error).","default":"date","title":"Order"},"description":"Orden de la lista. Presets: 'date' (fecha de factura desc, por defecto), 'recent' (modificación más reciente desc). Orden por columna desde la UI: 'date_asc', 'total_desc'/'total_asc', 'number_asc'/'number_desc', 'supplier_asc'/'supplier_desc', 'supplier_number_asc'/'supplier_number_desc', 'status_asc'/'status_desc'. Un valor desconocido cae al orden por defecto (no es un error)."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse_DocumentListItem_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["documents"],"summary":"Create Purchase","operationId":"create_purchase_api_v1_purchases_post","parameters":[{"name":"force","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Force"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/purchases/export":{"get":{"tags":["documents"],"summary":"Export Purchases","description":"Export of the purchase listing in the chosen format. Same filters as\n``GET /purchases`` (no pagination — exports the full filtered set).","operationId":"export_purchases_api_v1_purchases_export_get","parameters":[{"name":"contact_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Contact Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"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":"has_attachment","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Has Attachment"}},{"name":"pending","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Pending"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","description":"xlsx | csv | json | pdf","default":"xlsx","title":"Format"},"description":"xlsx | csv | json | pdf"},{"name":"columns","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated column keys; omit for all.","title":"Columns"},"description":"Comma-separated column keys; omit for all."},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/purchases/{doc_id}":{"get":{"tags":["documents"],"summary":"Get Purchase","operationId":"get_purchase_api_v1_purchases__doc_id__get","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["documents"],"summary":"Update Purchase","operationId":"update_purchase_api_v1_purchases__doc_id__patch","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["documents"],"summary":"Delete Purchase","operationId":"delete_purchase_api_v1_purchases__doc_id__delete","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/purchases/autogen-from-movements":{"post":{"tags":["documents"],"summary":"Autogen Purchases From Movements","description":"Auto-generate self-billed purchase invoices for outgoing bank movements\nthat need a supporting document (affiliate / contractor payouts where the\npayee issues no invoice), in the same shape as the synced sales invoices,\nand reconcile each against its movement. Idempotent: movements already\nlinked to a document are skipped.","operationId":"autogen_purchases_from_movements_api_v1_purchases_autogen_from_movements_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutogenPurchasesRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Autogen Purchases From Movements Api V1 Purchases Autogen From Movements Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/purchases/{doc_id}/rectify":{"post":{"tags":["documents"],"summary":"Rectify Purchase","description":"Generate a rectificativa de compra (``purchaserefund``) from an issued\npurchase — the purchase-side mirror of ``rectify_invoice``.\n\nClones the original purchase's lines into a new draft ``purchaserefund``\nlinked back via ``corrected_doc_id`` and carrying the rectification reason\n(RD 1619/2012). **Amounts stay POSITIVE**: the journal engine inverts the\nside for a ``purchaserefund`` (400 D / 6xx H / 472x H), so a supplier refund\nmust never be modelled as a negative purchase (which would post negative\namounts on the normal side and corrupt the libro mayor + IVA soportado).\n\nThe result is a draft the user reviews and then issues. For a **partial**\nrefund the user edits the line amounts / removes lines on the draft before\nissuing (RD 1619/2012 rectificación por diferencias); a full refund keeps the\ncloned amounts (rectificación por sustitución).","operationId":"rectify_purchase_api_v1_purchases__doc_id__rectify_post","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RectifyRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/purchases/{doc_id}/issue":{"post":{"tags":["documents"],"summary":"Issue Purchase","description":"Contabilizar a draft purchase: move it to ``issued`` and post the\njournal so it counts toward expenses / IVA soportado. A PDF is NOT\nrequired — a manually-keyed purchase is booked the same as a PDF-ingested\none. Mirrors ``issue_invoice``.","operationId":"issue_purchase_api_v1_purchases__doc_id__issue_post","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/purchases/{doc_id}/payments":{"post":{"tags":["documents"],"summary":"Add Purchase Payment","operationId":"add_purchase_payment_api_v1_purchases__doc_id__payments_post","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/purchases/{doc_id}/attachment":{"post":{"tags":["documents"],"summary":"Upload Purchase Attachment","operationId":"upload_purchase_attachment_api_v1_purchases__doc_id__attachment_post","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_purchase_attachment_api_v1_purchases__doc_id__attachment_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["documents"],"summary":"Download Purchase Attachment","operationId":"download_purchase_attachment_api_v1_purchases__doc_id__attachment_get","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/invoices/bulk-download":{"post":{"tags":["documents"],"summary":"Bulk Download Invoices","description":"Stream a ZIP with the rendered PDF for every selected sales document.\n\nEach PDF is generated on the fly using the tenant's current template.\nThe ZIP name is unique-per-call so it doesn't collide if the user runs\nseveral exports in a row.","operationId":"bulk_download_invoices_api_v1_invoices_bulk_download_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkIdsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/purchases/bulk-download":{"post":{"tags":["documents"],"summary":"Bulk Download Purchases","description":"Stream a ZIP with the original attached PDF for every selected purchase.\n\nPurchases that have no attachment are skipped. The response surfaces a\n``X-Aikount-Skipped`` header so the UI can warn the user about how many\nwere missing without us failing the whole call.","operationId":"bulk_download_purchases_api_v1_purchases_bulk_download_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkIdsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/invoices/bulk-delete":{"post":{"tags":["documents"],"summary":"Bulk Delete Invoices","description":"Delete the selected sales documents, undoing every side-effect.\n\nBest-effort: a failure on one doc doesn't roll back the others. The\nresponse lists every failure so the UI can show a clear partial-success\nmessage.","operationId":"bulk_delete_invoices_api_v1_invoices_bulk_delete_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkIdsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkActionSummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/purchases/bulk-delete":{"post":{"tags":["documents"],"summary":"Bulk Delete Purchases","description":"Delete the selected purchase documents, undoing every side-effect.","operationId":"bulk_delete_purchases_api_v1_purchases_bulk_delete_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkIdsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkActionSummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/invoices/bulk-issue":{"post":{"tags":["documents"],"summary":"Bulk Issue Invoices","description":"Issue (draft → issued) every selected invoice that is still a draft.\n\nDocs already past the draft state are reported as failures so the UI\ncan show what was skipped — we don't want a silent partial success.","operationId":"bulk_issue_invoices_api_v1_invoices_bulk_issue_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkIdsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkActionSummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/banking/cashflow":{"get":{"tags":["banking"],"summary":"Cashflow","description":"12-month cashflow series + current-month aggregates + total balance.\n\nUsed by the Banking page (top-right chart + Saldo card).","operationId":"cashflow_api_v1_banking_cashflow_get","parameters":[{"name":"months","in":"query","required":false,"schema":{"type":"integer","maximum":36,"minimum":1,"default":12,"title":"Months"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Cashflow Api V1 Banking Cashflow Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/treasuries":{"get":{"tags":["banking"],"summary":"List Treasuries","operationId":"list_treasuries_api_v1_treasuries_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse_TreasuryResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["banking"],"summary":"Create Treasury","operationId":"create_treasury_api_v1_treasuries_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TreasuryCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TreasuryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/treasuries/{treasury_id}":{"get":{"tags":["banking"],"summary":"Get Treasury","operationId":"get_treasury_api_v1_treasuries__treasury_id__get","parameters":[{"name":"treasury_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Treasury Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TreasuryDetailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["banking"],"summary":"Update Treasury","operationId":"update_treasury_api_v1_treasuries__treasury_id__patch","parameters":[{"name":"treasury_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Treasury Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TreasuryUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TreasuryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["banking"],"summary":"Delete Treasury","description":"Delete a treasury. If ``cascade=true``, also wipes its movements and runs the\nprovider-specific disconnect (Stripe / PayPal token revocation, etc.).","operationId":"delete_treasury_api_v1_treasuries__treasury_id__delete","parameters":[{"name":"treasury_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Treasury Id"}},{"name":"cascade","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Cascade"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/bank-movements":{"get":{"tags":["banking"],"summary":"List Bank Movements","operationId":"list_bank_movements_api_v1_bank_movements_get","parameters":[{"name":"treasury_id","in":"query","required":false,"schema":{"type":"array","items":{"type":"string","format":"uuid"},"default":[],"title":"Treasury Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"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":"min_amount","in":"query","required":false,"schema":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Min Amount"}},{"name":"max_amount","in":"query","required":false,"schema":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Max Amount"}},{"name":"category_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by category UUID, or 'none' for uncategorized movements.","title":"Category Id"},"description":"Filter by category UUID, or 'none' for uncategorized movements."},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse_BankMovementResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["banking"],"summary":"Create Bank Movement","operationId":"create_bank_movement_api_v1_bank_movements_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BankMovementCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BankMovementResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/bank-movements/export":{"get":{"tags":["banking"],"summary":"Export Bank Movements","description":"Export bank transactions to xlsx/csv/json/pdf, mirroring purchases/sales.\n\nSame filters as the listing (so the UI exports exactly what's on screen,\ne.g. filtered by the current quarter). Every reconciled purchase gets an\nunguessable public token minted lazily, and the export carries a per-row\npublic link to that purchase's PDF — so the gestor opens each invoice\nwithout an AgentLedger login.","operationId":"export_bank_movements_api_v1_bank_movements_export_get","parameters":[{"name":"treasury_id","in":"query","required":false,"schema":{"type":"array","items":{"type":"string","format":"uuid"},"default":[],"title":"Treasury Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"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":"min_amount","in":"query","required":false,"schema":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Min Amount"}},{"name":"max_amount","in":"query","required":false,"schema":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Max Amount"}},{"name":"category_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category Id"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"direction","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filtra por signo del importe: 'in' (cobros, importe > 0) o 'out' (gastos, importe < 0). Cualquier otro valor no filtra.","title":"Direction"},"description":"Filtra por signo del importe: 'in' (cobros, importe > 0) o 'out' (gastos, importe < 0). Cualquier otro valor no filtra."},{"name":"ids","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated movement UUIDs to export only those (checked rows).","title":"Ids"},"description":"Comma-separated movement UUIDs to export only those (checked rows)."},{"name":"format","in":"query","required":false,"schema":{"type":"string","default":"xlsx","title":"Format"}},{"name":"columns","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Columns"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/bank-movements/import-batches":{"get":{"tags":["banking"],"summary":"List Statement Imports","description":"List uploaded statements (extractos) so the gestor can review and\ndelete a whole upload. Optionally scoped to one treasury. Declared before\n``/{movement_id}`` so 'import-batches' isn't coerced into a UUID.","operationId":"list_statement_imports_api_v1_bank_movements_import_batches_get","parameters":[{"name":"treasury_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Treasury Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/StatementImportBatch"},"title":"Response List Statement Imports Api V1 Bank Movements Import Batches Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/bank-movements/{movement_id}":{"get":{"tags":["banking"],"summary":"Get Bank Movement","operationId":"get_bank_movement_api_v1_bank_movements__movement_id__get","parameters":[{"name":"movement_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Movement Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BankMovementDetailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["banking"],"summary":"Delete Bank Movement","description":"Delete a single movement (apunte). Reverses any reconciliations on it\nfirst. Recoverable from /activity (audit log).","operationId":"delete_bank_movement_api_v1_bank_movements__movement_id__delete","parameters":[{"name":"movement_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Movement Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/bank-movements/import-csv":{"post":{"tags":["banking"],"summary":"Import Bank Movements Csv","operationId":"import_bank_movements_csv_api_v1_bank_movements_import_csv_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_import_bank_movements_csv_api_v1_bank_movements_import_csv_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CsvImportResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/bank-movements/import-batches/{batch_id}":{"delete":{"tags":["banking"],"summary":"Delete Statement Import","description":"Delete an entire uploaded statement (extracto) and every movement it\ncreated — reversing reconciliations as it goes. Recoverable from /activity.","operationId":"delete_statement_import_api_v1_bank_movements_import_batches__batch_id__delete","parameters":[{"name":"batch_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Batch Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteBatchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reconciliations/against-document":{"post":{"tags":["banking"],"summary":"Reconcile Against Document","operationId":"reconcile_against_document_api_v1_reconciliations_against_document_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReconcileAgainstDocumentRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReconciliationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reconciliations/against-account":{"post":{"tags":["banking"],"summary":"Reconcile Against Account","operationId":"reconcile_against_account_api_v1_reconciliations_against_account_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReconcileAgainstAccountRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkReconcileResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reconciliations/auto":{"post":{"tags":["banking"],"summary":"Auto Reconcile Purchases","description":"Feature A — multi-movement reconciliation.\n\nSweep open purchases and, for each, look for a UNIQUE subset of unreconciled\nsame-supplier bank debits whose absolute amounts SUM to the outstanding\ntotal (one invoice billed as several card charges — Contabo, Google Ads…).\nReconciles the doc against every movement in the subset; abstains when more\nthan one distinct subset matches. The 1:1 exact match is the size-1 subset.","operationId":"auto_reconcile_purchases_api_v1_reconciliations_auto_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AutoReconcileRequest"},{"type":"null"}],"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoReconcileResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reconciliations/fx-settle":{"post":{"tags":["banking"],"summary":"Fx Settle Purchases","description":"Feature C — FX settlement re-book + reconcile.\n\nForeign-currency purchases (USD: X, OpenRouter, Mistral, OpenAI API…) are\nbooked with the EUR total at the ECB rate, but the bank debited a different\nEUR amount (the card's real FX rate + commission), so they (a) carry a\nslightly wrong cost and (b) never line up with the bank movement. This sweep\nre-books each unreconciled foreign purchase at the EUR the bank actually\ncharged (matched within the plausible FX band of its original-currency\ntotal, closest by date, each charge used once), then reconciles it against\nthat charge. ``dry_run`` (default true) returns the proposals WITHOUT writing.","operationId":"fx_settle_purchases_api_v1_reconciliations_fx_settle_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/FxSettleRequest"},{"type":"null"}],"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FxSettleResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reconciliations/auto-classify":{"post":{"tags":["banking"],"summary":"Auto Classify Movements","description":"Feature B — no-invoice → account AI classifier.\n\nFor unreconciled debits with NO matching purchase, ask the LLM whether each\nis a structurally invoice-less payment (AEAT/Hacienda → 47x, FNMT/tasas →\n629, comisiones → 626, intereses → 669). Confident ones are booked via\n``reconcile_against_account``; everything else stays pending for the purchase\nflow. ``dry_run`` (default true) returns the proposals WITHOUT writing.","operationId":"auto_classify_movements_api_v1_reconciliations_auto_classify_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AutoClassifyRequest"},{"type":"null"}],"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoClassifyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reconciliations/{reconciliation_id}":{"delete":{"tags":["banking"],"summary":"Delete Reconciliation","operationId":"delete_reconciliation_api_v1_reconciliations__reconciliation_id__delete","parameters":[{"name":"reconciliation_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Reconciliation Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/banking/movements/{movement_id}/category":{"patch":{"tags":["banking"],"summary":"Set Movement Category","description":"Manually set or clear the soft category on a single movement.","operationId":"set_movement_category_api_v1_banking_movements__movement_id__category_patch","parameters":[{"name":"movement_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Movement Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MovementCategoryAssign"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BankMovementResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/rules":{"get":{"tags":["rules"],"summary":"List Rules","operationId":"list_rules_api_v1_rules_get","parameters":[{"name":"treasury_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Treasury Id"}},{"name":"action_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Action Type"}},{"name":"target_category_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Target Category Id"}},{"name":"active","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Active"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse_RuleResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["rules"],"summary":"Create Rule","operationId":"create_rule_api_v1_rules_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/rules/{rule_id}":{"patch":{"tags":["rules"],"summary":"Update Rule","operationId":"update_rule_api_v1_rules__rule_id__patch","parameters":[{"name":"rule_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Rule Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["rules"],"summary":"Delete Rule","operationId":"delete_rule_api_v1_rules__rule_id__delete","parameters":[{"name":"rule_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Rule Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/rules/{rule_id}/scan":{"post":{"tags":["rules"],"summary":"Scan Rule","operationId":"scan_rule_api_v1_rules__rule_id__scan_post","parameters":[{"name":"rule_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Rule Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleScanResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/rules/{rule_id}/execute":{"post":{"tags":["rules"],"summary":"Execute Rule","operationId":"execute_rule_api_v1_rules__rule_id__execute_post","parameters":[{"name":"rule_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Rule Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleExecuteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/rules/scan-all":{"post":{"tags":["rules"],"summary":"Scan All Rules","operationId":"scan_all_rules_api_v1_rules_scan_all_post","parameters":[{"name":"action_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Action Type"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleScanAllResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/rules/execute-all":{"post":{"tags":["rules"],"summary":"Execute All Rules","operationId":"execute_all_rules_api_v1_rules_execute_all_post","parameters":[{"name":"action_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Action Type"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleExecuteAllResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/rules/suggestions":{"get":{"tags":["Rule Suggestions"],"summary":"List Suggestions","operationId":"list_suggestions_api_v1_rules_suggestions_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleSuggestionListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/rules/suggestions/generate":{"post":{"tags":["Rule Suggestions"],"summary":"Generate Suggestions","operationId":"generate_suggestions_api_v1_rules_suggestions_generate_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleSuggestionGenerateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/rules/suggestions/{suggestion_id}/accept":{"post":{"tags":["Rule Suggestions"],"summary":"Accept","operationId":"accept_api_v1_rules_suggestions__suggestion_id__accept_post","parameters":[{"name":"suggestion_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Suggestion Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleSuggestionAcceptResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/rules/suggestions/{suggestion_id}/reject":{"post":{"tags":["Rule Suggestions"],"summary":"Reject","operationId":"reject_api_v1_rules_suggestions__suggestion_id__reject_post","parameters":[{"name":"suggestion_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Suggestion Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reconciliation/board":{"get":{"tags":["reconciliation"],"summary":"Board","description":"Returns movements + documents + initial proposals for the visible window.\n\nAll filters apply to the movements column only; the documents and\ntreasuries blocks are always full so the UI can stay responsive to\ncross-bank manual matches and dropdown changes without refetching.","operationId":"board_api_v1_reconciliation_board_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"treasury_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Treasury Id"}},{"name":"direction","in":"query","required":false,"schema":{"anyOf":[{"type":"string","pattern":"^(in|out)$"},{"type":"null"}],"title":"Direction"}},{"name":"from_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"From Date"}},{"name":"to_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"To Date"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Board Api V1 Reconciliation Board Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reconciliation/propose":{"post":{"tags":["reconciliation"],"summary":"Propose","operationId":"propose_api_v1_reconciliation_propose_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProposeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Propose Api V1 Reconciliation Propose Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reconciliation/confirm":{"post":{"tags":["reconciliation"],"summary":"Confirm","operationId":"confirm_api_v1_reconciliation_confirm_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MatchRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Confirm Api V1 Reconciliation Confirm Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reconciliation/manual-match":{"post":{"tags":["reconciliation"],"summary":"Manual Match","operationId":"manual_match_api_v1_reconciliation_manual_match_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MatchRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Manual Match Api V1 Reconciliation Manual Match Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reconciliation/dismiss":{"post":{"tags":["reconciliation"],"summary":"Dismiss","operationId":"dismiss_api_v1_reconciliation_dismiss_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MatchRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Dismiss Api V1 Reconciliation Dismiss Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/categories":{"get":{"tags":["categories"],"summary":"List Categories","operationId":"list_categories_api_v1_categories_get","parameters":[{"name":"kind","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kind"}},{"name":"active","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Active"}},{"name":"treasury_id","in":"query","required":false,"schema":{"type":"array","items":{"type":"string","format":"uuid"},"default":[],"title":"Treasury 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":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse_CategoryWithStats_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["categories"],"summary":"Create Category","operationId":"create_category_api_v1_categories_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategoryCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategoryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/categories/breakdown":{"get":{"tags":["categories"],"summary":"Category Breakdown","operationId":"category_breakdown_api_v1_categories_breakdown_get","parameters":[{"name":"from","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"From"}},{"name":"to","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"To"}},{"name":"treasury_id","in":"query","required":false,"schema":{"type":"array","items":{"type":"string","format":"uuid"},"default":[],"title":"Treasury Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategoryBreakdownResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/categories/seed-defaults":{"post":{"tags":["categories"],"summary":"Seed Defaults","operationId":"seed_defaults_api_v1_categories_seed_defaults_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategorySeedResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/categories/suggest":{"post":{"tags":["categories"],"summary":"Suggest","operationId":"suggest_api_v1_categories_suggest_post","parameters":[{"name":"lookback_days","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"default":90,"title":"Lookback Days"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":40,"minimum":1,"default":40,"title":"Limit"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategorySuggestResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/categories/suggestions/accept":{"post":{"tags":["categories"],"summary":"Accept Suggestions","operationId":"accept_suggestions_api_v1_categories_suggestions_accept_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptSuggestionsRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptSuggestionsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/categories/{category_id}":{"get":{"tags":["categories"],"summary":"Get Category","operationId":"get_category_api_v1_categories__category_id__get","parameters":[{"name":"category_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Category Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategoryWithStats"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["categories"],"summary":"Update Category","operationId":"update_category_api_v1_categories__category_id__patch","parameters":[{"name":"category_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Category Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategoryUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategoryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["categories"],"summary":"Delete Category","operationId":"delete_category_api_v1_categories__category_id__delete","parameters":[{"name":"category_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Category Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/subscriptions/summary":{"get":{"tags":["subscriptions"],"summary":"Get Summary","operationId":"get_summary_api_v1_subscriptions_summary_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionsSummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/subscriptions/detect":{"post":{"tags":["subscriptions"],"summary":"Detect","operationId":"detect_api_v1_subscriptions_detect_post","parameters":[{"name":"refine_with_ai","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Refine With Ai"}},{"name":"lookback_months","in":"query","required":false,"schema":{"type":"integer","maximum":36,"minimum":1,"default":12,"title":"Lookback Months"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DetectResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/subscriptions/accept":{"post":{"tags":["subscriptions"],"summary":"Accept Candidates","operationId":"accept_candidates_api_v1_subscriptions_accept_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptCandidatesRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptCandidatesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/subscriptions":{"get":{"tags":["subscriptions"],"summary":"List Subscriptions","operationId":"list_subscriptions_api_v1_subscriptions_get","parameters":[{"name":"active","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Active"}},{"name":"cadence","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cadence"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse_SubscriptionResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["subscriptions"],"summary":"Create Subscription","operationId":"create_subscription_api_v1_subscriptions_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionCreateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/subscriptions/{sub_id}":{"get":{"tags":["subscriptions"],"summary":"Get Subscription","operationId":"get_subscription_api_v1_subscriptions__sub_id__get","parameters":[{"name":"sub_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sub Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionDetailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["subscriptions"],"summary":"Update Subscription","operationId":"update_subscription_api_v1_subscriptions__sub_id__patch","parameters":[{"name":"sub_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sub Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["subscriptions"],"summary":"Delete Subscription","operationId":"delete_subscription_api_v1_subscriptions__sub_id__delete","parameters":[{"name":"sub_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sub Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/subscriptions/{sub_id}/cancel":{"post":{"tags":["subscriptions"],"summary":"Cancel Subscription","operationId":"cancel_subscription_api_v1_subscriptions__sub_id__cancel_post","parameters":[{"name":"sub_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sub Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tax/analytics":{"get":{"tags":["tax-analytics"],"summary":"Sales breakdown by country / B2B-B2C / AEAT regime (303 / 349 / 369).","operationId":"tax_analytics_endpoint_api_v1_tax_analytics_get","parameters":[{"name":"from","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"From"}},{"name":"to","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"To"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxAnalyticsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tax/countries":{"get":{"tags":["tax-analytics"],"summary":"Just the per-country rollup — lightweight for charts.","operationId":"tax_countries_endpoint_api_v1_tax_countries_get","parameters":[{"name":"from","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"From"}},{"name":"to","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"To"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CountryRow"},"title":"Response Tax Countries Endpoint Api V1 Tax Countries Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/model-111/{year}/{quarter}":{"get":{"tags":["taxes"],"summary":"Modelo 111 — retenciones IRPF trimestrales (cálculo).","operationId":"model_111_endpoint_api_v1_taxes_model_111__year___quarter__get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","maximum":2100,"minimum":2000,"title":"Year"}},{"name":"quarter","in":"path","required":true,"schema":{"type":"integer","maximum":4,"minimum":1,"title":"Quarter"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Model 111 Endpoint Api V1 Taxes Model 111  Year   Quarter  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/model-111/{year}/{quarter}/export":{"get":{"tags":["taxes"],"summary":"Modelo 111 — export en Excel (xlsx) o CSV.","operationId":"model_111_export_endpoint_api_v1_taxes_model_111__year___quarter__export_get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","maximum":2100,"minimum":2000,"title":"Year"}},{"name":"quarter","in":"path","required":true,"schema":{"type":"integer","maximum":4,"minimum":1,"title":"Quarter"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","default":"xlsx","title":"Format"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/model-115/{year}/{quarter}":{"get":{"tags":["taxes"],"summary":"Modelo 115 — retenciones IRPF alquileres trimestrales (cálculo).","operationId":"model_115_endpoint_api_v1_taxes_model_115__year___quarter__get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","maximum":2100,"minimum":2000,"title":"Year"}},{"name":"quarter","in":"path","required":true,"schema":{"type":"integer","maximum":4,"minimum":1,"title":"Quarter"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Model 115 Endpoint Api V1 Taxes Model 115  Year   Quarter  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/model-115/{year}/{quarter}/export":{"get":{"tags":["taxes"],"summary":"Modelo 115 — export plano AEAT (pipe-delimited, first pass).","operationId":"model_115_export_endpoint_api_v1_taxes_model_115__year___quarter__export_get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","maximum":2100,"minimum":2000,"title":"Year"}},{"name":"quarter","in":"path","required":true,"schema":{"type":"integer","maximum":4,"minimum":1,"title":"Quarter"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","default":"xlsx","title":"Format"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/model-130/{year}/{quarter}":{"get":{"tags":["Tax Model 130"],"summary":"Calcula el modelo 130 (IRPF autónomos) del trimestre indicado.","description":"Devuelve todas las casillas intermedias + ``breakdown`` de documentos.","operationId":"get_model_130_api_v1_taxes_model_130__year___quarter__get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","maximum":2100,"minimum":2000,"title":"Year"}},{"name":"quarter","in":"path","required":true,"schema":{"type":"integer","maximum":4,"minimum":1,"title":"Quarter"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Model 130 Api V1 Taxes Model 130  Year   Quarter  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/model-130/{year}/{quarter}/export":{"get":{"tags":["Tax Model 130"],"summary":"Exporta el modelo 130 en formato de texto delimitado por '|'.","description":"Plain-text export consumable por la asesoría.\n\nNota: el formato oficial AEAT del modelo 130 usa posiciones fijas; este\nexport es una versión pipe-delimited con casillas etiquetadas. Endurecer al\nformato fijo es trabajo posterior — los valores en sí coinciden 1:1 con lo\nque la AEAT espera.","operationId":"export_model_130_api_v1_taxes_model_130__year___quarter__export_get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","maximum":2100,"minimum":2000,"title":"Year"}},{"name":"quarter","in":"path","required":true,"schema":{"type":"integer","maximum":4,"minimum":1,"title":"Quarter"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","default":"xlsx","title":"Format"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/model-180/{year}":{"get":{"tags":["tax-model-180"],"summary":"Modelo 180 — resumen anual de retenciones sobre alquileres (JSON).","operationId":"model_180_endpoint_api_v1_taxes_model_180__year__get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","title":"Year"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Model 180 Endpoint Api V1 Taxes Model 180  Year  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/model-180/{year}/export":{"get":{"tags":["tax-model-180"],"summary":"Modelo 180 — export descargable (pipe-delimited, preview).","operationId":"model_180_export_endpoint_api_v1_taxes_model_180__year__export_get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","title":"Year"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","default":"xlsx","title":"Format"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/model-190/{year}":{"get":{"tags":["tax-model-190"],"summary":"Modelo 190 — resumen anual de retenciones (JSON).","operationId":"model_190_endpoint_api_v1_taxes_model_190__year__get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","title":"Year"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Model 190 Endpoint Api V1 Taxes Model 190  Year  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/model-190/{year}/export":{"get":{"tags":["tax-model-190"],"summary":"Modelo 190 — export descargable (pipe-delimited, preview).","operationId":"model_190_export_endpoint_api_v1_taxes_model_190__year__export_get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","title":"Year"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","default":"xlsx","title":"Format"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/model-200/{year}":{"get":{"tags":["Tax Model 200"],"summary":"Calcula el modelo 200 (IS anual) del ejercicio indicado.","description":"Devuelve todas las casillas intermedias del Modelo 200.","operationId":"get_model_200_api_v1_taxes_model_200__year__get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","maximum":2100,"minimum":2000,"title":"Year"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Model 200 Api V1 Taxes Model 200  Year  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/model-200/{year}/export":{"get":{"tags":["Tax Model 200"],"summary":"Exporta el modelo 200 en formato de texto delimitado por '|'.","description":"Plain-text export consumable por la asesoría.\n\nNota: el formato oficial AEAT del Modelo 200 tiene cientos de casillas y\nse presenta vía Sociedades WEB. Este export es una versión pipe-delimited\ncon las casillas más relevantes etiquetadas para cuadrar a mano.","operationId":"export_model_200_api_v1_taxes_model_200__year__export_get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","maximum":2100,"minimum":2000,"title":"Year"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","default":"xlsx","title":"Format"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/model-202/{year}/{period}":{"get":{"tags":["Tax Model 202"],"summary":"Calcula el modelo 202 (IS pago fraccionado) del periodo indicado.","description":"Devuelve todas las casillas intermedias + ``breakdown`` de documentos.","operationId":"get_model_202_api_v1_taxes_model_202__year___period__get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","maximum":2100,"minimum":2000,"title":"Year"}},{"name":"period","in":"path","required":true,"schema":{"type":"integer","maximum":3,"minimum":1,"description":"1P abril, 2P octubre, 3P diciembre","title":"Period"},"description":"1P abril, 2P octubre, 3P diciembre"},{"name":"modality","in":"query","required":false,"schema":{"type":"string","pattern":"^[AB]$","default":"B","title":"Modality"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Model 202 Api V1 Taxes Model 202  Year   Period  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/model-202/{year}/{period}/export":{"get":{"tags":["Tax Model 202"],"summary":"Exporta el modelo 202 en formato de texto delimitado por '|'.","description":"Plain-text export consumable por la asesoría.\n\nNota: el formato oficial AEAT del modelo 202 usa posiciones fijas; este\nexport es una versión pipe-delimited con casillas etiquetadas. Endurecer\nal formato fijo es trabajo posterior.","operationId":"export_model_202_api_v1_taxes_model_202__year___period__export_get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","maximum":2100,"minimum":2000,"title":"Year"}},{"name":"period","in":"path","required":true,"schema":{"type":"integer","maximum":3,"minimum":1,"title":"Period"}},{"name":"modality","in":"query","required":false,"schema":{"type":"string","pattern":"^[AB]$","default":"B","title":"Modality"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","default":"xlsx","title":"Format"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/model-216/{year}/{quarter}":{"get":{"tags":["taxes"],"summary":"Modelo 216 — retenciones IRNR no residentes (cálculo).","operationId":"model_216_endpoint_api_v1_taxes_model_216__year___quarter__get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","maximum":2100,"minimum":2000,"title":"Year"}},{"name":"quarter","in":"path","required":true,"schema":{"type":"integer","maximum":4,"minimum":1,"title":"Quarter"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Model 216 Endpoint Api V1 Taxes Model 216  Year   Quarter  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/model-216/{year}/{quarter}/export":{"get":{"tags":["taxes"],"summary":"Modelo 216 — export plano AEAT (pipe-delimited, first pass).","operationId":"model_216_export_endpoint_api_v1_taxes_model_216__year___quarter__export_get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","maximum":2100,"minimum":2000,"title":"Year"}},{"name":"quarter","in":"path","required":true,"schema":{"type":"integer","maximum":4,"minimum":1,"title":"Quarter"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","default":"xlsx","title":"Format"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/model-296/{year}":{"get":{"tags":["tax-model-296"],"summary":"Modelo 296 — resumen anual de retenciones IRNR (JSON).","operationId":"model_296_endpoint_api_v1_taxes_model_296__year__get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","title":"Year"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Model 296 Endpoint Api V1 Taxes Model 296  Year  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/model-296/{year}/export":{"get":{"tags":["tax-model-296"],"summary":"Modelo 296 — export descargable (pipe-delimited, preview).","operationId":"model_296_export_endpoint_api_v1_taxes_model_296__year__export_get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","title":"Year"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","default":"xlsx","title":"Format"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/model-347/{year}":{"get":{"tags":["tax-model-347"],"summary":"Modelo 347 — operaciones con terceros > 3.005,06 € (JSON).","operationId":"model_347_endpoint_api_v1_taxes_model_347__year__get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","title":"Year"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Model 347 Endpoint Api V1 Taxes Model 347  Year  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/model-347/{year}/export":{"get":{"tags":["tax-model-347"],"summary":"Modelo 347 — export descargable (pipe-delimited, preview).","operationId":"model_347_export_endpoint_api_v1_taxes_model_347__year__export_get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","title":"Year"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","default":"xlsx","title":"Format"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/model-390/{year}":{"get":{"tags":["tax-model-390"],"summary":"Modelo 390 — resumen anual de IVA (JSON).","operationId":"model_390_endpoint_api_v1_taxes_model_390__year__get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","title":"Year"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Model 390 Endpoint Api V1 Taxes Model 390  Year  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/model-390/{year}/export":{"get":{"tags":["tax-model-390"],"summary":"Modelo 390 — export descargable (pipe-delimited, preview).","operationId":"model_390_export_endpoint_api_v1_taxes_model_390__year__export_get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","title":"Year"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","default":"xlsx","title":"Format"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/filings":{"get":{"tags":["tax-filings"],"summary":"List Tax Filings","operationId":"list_tax_filings_api_v1_taxes_filings_get","parameters":[{"name":"model","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"}},{"name":"year","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Year"}},{"name":"quarter","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Quarter"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TaxFilingResponse"},"title":"Response List Tax Filings Api V1 Taxes Filings Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["tax-filings"],"summary":"Create Tax Filing","operationId":"create_tax_filing_api_v1_taxes_filings_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_create_tax_filing_api_v1_taxes_filings_post"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxFilingResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/filings/{filing_id}/attachment":{"get":{"tags":["tax-filings"],"summary":"Download Tax Filing","operationId":"download_tax_filing_api_v1_taxes_filings__filing_id__attachment_get","parameters":[{"name":"filing_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Filing Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/taxes/filings/{filing_id}":{"patch":{"tags":["tax-filings"],"summary":"Update Tax Filing","operationId":"update_tax_filing_api_v1_taxes_filings__filing_id__patch","parameters":[{"name":"filing_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Filing Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxFilingUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxFilingResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["tax-filings"],"summary":"Delete Tax Filing","operationId":"delete_tax_filing_api_v1_taxes_filings__filing_id__delete","parameters":[{"name":"filing_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Filing Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/overview":{"get":{"tags":["overview"],"summary":"Overview","operationId":"overview_api_v1_overview_get","parameters":[{"name":"from","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"From"}},{"name":"to","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"To"}},{"name":"months","in":"query","required":false,"schema":{"type":"integer","maximum":24,"minimum":1,"default":6,"title":"Months"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OverviewResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/accounts":{"get":{"tags":["accounting"],"summary":"List Accounts Endpoint","operationId":"list_accounts_endpoint_api_v1_accounts_get","parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"group","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":7,"minimum":1},{"type":"null"}],"title":"Group"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse_AccountResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["accounting"],"summary":"Create Account Endpoint","operationId":"create_account_endpoint_api_v1_accounts_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/accounts/{account_id}":{"get":{"tags":["accounting"],"summary":"Get Account Endpoint","operationId":"get_account_endpoint_api_v1_accounts__account_id__get","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Account Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["accounting"],"summary":"Update Account Endpoint","operationId":"update_account_endpoint_api_v1_accounts__account_id__patch","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Account Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["accounting"],"summary":"Delete Account Endpoint","operationId":"delete_account_endpoint_api_v1_accounts__account_id__delete","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Account Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/journal":{"get":{"tags":["accounting"],"summary":"List Journal Endpoint","operationId":"list_journal_endpoint_api_v1_journal_get","parameters":[{"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":"kind","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kind"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse_JournalEntryResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["accounting"],"summary":"Create Journal Endpoint","operationId":"create_journal_endpoint_api_v1_journal_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JournalEntryCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JournalEntryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/journal/imbalances":{"get":{"tags":["accounting"],"summary":"Journal Imbalances Endpoint","description":"List journal entries whose debit ≠ credit — locates a descuadre.\n\nSurfaced by the libro-mayor / balance view so a \"hay descuadre\" warning is\nactionable: it points at the exact unbalanced entries instead of just a\ntotal.","operationId":"journal_imbalances_endpoint_api_v1_journal_imbalances_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":100,"title":"Limit"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Journal Imbalances Endpoint Api V1 Journal Imbalances Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/journal/{entry_id}":{"get":{"tags":["accounting"],"summary":"Get Journal Endpoint","operationId":"get_journal_endpoint_api_v1_journal__entry_id__get","parameters":[{"name":"entry_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Entry Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JournalEntryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["accounting"],"summary":"Update Journal Endpoint","operationId":"update_journal_endpoint_api_v1_journal__entry_id__patch","parameters":[{"name":"entry_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Entry Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JournalEntryUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JournalEntryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["accounting"],"summary":"Delete Journal Endpoint","operationId":"delete_journal_endpoint_api_v1_journal__entry_id__delete","parameters":[{"name":"entry_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Entry Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/journal/{entry_id}/lock":{"post":{"tags":["accounting"],"summary":"Lock Journal Endpoint","operationId":"lock_journal_endpoint_api_v1_journal__entry_id__lock_post","parameters":[{"name":"entry_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Entry Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JournalEntryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ledger":{"get":{"tags":["accounting"],"summary":"Get Ledger Endpoint","operationId":"get_ledger_endpoint_api_v1_ledger_get","parameters":[{"name":"account_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Account Id"}},{"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":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LedgerResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ledger/trial-balance":{"get":{"tags":["accounting"],"summary":"Trial Balance Endpoint","operationId":"trial_balance_endpoint_api_v1_ledger_trial_balance_get","parameters":[{"name":"at_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"At Date"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrialBalanceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/accounting/financial-statements":{"get":{"tags":["accounting"],"summary":"Financial Statements Endpoint","description":"Balance de Situación (acumulado a to_date) + Cuenta de Pérdidas y\nGanancias (periodo from_date..to_date), derivados del libro diario.","operationId":"financial_statements_endpoint_api_v1_accounting_financial_statements_get","parameters":[{"name":"from_date","in":"query","required":true,"schema":{"type":"string","format":"date","description":"P&L period start","title":"From Date"},"description":"P&L period start"},{"name":"to_date","in":"query","required":true,"schema":{"type":"string","format":"date","description":"P&L period end / balance cut-off date","title":"To Date"},"description":"P&L period end / balance cut-off date"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Financial Statements Endpoint Api V1 Accounting Financial Statements Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/accounting/backfill-journal":{"post":{"tags":["accounting"],"summary":"Backfill Journal Endpoint","description":"Post every Document + Payment that should be in the libro mayor but\nisn't, and classify Stripe-imported sales into the right 705xxxx account.\nReturns a stats dict (docs posted/skipped/failed, lines reclassified).","operationId":"backfill_journal_endpoint_api_v1_accounting_backfill_journal_post","parameters":[{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":50000,"minimum":1},{"type":"null"}],"description":"Cap the number of documents processed in one call. Omit for a full backfill of every postable document and payment.","title":"Limit"},"description":"Cap the number of documents processed in one call. Omit for a full backfill of every postable document and payment."},{"name":"reclassify_stripe","in":"query","required":false,"schema":{"type":"boolean","description":"Auto-map each Stripe treasury to its 705xxxx subaccount (by name) and bulk-update the DocumentLine.account_id for already-imported sales docs before posting.","default":true,"title":"Reclassify Stripe"},"description":"Auto-map each Stripe treasury to its 705xxxx subaccount (by name) and bulk-update the DocumentLine.account_id for already-imported sales docs before posting."},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Backfill Journal Endpoint Api V1 Accounting Backfill Journal Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/aeat/303":{"get":{"tags":["accounting"],"summary":"Aeat 303 Endpoint","operationId":"aeat_303_endpoint_api_v1_aeat_303_get","parameters":[{"name":"year","in":"query","required":true,"schema":{"type":"integer","maximum":2100,"minimum":2000,"title":"Year"}},{"name":"quarter","in":"query","required":true,"schema":{"type":"integer","maximum":4,"minimum":1,"title":"Quarter"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/aeat/303/summary":{"get":{"tags":["accounting"],"summary":"Aeat 303 Summary","description":"Resumen agregado de TODOS los trimestres con docs del tenant.\n\nDevuelve una fila por (año, trimestre) desde el primer doc hasta el\ntrimestre actual: ventas (base), IVA repercutido positivo, IVA\nrectificado negativo (creditnotes), IVA soportado (compras), y el\nimporte a ingresar (output_neto - input). Útil para vista histórica\nde cumplimiento fiscal.","operationId":"aeat_303_summary_api_v1_aeat_303_summary_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Aeat 303 Summary Api V1 Aeat 303 Summary Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/aeat/349":{"get":{"tags":["accounting"],"summary":"Aeat 349 Endpoint","operationId":"aeat_349_endpoint_api_v1_aeat_349_get","parameters":[{"name":"year","in":"query","required":true,"schema":{"type":"integer","maximum":2100,"minimum":2000,"title":"Year"}},{"name":"quarter","in":"query","required":true,"schema":{"type":"integer","maximum":4,"minimum":1,"title":"Quarter"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/aeat/349/summary":{"get":{"tags":["accounting"],"summary":"Aeat 349 Summary","operationId":"aeat_349_summary_api_v1_aeat_349_summary_get","parameters":[{"name":"year","in":"query","required":true,"schema":{"type":"integer","maximum":2100,"minimum":2000,"title":"Year"}},{"name":"quarter","in":"query","required":true,"schema":{"type":"integer","maximum":4,"minimum":1,"title":"Quarter"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Aeat 349 Summary Api V1 Aeat 349 Summary Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/aeat/369":{"get":{"tags":["accounting"],"summary":"Aeat 369 Endpoint","operationId":"aeat_369_endpoint_api_v1_aeat_369_get","parameters":[{"name":"year","in":"query","required":true,"schema":{"type":"integer","maximum":2100,"minimum":2000,"title":"Year"}},{"name":"quarter","in":"query","required":true,"schema":{"type":"integer","maximum":4,"minimum":1,"title":"Quarter"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/aeat/369/summary":{"get":{"tags":["accounting"],"summary":"Aeat 369 Summary","operationId":"aeat_369_summary_api_v1_aeat_369_summary_get","parameters":[{"name":"year","in":"query","required":true,"schema":{"type":"integer","maximum":2100,"minimum":2000,"title":"Year"}},{"name":"quarter","in":"query","required":true,"schema":{"type":"integer","maximum":4,"minimum":1,"title":"Quarter"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Aeat 369 Summary Api V1 Aeat 369 Summary Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/aeat/369/history":{"get":{"tags":["accounting"],"summary":"Aeat 369 History","description":"Histórico OSS (369): una fila por (trimestre, país de consumo) desde el\nprimer documento hasta el trimestre actual — mismo patrón que\n``/aeat/303/summary``. Solo incluye trimestres con ventas OSS (régimen\n``eu_b2c_oss``), para no llenar la tabla de trimestres vacíos.","operationId":"aeat_369_history_api_v1_aeat_369_history_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Aeat 369 History Api V1 Aeat 369 History Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/aeat/303/{year}/{quarter}/export":{"get":{"tags":["accounting"],"summary":"Aeat 303 Export","description":"Modelo 303 en Excel (.xlsx): hojas de IVA repercutido, IVA soportado y\nresumen del resultado a ingresar — el listado con formato que pidió Samu.","operationId":"aeat_303_export_api_v1_aeat_303__year___quarter__export_get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","title":"Year"}},{"name":"quarter","in":"path","required":true,"schema":{"type":"integer","title":"Quarter"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/aeat/369/{year}/{quarter}/export":{"get":{"tags":["accounting"],"summary":"Aeat 369 Export","description":"Modelo 369 (OSS) en Excel (.xlsx): resumen por país de consumo + detalle\npor factura.","operationId":"aeat_369_export_api_v1_aeat_369__year___quarter__export_get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","title":"Year"}},{"name":"quarter","in":"path","required":true,"schema":{"type":"integer","title":"Quarter"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/aeat/igic":{"get":{"tags":["accounting"],"summary":"Aeat Igic Csv","operationId":"aeat_igic_csv_api_v1_aeat_igic_get","parameters":[{"name":"year","in":"query","required":true,"schema":{"type":"integer","maximum":2100,"minimum":2000,"title":"Year"}},{"name":"quarter","in":"query","required":true,"schema":{"type":"integer","maximum":4,"minimum":1,"title":"Quarter"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/aeat/igic/summary":{"get":{"tags":["accounting"],"summary":"Aeat Igic Summary","operationId":"aeat_igic_summary_api_v1_aeat_igic_summary_get","parameters":[{"name":"year","in":"query","required":true,"schema":{"type":"integer","maximum":2100,"minimum":2000,"title":"Year"}},{"name":"quarter","in":"query","required":true,"schema":{"type":"integer","maximum":4,"minimum":1,"title":"Quarter"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Aeat Igic Summary Api V1 Aeat Igic Summary Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/aeat/igic/history":{"get":{"tags":["accounting"],"summary":"Aeat Igic History","operationId":"aeat_igic_history_api_v1_aeat_igic_history_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Aeat Igic History Api V1 Aeat Igic History Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/aeat/igic/{year}/{quarter}/export":{"get":{"tags":["accounting"],"summary":"Aeat Igic Export","operationId":"aeat_igic_export_api_v1_aeat_igic__year___quarter__export_get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","title":"Year"}},{"name":"quarter","in":"path","required":true,"schema":{"type":"integer","title":"Quarter"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/aeat/ipsi":{"get":{"tags":["accounting"],"summary":"Aeat Ipsi Csv","operationId":"aeat_ipsi_csv_api_v1_aeat_ipsi_get","parameters":[{"name":"year","in":"query","required":true,"schema":{"type":"integer","maximum":2100,"minimum":2000,"title":"Year"}},{"name":"quarter","in":"query","required":true,"schema":{"type":"integer","maximum":4,"minimum":1,"title":"Quarter"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/aeat/ipsi/summary":{"get":{"tags":["accounting"],"summary":"Aeat Ipsi Summary","operationId":"aeat_ipsi_summary_api_v1_aeat_ipsi_summary_get","parameters":[{"name":"year","in":"query","required":true,"schema":{"type":"integer","maximum":2100,"minimum":2000,"title":"Year"}},{"name":"quarter","in":"query","required":true,"schema":{"type":"integer","maximum":4,"minimum":1,"title":"Quarter"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Aeat Ipsi Summary Api V1 Aeat Ipsi Summary Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/aeat/ipsi/history":{"get":{"tags":["accounting"],"summary":"Aeat Ipsi History","operationId":"aeat_ipsi_history_api_v1_aeat_ipsi_history_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Aeat Ipsi History Api V1 Aeat Ipsi History Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/aeat/ipsi/{year}/{quarter}/export":{"get":{"tags":["accounting"],"summary":"Aeat Ipsi Export","operationId":"aeat_ipsi_export_api_v1_aeat_ipsi__year___quarter__export_get","parameters":[{"name":"year","in":"path","required":true,"schema":{"type":"integer","title":"Year"}},{"name":"quarter","in":"path","required":true,"schema":{"type":"integer","title":"Quarter"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/providers":{"get":{"tags":["integrations"],"summary":"List Providers","description":"Return the list of providers the user can connect from the UI.\n\nUnconfigured providers (missing platform credentials) are silently omitted,\nso end-users never see ``set XYZ in .env`` style messages. The platform\nowner configures providers globally; tenants see only what's offered.\n\nThe ``manual`` provider is always present — CSV import is built-in.","operationId":"list_providers_api_v1_integrations_providers_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response List Providers Api V1 Integrations Providers Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/stripe/connect":{"get":{"tags":["integrations"],"summary":"Stripe Connect Start","operationId":"stripe_connect_start_api_v1_integrations_stripe_connect_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Stripe Connect Start Api V1 Integrations Stripe Connect Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/stripe/status":{"get":{"tags":["integrations"],"summary":"Stripe Status","description":"List every Stripe gateway treasury connected for this tenant.\n\nMulti-account: a tenant may hold several Stripe accounts side by side\n(e.g. Upload-Post + Analiza Gráficas). Each shows its own balance, sync\nstatus and a ``connected`` flag (true when the treasury has its own key,\nfalse when it was created without one).","operationId":"stripe_status_api_v1_integrations_stripe_status_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Stripe Status Api V1 Integrations Stripe Status Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/stripe/connect-with-key":{"post":{"tags":["integrations"],"summary":"Stripe Connect With Key","description":"Connect (or rotate) a Stripe account via a user-pasted restricted key.\n\nMulti-account safe: each (tenant, stripe_account_id) pair has its own\nTreasury row that holds the key. Pasting a key for a NEW account creates a\nnew Treasury alongside any existing ones — nothing is overwritten. Pasting\na key for an already-connected account rotates that treasury's key in\nplace.","operationId":"stripe_connect_with_key_api_v1_integrations_stripe_connect_with_key_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StripeApiKeyConnect"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Stripe Connect With Key Api V1 Integrations Stripe Connect With Key Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/stripe/disconnect":{"post":{"tags":["integrations"],"summary":"Stripe Disconnect","description":"Clear the stored Stripe key. Treasuries themselves (and their movements)\nare kept — only the key is wiped so the sync stops.\n\nMulti-account: pass ``treasury_id`` to disconnect a single Stripe account.\nWithout it, every Stripe treasury for the tenant is disconnected (and the\nlegacy tenant-level key is cleared too).","operationId":"stripe_disconnect_api_v1_integrations_stripe_disconnect_post","parameters":[{"name":"treasury_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Treasury Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Stripe Disconnect Api V1 Integrations Stripe Disconnect Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/stripe/connect-as-treasury":{"post":{"tags":["integrations"],"summary":"Stripe Connect As Treasury","description":"Create (or return existing) a Treasury that mirrors the tenant's Stripe\nConnect account as a virtual bank. Triggers an inline sync of the last 30\ndays of balance transactions so the UI shows movements immediately.","operationId":"stripe_connect_as_treasury_api_v1_integrations_stripe_connect_as_treasury_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Stripe Connect As Treasury Api V1 Integrations Stripe Connect As Treasury Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/stripe/sync-balance/{treasury_id}":{"post":{"tags":["integrations"],"summary":"Stripe Sync Balance","description":"Kick off a full Stripe history sync in the background.\n\nReturns immediately with ``{sync_status: 'syncing'}``. Poll\n``GET /treasuries/{id}`` to read ``sync_status``, ``sync_progress`` and\n``last_sync_error`` until status flips back to ``idle`` or ``error``.","operationId":"stripe_sync_balance_api_v1_integrations_stripe_sync_balance__treasury_id__post","parameters":[{"name":"treasury_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Treasury Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Stripe Sync Balance Api V1 Integrations Stripe Sync Balance  Treasury Id  Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/stripe/sync-invoices":{"post":{"tags":["integrations"],"summary":"Stripe Sync Invoices","description":"Bulk-import paid Stripe invoices as sales Documents + Payments.\n\nBody (all optional):\n  treasury_id: UUID        - target a specific Stripe Connect treasury;\n                             required for multi-account (Connect) tenants\n                             since they don't have a tenant-level Stripe\n                             key. Without it we fall back to the legacy\n                             single-account mode.\n  from_date: \"YYYY-MM-DD\"  - lower bound on Stripe invoice.created\n  to_date:   \"YYYY-MM-DD\"  - upper bound on Stripe invoice.created\n  limit:     int           - page size sent to Stripe (default 100, max 100)\n  force:     bool          - re-import even if a Document already exists for the invoice","operationId":"stripe_sync_invoices_api_v1_integrations_stripe_sync_invoices_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}],"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Stripe Sync Invoices Api V1 Integrations Stripe Sync Invoices Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/stripe/sync-customer":{"post":{"tags":["integrations"],"summary":"Stripe Sync Customer","description":"Import one Stripe customer's *entire* paid-invoice history on demand.\n\nPowers the lazy backfill behind the customer-facing Invoices screen: when a\nuser (often just-subscribed) opens their invoices and we have nothing for\nthem yet, the caller hits this with their ``stripe_customer_id`` so the\nlegal invoices appear immediately instead of an empty page. Scoped to one\ncustomer, so it's cheap enough for a synchronous read path, and idempotent\n(dedupe by Stripe invoice id) so repeated calls never duplicate.\n\nBody:\n  treasury_id:        UUID  - the Stripe Connect treasury the customer lives\n                              on (required; multi-account tenants have no\n                              tenant-level key).\n  stripe_customer_id: str   - the ``cus_…`` to import.","operationId":"stripe_sync_customer_api_v1_integrations_stripe_sync_customer_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}],"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Stripe Sync Customer Api V1 Integrations Stripe Sync Customer Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/stripe/backfill-creditnotes":{"post":{"tags":["integrations"],"summary":"Stripe Backfill Creditnotes","description":"Crea facturas rectificativas (creditnote) para refunds/disputas Stripe\nya importados como BankMovement antes de que existiera la auto-generación.\n\nIdempotente — saltarse las que ya tienen su rectificativa. Por defecto\nprocesa todas las Stripe gateway treasuries del tenant. Acota con\n``from_date`` para no tocar trimestres ya presentados a Hacienda.\n\nBody (todo opcional):\n  treasury_id: UUID         - limitar a una sola treasury\n  from_date:   \"YYYY-MM-DD\" - skip movimientos anteriores\n  limit:       int          - tope por treasury (default 10000)","operationId":"stripe_backfill_creditnotes_api_v1_integrations_stripe_backfill_creditnotes_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}],"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Stripe Backfill Creditnotes Api V1 Integrations Stripe Backfill Creditnotes Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["integrations"],"summary":"Stripe Rollback Creditnotes","description":"Borra las facturas rectificativas auto-generadas por el backfill o el\nsync. Filtro de seguridad estricto: SOLO Documents con\n``external_source='stripe'`` Y ``external_id LIKE 'refund:%'`` —\nimposible que toque facturas reales o manuales.\n\nBody (opcional):\n  from_date: \"YYYY-MM-DD\"  - solo borrar creditnotes con doc_date >=\n  to_date:   \"YYYY-MM-DD\"  - solo borrar creditnotes con doc_date <=\n  tenant_id se infiere del token; nunca acepta override.\n\nCascada: DELETE Documents → SQLAlchemy borra DocumentLine y Payment\nasociados por la relación cascade='all, delete-orphan'.","operationId":"stripe_rollback_creditnotes_api_v1_integrations_stripe_backfill_creditnotes_delete","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}],"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Stripe Rollback Creditnotes Api V1 Integrations Stripe Backfill Creditnotes Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/stripe/reclassify-eu-invoices":{"post":{"tags":["integrations"],"summary":"Stripe Reclassify Eu Invoices","description":"Re-clasifica las facturas Stripe UE B2C que se importaron como OSS\npara que apliquen IVA 21% ES (régimen pre-OSS, Art. 70.Dos LIVA).\n\nEl TOTAL cobrado NO cambia (el cliente ya pagó esa cantidad). Solo se\nrecalcula el DESGLOSE interno con IVA incluido:\n  base = total / 1.21    iva = total - base\n\nSólo toca facturas con ``contact_snapshot.regime == 'eu_b2c_oss'`` y\n``external_source == 'stripe'``. Idempotente.\n\nBody opcional:\n  from_date / to_date  - acotar\n  dry_run: bool        - si true, solo lista lo que cambiaría","operationId":"stripe_reclassify_eu_invoices_api_v1_integrations_stripe_reclassify_eu_invoices_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}],"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Stripe Reclassify Eu Invoices Api V1 Integrations Stripe Reclassify Eu Invoices Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/stripe/cleanup-zero-paid-invoices":{"post":{"tags":["integrations"],"summary":"Stripe Cleanup Zero Paid Invoices","description":"Borra invoices Stripe importadas que no representan un cobro real.\n\nFiltro estricto:\n  - external_source = 'stripe'\n  - doc_type = 'invoice'\n  - NO tiene Payments asociados (subquery WHERE NOT EXISTS payments)\n  - status = 'paid'\n\nSon las prorations / ajustes de suscripción que Stripe netea contra\nbalance interno: status=paid pero amount_paid=0, así que\n``_import_one_invoice`` no creó Payment. El cobro real ya está en otra\ninvoice (la siguiente del mismo subscription cycle) — borrar estas no\npierde dinero, solo elimina ruido contable.\n\nBody (opcional):\n  from_date / to_date  - acotar para no tocar trimestres ya presentados\n  dry_run: bool        - si true (default false), solo lista lo que borraría","operationId":"stripe_cleanup_zero_paid_invoices_api_v1_integrations_stripe_cleanup_zero_paid_invoices_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}],"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Stripe Cleanup Zero Paid Invoices Api V1 Integrations Stripe Cleanup Zero Paid Invoices Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/stripe/sync-customers":{"post":{"tags":["integrations"],"summary":"Stripe Sync Customers","description":"Import the tenant's Stripe customer base as Contacts.\n\nWalks ``Customer.list`` (expanding ``tax_ids``) and upserts each row into\nthe ``contacts`` table. Existing contacts get refreshed in place — Stripe\nis treated as the source of truth for the synced fields.\n\nBody (all optional):\n  limit:       int  - page size sent to Stripe (default 100, max 100)\n  safety_cap:  int  - hard upper bound on rows iterated. With the default\n                      ``200`` the call returns synchronously with the\n                      counts of what got imported. Set to a larger value\n                      and pass ``background=true`` to scan the full base\n                      asynchronously (status is returned immediately).\n  background:  bool - run asynchronously and return ``{\"status\":\"started\"}``.\n                      The job updates the Stripe gateway treasury's\n                      ``sync_status`` / ``sync_progress`` columns.","operationId":"stripe_sync_customers_api_v1_integrations_stripe_sync_customers_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}],"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Stripe Sync Customers Api V1 Integrations Stripe Sync Customers Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/gocardless/status":{"get":{"tags":["integrations"],"summary":"Gocardless Status","operationId":"gocardless_status_api_v1_integrations_gocardless_status_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Gocardless Status Api V1 Integrations Gocardless Status Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/gocardless/banks":{"get":{"tags":["integrations"],"summary":"Gocardless Banks","operationId":"gocardless_banks_api_v1_integrations_gocardless_banks_get","parameters":[{"name":"country","in":"query","required":false,"schema":{"type":"string","minLength":2,"maxLength":2,"default":"ES","title":"Country"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Gocardless Banks Api V1 Integrations Gocardless Banks Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/gocardless/connect":{"post":{"tags":["integrations"],"summary":"Gocardless Connect","operationId":"gocardless_connect_api_v1_integrations_gocardless_connect_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Gocardless Connect Api V1 Integrations Gocardless Connect Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/gocardless/sync/{treasury_id}":{"post":{"tags":["integrations"],"summary":"Gocardless Sync","operationId":"gocardless_sync_api_v1_integrations_gocardless_sync__treasury_id__post","parameters":[{"name":"treasury_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Treasury Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Gocardless Sync Api V1 Integrations Gocardless Sync  Treasury Id  Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/paypal/status":{"get":{"tags":["integrations"],"summary":"Paypal Status","operationId":"paypal_status_api_v1_integrations_paypal_status_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Paypal Status Api V1 Integrations Paypal Status Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/paypal/connect-with-key":{"post":{"tags":["integrations"],"summary":"Paypal Connect With Key","description":"Connect a PayPal account via the tenant's own REST app credentials\n(client_id + secret). Validates the credentials, stores them encrypted,\ncreates the PayPal treasury and kicks off a full historical sync in the\nbackground. Mirrors the Stripe ``connect-with-key`` flow.","operationId":"paypal_connect_with_key_api_v1_integrations_paypal_connect_with_key_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayPalKeyConnect"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Paypal Connect With Key Api V1 Integrations Paypal Connect With Key Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/paypal/connect":{"get":{"tags":["integrations"],"summary":"Paypal Connect Start","operationId":"paypal_connect_start_api_v1_integrations_paypal_connect_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Paypal Connect Start Api V1 Integrations Paypal Connect Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/paypal/disconnect":{"post":{"tags":["integrations"],"summary":"Paypal Disconnect","operationId":"paypal_disconnect_api_v1_integrations_paypal_disconnect_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Paypal Disconnect Api V1 Integrations Paypal Disconnect Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/paypal/sync":{"post":{"tags":["integrations"],"summary":"Paypal Sync","operationId":"paypal_sync_api_v1_integrations_paypal_sync_post","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":1095,"minimum":1,"default":30,"title":"Days"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Paypal Sync Api V1 Integrations Paypal Sync Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/stripe/payouts/scan":{"post":{"tags":["integrations"],"summary":"Stripe Payouts Scan","operationId":"stripe_payouts_scan_api_v1_integrations_stripe_payouts_scan_post","parameters":[{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Since"}},{"name":"until","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Until"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Stripe Payouts Scan Api V1 Integrations Stripe Payouts Scan Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/stripe/payouts/execute":{"post":{"tags":["integrations"],"summary":"Stripe Payouts Execute","description":"If `payload` is provided, execute those exact candidates. Otherwise scan + execute.","operationId":"stripe_payouts_execute_api_v1_integrations_stripe_payouts_execute_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"array","items":{"type":"object","additionalProperties":true}},{"type":"null"}],"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Stripe Payouts Execute Api V1 Integrations Stripe Payouts Execute Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ai/extract-pdf":{"post":{"tags":["integrations"],"summary":"Ai Extract Pdf","description":"Pure extraction — no DB writes. Returns the structured invoice payload.\n\nRuns the extractor in a worker thread so the event loop stays free —\nthis endpoint is the legacy \"preview\" path; the real ingestion uses\n``/ai/ingest-purchase`` which is fully async via the job queue.","operationId":"ai_extract_pdf_api_v1_ai_extract_pdf_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_ai_extract_pdf_api_v1_ai_extract_pdf_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractPdfResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ai/ingest-purchase":{"post":{"tags":["integrations"],"summary":"Ai Ingest Purchase","description":"Queue a single PDF / image for AI ingestion.\n\nReturns IMMEDIATELY with the queued job — the actual extraction +\ndocument creation happens in a background worker. Poll\n``GET /ai/ingest-jobs/{id}`` or list ``GET /ai/ingest-jobs`` to track\nprogress; the row carries the same result payload the legacy\nsynchronous endpoint used to return inline (see ``IngestionJob.result``)\nso the UI renders the same UploadResultCard once it lands.","operationId":"ai_ingest_purchase_api_v1_ai_ingest_purchase_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_ai_ingest_purchase_api_v1_ai_ingest_purchase_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestJob"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ai/ingest-purchase-batch":{"post":{"tags":["integrations"],"summary":"Ai Ingest Purchase Batch","description":"Queue several files at once. Each ``files[]`` entry becomes one\njob; if the entry is a ZIP, it's expanded and every PDF/image inside\nbecomes its own job. All jobs in the same call share a ``batch_id``\nso the frontend can group their cards.\n\nReturns the full list of created jobs (already queued, possibly mid-\nprocessing by the time the response reaches the client).","operationId":"ai_ingest_purchase_batch_api_v1_ai_ingest_purchase_batch_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_ai_ingest_purchase_batch_api_v1_ai_ingest_purchase_batch_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestJobsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/stripe/backfill-fee/{treasury_id}":{"post":{"tags":["integrations"],"summary":"Backfill Stripe Fee Purchase","description":"Backfill one month's \"Comisiones Stripe\" purchase from its official Stripe\nTax Invoice PDF — same shape as the auto monthly path (per-SaaS commission\naccount, reverse charge → 303/349, settled), with the official total and the\nPDF attached. Adopts an existing month instead of duplicating.","operationId":"backfill_stripe_fee_purchase_api_v1_integrations_stripe_backfill_fee__treasury_id__post","parameters":[{"name":"treasury_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Treasury Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_backfill_stripe_fee_purchase_api_v1_integrations_stripe_backfill_fee__treasury_id__post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Backfill Stripe Fee Purchase Api V1 Integrations Stripe Backfill Fee  Treasury Id  Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ai/ingest-jobs":{"get":{"tags":["integrations"],"summary":"Ai List Ingest Jobs","description":"List ingestion jobs for the current tenant, newest first.\n\n``active_only=true`` filters to ``queued`` + ``processing`` — handy for\nthe page-load fetch where we only want to rebuild in-flight cards.\nWithout the flag we return the recent history so the user can see what\nwas processed in this session (the frontend dismisses them when the\nuser clicks \"ocultar\").","operationId":"ai_list_ingest_jobs_api_v1_ai_ingest_jobs_get","parameters":[{"name":"active_only","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Active Only"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestJobsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ai/ingest-jobs/{job_id}":{"get":{"tags":["integrations"],"summary":"Ai Get Ingest Job","description":"Poll a single job. The frontend hits this every ~2s while a card is\nin ``queued`` / ``processing`` state and stops when it transitions to\n``done`` / ``error``.","operationId":"ai_get_ingest_job_api_v1_ai_ingest_jobs__job_id__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Job Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestJob"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["integrations"],"summary":"Ai Delete Ingest Job","description":"Dismiss a finished job (``done`` or ``error``). The card disappears\nfrom subsequent ``/ai/ingest-jobs`` listings.\n\nRefuses to delete a row still in flight — the worker may be holding the\nfile open. If you really need to cancel, that's a separate feature.","operationId":"ai_delete_ingest_job_api_v1_ai_ingest_jobs__job_id__delete","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Job Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Ai Delete Ingest Job Api V1 Ai Ingest Jobs  Job Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ai/purchases/{doc_id}/bank-match":{"get":{"tags":["integrations"],"summary":"Ai Purchase Bank Match","description":"Suggest the bank movement most likely to be the payment for this\npurchase. By default INCLUDES already-reconciled movements (capped at\n0.6 confidence) so the user can spot wrong existing links — pass\n``include_reconciled=false`` to limit to pending.","operationId":"ai_purchase_bank_match_api_v1_ai_purchases__doc_id__bank_match_get","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"include_reconciled","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Include Reconciled"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/BankMatchHint"},{"type":"null"}],"title":"Response Ai Purchase Bank Match Api V1 Ai Purchases  Doc Id  Bank Match Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ai/invoices/{doc_id}/bank-match":{"get":{"tags":["integrations"],"summary":"Ai Invoice Bank Match","description":"Suggest the bank movement most likely to be the customer payment for\nthis sales invoice. Mirrors the purchase variant; the only difference is\nthe sign of the candidate movement (positive credit instead of debit).","operationId":"ai_invoice_bank_match_api_v1_ai_invoices__doc_id__bank_match_get","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"include_reconciled","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Include Reconciled"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/BankMatchHint"},{"type":"null"}],"title":"Response Ai Invoice Bank Match Api V1 Ai Invoices  Doc Id  Bank Match Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ai/bank-movements/{movement_id}/document-match":{"get":{"tags":["integrations"],"summary":"Ai Movement Document Match","description":"Inverse of the two above: given a pending bank movement, suggest\nthe Document (purchase or invoice depending on sign) that most likely\nexplains it. Used by the reconciliation page's \"Sugerencia IA\" button.","operationId":"ai_movement_document_match_api_v1_ai_bank_movements__movement_id__document_match_get","parameters":[{"name":"movement_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Movement Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/DocumentMatchHint"},{"type":"null"}],"title":"Response Ai Movement Document Match Api V1 Ai Bank Movements  Movement Id  Document Match Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/ponto/status":{"get":{"tags":["integrations"],"summary":"Ponto Status","operationId":"ponto_status_api_v1_integrations_ponto_status_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Ponto Status Api V1 Integrations Ponto Status Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/ponto/connect":{"post":{"tags":["integrations"],"summary":"Ponto Connect","description":"Pull the tenant's Ponto accounts and create local Treasuries.\n\nBody (optional): ``{\"client_id\": \"...\", \"client_secret\": \"...\"}``. When\nprovided, the credentials are persisted on the tenant (encrypted at rest)\nbefore the import runs. If omitted, we use whatever the tenant has stored\n— or, for the bootstrap admin tenant, the env-level fallback.","operationId":"ponto_connect_api_v1_integrations_ponto_connect_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}],"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Ponto Connect Api V1 Integrations Ponto Connect Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/ponto/sync/{treasury_id}":{"post":{"tags":["integrations"],"summary":"Ponto Sync","operationId":"ponto_sync_api_v1_integrations_ponto_sync__treasury_id__post","parameters":[{"name":"treasury_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Treasury Id"}},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Since"}},{"name":"until","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Until"}},{"name":"include_pending","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Pending"}},{"name":"force_refresh","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Force Refresh"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Ponto Sync Api V1 Integrations Ponto Sync  Treasury Id  Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/ponto/reauthorize/{treasury_id}":{"post":{"tags":["integrations"],"summary":"Ponto Reauthorize","description":"Generate a fresh SCA URL for the user to reauthorize the bank.\nAfter completion, Ponto re-pulls the historical backfill.","operationId":"ponto_reauthorize_api_v1_integrations_ponto_reauthorize__treasury_id__post","parameters":[{"name":"treasury_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Treasury Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Ponto Reauthorize Api V1 Integrations Ponto Reauthorize  Treasury Id  Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/ponto/refresh/{treasury_id}":{"post":{"tags":["integrations"],"summary":"Ponto Refresh","description":"Force Ponto to query the bank NOW (separate from importing the data here).","operationId":"ponto_refresh_api_v1_integrations_ponto_refresh__treasury_id__post","parameters":[{"name":"treasury_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Treasury Id"}},{"name":"subtype","in":"query","required":false,"schema":{"type":"string","pattern":"^(accountDetails|accountTransactions|accountPendingTransactions)$","default":"accountTransactions","title":"Subtype"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Ponto Refresh Api V1 Integrations Ponto Refresh  Treasury Id  Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/ponto_connect/status":{"get":{"tags":["integrations"],"summary":"Ponto Connect Status","operationId":"ponto_connect_status_api_v1_integrations_ponto_connect_status_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Ponto Connect Status Api V1 Integrations Ponto Connect Status Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/ponto_connect/connect":{"get":{"tags":["integrations"],"summary":"Ponto Connect Start","operationId":"ponto_connect_start_api_v1_integrations_ponto_connect_connect_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Ponto Connect Start Api V1 Integrations Ponto Connect Connect Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/ponto_connect/sync/{treasury_id}":{"post":{"tags":["integrations"],"summary":"Ponto Connect Sync","operationId":"ponto_connect_sync_api_v1_integrations_ponto_connect_sync__treasury_id__post","parameters":[{"name":"treasury_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Treasury Id"}},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Since"}},{"name":"until","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Until"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Ponto Connect Sync Api V1 Integrations Ponto Connect Sync  Treasury Id  Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/ponto_connect/disconnect":{"post":{"tags":["integrations"],"summary":"Ponto Connect Disconnect","operationId":"ponto_connect_disconnect_api_v1_integrations_ponto_connect_disconnect_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Ponto Connect Disconnect Api V1 Integrations Ponto Connect Disconnect Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/ponto_connect/disconnect/{treasury_id}":{"post":{"tags":["integrations"],"summary":"Ponto Connect Disconnect Treasury","description":"Disconnect ONE Ponto Connect account: revoke it at Ponto (stops the\n~4 €/month) and keep its imported movements. If we can't revoke (e.g. the\nconsent expired), return 409 with the Ponto dashboard URL so the user can\nfinish there.","operationId":"ponto_connect_disconnect_treasury_api_v1_integrations_ponto_connect_disconnect__treasury_id__post","parameters":[{"name":"treasury_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Treasury Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Ponto Connect Disconnect Treasury Api V1 Integrations Ponto Connect Disconnect  Treasury Id  Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/truelayer/status":{"get":{"tags":["integrations"],"summary":"Truelayer Status","operationId":"truelayer_status_api_v1_integrations_truelayer_status_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Truelayer Status Api V1 Integrations Truelayer Status Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/truelayer/connect":{"get":{"tags":["integrations"],"summary":"Truelayer Connect","operationId":"truelayer_connect_api_v1_integrations_truelayer_connect_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Truelayer Connect Api V1 Integrations Truelayer Connect Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/truelayer/sync/{treasury_id}":{"post":{"tags":["integrations"],"summary":"Truelayer Sync","operationId":"truelayer_sync_api_v1_integrations_truelayer_sync__treasury_id__post","parameters":[{"name":"treasury_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Treasury Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Truelayer Sync Api V1 Integrations Truelayer Sync  Treasury Id  Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/saltedge/status":{"get":{"tags":["integrations"],"summary":"Saltedge Status","operationId":"saltedge_status_api_v1_integrations_saltedge_status_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Saltedge Status Api V1 Integrations Saltedge Status Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/saltedge/providers":{"get":{"tags":["integrations"],"summary":"Saltedge Providers","operationId":"saltedge_providers_api_v1_integrations_saltedge_providers_get","parameters":[{"name":"country_code","in":"query","required":false,"schema":{"type":"string","minLength":2,"maxLength":2,"default":"ES","title":"Country Code"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Saltedge Providers Api V1 Integrations Saltedge Providers Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/saltedge/connect":{"get":{"tags":["integrations"],"summary":"Saltedge Connect","description":"Create a Salt Edge Connect Session and return the hosted widget URL.\nIf `provider_code` is given, the widget skips the bank picker.","operationId":"saltedge_connect_api_v1_integrations_saltedge_connect_get","parameters":[{"name":"provider_code","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider Code"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Saltedge Connect Api V1 Integrations Saltedge Connect Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/saltedge/sync/{treasury_id}":{"post":{"tags":["integrations"],"summary":"Saltedge Sync","operationId":"saltedge_sync_api_v1_integrations_saltedge_sync__treasury_id__post","parameters":[{"name":"treasury_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Treasury Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Saltedge Sync Api V1 Integrations Saltedge Sync  Treasury Id  Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/saltedge/refresh/{treasury_id}":{"post":{"tags":["integrations"],"summary":"Saltedge Refresh","description":"Ask Salt Edge to re-fetch from the bank for this treasury's connection.","operationId":"saltedge_refresh_api_v1_integrations_saltedge_refresh__treasury_id__post","parameters":[{"name":"treasury_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Treasury Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Saltedge Refresh Api V1 Integrations Saltedge Refresh  Treasury Id  Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/billing/status":{"get":{"tags":["billing"],"summary":"Billing Status","operationId":"billing_status_api_v1_billing_status_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingStatus"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/billing/limits":{"get":{"tags":["billing"],"summary":"Billing Limits","operationId":"billing_limits_api_v1_billing_limits_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingLimits"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/billing/checkout":{"post":{"tags":["billing"],"summary":"Start Checkout","operationId":"start_checkout_api_v1_billing_checkout_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UrlResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/billing/portal":{"post":{"tags":["billing"],"summary":"Open Portal","operationId":"open_portal_api_v1_billing_portal_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UrlResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/billing/webhook":{"post":{"tags":["billing"],"summary":"Billing Webhook","description":"Stripe billing events. Verified by signature; no auth dependency.","operationId":"billing_webhook_api_v1_billing_webhook_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Billing Webhook Api V1 Billing Webhook Post"}}}}}}},"/api/v1/ai/status":{"get":{"tags":["ai"],"summary":"Status","description":"Whether the agent is reachable. Never leaks env var names.","operationId":"status_api_v1_ai_status_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Status Api V1 Ai Status Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ai/models":{"get":{"tags":["ai"],"summary":"Models","description":"List models available on the configured AI gateway, live.\n\nPass ``?refresh=true`` to bypass the 60-second cache. When the gateway is\nunreachable (e.g. wrong API key, no balance) we return an empty list plus\nthe upstream ``error`` message so the UI can show why.\n\nThe response also carries ``provider`` (id/label/base_url) for the active\nprovider so the UI can render \"Balrog · Qwen (self-hosted)\" or \"Vertex AI ·\nGemini\" instead of a bare model list.","operationId":"models_api_v1_ai_models_get","parameters":[{"name":"refresh","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Refresh"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Models Api V1 Ai Models Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ai/chat":{"post":{"tags":["ai"],"summary":"Chat","operationId":"chat_api_v1_ai_chat_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ai/usage":{"get":{"tags":["ai"],"summary":"Ai Usage Summary","description":"AI spend for the tenant. Defaults to the current calendar month. Owner/\nadmin only — it's account-level cost information.","operationId":"ai_usage_summary_api_v1_ai_usage_get","parameters":[{"name":"from","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"From"}},{"name":"to","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"To"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiUsageSummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/audit/timeline":{"get":{"tags":["audit"],"summary":"Get Entity Timeline","description":"All changes that ever touched a single entity, newest first.\n\nPair entity_type with the SQLAlchemy table name (``documents``,\n``contacts``, ``bank_movements``, etc.), not the model class name.","operationId":"get_entity_timeline_api_v1_audit_timeline_get","parameters":[{"name":"entity_type","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":64,"title":"Entity Type"}},{"name":"entity_id","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":64,"title":"Entity Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditTimelinePage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/audit/activity":{"get":{"tags":["audit"],"summary":"Get Tenant Activity","description":"Global activity feed for the tenant.\n\nThe default view is \"everything, newest first\" — drop filters in via\nquery params to narrow down. Useful for the resident agent: it can ask\n\"what did I change today?\" with\n``GET /audit/activity?actor_type=api_key&from=2026-05-27T00:00:00Z``.","operationId":"get_tenant_activity_api_v1_audit_activity_get","parameters":[{"name":"entity_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Entity Type"}},{"name":"actor_type","in":"query","required":false,"schema":{"anyOf":[{"enum":["user","api_key","agent","system","integration"],"type":"string"},{"type":"null"}],"title":"Actor Type"}},{"name":"hide_system","in":"query","required":false,"schema":{"type":"boolean","description":"exclude actor_type='system' rows (cron syncs, OAuth refreshes)","default":false,"title":"Hide System"},"description":"exclude actor_type='system' rows (cron syncs, OAuth refreshes)"},{"name":"operation","in":"query","required":false,"schema":{"anyOf":[{"enum":["insert","update","delete","restore"],"type":"string"},{"type":"null"}],"title":"Operation"}},{"name":"actor_user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Actor User Id"}},{"name":"actor_api_key_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Actor Api Key Id"}},{"name":"from","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"From"}},{"name":"to","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"To"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"description":"substring match against entity_label","title":"Search"},"description":"substring match against entity_label"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditTimelinePage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/audit/batches":{"get":{"tags":["audit"],"summary":"List Batches","description":"List request batches (groups of audit entries sharing a request_id),\nnewest first, each annotated with how many entries it contains.\n\nThis is the \"undo last action\" affordance: every batch is one HTTP\nrequest, so reverting a batch undoes one user/agent action atomically.","operationId":"list_batches_api_v1_audit_batches_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"actor_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":16},{"type":"null"}],"title":"Actor Type"}},{"name":"from","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"From"}},{"name":"to","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"To"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditBatchListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/audit/batches/{request_id}":{"get":{"tags":["audit"],"summary":"Get Batch","description":"Every audit entry belonging to one request, in chronological order.","operationId":"get_batch_api_v1_audit_batches__request_id__get","parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","title":"Request Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditTimelinePage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/audit/{entry_id}":{"get":{"tags":["audit"],"summary":"Get Entry","description":"Full snapshot + diff for a single entry.","operationId":"get_entry_api_v1_audit__entry_id__get","parameters":[{"name":"entry_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Entry Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditEntryDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/audit/{entry_id}/restore":{"post":{"tags":["audit"],"summary":"Restore One","description":"Apply one historical audit entry back onto the live data.\n\nThe restore itself becomes a new audit entry (operation=``restore``) so the\ntimeline records \"this was put back\" — which means restores are themselves\nreversible.","operationId":"restore_one_api_v1_audit__entry_id__restore_post","parameters":[{"name":"entry_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Entry Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RestoreResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/audit/batches/{request_id}/revert":{"post":{"tags":["audit"],"summary":"Revert Batch Endpoint","description":"Revert every change made by one request, atomically.\n\nThis is the \"undo what the agent just did\" button. The request_id comes\nfrom any audit entry (``GET /audit/activity`` returns it). Reverts walk\nthe entries in reverse chronological order so dependent changes unwind\ncleanly.\n\nThe revert itself runs under a fresh request_id so the user can see (and\nif needed, un-revert) the recovery action in the activity feed.","operationId":"revert_batch_endpoint_api_v1_audit_batches__request_id__revert_post","parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","title":"Request Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchRestoreResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/verifactu/settings":{"get":{"tags":["verifactu"],"summary":"Get Settings","operationId":"get_settings_api_v1_verifactu_settings_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifactuSettings"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["verifactu"],"summary":"Update Settings","operationId":"update_settings_api_v1_verifactu_settings_patch","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifactuSettingsUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifactuSettings"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/verifactu/certificate":{"post":{"tags":["verifactu"],"summary":"Upload Certificate","operationId":"upload_certificate_api_v1_verifactu_certificate_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_certificate_api_v1_verifactu_certificate_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CertUploadResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["verifactu"],"summary":"Delete Certificate","operationId":"delete_certificate_api_v1_verifactu_certificate_delete","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/verifactu/records":{"get":{"tags":["verifactu"],"summary":"List Records","operationId":"list_records_api_v1_verifactu_records_get","parameters":[{"name":"document_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Document Id"}},{"name":"estado","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Estado"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":100,"title":"Limit"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/VerifactuRecordOut"},"title":"Response List Records Api V1 Verifactu Records Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/verifactu/records/{record_id}":{"get":{"tags":["verifactu"],"summary":"Get Record","operationId":"get_record_api_v1_verifactu_records__record_id__get","parameters":[{"name":"record_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Record Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifactuRecordOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/verifactu/records/{record_id}/retry":{"post":{"tags":["verifactu"],"summary":"Retry Record","operationId":"retry_record_api_v1_verifactu_records__record_id__retry_post","parameters":[{"name":"record_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Record Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifactuRecordOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/verifactu/documents/{doc_id}/record":{"get":{"tags":["verifactu"],"summary":"Record For Document","operationId":"record_for_document_api_v1_verifactu_documents__doc_id__record_get","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/VerifactuRecordOut"},{"type":"null"}],"title":"Response Record For Document Api V1 Verifactu Documents  Doc Id  Record Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/verifactu/documents/{doc_id}/preview":{"get":{"tags":["verifactu"],"summary":"Preview Document","operationId":"preview_document_api_v1_verifactu_documents__doc_id__preview_get","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifactuPreview"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/invoices/{doc_id}/share":{"post":{"tags":["invoices"],"summary":"Create Or Get Share","description":"Mint a public link for this invoice, or return the existing one.\n\nIdempotent: if the invoice already has a token, we return it unchanged\nso the user can copy the same URL again without breaking the link the\ncustomer already received.","operationId":"create_or_get_share_api_v1_invoices__doc_id__share_post","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceShareResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["invoices"],"summary":"Revoke Share","description":"Revoke the public link entirely. After this, the URL 404s.","operationId":"revoke_share_api_v1_invoices__doc_id__share_delete","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/invoices/{doc_id}/share/rotate":{"post":{"tags":["invoices"],"summary":"Rotate Share","description":"Force a new token, revoking any link previously shared.\n\nUse when the customer's link has leaked (forwarded to the wrong person,\nposted publicly, etc.). The old token immediately stops working.","operationId":"rotate_share_api_v1_invoices__doc_id__share_rotate_post","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceShareResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/contacts/{code}/invoices":{"get":{"tags":["invoices"],"summary":"List Contact Invoices","description":"Return the issued invoices for a given contact, each with a signed\npublic URL ready to embed in the host app's customer-facing UI.\n\n``code`` accepts either the AgentLedger Contact UUID or the Stripe\ncustomer id (``cus_...``) — the latter is the recommended key for\nintegrations because it's already in the host's user record and is\nstable across email changes.\n\nLazily mints ``public_token`` on any invoice that doesn't have one\nyet, so the caller never gets back an entry without a working\n``public_url``. The mint is idempotent across calls.","operationId":"list_contact_invoices_api_v1_contacts__code__invoices_get","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string","title":"Code"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactInvoicesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/contacts/{contact_id}/email-invoices":{"post":{"tags":["invoices"],"summary":"Email Invoices To Contact","description":"Mint share-links for ``invoice_ids`` and email them in a single message.\n\nUsed by the \"Enviar facturas por email\" button on the customer view.\nThe destination defaults to the contact's stored email; the UI can\noverride it (e.g. the customer's billing email differs from the\nprimary contact email).\n\nThe endpoint also auto-mints tokens for invoices that don't have one\nyet, so the user doesn't have to click \"compartir\" on each one before\nsending.","operationId":"email_invoices_to_contact_api_v1_contacts__contact_id__email_invoices_post","parameters":[{"name":"contact_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Contact Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-Tenant-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailInvoicesRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailInvoicesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/p/invoices/{token}":{"get":{"tags":["public-invoices"],"summary":"View Public Invoice","description":"Public read-only metadata for the viewer page.\n\nReturns just enough to render a clean \"Factura nº X — DD/MM/YYYY —\nTotal €N\" header above the embedded PDF. We deliberately don't expose\nline-by-line breakdowns here (the PDF has them) so the JSON surface\nstays minimal and we don't leak more than the PDF already shows.","operationId":"view_public_invoice_p_invoices__token__get","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicInvoiceView"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/p/invoices/{token}/pdf":{"get":{"tags":["public-invoices"],"summary":"Download Public Invoice Pdf","description":"Render the invoice as PDF and return it inline.\n\nIncrements ``public_view_count`` + ``public_last_viewed_at`` so the\nowner can see in the UI that the customer actually opened the link.","operationId":"download_public_invoice_pdf_p_invoices__token__pdf_get","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"}}}}}}},"/p/purchases/{token}/pdf":{"get":{"tags":["public-invoices"],"summary":"Download Public Purchase Pdf","description":"Serve a purchase's ORIGINAL attachment (the supplier's uploaded PDF) by\nits unguessable public token — no auth, the token IS the authorization.\n\nUsed by the bank-transaction export: each row links here so the gestor can\nopen every reconciled purchase's invoice without an AgentLedger account.\nPurchases never render a PDF (the supplier's file is the canonical artifact),\nso we stream the attachment instead of calling the invoice renderer.","operationId":"download_public_purchase_pdf_p_purchases__token__pdf_get","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"}}}}}}},"/api/v1/public/invoice-generator/pdf":{"post":{"tags":["public-tools"],"summary":"Generate Pdf","description":"Render a one-off invoice to PDF — same engine as the in-app invoices.","operationId":"generate_pdf_api_v1_public_invoice_generator_pdf_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicInvoiceRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/public/invoice-generator/html":{"post":{"tags":["public-tools"],"summary":"Generate Html","description":"Render the invoice to HTML — used for the live preview (PDFs don't embed\nreliably in an <iframe>; HTML always does, and it's faster).","operationId":"generate_html_api_v1_public_invoice_generator_html_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicInvoiceRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/public/invoice-generator/parse":{"post":{"tags":["public-tools"],"summary":"Parse Natural Language","description":"Turn a free-text invoice description into structured fields via AI.","operationId":"parse_natural_language_api_v1_public_invoice_generator_parse_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicInvoiceParseRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Parse Natural Language Api V1 Public Invoice Generator Parse Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/public/invoice-generator/example":{"post":{"tags":["public-tools"],"summary":"Generate Example","description":"Derive an anonymized worked-example from a generated invoice and publish it.\n\nThe user's real invoice is never stored: we deterministically scrub all PII\nand persist only the synthetic example + AI-written explainer. The dedup gate\n(one row per scenario × sector) keeps anonymous traffic from spawning thin\nnear-duplicates — a repeat (scenario, sector) returns the existing page.","operationId":"generate_example_api_v1_public_invoice_generator_example_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicInvoiceRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Generate Example Api V1 Public Invoice Generator Example Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/ejemplos-de-factura":{"get":{"tags":["public-examples"],"summary":"Examples Index","operationId":"examples_index_ejemplos_de_factura_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/sitemap-ejemplos.xml":{"get":{"tags":["public-examples"],"summary":"Examples Sitemap","operationId":"examples_sitemap_sitemap_ejemplos_xml_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/ejemplos-de-factura/{scenario}/{sector}/factura.pdf":{"get":{"tags":["public-examples"],"summary":"Example Invoice Pdf","operationId":"example_invoice_pdf_ejemplos_de_factura__scenario___sector__factura_pdf_get","parameters":[{"name":"scenario","in":"path","required":true,"schema":{"type":"string","title":"Scenario"}},{"name":"sector","in":"path","required":true,"schema":{"type":"string","title":"Sector"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/ejemplos-de-factura/{scenario}/{sector}/factura.html":{"get":{"tags":["public-examples"],"summary":"Example Invoice Html","description":"Invoice as HTML for reliable in-page <iframe> embedding (PDFs don't).","operationId":"example_invoice_html_ejemplos_de_factura__scenario___sector__factura_html_get","parameters":[{"name":"scenario","in":"path","required":true,"schema":{"type":"string","title":"Scenario"}},{"name":"sector","in":"path","required":true,"schema":{"type":"string","title":"Sector"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/ejemplos-de-factura/{scenario}/{sector}":{"get":{"tags":["public-examples"],"summary":"Example Detail","operationId":"example_detail_ejemplos_de_factura__scenario___sector__get","parameters":[{"name":"scenario","in":"path","required":true,"schema":{"type":"string","title":"Scenario"}},{"name":"sector","in":"path","required":true,"schema":{"type":"string","title":"Sector"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"AcceptCandidateInput":{"properties":{"counterparty_pattern":{"type":"string","maxLength":255,"minLength":1,"title":"Counterparty Pattern"},"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"amount":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Amount"},"currency":{"type":"string","maxLength":3,"minLength":3,"title":"Currency","default":"EUR"},"cadence":{"type":"string","enum":["weekly","monthly","quarterly","yearly"],"title":"Cadence","default":"monthly"},"category_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Category Id"},"treasury_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Treasury Id"},"vendor":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Vendor"},"started_on":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Started On"},"next_charge_at":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Next Charge At"}},"type":"object","required":["counterparty_pattern","name","amount"],"title":"AcceptCandidateInput"},"AcceptCandidatesRequest":{"properties":{"candidates":{"items":{"$ref":"#/components/schemas/AcceptCandidateInput"},"type":"array","title":"Candidates"}},"type":"object","title":"AcceptCandidatesRequest"},"AcceptCandidatesResponse":{"properties":{"created":{"type":"integer","title":"Created"},"linked_movements":{"type":"integer","title":"Linked Movements"},"subscription_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Subscription Ids","default":[]}},"type":"object","required":["created","linked_movements"],"title":"AcceptCandidatesResponse"},"AcceptInvitationRequest":{"properties":{"password":{"anyOf":[{"type":"string","maxLength":200,"minLength":8},{"type":"null"}],"title":"Password"},"full_name":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Full Name"}},"type":"object","title":"AcceptInvitationRequest"},"AcceptInvitationResponse":{"properties":{"access_token":{"type":"string","title":"Access Token"},"token_type":{"type":"string","title":"Token Type","default":"bearer"},"tenant":{"additionalProperties":true,"type":"object","title":"Tenant"},"user":{"additionalProperties":true,"type":"object","title":"User"}},"type":"object","required":["access_token","tenant","user"],"title":"AcceptInvitationResponse"},"AcceptSuggestionInput":{"properties":{"movement_id":{"type":"string","format":"uuid","title":"Movement Id"},"category_id":{"type":"string","format":"uuid","title":"Category Id"}},"type":"object","required":["movement_id","category_id"],"title":"AcceptSuggestionInput"},"AcceptSuggestionsRequest":{"properties":{"suggestions":{"items":{"$ref":"#/components/schemas/AcceptSuggestionInput"},"type":"array","title":"Suggestions"}},"type":"object","title":"AcceptSuggestionsRequest"},"AcceptSuggestionsResponse":{"properties":{"applied":{"type":"integer","title":"Applied"},"skipped":{"type":"integer","title":"Skipped"}},"type":"object","required":["applied","skipped"],"title":"AcceptSuggestionsResponse"},"AccountCreate":{"properties":{"number":{"type":"string","maxLength":20,"minLength":1,"title":"Number"},"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"},"group":{"type":"integer","maximum":9.0,"minimum":0.0,"title":"Group"},"parent_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Parent Id"},"is_active":{"type":"boolean","title":"Is Active","default":true}},"type":"object","required":["number","name","group"],"title":"AccountCreate"},"AccountDeleteRequest":{"properties":{"password":{"type":"string","maxLength":200,"minLength":1,"title":"Password"},"confirm":{"type":"boolean","title":"Confirm","description":"Must be true to proceed with erasure."}},"type":"object","required":["password","confirm"],"title":"AccountDeleteRequest","description":"Body for ``POST /api/v1/account/delete`` (GDPR art. 17 erasure).\n\nThe password is re-verified server-side; ``confirm`` must be true so a\nmisfired request can't wipe an account."},"AccountDeleteResponse":{"properties":{"status":{"type":"string","title":"Status","default":"deleted"},"tenants_deleted":{"items":{"type":"string"},"type":"array","title":"Tenants Deleted"},"memberships_removed":{"items":{"type":"string"},"type":"array","title":"Memberships Removed"}},"type":"object","title":"AccountDeleteResponse"},"AccountResponse":{"properties":{"number":{"type":"string","maxLength":20,"minLength":1,"title":"Number"},"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"},"group":{"type":"integer","maximum":9.0,"minimum":0.0,"title":"Group"},"parent_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Parent Id"},"is_active":{"type":"boolean","title":"Is Active","default":true},"id":{"type":"string","format":"uuid","title":"Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["number","name","group","id","created_at","updated_at"],"title":"AccountResponse"},"AccountUpdate":{"properties":{"number":{"anyOf":[{"type":"string","maxLength":20,"minLength":1},{"type":"null"}],"title":"Number"},"name":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"null"}],"title":"Name"},"group":{"anyOf":[{"type":"integer","maximum":9.0,"minimum":0.0},{"type":"null"}],"title":"Group"},"parent_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Parent Id"},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"}},"type":"object","title":"AccountUpdate"},"AiBoardRequest":{"properties":{"prompt":{"type":"string","maxLength":500,"minLength":2,"title":"Prompt"},"name":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Name"}},"type":"object","required":["prompt"],"title":"AiBoardRequest"},"AiBoardResponse":{"properties":{"board":{"$ref":"#/components/schemas/DashboardOut"},"rationale":{"type":"string","title":"Rationale","default":""}},"type":"object","required":["board"],"title":"AiBoardResponse"},"AiUsageBySurface":{"properties":{"surface":{"type":"string","title":"Surface"},"calls":{"type":"integer","title":"Calls"},"prompt_tokens":{"type":"integer","title":"Prompt Tokens"},"completion_tokens":{"type":"integer","title":"Completion Tokens"},"cost_usd":{"type":"number","title":"Cost Usd"}},"type":"object","required":["surface","calls","prompt_tokens","completion_tokens","cost_usd"],"title":"AiUsageBySurface"},"AiUsageByUser":{"properties":{"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"calls":{"type":"integer","title":"Calls"},"cost_usd":{"type":"number","title":"Cost Usd"}},"type":"object","required":["calls","cost_usd"],"title":"AiUsageByUser"},"AiUsageSummary":{"properties":{"from":{"type":"string","format":"date","title":"From"},"to":{"type":"string","format":"date","title":"To"},"calls":{"type":"integer","title":"Calls"},"prompt_tokens":{"type":"integer","title":"Prompt Tokens"},"completion_tokens":{"type":"integer","title":"Completion Tokens"},"cached_tokens":{"type":"integer","title":"Cached Tokens"},"cost_usd":{"type":"number","title":"Cost Usd"},"by_surface":{"items":{"$ref":"#/components/schemas/AiUsageBySurface"},"type":"array","title":"By Surface"},"by_user":{"items":{"$ref":"#/components/schemas/AiUsageByUser"},"type":"array","title":"By User"}},"type":"object","required":["from","to","calls","prompt_tokens","completion_tokens","cached_tokens","cost_usd","by_surface","by_user"],"title":"AiUsageSummary"},"AiWidgetRequest":{"properties":{"prompt":{"type":"string","maxLength":500,"minLength":2,"title":"Prompt"},"allowed_types":{"anyOf":[{"items":{"type":"string","enum":["kpi","timeseries","top_list","treasury_list","pending_reconciliation","runway","top_expense_accounts","upcoming_taxes","recent_invoices","recent_purchases","subscriptions_summary","uncategorized_movements","sales_by_country","markdown"]},"type":"array"},{"type":"null"}],"title":"Allowed Types"}},"type":"object","required":["prompt"],"title":"AiWidgetRequest"},"AiWidgetResponse":{"properties":{"widget":{"$ref":"#/components/schemas/WidgetSpec"},"rationale":{"type":"string","title":"Rationale","default":""}},"type":"object","required":["widget"],"title":"AiWidgetResponse"},"ApiKeyCreate":{"properties":{"name":{"type":"string","title":"Name"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes","default":["*"]}},"type":"object","required":["name"],"title":"ApiKeyCreate"},"ApiKeyCreateResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"name":{"type":"string","title":"Name"},"token":{"type":"string","title":"Token"},"prefix":{"type":"string","title":"Prefix"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes"}},"type":"object","required":["id","name","token","prefix","scopes"],"title":"ApiKeyCreateResponse"},"ApiKeyListItem":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"name":{"type":"string","title":"Name"},"prefix":{"type":"string","title":"Prefix"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes"},"last_used_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Used At"},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Revoked At"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","name","prefix","scopes","last_used_at","revoked_at","created_at"],"title":"ApiKeyListItem"},"AuditBatchListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AuditBatchSummary"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["items","total","limit","offset"],"title":"AuditBatchListResponse"},"AuditBatchSummary":{"properties":{"request_id":{"type":"string","title":"Request Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"actor_type":{"type":"string","title":"Actor Type"},"actor_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor Label"},"request_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Request Method"},"request_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Request Path"},"batch_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Batch Label"},"entry_count":{"type":"integer","title":"Entry Count"},"operations":{"additionalProperties":{"type":"integer"},"type":"object","title":"Operations"},"sample_entities":{"items":{"additionalProperties":{"type":"string"},"type":"object"},"type":"array","title":"Sample Entities"}},"type":"object","required":["request_id","created_at","actor_type","entry_count","operations"],"title":"AuditBatchSummary","description":"Aggregated view of a single ``request_id`` group."},"AuditEntryDetail":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"actor_type":{"type":"string","title":"Actor Type"},"actor_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor Label"},"actor_user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Actor User Id"},"actor_api_key_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Actor Api Key Id"},"entity_type":{"type":"string","title":"Entity Type"},"entity_id":{"type":"string","title":"Entity Id"},"entity_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entity Label"},"operation":{"type":"string","title":"Operation"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Request Id"},"request_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Request Method"},"request_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Request Path"},"batch_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Batch Label"},"restored_from_audit_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Restored From Audit Id"},"actor_ip":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor Ip"},"actor_user_agent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor User Agent"},"before":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Before"},"after":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"After"},"diff":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Diff"}},"type":"object","required":["id","created_at","actor_type","entity_type","entity_id","operation"],"title":"AuditEntryDetail","description":"Full entry with snapshots and computed diff.\n\nThe client context (``actor_ip`` / ``actor_user_agent``) is exposed here,\non the on-demand detail view, rather than in bulk list responses — it's\nsecurity-forensics data, surfaced only when an entry is inspected."},"AuditEntrySummary":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"actor_type":{"type":"string","title":"Actor Type"},"actor_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor Label"},"actor_user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Actor User Id"},"actor_api_key_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Actor Api Key Id"},"entity_type":{"type":"string","title":"Entity Type"},"entity_id":{"type":"string","title":"Entity Id"},"entity_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entity Label"},"operation":{"type":"string","title":"Operation"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Request Id"},"request_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Request Method"},"request_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Request Path"},"batch_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Batch Label"},"restored_from_audit_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Restored From Audit Id"},"has_before":{"type":"boolean","title":"Has Before","default":false},"has_after":{"type":"boolean","title":"Has After","default":false},"changed_fields":{"items":{"type":"string"},"type":"array","title":"Changed Fields"}},"type":"object","required":["id","created_at","actor_type","entity_type","entity_id","operation"],"title":"AuditEntrySummary","description":"Lightweight row used in list views — omits the full snapshots.\n\nThe full ``before``/``after`` JSON can be tens of kB per row (think\nDocument with 50 lines, dashboard layouts). The activity feed and timeline\ndon't need them — they're fetched on demand from\n``GET /audit/{id}`` when the user opens an entry."},"AuditTimelinePage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AuditEntrySummary"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["items","total","limit","offset"],"title":"AuditTimelinePage","description":"Paginated list of audit entries."},"AutoClassifyProposal":{"properties":{"movement_id":{"type":"string","format":"uuid","title":"Movement Id"},"value_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Value Date"},"amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Amount"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"counterparty":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Counterparty"},"decision":{"type":"string","title":"Decision"},"account_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Number"},"account_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Name"},"confidence":{"type":"number","title":"Confidence"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"applied":{"type":"boolean","title":"Applied","default":false}},"type":"object","required":["movement_id","amount","decision","confidence"],"title":"AutoClassifyProposal"},"AutoClassifyRequest":{"properties":{"dry_run":{"type":"boolean","title":"Dry Run","default":true},"limit":{"type":"integer","maximum":200.0,"minimum":1.0,"title":"Limit","default":50},"min_confidence":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Min Confidence","default":0.85}},"type":"object","title":"AutoClassifyRequest","description":"``dry_run`` defaults to True: returns the proposed classifications WITHOUT\nwriting, so the main agent can review before applying."},"AutoClassifyResponse":{"properties":{"dry_run":{"type":"boolean","title":"Dry Run"},"classified":{"type":"integer","title":"Classified"},"abstained":{"type":"integer","title":"Abstained"},"applied":{"type":"integer","title":"Applied"},"proposals":{"items":{"$ref":"#/components/schemas/AutoClassifyProposal"},"type":"array","title":"Proposals","default":[]}},"type":"object","required":["dry_run","classified","abstained","applied"],"title":"AutoClassifyResponse"},"AutoReconcileDetail":{"properties":{"document_id":{"type":"string","format":"uuid","title":"Document Id"},"doc_number":{"type":"string","title":"Doc Number"},"result":{"type":"string","title":"Result"},"movements_linked":{"type":"integer","title":"Movements Linked","default":0},"reconciliation_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Reconciliation Ids","default":[]}},"type":"object","required":["document_id","doc_number","result"],"title":"AutoReconcileDetail"},"AutoReconcileRequest":{"properties":{"days_window":{"type":"integer","maximum":120.0,"minimum":1.0,"title":"Days Window","default":40},"tolerance":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Tolerance","default":"0.02"},"candidate_cap":{"type":"integer","maximum":20.0,"minimum":1.0,"title":"Candidate Cap","default":12},"limit":{"type":"integer","maximum":2000.0,"minimum":1.0,"title":"Limit","default":500}},"type":"object","title":"AutoReconcileRequest","description":"Tuning for the multi-movement sweep. All optional; defaults match the\ntask spec (±40 días, tolerancia 0,02 €, hasta 12 candidatos por factura)."},"AutoReconcileResponse":{"properties":{"reconciled_docs":{"type":"integer","title":"Reconciled Docs"},"movements_linked":{"type":"integer","title":"Movements Linked"},"skipped_ambiguous":{"type":"integer","title":"Skipped Ambiguous"},"details":{"items":{"$ref":"#/components/schemas/AutoReconcileDetail"},"type":"array","title":"Details","default":[]}},"type":"object","required":["reconciled_docs","movements_linked","skipped_ambiguous"],"title":"AutoReconcileResponse"},"AutogenPurchasesRequest":{"properties":{"treasury_id":{"type":"string","format":"uuid","title":"Treasury Id"},"supplier_name":{"type":"string","maxLength":255,"minLength":1,"title":"Supplier Name"},"event_codes":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Event Codes"},"category_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Category Id"},"movement_ids":{"anyOf":[{"items":{"type":"string","format":"uuid"},"type":"array"},{"type":"null"}],"title":"Movement Ids"},"tax_type_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Tax Type Id"},"account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Account Id"},"description_template":{"type":"string","maxLength":300,"title":"Description Template","default":"{counterparty}"},"limit":{"type":"integer","maximum":500.0,"minimum":1.0,"title":"Limit","default":50}},"type":"object","required":["treasury_id","supplier_name"],"title":"AutogenPurchasesRequest","description":"Filter + target for auto-generating self-billed purchases from movements."},"BankMatchHint":{"properties":{"movement_id":{"type":"string","title":"Movement Id"},"treasury_id":{"type":"string","title":"Treasury Id"},"treasury_name":{"type":"string","title":"Treasury Name"},"value_date":{"type":"string","title":"Value Date"},"amount":{"type":"number","title":"Amount"},"description":{"type":"string","title":"Description"},"confidence":{"type":"number","title":"Confidence"},"reasoning":{"type":"string","title":"Reasoning"},"already_linked":{"type":"boolean","title":"Already Linked","default":false}},"type":"object","required":["movement_id","treasury_id","treasury_name","value_date","amount","description","confidence","reasoning"],"title":"BankMatchHint","description":"The same suggestion shape the ingest flow already produces, plus a\nconvenience ``already_linked`` flag so the frontend can disable the\n\"aplicar\" button when the doc already has its reconciliation."},"BankMovementCreate":{"properties":{"treasury_id":{"type":"string","format":"uuid","title":"Treasury Id"},"value_date":{"type":"string","format":"date","title":"Value Date"},"booking_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Booking Date"},"amount":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Amount"},"currency":{"type":"string","maxLength":3,"minLength":3,"title":"Currency","default":"EUR"},"description":{"type":"string","maxLength":500,"title":"Description","default":""},"counterparty":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Counterparty"},"external_id":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"External Id"},"tags":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Tags"}},"type":"object","required":["treasury_id","value_date","amount"],"title":"BankMovementCreate"},"BankMovementDetailResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"treasury_id":{"type":"string","format":"uuid","title":"Treasury Id"},"value_date":{"type":"string","format":"date","title":"Value Date"},"booking_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Booking Date"},"amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Amount"},"currency":{"type":"string","title":"Currency"},"description":{"type":"string","title":"Description"},"counterparty":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Counterparty"},"status":{"type":"string","title":"Status"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id"},"tags":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Tags"},"raw":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Raw"},"category_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Category Id"},"category_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category Source"},"subscription_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Subscription Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"linked_doc_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Linked Doc Id"},"linked_doc_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Linked Doc Number"},"linked_doc_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Linked Doc Type"},"linked_attachment_filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Linked Attachment Filename"},"reconciliations":{"items":{"$ref":"#/components/schemas/ReconciliationMini"},"type":"array","title":"Reconciliations","default":[]}},"type":"object","required":["id","treasury_id","value_date","booking_date","amount","currency","description","counterparty","status","external_id","tags","created_at","updated_at"],"title":"BankMovementDetailResponse"},"BankMovementResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"treasury_id":{"type":"string","format":"uuid","title":"Treasury Id"},"value_date":{"type":"string","format":"date","title":"Value Date"},"booking_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Booking Date"},"amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Amount"},"currency":{"type":"string","title":"Currency"},"description":{"type":"string","title":"Description"},"counterparty":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Counterparty"},"status":{"type":"string","title":"Status"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id"},"tags":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Tags"},"raw":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Raw"},"category_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Category Id"},"category_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category Source"},"subscription_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Subscription Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"linked_doc_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Linked Doc Id"},"linked_doc_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Linked Doc Number"},"linked_doc_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Linked Doc Type"},"linked_attachment_filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Linked Attachment Filename"}},"type":"object","required":["id","treasury_id","value_date","booking_date","amount","currency","description","counterparty","status","external_id","tags","created_at","updated_at"],"title":"BankMovementResponse"},"BatchRestoreResponse":{"properties":{"request_id":{"type":"string","title":"Request Id"},"results":{"items":{"$ref":"#/components/schemas/RestoreResult"},"type":"array","title":"Results"},"new_request_id":{"type":"string","title":"New Request Id"}},"type":"object","required":["request_id","results","new_request_id"],"title":"BatchRestoreResponse"},"BillingLimits":{"properties":{"plan":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Plan"},"revenue":{"type":"number","title":"Revenue"},"ceiling":{"type":"integer","title":"Ceiling"},"over":{"type":"boolean","title":"Over"},"blocked":{"type":"boolean","title":"Blocked"},"grace_until":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Grace Until"},"next_plan":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Plan"}},"type":"object","required":["plan","revenue","ceiling","over","blocked","grace_until","next_plan"],"title":"BillingLimits"},"BillingStatus":{"properties":{"plan":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Plan"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"current_period_end":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Period End"}},"type":"object","required":["plan","status","current_period_end"],"title":"BillingStatus"},"Body_ai_extract_pdf_api_v1_ai_extract_pdf_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_ai_extract_pdf_api_v1_ai_extract_pdf_post"},"Body_ai_ingest_purchase_api_v1_ai_ingest_purchase_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"force":{"type":"boolean","title":"Force","default":false}},"type":"object","required":["file"],"title":"Body_ai_ingest_purchase_api_v1_ai_ingest_purchase_post"},"Body_ai_ingest_purchase_batch_api_v1_ai_ingest_purchase_batch_post":{"properties":{"files":{"items":{"type":"string","contentMediaType":"application/octet-stream"},"type":"array","title":"Files"},"force":{"type":"boolean","title":"Force","default":false}},"type":"object","required":["files"],"title":"Body_ai_ingest_purchase_batch_api_v1_ai_ingest_purchase_batch_post"},"Body_backfill_stripe_fee_purchase_api_v1_integrations_stripe_backfill_fee__treasury_id__post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"year":{"type":"integer","title":"Year"},"month":{"type":"integer","title":"Month"},"total":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Total"}},"type":"object","required":["file","year","month","total"],"title":"Body_backfill_stripe_fee_purchase_api_v1_integrations_stripe_backfill_fee__treasury_id__post"},"Body_create_tax_filing_api_v1_taxes_filings_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"model_code":{"type":"string","title":"Model Code"},"year":{"type":"integer","title":"Year"},"quarter":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Quarter"},"filed_at":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Filed At"},"reference":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reference"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"}},"type":"object","required":["file","model_code","year"],"title":"Body_create_tax_filing_api_v1_taxes_filings_post"},"Body_import_bank_movements_csv_api_v1_bank_movements_import_csv_post":{"properties":{"treasury_id":{"type":"string","format":"uuid","title":"Treasury Id"},"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["treasury_id","file"],"title":"Body_import_bank_movements_csv_api_v1_bank_movements_import_csv_post"},"Body_import_invoices_csv_endpoint_api_v1_invoices_import_csv_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_import_invoices_csv_endpoint_api_v1_invoices_import_csv_post"},"Body_import_purchases_csv_endpoint_api_v1_purchases_import_csv_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_import_purchases_csv_endpoint_api_v1_purchases_import_csv_post"},"Body_upload_certificate_api_v1_verifactu_certificate_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"password":{"type":"string","title":"Password","default":""}},"type":"object","required":["file"],"title":"Body_upload_certificate_api_v1_verifactu_certificate_post"},"Body_upload_invoice_attachment_api_v1_invoices__doc_id__attachment_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_invoice_attachment_api_v1_invoices__doc_id__attachment_post"},"Body_upload_logo_api_v1_tenants_me_logo_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_logo_api_v1_tenants_me_logo_post"},"Body_upload_purchase_attachment_api_v1_purchases__doc_id__attachment_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_purchase_attachment_api_v1_purchases__doc_id__attachment_post"},"BulkActionSummary":{"properties":{"ok":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Ok"},"failed":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Failed"}},"type":"object","title":"BulkActionSummary","description":"Per-id outcome of a bulk action — useful for partial failures."},"BulkIdsRequest":{"properties":{"ids":{"items":{"type":"string","format":"uuid"},"type":"array","maxItems":200,"minItems":1,"title":"Ids"}},"type":"object","required":["ids"],"title":"BulkIdsRequest","description":"Body shared by every bulk endpoint (download/delete)."},"BulkReconcileResponse":{"properties":{"created":{"type":"integer","title":"Created"}},"type":"object","required":["created"],"title":"BulkReconcileResponse"},"CatalogResponse":{"properties":{"widget_types":{"items":{"$ref":"#/components/schemas/WidgetTypeDef"},"type":"array","title":"Widget Types"}},"type":"object","required":["widget_types"],"title":"CatalogResponse"},"CategoryBreakdownItem":{"properties":{"category_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Category Id"},"name":{"type":"string","title":"Name"},"color":{"type":"string","title":"Color"},"kind":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kind"},"total_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Amount"},"count":{"type":"integer","title":"Count"}},"type":"object","required":["category_id","name","color","total_amount","count"],"title":"CategoryBreakdownItem"},"CategoryBreakdownResponse":{"properties":{"from_date":{"type":"string","format":"date","title":"From Date"},"to_date":{"type":"string","format":"date","title":"To Date"},"items":{"items":{"$ref":"#/components/schemas/CategoryBreakdownItem"},"type":"array","title":"Items"},"total_income":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Income"},"total_expense":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Expense"}},"type":"object","required":["from_date","to_date","items","total_income","total_expense"],"title":"CategoryBreakdownResponse"},"CategoryCreate":{"properties":{"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"kind":{"type":"string","enum":["expense","income","both","transfer"],"title":"Kind","default":"expense"},"color":{"type":"string","maxLength":9,"minLength":4,"title":"Color","default":"#64748b"},"icon":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Icon"},"parent_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Parent Id"},"monthly_budget":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Monthly Budget"},"is_active":{"type":"boolean","title":"Is Active","default":true},"sort_order":{"type":"integer","title":"Sort Order","default":100}},"type":"object","required":["name"],"title":"CategoryCreate"},"CategoryResponse":{"properties":{"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"kind":{"type":"string","enum":["expense","income","both","transfer"],"title":"Kind","default":"expense"},"color":{"type":"string","maxLength":9,"minLength":4,"title":"Color","default":"#64748b"},"icon":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Icon"},"parent_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Parent Id"},"monthly_budget":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Monthly Budget"},"is_active":{"type":"boolean","title":"Is Active","default":true},"sort_order":{"type":"integer","title":"Sort Order","default":100},"id":{"type":"string","format":"uuid","title":"Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["name","id","created_at","updated_at"],"title":"CategoryResponse"},"CategorySeedResponse":{"properties":{"created":{"type":"integer","title":"Created"}},"type":"object","required":["created"],"title":"CategorySeedResponse"},"CategorySuggestResponse":{"properties":{"candidates":{"items":{"$ref":"#/components/schemas/CategorySuggestion"},"type":"array","title":"Candidates","default":[]},"scanned":{"type":"integer","title":"Scanned","default":0},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","title":"CategorySuggestResponse"},"CategorySuggestion":{"properties":{"movement_id":{"type":"string","format":"uuid","title":"Movement Id"},"suggested_category_id":{"type":"string","format":"uuid","title":"Suggested Category Id"},"suggested_category_name":{"type":"string","title":"Suggested Category Name"},"suggested_category_color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Suggested Category Color"},"confidence":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Confidence"},"reasoning":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reasoning"},"movement_date":{"type":"string","format":"date","title":"Movement Date"},"movement_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Movement Amount"},"movement_currency":{"type":"string","title":"Movement Currency","default":"EUR"},"movement_description":{"type":"string","title":"Movement Description","default":""},"movement_counterparty":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Movement Counterparty"}},"type":"object","required":["movement_id","suggested_category_id","suggested_category_name","confidence","movement_date","movement_amount"],"title":"CategorySuggestion"},"CategoryUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":120,"minLength":1},{"type":"null"}],"title":"Name"},"kind":{"anyOf":[{"type":"string","enum":["expense","income","both","transfer"]},{"type":"null"}],"title":"Kind"},"color":{"anyOf":[{"type":"string","maxLength":9,"minLength":4},{"type":"null"}],"title":"Color"},"icon":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Icon"},"parent_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Parent Id"},"monthly_budget":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Monthly Budget"},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"},"sort_order":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sort Order"}},"type":"object","title":"CategoryUpdate"},"CategoryWithStats":{"properties":{"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"kind":{"type":"string","enum":["expense","income","both","transfer"],"title":"Kind","default":"expense"},"color":{"type":"string","maxLength":9,"minLength":4,"title":"Color","default":"#64748b"},"icon":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Icon"},"parent_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Parent Id"},"monthly_budget":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Monthly Budget"},"is_active":{"type":"boolean","title":"Is Active","default":true},"sort_order":{"type":"integer","title":"Sort Order","default":100},"id":{"type":"string","format":"uuid","title":"Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"movements_count":{"type":"integer","title":"Movements Count","default":0},"total_spent":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Spent","default":"0"}},"type":"object","required":["name","id","created_at","updated_at"],"title":"CategoryWithStats"},"CertUploadResponse":{"properties":{"cert_subject":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cert Subject"},"cert_nif":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cert Nif"},"cert_expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Cert Expires At"},"cert_uploaded_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Cert Uploaded At"}},"type":"object","title":"CertUploadResponse"},"ChangePasswordRequest":{"properties":{"current_password":{"type":"string","title":"Current Password"},"new_password":{"type":"string","maxLength":200,"minLength":8,"title":"New Password"}},"type":"object","required":["current_password","new_password"],"title":"ChangePasswordRequest"},"ChatMessage":{"properties":{"role":{"type":"string","enum":["user","assistant"],"title":"Role"},"content":{"type":"string","title":"Content"}},"type":"object","required":["role","content"],"title":"ChatMessage"},"ChatRequest":{"properties":{"messages":{"items":{"$ref":"#/components/schemas/ChatMessage"},"type":"array","title":"Messages"}},"type":"object","title":"ChatRequest"},"CheckoutRequest":{"properties":{"plan":{"type":"string","title":"Plan"},"period":{"type":"string","title":"Period","default":"monthly"}},"type":"object","required":["plan"],"title":"CheckoutRequest"},"ContactCreate":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"},"legal_name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Legal Name"},"vat":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Vat"},"email":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Email"},"phone":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Phone"},"address":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Address"},"address_line2":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Address Line2"},"city":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"City"},"state":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"State"},"postal_code":{"anyOf":[{"type":"string","maxLength":16},{"type":"null"}],"title":"Postal Code"},"country":{"anyOf":[{"type":"string","maxLength":2,"minLength":2},{"type":"null"}],"title":"Country"},"is_customer":{"type":"boolean","title":"Is Customer","default":true},"is_supplier":{"type":"boolean","title":"Is Supplier","default":true},"customer_type":{"anyOf":[{"type":"string","maxLength":16},{"type":"null"}],"title":"Customer Type"},"recargo_equivalencia":{"type":"boolean","title":"Recargo Equivalencia","default":false},"irpf_rate":{"anyOf":[{"type":"number","maximum":100.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Irpf Rate","default":"0"},"tax_id_type":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Tax Id Type"},"currency":{"anyOf":[{"type":"string","maxLength":3,"minLength":3},{"type":"null"}],"title":"Currency"},"language":{"anyOf":[{"type":"string","maxLength":8},{"type":"null"}],"title":"Language"},"stripe_customer_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Stripe Customer Id"},"external_source":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"External Source"},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Notes"}},"type":"object","required":["name"],"title":"ContactCreate"},"ContactInvoiceSummary":{"properties":{"invoice_id":{"type":"string","title":"Invoice Id"},"doc_type":{"type":"string","title":"Doc Type"},"doc_number":{"type":"string","title":"Doc Number"},"doc_date":{"type":"string","title":"Doc Date"},"total":{"type":"string","title":"Total"},"currency":{"type":"string","title":"Currency"},"status":{"type":"string","title":"Status"},"public_url":{"type":"string","title":"Public Url"},"pdf_url":{"type":"string","title":"Pdf Url"},"eur_total":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Eur Total"},"eur_currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Eur Currency"},"fx_rate":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fx Rate"}},"type":"object","required":["invoice_id","doc_type","doc_number","doc_date","total","currency","status","public_url","pdf_url"],"title":"ContactInvoiceSummary","description":"One row in the per-contact invoice list. Designed to be embedded\nin a customer-facing application (e.g. Upload-Post's \"My invoices\"\npage): every entry already carries a signed ``public_url`` the host\napp can render as a direct link — no AgentLedger auth round-trip\nneeded from the customer's browser."},"ContactInvoicesResponse":{"properties":{"contact_id":{"type":"string","title":"Contact Id"},"contact_name":{"type":"string","title":"Contact Name"},"stripe_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Customer Id"},"invoices":{"items":{"$ref":"#/components/schemas/ContactInvoiceSummary"},"type":"array","title":"Invoices"}},"type":"object","required":["contact_id","contact_name","stripe_customer_id","invoices"],"title":"ContactInvoicesResponse","description":"Wrapper around the invoice list. Includes the contact identity we\nmatched on so the caller can sanity-check it picked the right customer\n(especially useful when migrating between Stripe customer ids)."},"ContactResponse":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"},"legal_name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Legal Name"},"vat":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Vat"},"email":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Email"},"phone":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Phone"},"address":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Address"},"address_line2":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Address Line2"},"city":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"City"},"state":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"State"},"postal_code":{"anyOf":[{"type":"string","maxLength":16},{"type":"null"}],"title":"Postal Code"},"country":{"anyOf":[{"type":"string","maxLength":2,"minLength":2},{"type":"null"}],"title":"Country"},"is_customer":{"type":"boolean","title":"Is Customer","default":true},"is_supplier":{"type":"boolean","title":"Is Supplier","default":true},"customer_type":{"anyOf":[{"type":"string","maxLength":16},{"type":"null"}],"title":"Customer Type"},"recargo_equivalencia":{"type":"boolean","title":"Recargo Equivalencia","default":false},"irpf_rate":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Irpf Rate","default":"0"},"tax_id_type":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Tax Id Type"},"currency":{"anyOf":[{"type":"string","maxLength":3,"minLength":3},{"type":"null"}],"title":"Currency"},"language":{"anyOf":[{"type":"string","maxLength":8},{"type":"null"}],"title":"Language"},"stripe_customer_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Stripe Customer Id"},"external_source":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"External Source"},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Notes"},"id":{"type":"string","format":"uuid","title":"Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"vies_verified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Vies Verified At"},"vies_verified_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vies Verified Name"},"last_synced_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Synced At"}},"type":"object","required":["name","id","created_at","updated_at"],"title":"ContactResponse"},"ContactStatsResponse":{"properties":{"contact_id":{"type":"string","format":"uuid","title":"Contact Id"},"invoice_count":{"type":"integer","title":"Invoice Count"},"invoice_total":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Invoice Total"},"invoice_total_ytd":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Invoice Total Ytd"},"last_invoice_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Invoice Date"},"purchase_count":{"type":"integer","title":"Purchase Count"},"purchase_total":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Purchase Total"}},"type":"object","required":["contact_id","invoice_count","invoice_total","invoice_total_ytd","last_invoice_date","purchase_count","purchase_total"],"title":"ContactStatsResponse","description":"Aggregated sales/spend stats for a single contact."},"ContactSummary":{"properties":{"total":{"type":"integer","title":"Total"},"customers":{"type":"integer","title":"Customers"},"suppliers":{"type":"integer","title":"Suppliers"},"without_vat":{"type":"integer","title":"Without Vat"},"from_stripe":{"type":"integer","title":"From Stripe"}},"type":"object","required":["total","customers","suppliers","without_vat","from_stripe"],"title":"ContactSummary"},"ContactUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"null"}],"title":"Name"},"legal_name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Legal Name"},"vat":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Vat"},"email":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Email"},"phone":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Phone"},"address":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Address"},"address_line2":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Address Line2"},"city":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"City"},"state":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"State"},"postal_code":{"anyOf":[{"type":"string","maxLength":16},{"type":"null"}],"title":"Postal Code"},"country":{"anyOf":[{"type":"string","maxLength":2,"minLength":2},{"type":"null"}],"title":"Country"},"is_customer":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Customer"},"is_supplier":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Supplier"},"customer_type":{"anyOf":[{"type":"string","maxLength":16},{"type":"null"}],"title":"Customer Type"},"recargo_equivalencia":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Recargo Equivalencia"},"irpf_rate":{"anyOf":[{"type":"number","maximum":100.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Irpf Rate"},"tax_id_type":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Tax Id Type"},"currency":{"anyOf":[{"type":"string","maxLength":3,"minLength":3},{"type":"null"}],"title":"Currency"},"language":{"anyOf":[{"type":"string","maxLength":8},{"type":"null"}],"title":"Language"},"stripe_customer_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Stripe Customer Id"},"external_source":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"External Source"},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Notes"}},"type":"object","title":"ContactUpdate"},"CountryRow":{"properties":{"country":{"type":"string","title":"Country"},"country_name":{"type":"string","title":"Country Name"},"b2b_total":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"B2B Total"},"b2c_total":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"B2C Total"},"total":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total"},"doc_count":{"type":"integer","title":"Doc Count"},"pct_of_total":{"type":"number","title":"Pct Of Total"}},"type":"object","required":["country","country_name","b2b_total","b2c_total","total","doc_count","pct_of_total"],"title":"CountryRow"},"CreateTenantRequest":{"properties":{"business_type":{"type":"string","pattern":"^(empresa|autonomo|asesoria)$","title":"Business Type"},"company_name":{"type":"string","maxLength":120,"minLength":2,"title":"Company Name"},"vat":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Vat"},"legal_form":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Legal Form"},"country_region":{"type":"string","maxLength":24,"title":"Country Region","default":"ES-Peninsula"}},"type":"object","required":["business_type","company_name"],"title":"CreateTenantRequest","description":"Spawn a brand-new tenant for the currently-authenticated user.\n\nUsed by the \"Crear empresa\" entry in the TopBar tenant switcher — lets\na gestor or owner manage several companies from the same login. The\nfull onboarding wizard's idempotency check would reject this (it\nshort-circuits when the user already has a membership), so we expose\na separate endpoint with a cut-down field set."},"CsvImportResponse":{"properties":{"created":{"type":"integer","title":"Created"},"skipped":{"type":"integer","title":"Skipped"},"batch_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Batch Id"}},"type":"object","required":["created","skipped"],"title":"CsvImportResponse"},"DashboardCreate":{"properties":{"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"is_default":{"type":"boolean","title":"Is Default","default":false},"layout":{"anyOf":[{"$ref":"#/components/schemas/LayoutSpec"},{"type":"null"}]}},"type":"object","required":["name"],"title":"DashboardCreate"},"DashboardListItem":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"name":{"type":"string","title":"Name"},"is_default":{"type":"boolean","title":"Is Default"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"widget_count":{"type":"integer","title":"Widget Count"}},"type":"object","required":["id","name","is_default","updated_at","widget_count"],"title":"DashboardListItem"},"DashboardOut":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"name":{"type":"string","title":"Name"},"is_default":{"type":"boolean","title":"Is Default"},"layout":{"$ref":"#/components/schemas/LayoutSpec"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","name","is_default","layout","created_at","updated_at"],"title":"DashboardOut"},"DashboardUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":120,"minLength":1},{"type":"null"}],"title":"Name"},"is_default":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Default"},"layout":{"anyOf":[{"$ref":"#/components/schemas/LayoutSpec"},{"type":"null"}]}},"type":"object","title":"DashboardUpdate"},"DeleteBatchResponse":{"properties":{"deleted":{"type":"integer","title":"Deleted"}},"type":"object","required":["deleted"],"title":"DeleteBatchResponse"},"DetectResponse":{"properties":{"candidates":{"items":{"$ref":"#/components/schemas/RecurringCandidate"},"type":"array","title":"Candidates"},"scanned":{"type":"integer","title":"Scanned"}},"type":"object","required":["candidates","scanned"],"title":"DetectResponse"},"DocumentCreate":{"properties":{"doc_type":{"type":"string","maxLength":32,"minLength":1,"title":"Doc Type","default":"invoice"},"contact_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Contact Id"},"doc_date":{"type":"string","format":"date","title":"Doc Date"},"due_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Due Date"},"currency":{"type":"string","maxLength":3,"minLength":3,"title":"Currency","default":"EUR"},"header_discount_pct":{"anyOf":[{"type":"number","maximum":100.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Header Discount Pct","default":"0"},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Notes"},"tags":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Tags"},"supplier_invoice_number":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Supplier Invoice Number"},"external_id":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"External Id"},"external_source":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"External Source"},"corrected_doc_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Corrected Doc Id"},"rectification_reason":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Rectification Reason"},"is_lease":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Lease"},"lines":{"items":{"$ref":"#/components/schemas/DocumentLineIn"},"type":"array","title":"Lines"},"series_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Series Id"}},"type":"object","required":["doc_date"],"title":"DocumentCreate"},"DocumentLineIn":{"properties":{"description":{"type":"string","maxLength":500,"minLength":1,"title":"Description"},"quantity":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Quantity","default":"1"},"unit_price":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Unit Price","default":"0"},"discount_pct":{"anyOf":[{"type":"number","maximum":100.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Discount Pct","default":"0"},"product_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Product Id"},"tax_type_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Tax Type Id"},"irpf_rate":{"anyOf":[{"type":"number","maximum":100.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Irpf Rate"},"deductible_percentage":{"anyOf":[{"type":"number","maximum":100.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Deductible Percentage","default":"100"},"account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Account Id"},"position":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Position"}},"type":"object","required":["description"],"title":"DocumentLineIn","description":"Input for a line on create/update."},"DocumentLineResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"position":{"type":"integer","title":"Position"},"product_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Product Id"},"description":{"type":"string","title":"Description"},"quantity":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Quantity"},"unit_price":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Unit Price"},"discount_pct":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Discount Pct"},"tax_type_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Tax Type Id"},"tax_rate":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Tax Rate"},"re_rate":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Re Rate"},"irpf_rate":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Irpf Rate"},"line_subtotal":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Line Subtotal"},"line_tax":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Line Tax"},"line_re":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Line Re"},"line_irpf":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Line Irpf"},"line_total":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Line Total"},"deductible_percentage":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Deductible Percentage","default":"100"},"account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Account Id"},"period_start":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Period Start"},"period_end":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Period End"}},"type":"object","required":["id","position","product_id","description","quantity","unit_price","discount_pct","tax_type_id","tax_rate","re_rate","irpf_rate","line_subtotal","line_tax","line_re","line_irpf","line_total","account_id"],"title":"DocumentLineResponse"},"DocumentListItem":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"doc_type":{"type":"string","title":"Doc Type"},"doc_number":{"type":"string","title":"Doc Number"},"contact_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Contact Id"},"contact_snapshot":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Contact Snapshot"},"supplier_invoice_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Supplier Invoice Number"},"doc_date":{"type":"string","format":"date","title":"Doc Date"},"due_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Due Date"},"status":{"type":"string","title":"Status"},"currency":{"type":"string","title":"Currency"},"subtotal":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Subtotal"},"tax_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Tax Amount"},"re_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Re Amount"},"irpf_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Irpf Amount"},"discount_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Discount Amount"},"total":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total"},"paid_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Paid Amount"},"attachment_filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Attachment Filename"},"source_document_ids":{"anyOf":[{"items":{"type":"string","format":"uuid"},"type":"array"},{"type":"null"}],"title":"Source Document Ids"},"customer_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Type"},"payment_sources":{"items":{"$ref":"#/components/schemas/DocumentPaymentSource"},"type":"array","title":"Payment Sources"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","doc_type","doc_number","contact_id","contact_snapshot","supplier_invoice_number","doc_date","due_date","status","currency","subtotal","tax_amount","re_amount","irpf_amount","discount_amount","total","paid_amount","created_at","updated_at"],"title":"DocumentListItem","description":"Light response for list views."},"DocumentMatchHint":{"properties":{"document_id":{"type":"string","title":"Document Id"},"doc_number":{"type":"string","title":"Doc Number"},"doc_type":{"type":"string","title":"Doc Type"},"doc_date":{"type":"string","title":"Doc Date"},"supplier_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Supplier Name"},"supplier_invoice_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Supplier Invoice Number"},"total":{"type":"number","title":"Total"},"confidence":{"type":"number","title":"Confidence"},"reasoning":{"type":"string","title":"Reasoning"}},"type":"object","required":["document_id","doc_number","doc_type","doc_date","total","confidence","reasoning"],"title":"DocumentMatchHint"},"DocumentPaymentSource":{"properties":{"treasury_id":{"type":"string","format":"uuid","title":"Treasury Id"},"treasury_name":{"type":"string","title":"Treasury Name"},"label":{"type":"string","title":"Label"},"provider":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider"},"gateway":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Gateway"}},"type":"object","required":["treasury_id","treasury_name","label"],"title":"DocumentPaymentSource","description":"One treasury that paid (or partially paid) a document.\n\nUsed by list endpoints to surface \"this sale was cobrada vía Stripe / PayPal /\nbank account X\" badges without forcing the client to fetch each document and\nfollow the Payment → Treasury join."},"DocumentResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"doc_type":{"type":"string","title":"Doc Type"},"doc_number":{"type":"string","title":"Doc Number"},"contact_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Contact Id"},"contact_snapshot":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Contact Snapshot"},"supplier_invoice_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Supplier Invoice Number"},"doc_date":{"type":"string","format":"date","title":"Doc Date"},"due_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Due Date"},"status":{"type":"string","title":"Status"},"currency":{"type":"string","title":"Currency"},"subtotal":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Subtotal"},"tax_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Tax Amount"},"re_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Re Amount"},"irpf_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Irpf Amount"},"discount_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Discount Amount"},"total":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total"},"paid_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Paid Amount"},"attachment_filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Attachment Filename"},"source_document_ids":{"anyOf":[{"items":{"type":"string","format":"uuid"},"type":"array"},{"type":"null"}],"title":"Source Document Ids"},"customer_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Type"},"payment_sources":{"items":{"$ref":"#/components/schemas/DocumentPaymentSource"},"type":"array","title":"Payment Sources"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"tags":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Tags"},"header_discount_pct":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Header Discount Pct"},"attachment_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Attachment Path"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id"},"external_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Source"},"series_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Series Id"},"sequence_number":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sequence Number"},"corrected_doc_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Corrected Doc Id"},"rectification_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rectification Reason"},"is_lease":{"type":"boolean","title":"Is Lease","default":false},"operation_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Operation Date"},"original_currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Original Currency"},"original_subtotal":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Original Subtotal"},"original_tax_amount":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Original Tax Amount"},"original_total":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Original Total"},"fx_rate":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Fx Rate"},"lines":{"items":{"$ref":"#/components/schemas/DocumentLineResponse"},"type":"array","title":"Lines"},"payments":{"items":{"$ref":"#/components/schemas/PaymentResponse"},"type":"array","title":"Payments"},"source_documents":{"items":{"$ref":"#/components/schemas/SourceDocRef"},"type":"array","title":"Source Documents"}},"type":"object","required":["id","doc_type","doc_number","contact_id","contact_snapshot","supplier_invoice_number","doc_date","due_date","status","currency","subtotal","tax_amount","re_amount","irpf_amount","discount_amount","total","paid_amount","attachment_filename","created_at","updated_at","notes","tags","header_discount_pct","attachment_path","external_id","external_source","series_id","sequence_number","lines","payments"],"title":"DocumentResponse","description":"Full response including lines + payments."},"DocumentUpdate":{"properties":{"contact_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Contact Id"},"doc_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Doc Date"},"due_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Due Date"},"currency":{"anyOf":[{"type":"string","maxLength":3,"minLength":3},{"type":"null"}],"title":"Currency"},"header_discount_pct":{"anyOf":[{"type":"number","maximum":100.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Header Discount Pct"},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Notes"},"tags":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Tags"},"supplier_invoice_number":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Supplier Invoice Number"},"lines":{"anyOf":[{"items":{"$ref":"#/components/schemas/DocumentLineIn"},"type":"array"},{"type":"null"}],"title":"Lines"},"status":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Status"},"rectification_reason":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Rectification Reason"},"is_lease":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Lease"}},"type":"object","title":"DocumentUpdate"},"EmailInvoicesRequest":{"properties":{"invoice_ids":{"items":{"type":"string","format":"uuid"},"type":"array","maxItems":50,"minItems":1,"title":"Invoice Ids"},"to_email":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}],"title":"To Email"},"cc":{"items":{"type":"string","format":"email"},"type":"array","maxItems":10,"title":"Cc"},"bcc":{"items":{"type":"string","format":"email"},"type":"array","maxItems":10,"title":"Bcc"},"subject":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Subject"},"message":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Message"}},"type":"object","required":["invoice_ids"],"title":"EmailInvoicesRequest","description":"Body for the bulk-send endpoint. ``invoice_ids`` are the documents we\nwant to share; ``to_email`` defaults to the contact's email when the\ncaller doesn't override it from the UI.\n\n``cc`` and ``bcc`` are optional extra recipients. CC is visible in the\nemail headers; BCC is delivered as an envelope-only recipient — common\nfor the gestor or the user wanting a silent copy of every invoice email\nsent to a customer."},"EmailInvoicesResponse":{"properties":{"sent_to":{"type":"string","title":"Sent To"},"invoices":{"items":{"$ref":"#/components/schemas/SharedInvoiceSummary"},"type":"array","title":"Invoices"}},"type":"object","required":["sent_to","invoices"],"title":"EmailInvoicesResponse"},"ExtractPdfResponse":{"properties":{"extraction":{"additionalProperties":true,"type":"object","title":"Extraction"}},"type":"object","required":["extraction"],"title":"ExtractPdfResponse","description":"Pure-extraction response: the structured invoice payload, no DB writes."},"ForgotPasswordRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"}},"type":"object","required":["email"],"title":"ForgotPasswordRequest"},"FxSettleProposal":{"properties":{"document_id":{"type":"string","format":"uuid","title":"Document Id"},"doc_number":{"type":"string","title":"Doc Number"},"supplier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Supplier"},"original_currency":{"type":"string","title":"Original Currency"},"original_total":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Original Total"},"old_total":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Old Total"},"proposed_total":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Proposed Total"},"charge_movement_id":{"type":"string","format":"uuid","title":"Charge Movement Id"},"charge_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Charge Date"},"applied":{"type":"boolean","title":"Applied","default":false},"reconciliation_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Reconciliation Id"}},"type":"object","required":["document_id","doc_number","original_currency","original_total","old_total","proposed_total","charge_movement_id"],"title":"FxSettleProposal"},"FxSettleRequest":{"properties":{"dry_run":{"type":"boolean","title":"Dry Run","default":true},"days_window":{"type":"integer","maximum":120.0,"minimum":1.0,"title":"Days Window","default":45},"limit":{"type":"integer","maximum":2000.0,"minimum":1.0,"title":"Limit","default":500}},"type":"object","title":"FxSettleRequest","description":"``dry_run`` defaults to True: returns the proposed re-books WITHOUT writing,\nso the main agent can review before applying. ``days_window`` is the ± window\n(in days) around each invoice's date in which a settling bank charge is sought."},"FxSettleResponse":{"properties":{"dry_run":{"type":"boolean","title":"Dry Run"},"rebooked":{"type":"integer","title":"Rebooked"},"reconciled":{"type":"integer","title":"Reconciled"},"skipped":{"type":"integer","title":"Skipped"},"proposals":{"items":{"$ref":"#/components/schemas/FxSettleProposal"},"type":"array","title":"Proposals","default":[]}},"type":"object","required":["dry_run","rebooked","reconciled","skipped"],"title":"FxSettleResponse"},"GoogleLoginRequest":{"properties":{"id_token":{"type":"string","minLength":1,"title":"Id Token"}},"type":"object","required":["id_token"],"title":"GoogleLoginRequest","description":"The frontend sends the ID token returned by Google Identity Services.\n\nWe never see the access token or the Google client secret — we only\nneed the ID token (a JWT signed by Google) and verify it against Google's\npublic JWKS. The ``sub`` claim is the stable per-account identifier."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"IngestJob":{"properties":{"id":{"type":"string","title":"Id"},"status":{"type":"string","title":"Status"},"phase":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phase"},"source_filename":{"type":"string","title":"Source Filename"},"source_mime":{"type":"string","title":"Source Mime"},"batch_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Batch Id"},"created_at":{"type":"string","title":"Created At"},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Started At"},"finished_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Finished At"},"result":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Result"},"document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Id"},"error_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Code"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"}},"type":"object","required":["id","status","source_filename","source_mime","created_at"],"title":"IngestJob","description":"Status payload for one queued/processing/done/error job. Returned by\nthe create / list / get endpoints — the frontend renders a card per\nrow and polls until ``status`` is terminal."},"IngestJobsResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/IngestJob"},"type":"array","title":"Items"}},"type":"object","required":["items"],"title":"IngestJobsResponse"},"InvitationOut":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"email":{"type":"string","title":"Email"},"full_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Full Name"},"role":{"type":"string","title":"Role"},"status":{"type":"string","title":"Status"},"invited_by_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invited By Email"},"expires_at":{"type":"string","format":"date-time","title":"Expires At"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","email","full_name","role","status","expires_at","created_at"],"title":"InvitationOut"},"InvitationPreview":{"properties":{"email":{"type":"string","title":"Email"},"full_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Full Name"},"role":{"type":"string","title":"Role"},"tenant_name":{"type":"string","title":"Tenant Name"},"inviter_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Inviter Name"},"requires_signup":{"type":"boolean","title":"Requires Signup"}},"type":"object","required":["email","full_name","role","tenant_name","inviter_name","requires_signup"],"title":"InvitationPreview"},"InviteRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"},"full_name":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Full Name"},"role":{"type":"string","title":"Role","default":"viewer"}},"type":"object","required":["email"],"title":"InviteRequest"},"InvoiceShareResponse":{"properties":{"token":{"type":"string","title":"Token"},"url":{"type":"string","title":"Url"},"pdf_url":{"type":"string","title":"Pdf Url"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"view_count":{"type":"integer","title":"View Count"},"last_viewed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Viewed At"}},"type":"object","required":["token","url","pdf_url","created_at","view_count","last_viewed_at"],"title":"InvoiceShareResponse","description":"Returned by share-mint endpoints. ``url`` is the customer-facing link;\n``pdf_url`` goes directly to the PDF (handy when the customer just wants\nthe file without opening the viewer page)."},"JournalEntryCreate":{"properties":{"entry_date":{"type":"string","format":"date","title":"Entry Date"},"description":{"type":"string","maxLength":255,"title":"Description","default":""},"lines":{"items":{"$ref":"#/components/schemas/JournalLineCreate"},"type":"array","minItems":2,"title":"Lines"}},"type":"object","required":["entry_date","lines"],"title":"JournalEntryCreate"},"JournalEntryResponse":{"properties":{"entry_date":{"type":"string","format":"date","title":"Entry Date"},"description":{"type":"string","maxLength":255,"title":"Description","default":""},"id":{"type":"string","format":"uuid","title":"Id"},"number":{"type":"integer","title":"Number"},"kind":{"type":"string","title":"Kind"},"locked":{"type":"boolean","title":"Locked"},"source_doc_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Source Doc Id"},"source_doc_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Doc Type"},"lines":{"items":{"$ref":"#/components/schemas/JournalLineResponse"},"type":"array","title":"Lines","default":[]},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["entry_date","id","number","kind","locked","created_at","updated_at"],"title":"JournalEntryResponse"},"JournalEntryUpdate":{"properties":{"entry_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Entry Date"},"description":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Description"},"lines":{"anyOf":[{"items":{"$ref":"#/components/schemas/JournalLineCreate"},"type":"array","minItems":2},{"type":"null"}],"title":"Lines"}},"type":"object","title":"JournalEntryUpdate"},"JournalLineCreate":{"properties":{"account_id":{"type":"string","format":"uuid","title":"Account Id"},"description":{"type":"string","maxLength":255,"title":"Description","default":""},"debit":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Debit","default":"0"},"credit":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Credit","default":"0"}},"type":"object","required":["account_id"],"title":"JournalLineCreate"},"JournalLineResponse":{"properties":{"account_id":{"type":"string","format":"uuid","title":"Account Id"},"description":{"type":"string","maxLength":255,"title":"Description","default":""},"debit":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Debit","default":"0"},"credit":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Credit","default":"0"},"id":{"type":"string","format":"uuid","title":"Id"},"position":{"type":"integer","title":"Position"},"account_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Number"},"account_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Name"}},"type":"object","required":["account_id","id","position"],"title":"JournalLineResponse"},"LayoutSpec":{"properties":{"widgets":{"items":{"$ref":"#/components/schemas/WidgetSpec"},"type":"array","title":"Widgets"}},"type":"object","title":"LayoutSpec"},"LedgerResponse":{"properties":{"account_id":{"type":"string","format":"uuid","title":"Account Id"},"account_number":{"type":"string","title":"Account Number"},"account_name":{"type":"string","title":"Account Name"},"from_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"From Date"},"to_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"To Date"},"summary":{"$ref":"#/components/schemas/LedgerSummary"},"items":{"items":{"$ref":"#/components/schemas/LedgerRow"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["account_id","account_number","account_name","summary","items","total","limit","offset"],"title":"LedgerResponse"},"LedgerRow":{"properties":{"entry_id":{"type":"string","format":"uuid","title":"Entry Id"},"entry_number":{"type":"integer","title":"Entry Number"},"entry_date":{"type":"string","format":"date","title":"Entry Date"},"description":{"type":"string","title":"Description"},"line_description":{"type":"string","title":"Line Description","default":""},"debit":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Debit"},"credit":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Credit"},"balance":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Balance"}},"type":"object","required":["entry_id","entry_number","entry_date","description","debit","credit","balance"],"title":"LedgerRow"},"LedgerSummary":{"properties":{"opening_balance":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Opening Balance"},"total_debit":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Debit"},"total_credit":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Credit"},"closing_balance":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Closing Balance"},"count":{"type":"integer","title":"Count"}},"type":"object","required":["opening_balance","total_debit","total_credit","closing_balance","count"],"title":"LedgerSummary"},"LoginRequest":{"properties":{"email":{"type":"string","maxLength":255,"minLength":3,"title":"Email"},"password":{"type":"string","title":"Password"},"mfa_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mfa Code"}},"type":"object","required":["email","password"],"title":"LoginRequest"},"LoginResponse":{"properties":{"access_token":{"type":"string","title":"Access Token"},"token_type":{"type":"string","title":"Token Type","default":"bearer"},"user":{"additionalProperties":true,"type":"object","title":"User"},"onboarding_required":{"type":"boolean","title":"Onboarding Required","default":false}},"type":"object","required":["access_token","user"],"title":"LoginResponse"},"LogoUploadResponse":{"properties":{"logo_url":{"type":"string","title":"Logo Url"}},"type":"object","required":["logo_url"],"title":"LogoUploadResponse"},"MatchRequest":{"properties":{"movement_id":{"type":"string","format":"uuid","title":"Movement Id"},"document_id":{"type":"string","format":"uuid","title":"Document Id"}},"type":"object","required":["movement_id","document_id"],"title":"MatchRequest"},"MeResponse":{"properties":{"tenant":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Tenant"},"user":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"User"},"role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Role"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes"},"memberships":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Memberships","default":[]},"onboarding_required":{"type":"boolean","title":"Onboarding Required","default":false},"email_verified":{"type":"boolean","title":"Email Verified","default":true}},"type":"object","required":["tenant","user","scopes"],"title":"MeResponse"},"MemberOut":{"properties":{"user_id":{"type":"string","format":"uuid","title":"User Id"},"email":{"type":"string","title":"Email"},"full_name":{"type":"string","title":"Full Name"},"role":{"type":"string","title":"Role"},"status":{"type":"string","title":"Status"},"is_self":{"type":"boolean","title":"Is Self"},"invited_by_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invited By Email"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"last_login_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Login At"}},"type":"object","required":["user_id","email","full_name","role","status","is_self","created_at"],"title":"MemberOut"},"MergeContactsBody":{"properties":{"duplicate_ids":{"items":{"type":"string","format":"uuid"},"type":"array","minItems":1,"title":"Duplicate Ids","description":"Contact ids to fold into the path's keep_id."}},"type":"object","required":["duplicate_ids"],"title":"MergeContactsBody"},"MergeContactsResponse":{"properties":{"keep_id":{"type":"string","title":"Keep Id"},"merged_ids":{"items":{"type":"string"},"type":"array","title":"Merged Ids"},"documents_moved":{"type":"integer","title":"Documents Moved"},"backfilled_vat":{"type":"boolean","title":"Backfilled Vat"},"backfilled_country":{"type":"boolean","title":"Backfilled Country"}},"type":"object","required":["keep_id","merged_ids","documents_moved","backfilled_vat","backfilled_country"],"title":"MergeContactsResponse"},"MfaActivateRequest":{"properties":{"code":{"type":"string","maxLength":10,"minLength":6,"title":"Code"}},"type":"object","required":["code"],"title":"MfaActivateRequest"},"MfaActivateResponse":{"properties":{"mfa_enabled":{"type":"boolean","title":"Mfa Enabled","default":true},"recovery_codes":{"items":{"type":"string"},"type":"array","title":"Recovery Codes"}},"type":"object","required":["recovery_codes"],"title":"MfaActivateResponse"},"MfaDisableRequest":{"properties":{"password":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Password"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"}},"type":"object","title":"MfaDisableRequest"},"MfaSetupResponse":{"properties":{"secret":{"type":"string","title":"Secret"},"otpauth_uri":{"type":"string","title":"Otpauth Uri"},"qr_data_uri":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Qr Data Uri"}},"type":"object","required":["secret","otpauth_uri"],"title":"MfaSetupResponse","description":"Returned by ``POST /auth/mfa/setup``.\n\nThe secret is persisted (encrypted) on the user but MFA is **not** yet\nenabled — the user must prove possession via ``/activate`` first. We return\nthe provisioning URI (and a QR data-uri) so the frontend can render the\nenrolment QR; ``secret`` is also returned for manual key entry."},"MfaStatusResponse":{"properties":{"mfa_enabled":{"type":"boolean","title":"Mfa Enabled"},"recovery_codes_remaining":{"type":"integer","title":"Recovery Codes Remaining","default":0}},"type":"object","required":["mfa_enabled"],"title":"MfaStatusResponse"},"MonthlyCountryItem":{"properties":{"country":{"type":"string","title":"Country"},"total":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total"},"b2b":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"B2B"},"b2c":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"B2C"}},"type":"object","required":["country","total","b2b","b2c"],"title":"MonthlyCountryItem"},"MonthlyCountryRow":{"properties":{"month":{"type":"string","title":"Month"},"label":{"type":"string","title":"Label"},"items":{"items":{"$ref":"#/components/schemas/MonthlyCountryItem"},"type":"array","title":"Items"}},"type":"object","required":["month","label","items"],"title":"MonthlyCountryRow"},"MovementCategoryAssign":{"properties":{"category_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Category Id"}},"type":"object","title":"MovementCategoryAssign"},"NumberingNextResponse":{"properties":{"series_id":{"type":"string","format":"uuid","title":"Series Id"},"number":{"type":"integer","title":"Number"},"formatted":{"type":"string","title":"Formatted"}},"type":"object","required":["series_id","number","formatted"],"title":"NumberingNextResponse","description":"Response from POST /numbering/{id}/next."},"NumberingSeriesCreate":{"properties":{"doc_type":{"type":"string","maxLength":32,"minLength":1,"title":"Doc Type"},"code":{"type":"string","maxLength":32,"minLength":1,"title":"Code"},"prefix":{"type":"string","maxLength":32,"title":"Prefix","default":""},"suffix":{"type":"string","maxLength":32,"title":"Suffix","default":""},"next_number":{"type":"integer","minimum":1.0,"title":"Next Number","default":1},"pad_length":{"type":"integer","maximum":12.0,"minimum":1.0,"title":"Pad Length","default":5},"is_default":{"type":"boolean","title":"Is Default","default":false}},"type":"object","required":["doc_type","code"],"title":"NumberingSeriesCreate"},"NumberingSeriesResponse":{"properties":{"doc_type":{"type":"string","maxLength":32,"minLength":1,"title":"Doc Type"},"code":{"type":"string","maxLength":32,"minLength":1,"title":"Code"},"prefix":{"type":"string","maxLength":32,"title":"Prefix","default":""},"suffix":{"type":"string","maxLength":32,"title":"Suffix","default":""},"next_number":{"type":"integer","minimum":1.0,"title":"Next Number","default":1},"pad_length":{"type":"integer","maximum":12.0,"minimum":1.0,"title":"Pad Length","default":5},"is_default":{"type":"boolean","title":"Is Default","default":false},"id":{"type":"string","format":"uuid","title":"Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["doc_type","code","id","created_at","updated_at"],"title":"NumberingSeriesResponse"},"NumberingSeriesUpdate":{"properties":{"doc_type":{"anyOf":[{"type":"string","maxLength":32,"minLength":1},{"type":"null"}],"title":"Doc Type"},"code":{"anyOf":[{"type":"string","maxLength":32,"minLength":1},{"type":"null"}],"title":"Code"},"prefix":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Prefix"},"suffix":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Suffix"},"next_number":{"anyOf":[{"type":"integer","minimum":1.0},{"type":"null"}],"title":"Next Number"},"pad_length":{"anyOf":[{"type":"integer","maximum":12.0,"minimum":1.0},{"type":"null"}],"title":"Pad Length"},"is_default":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Default"}},"type":"object","title":"NumberingSeriesUpdate"},"OnboardingCompleteRequest":{"properties":{"business_type":{"type":"string","pattern":"^(empresa|autonomo|asesoria)$","title":"Business Type"},"company_name":{"type":"string","maxLength":120,"minLength":2,"title":"Company Name"},"vat":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Vat"},"num_employees":{"anyOf":[{"type":"string","maxLength":8},{"type":"null"}],"title":"Num Employees"},"legal_form":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Legal Form"},"country_region":{"type":"string","maxLength":24,"title":"Country Region","default":"ES-Peninsula"},"website":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Website"}},"type":"object","required":["business_type","company_name"],"title":"OnboardingCompleteRequest"},"OnboardingCompleteResponse":{"properties":{"access_token":{"type":"string","title":"Access Token"},"token_type":{"type":"string","title":"Token Type","default":"bearer"},"tenant":{"additionalProperties":true,"type":"object","title":"Tenant"},"user":{"additionalProperties":true,"type":"object","title":"User"}},"type":"object","required":["access_token","tenant","user"],"title":"OnboardingCompleteResponse"},"OverviewCategoryRow":{"properties":{"category_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Category Id"},"name":{"type":"string","title":"Name"},"color":{"type":"string","title":"Color"},"kind":{"type":"string","title":"Kind"},"total":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total"},"count":{"type":"integer","title":"Count"},"pct_of_total":{"type":"number","title":"Pct Of Total"}},"type":"object","required":["name","color","kind","total","count","pct_of_total"],"title":"OverviewCategoryRow"},"OverviewCounterpartyRow":{"properties":{"counterparty":{"type":"string","title":"Counterparty"},"total":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total"},"count":{"type":"integer","title":"Count"}},"type":"object","required":["counterparty","total","count"],"title":"OverviewCounterpartyRow"},"OverviewKPI":{"properties":{"total_income":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Income"},"total_expense":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Expense"},"net":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Net"},"income_count":{"type":"integer","title":"Income Count"},"expense_count":{"type":"integer","title":"Expense Count"},"avg_monthly_income":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Avg Monthly Income"},"avg_monthly_expense":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Avg Monthly Expense"}},"type":"object","required":["total_income","total_expense","net","income_count","expense_count","avg_monthly_income","avg_monthly_expense"],"title":"OverviewKPI"},"OverviewMonthRow":{"properties":{"month":{"type":"string","title":"Month"},"label":{"type":"string","title":"Label"},"income":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Income"},"expense":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Expense"},"net":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Net"}},"type":"object","required":["month","label","income","expense","net"],"title":"OverviewMonthRow"},"OverviewResponse":{"properties":{"from_date":{"type":"string","format":"date","title":"From Date"},"to_date":{"type":"string","format":"date","title":"To Date"},"kpi":{"$ref":"#/components/schemas/OverviewKPI"},"months":{"items":{"$ref":"#/components/schemas/OverviewMonthRow"},"type":"array","title":"Months"},"top_expense_categories":{"items":{"$ref":"#/components/schemas/OverviewCategoryRow"},"type":"array","title":"Top Expense Categories"},"top_income_categories":{"items":{"$ref":"#/components/schemas/OverviewCategoryRow"},"type":"array","title":"Top Income Categories"},"top_expense_counterparties":{"items":{"$ref":"#/components/schemas/OverviewCounterpartyRow"},"type":"array","title":"Top Expense Counterparties"},"top_income_counterparties":{"items":{"$ref":"#/components/schemas/OverviewCounterpartyRow"},"type":"array","title":"Top Income Counterparties"},"uncategorized_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Uncategorized Amount"},"uncategorized_count":{"type":"integer","title":"Uncategorized Count"},"subscriptions":{"$ref":"#/components/schemas/OverviewSubscriptionsBlock"}},"type":"object","required":["from_date","to_date","kpi","months","top_expense_categories","top_income_categories","top_expense_counterparties","top_income_counterparties","uncategorized_amount","uncategorized_count","subscriptions"],"title":"OverviewResponse"},"OverviewSubscriptionsBlock":{"properties":{"monthly_fixed":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Monthly Fixed"},"yearly_fixed":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Yearly Fixed"},"count":{"type":"integer","title":"Count"}},"type":"object","required":["monthly_fixed","yearly_fixed","count"],"title":"OverviewSubscriptionsBlock"},"PaginatedResponse_AccountResponse_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AccountResponse"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["items","total","limit","offset"],"title":"PaginatedResponse[AccountResponse]"},"PaginatedResponse_BankMovementResponse_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/BankMovementResponse"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["items","total","limit","offset"],"title":"PaginatedResponse[BankMovementResponse]"},"PaginatedResponse_CategoryWithStats_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CategoryWithStats"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["items","total","limit","offset"],"title":"PaginatedResponse[CategoryWithStats]"},"PaginatedResponse_ContactResponse_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ContactResponse"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["items","total","limit","offset"],"title":"PaginatedResponse[ContactResponse]"},"PaginatedResponse_DocumentListItem_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/DocumentListItem"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["items","total","limit","offset"],"title":"PaginatedResponse[DocumentListItem]"},"PaginatedResponse_JournalEntryResponse_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/JournalEntryResponse"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["items","total","limit","offset"],"title":"PaginatedResponse[JournalEntryResponse]"},"PaginatedResponse_ProductResponse_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ProductResponse"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["items","total","limit","offset"],"title":"PaginatedResponse[ProductResponse]"},"PaginatedResponse_RuleResponse_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/RuleResponse"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["items","total","limit","offset"],"title":"PaginatedResponse[RuleResponse]"},"PaginatedResponse_SubscriptionResponse_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/SubscriptionResponse"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["items","total","limit","offset"],"title":"PaginatedResponse[SubscriptionResponse]"},"PaginatedResponse_TreasuryResponse_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/TreasuryResponse"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["items","total","limit","offset"],"title":"PaginatedResponse[TreasuryResponse]"},"PayPalKeyConnect":{"properties":{"client_id":{"type":"string","title":"Client Id"},"client_secret":{"type":"string","title":"Client Secret"},"mode":{"type":"string","title":"Mode","default":"live"}},"type":"object","required":["client_id","client_secret"],"title":"PayPalKeyConnect"},"PaymentCreate":{"properties":{"treasury_id":{"type":"string","format":"uuid","title":"Treasury Id"},"amount":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Amount"},"payment_date":{"type":"string","format":"date","title":"Payment Date"},"description":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Description"},"external_id":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"External Id"}},"type":"object","required":["treasury_id","amount","payment_date"],"title":"PaymentCreate"},"PaymentResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"document_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Document Id"},"treasury_id":{"type":"string","format":"uuid","title":"Treasury Id"},"amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Amount"},"payment_date":{"type":"string","format":"date","title":"Payment Date"},"description":{"type":"string","title":"Description"},"direction":{"type":"string","title":"Direction"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","document_id","treasury_id","amount","payment_date","description","direction","external_id","created_at"],"title":"PaymentResponse"},"ProductCreate":{"properties":{"sku":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Sku"},"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Description"},"unit_price":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Unit Price","default":"0"},"cost_price":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Cost Price","default":"0"},"tax_type_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Tax Type Id"},"sales_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Sales Account Id"},"purchase_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Purchase Account Id"},"is_active":{"type":"boolean","title":"Is Active","default":true}},"type":"object","required":["name"],"title":"ProductCreate"},"ProductResponse":{"properties":{"sku":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Sku"},"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Description"},"unit_price":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Unit Price","default":"0"},"cost_price":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Cost Price","default":"0"},"tax_type_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Tax Type Id"},"sales_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Sales Account Id"},"purchase_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Purchase Account Id"},"is_active":{"type":"boolean","title":"Is Active","default":true},"id":{"type":"string","format":"uuid","title":"Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["name","id","created_at","updated_at"],"title":"ProductResponse"},"ProductUpdate":{"properties":{"sku":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Sku"},"name":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Description"},"unit_price":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Unit Price"},"cost_price":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Cost Price"},"tax_type_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Tax Type Id"},"sales_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Sales Account Id"},"purchase_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Purchase Account Id"},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"}},"type":"object","title":"ProductUpdate"},"ProposeRequest":{"properties":{"movement_ids":{"anyOf":[{"items":{"type":"string","format":"uuid"},"type":"array"},{"type":"null"}],"title":"Movement Ids"},"min_confidence":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Min Confidence","default":0.5}},"type":"object","title":"ProposeRequest"},"PublicInvoiceClient":{"properties":{"name":{"type":"string","maxLength":200,"title":"Name","default":""},"legal_name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Legal Name"},"nif":{"type":"string","maxLength":32,"title":"Nif","default":""},"address":{"type":"string","maxLength":300,"title":"Address","default":""},"address_line2":{"type":"string","maxLength":300,"title":"Address Line2","default":""},"city":{"type":"string","maxLength":120,"title":"City","default":""},"postal_code":{"type":"string","maxLength":16,"title":"Postal Code","default":""},"country":{"type":"string","maxLength":2,"title":"Country","default":"ES"},"email":{"type":"string","maxLength":200,"title":"Email","default":""},"regime":{"type":"string","maxLength":24,"title":"Regime","default":"es_domestic"}},"type":"object","title":"PublicInvoiceClient"},"PublicInvoiceIssuer":{"properties":{"name":{"type":"string","maxLength":200,"title":"Name","default":""},"legal_name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Legal Name"},"nif":{"type":"string","maxLength":32,"title":"Nif","default":""},"address":{"type":"string","maxLength":300,"title":"Address","default":""},"city":{"type":"string","maxLength":120,"title":"City","default":""},"postal_code":{"type":"string","maxLength":16,"title":"Postal Code","default":""},"country":{"type":"string","maxLength":2,"title":"Country","default":"ES"},"email":{"type":"string","maxLength":200,"title":"Email","default":""},"phone":{"type":"string","maxLength":40,"title":"Phone","default":""},"website":{"type":"string","maxLength":200,"title":"Website","default":""},"iban":{"type":"string","maxLength":40,"title":"Iban","default":""},"bic":{"type":"string","maxLength":16,"title":"Bic","default":""},"brand_color":{"anyOf":[{"type":"string","maxLength":9},{"type":"null"}],"title":"Brand Color"}},"type":"object","title":"PublicInvoiceIssuer"},"PublicInvoiceLine":{"properties":{"description":{"type":"string","maxLength":400,"title":"Description","default":""},"quantity":{"anyOf":[{"type":"number","maximum":1000000.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Quantity","default":"1"},"unit_price":{"anyOf":[{"type":"number","maximum":10000000.0,"minimum":-1000000.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Unit Price","default":"0"},"discount_pct":{"anyOf":[{"type":"number","maximum":100.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Discount Pct","default":"0"},"tax_rate":{"anyOf":[{"type":"number","maximum":100.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Tax Rate","default":"21"}},"type":"object","title":"PublicInvoiceLine"},"PublicInvoiceParseRequest":{"properties":{"text":{"type":"string","maxLength":2000,"minLength":3,"title":"Text"},"lang":{"type":"string","maxLength":2,"title":"Lang","default":"es"}},"type":"object","required":["text"],"title":"PublicInvoiceParseRequest","description":"Natural-language description → structured invoice fields (AI)."},"PublicInvoiceRequest":{"properties":{"issuer":{"$ref":"#/components/schemas/PublicInvoiceIssuer","default":{"name":"","nif":"","address":"","city":"","postal_code":"","country":"ES","email":"","phone":"","website":"","iban":"","bic":""}},"client":{"$ref":"#/components/schemas/PublicInvoiceClient","default":{"name":"","nif":"","address":"","address_line2":"","city":"","postal_code":"","country":"ES","email":"","regime":"es_domestic"}},"lines":{"items":{"$ref":"#/components/schemas/PublicInvoiceLine"},"type":"array","maxItems":50,"title":"Lines"},"doc_number":{"type":"string","maxLength":64,"title":"Doc Number","default":""},"doc_date":{"type":"string","maxLength":10,"title":"Doc Date","default":""},"due_date":{"type":"string","maxLength":10,"title":"Due Date","default":""},"irpf_pct":{"anyOf":[{"type":"number","maximum":100.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Irpf Pct","default":"0"},"recargo_equivalencia":{"type":"boolean","title":"Recargo Equivalencia","default":false},"notes":{"type":"string","maxLength":2000,"title":"Notes","default":""},"footer":{"type":"string","maxLength":500,"title":"Footer","default":""},"currency":{"type":"string","maxLength":3,"title":"Currency","default":"EUR"},"template":{"type":"string","maxLength":16,"title":"Template","default":"classic"},"lang":{"type":"string","maxLength":2,"title":"Lang","default":"es"}},"type":"object","title":"PublicInvoiceRequest"},"PublicInvoiceView":{"properties":{"doc_number":{"type":"string","title":"Doc Number"},"doc_date":{"type":"string","title":"Doc Date"},"total":{"type":"string","title":"Total"},"currency":{"type":"string","title":"Currency"},"eur_total":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Eur Total"},"eur_currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Eur Currency"},"fx_rate":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fx Rate"},"status":{"type":"string","title":"Status"},"issuer_name":{"type":"string","title":"Issuer Name"},"issuer_nif":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Issuer Nif"},"issuer_brand_color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Issuer Brand Color"},"issuer_logo_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Issuer Logo Url"},"customer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Name"},"customer_language":{"type":"string","title":"Customer Language"},"pdf_url":{"type":"string","title":"Pdf Url"}},"type":"object","required":["doc_number","doc_date","total","currency","status","issuer_name","issuer_nif","issuer_brand_color","issuer_logo_url","customer_name","customer_language","pdf_url"],"title":"PublicInvoiceView","description":"Read-only invoice projection for the public viewer page."},"QuickCreateRequest":{"properties":{"email":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}],"title":"Email"},"full_name":{"type":"string","maxLength":120,"minLength":2,"title":"Full Name"},"role":{"type":"string","title":"Role","default":"viewer"},"password":{"anyOf":[{"type":"string","maxLength":200,"minLength":8},{"type":"null"}],"title":"Password"},"send_email":{"type":"boolean","title":"Send Email","default":false}},"type":"object","required":["full_name"],"title":"QuickCreateRequest","description":"Create a user directly without sending an email invitation.\n\nUse when the admin wants a \"placeholder\" user (e.g. an assistant who\ndoesn't have email but needs read-only access) or wants to share\ncredentials out-of-band. If `email` is omitted, a stable placeholder\naddress is generated under the `*.aikount.local` namespace."},"QuickCreateResponse":{"properties":{"user_id":{"type":"string","format":"uuid","title":"User Id"},"email":{"type":"string","title":"Email"},"full_name":{"type":"string","title":"Full Name"},"role":{"type":"string","title":"Role"},"temp_password":{"type":"string","title":"Temp Password"}},"type":"object","required":["user_id","email","full_name","role","temp_password"],"title":"QuickCreateResponse"},"ReconcileAgainstAccountRequest":{"properties":{"movement_ids":{"items":{"type":"string","format":"uuid"},"type":"array","minItems":1,"title":"Movement Ids"},"target_account_id":{"type":"string","format":"uuid","title":"Target Account Id"},"description":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Description"},"date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Date"}},"type":"object","required":["movement_ids","target_account_id"],"title":"ReconcileAgainstAccountRequest"},"ReconcileAgainstDocumentRequest":{"properties":{"movement_id":{"type":"string","format":"uuid","title":"Movement Id"},"document_id":{"type":"string","format":"uuid","title":"Document Id"},"amount":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Amount"}},"type":"object","required":["movement_id","document_id"],"title":"ReconcileAgainstDocumentRequest"},"ReconciliationMini":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"method":{"type":"string","title":"Method"},"amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Amount"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"payment_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Payment Id"},"document_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Document Id"},"account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Account Id"},"rule_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Rule Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"doc_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Doc Number"},"doc_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Doc Type"},"attachment_filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Attachment Filename"},"account_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Number"},"account_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Name"}},"type":"object","required":["id","method","amount","created_at"],"title":"ReconciliationMini"},"ReconciliationResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"movement_id":{"type":"string","format":"uuid","title":"Movement Id"},"method":{"type":"string","title":"Method"},"payment_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Payment Id"},"document_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Document Id"},"account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Account Id"},"rule_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Rule Id"},"amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Amount"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","movement_id","method","payment_id","document_id","account_id","rule_id","amount","description","created_at","updated_at"],"title":"ReconciliationResponse"},"RectifyRequest":{"properties":{"reason":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Reason"}},"type":"object","title":"RectifyRequest"},"RecurringCandidate":{"properties":{"counterparty":{"type":"string","title":"Counterparty"},"name_guess":{"type":"string","title":"Name Guess"},"amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Amount"},"currency":{"type":"string","title":"Currency","default":"EUR"},"cadence":{"type":"string","enum":["weekly","monthly","quarterly","yearly"],"title":"Cadence"},"occurrences":{"type":"integer","title":"Occurrences"},"first_seen":{"type":"string","format":"date","title":"First Seen"},"last_seen":{"type":"string","format":"date","title":"Last Seen"},"confidence":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Confidence"},"sample_movement_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Sample Movement Ids"},"category_id_guess":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Category Id Guess"},"category_name_guess":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category Name Guess"}},"type":"object","required":["counterparty","name_guess","amount","cadence","occurrences","first_seen","last_seen","confidence","sample_movement_ids"],"title":"RecurringCandidate"},"RegimeRow":{"properties":{"regime":{"type":"string","enum":["es_domestic","eu_b2b_reverse_charge","eu_b2c_oss","export_non_eu","unknown"],"title":"Regime"},"total":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total"},"doc_count":{"type":"integer","title":"Doc Count"},"vat_collected":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Vat Collected"},"aeat_model":{"type":"string","enum":["303","349","369","303-export"],"title":"Aeat Model"}},"type":"object","required":["regime","total","doc_count","vat_collected","aeat_model"],"title":"RegimeRow"},"RegisterRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"},"full_name":{"type":"string","maxLength":120,"minLength":2,"title":"Full Name"},"password":{"type":"string","maxLength":200,"minLength":8,"title":"Password"},"accepted_terms":{"type":"boolean","title":"Accepted Terms","description":"Must be true: the user accepted the Terms of Service and Privacy Policy."}},"type":"object","required":["email","full_name","password","accepted_terms"],"title":"RegisterRequest"},"RegisterResponse":{"properties":{"access_token":{"type":"string","title":"Access Token"},"token_type":{"type":"string","title":"Token Type","default":"bearer"},"user":{"additionalProperties":true,"type":"object","title":"User"},"onboarding_required":{"type":"boolean","title":"Onboarding Required","default":true}},"type":"object","required":["access_token","user"],"title":"RegisterResponse"},"ResendVerificationRequest":{"properties":{},"type":"object","title":"ResendVerificationRequest"},"ResetPasswordRequest":{"properties":{"token":{"type":"string","title":"Token"},"new_password":{"type":"string","maxLength":200,"minLength":8,"title":"New Password"}},"type":"object","required":["token","new_password"],"title":"ResetPasswordRequest"},"RestoreResult":{"properties":{"entry_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Entry Id"},"entity_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entity Type"},"entity_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entity Id"},"operation":{"type":"string","title":"Operation"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["operation"],"title":"RestoreResult","description":"Outcome of one restore action."},"RuleCreate":{"properties":{"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"treasury_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Treasury Id"},"treasury_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Treasury Ids"},"transaction_sign":{"type":"string","title":"Transaction Sign","default":"any"},"description_contains":{"items":{"type":"string"},"type":"array","title":"Description Contains"},"raw_type_in":{"items":{"type":"string"},"type":"array","title":"Raw Type In"},"min_amount":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Min Amount"},"max_amount":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Max Amount"},"action_type":{"type":"string","maxLength":32,"title":"Action Type","default":"account"},"target_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Target Account Id"},"target_category_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Target Category Id"},"automatic":{"type":"boolean","title":"Automatic","default":false},"priority":{"type":"integer","title":"Priority","default":100},"is_active":{"type":"boolean","title":"Is Active","default":true}},"type":"object","required":["name"],"title":"RuleCreate"},"RuleExecuteAllItem":{"properties":{"rule_id":{"type":"string","format":"uuid","title":"Rule Id"},"rule_name":{"type":"string","title":"Rule Name"},"applied":{"type":"integer","title":"Applied"},"skipped":{"type":"integer","title":"Skipped"},"ambiguous":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Ambiguous"}},"type":"object","required":["rule_id","rule_name","applied","skipped"],"title":"RuleExecuteAllItem"},"RuleExecuteAllResponse":{"properties":{"rules":{"items":{"$ref":"#/components/schemas/RuleExecuteAllItem"},"type":"array","title":"Rules"},"total_applied":{"type":"integer","title":"Total Applied"}},"type":"object","required":["rules","total_applied"],"title":"RuleExecuteAllResponse"},"RuleExecuteResponse":{"properties":{"applied":{"type":"integer","title":"Applied"},"skipped":{"type":"integer","title":"Skipped"},"ambiguous":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Ambiguous"}},"type":"object","required":["applied","skipped"],"title":"RuleExecuteResponse"},"RuleMatch":{"properties":{"movement_id":{"type":"string","format":"uuid","title":"Movement Id"},"amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Amount"},"description":{"type":"string","title":"Description"},"value_date":{"type":"string","format":"date","title":"Value Date"}},"type":"object","required":["movement_id","amount","description","value_date"],"title":"RuleMatch"},"RuleResponse":{"properties":{"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"treasury_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Treasury Id"},"treasury_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Treasury Ids"},"transaction_sign":{"type":"string","title":"Transaction Sign","default":"any"},"description_contains":{"items":{"type":"string"},"type":"array","title":"Description Contains"},"raw_type_in":{"items":{"type":"string"},"type":"array","title":"Raw Type In"},"min_amount":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Min Amount"},"max_amount":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Max Amount"},"action_type":{"type":"string","maxLength":32,"title":"Action Type","default":"account"},"target_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Target Account Id"},"target_category_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Target Category Id"},"automatic":{"type":"boolean","title":"Automatic","default":false},"priority":{"type":"integer","title":"Priority","default":100},"is_active":{"type":"boolean","title":"Is Active","default":true},"id":{"type":"string","format":"uuid","title":"Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["name","id","created_at","updated_at"],"title":"RuleResponse"},"RuleScanAllItem":{"properties":{"rule_id":{"type":"string","format":"uuid","title":"Rule Id"},"rule_name":{"type":"string","title":"Rule Name"},"matches":{"items":{"$ref":"#/components/schemas/RuleMatch"},"type":"array","title":"Matches"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["rule_id","rule_name","matches","total"],"title":"RuleScanAllItem"},"RuleScanAllResponse":{"properties":{"rules":{"items":{"$ref":"#/components/schemas/RuleScanAllItem"},"type":"array","title":"Rules"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["rules","total"],"title":"RuleScanAllResponse"},"RuleScanResponse":{"properties":{"matches":{"items":{"$ref":"#/components/schemas/RuleMatch"},"type":"array","title":"Matches"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["matches","total"],"title":"RuleScanResponse"},"RuleSuggestionAcceptResponse":{"properties":{"rule_id":{"type":"string","format":"uuid","title":"Rule Id"},"category_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Category Id"},"created_category":{"type":"boolean","title":"Created Category","default":false}},"type":"object","required":["rule_id"],"title":"RuleSuggestionAcceptResponse"},"RuleSuggestionGenerateResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/RuleSuggestionResponse"},"type":"array","title":"Items"},"scanned":{"type":"integer","title":"Scanned","default":0},"clusters":{"type":"integer","title":"Clusters","default":0},"created":{"type":"integer","title":"Created","default":0},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["items"],"title":"RuleSuggestionGenerateResponse"},"RuleSuggestionListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/RuleSuggestionResponse"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["items","total"],"title":"RuleSuggestionListResponse"},"RuleSuggestionResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"description_contains":{"items":{"type":"string"},"type":"array","title":"Description Contains"},"category_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Category Id"},"category_name_proposed":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category Name Proposed"},"sign":{"type":"string","title":"Sign"},"confidence":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Confidence"},"rationale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rationale"},"sample_movement_ids":{"items":{"type":"string"},"type":"array","title":"Sample Movement Ids"},"sample_count":{"type":"integer","title":"Sample Count","default":0},"status":{"type":"string","title":"Status"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","sign","confidence","status","created_at"],"title":"RuleSuggestionResponse"},"RuleUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":120,"minLength":1},{"type":"null"}],"title":"Name"},"treasury_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Treasury Id"},"treasury_ids":{"anyOf":[{"items":{"type":"string","format":"uuid"},"type":"array"},{"type":"null"}],"title":"Treasury Ids"},"transaction_sign":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transaction Sign"},"description_contains":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Description Contains"},"raw_type_in":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Raw Type In"},"min_amount":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Min Amount"},"max_amount":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Max Amount"},"action_type":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Action Type"},"target_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Target Account Id"},"target_category_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Target Category Id"},"automatic":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Automatic"},"priority":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Priority"},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"}},"type":"object","title":"RuleUpdate"},"SharedInvoiceSummary":{"properties":{"invoice_id":{"type":"string","title":"Invoice Id"},"doc_number":{"type":"string","title":"Doc Number"},"doc_date":{"type":"string","title":"Doc Date"},"total":{"type":"string","title":"Total"},"currency":{"type":"string","title":"Currency"},"url":{"type":"string","title":"Url"},"eur_total":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Eur Total"},"eur_currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Eur Currency"},"fx_rate":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fx Rate"}},"type":"object","required":["invoice_id","doc_number","doc_date","total","currency","url"],"title":"SharedInvoiceSummary","description":"One line in the bulk-email confirmation response.\n\n``total`` / ``currency`` are the *operation* currency the customer paid in\n(USD for a USD subscription); ``eur_*`` carry the EUR equivalent + FX rate\nand are only present on foreign-currency invoices."},"SourceDocRef":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"doc_number":{"type":"string","title":"Doc Number"},"doc_type":{"type":"string","title":"Doc Type"}},"type":"object","required":["id","doc_number","doc_type"],"title":"SourceDocRef","description":"Resolved reference to a source document in the pre-sales chain.\n\nLets the UI render \"Generado desde PRE-2026-0012\" with a real, clickable\nnumber instead of an opaque UUID. Only populated on full detail responses\n(``DocumentResponse``); list endpoints stay light and expose the raw ids."},"StatementImportBatch":{"properties":{"batch_id":{"type":"string","format":"uuid","title":"Batch Id"},"treasury_id":{"type":"string","format":"uuid","title":"Treasury Id"},"filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Filename"},"count":{"type":"integer","title":"Count"},"total":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total"},"first_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"First Date"},"last_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Last Date"},"imported_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Imported At"},"reconciled_count":{"type":"integer","title":"Reconciled Count","default":0}},"type":"object","required":["batch_id","treasury_id","count","total"],"title":"StatementImportBatch","description":"One statement upload (extracto), grouping the movements it created."},"StripeApiKeyConnect":{"properties":{"api_key":{"type":"string","title":"Api Key"}},"type":"object","required":["api_key"],"title":"StripeApiKeyConnect"},"SubscriptionCreate":{"properties":{"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"vendor":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Vendor"},"counterparty_pattern":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Counterparty Pattern"},"amount":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Amount"},"currency":{"type":"string","maxLength":3,"minLength":3,"title":"Currency","default":"EUR"},"cadence":{"type":"string","enum":["weekly","monthly","quarterly","yearly"],"title":"Cadence","default":"monthly"},"treasury_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Treasury Id"},"category_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Category Id"},"started_on":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Started On"},"next_charge_at":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Next Charge At"},"is_active":{"type":"boolean","title":"Is Active","default":true},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Notes"}},"type":"object","required":["name","amount"],"title":"SubscriptionCreate"},"SubscriptionCreateResponse":{"properties":{"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"vendor":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Vendor"},"counterparty_pattern":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Counterparty Pattern"},"amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Amount"},"currency":{"type":"string","maxLength":3,"minLength":3,"title":"Currency","default":"EUR"},"cadence":{"type":"string","enum":["weekly","monthly","quarterly","yearly"],"title":"Cadence","default":"monthly"},"treasury_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Treasury Id"},"category_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Category Id"},"started_on":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Started On"},"next_charge_at":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Next Charge At"},"is_active":{"type":"boolean","title":"Is Active","default":true},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Notes"},"id":{"type":"string","format":"uuid","title":"Id"},"auto_detected":{"type":"boolean","title":"Auto Detected","default":false},"detection_confidence":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Detection Confidence"},"cancelled_on":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Cancelled On"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"linked_movements":{"type":"integer","title":"Linked Movements","default":0}},"type":"object","required":["name","amount","id","created_at","updated_at"],"title":"SubscriptionCreateResponse","description":"Sibling of SubscriptionResponse that also reports how many existing\nmovements were linked to the new subscription as a side-effect."},"SubscriptionDetailResponse":{"properties":{"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"vendor":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Vendor"},"counterparty_pattern":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Counterparty Pattern"},"amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Amount"},"currency":{"type":"string","maxLength":3,"minLength":3,"title":"Currency","default":"EUR"},"cadence":{"type":"string","enum":["weekly","monthly","quarterly","yearly"],"title":"Cadence","default":"monthly"},"treasury_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Treasury Id"},"category_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Category Id"},"started_on":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Started On"},"next_charge_at":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Next Charge At"},"is_active":{"type":"boolean","title":"Is Active","default":true},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Notes"},"id":{"type":"string","format":"uuid","title":"Id"},"auto_detected":{"type":"boolean","title":"Auto Detected","default":false},"detection_confidence":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Detection Confidence"},"cancelled_on":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Cancelled On"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"movements_count":{"type":"integer","title":"Movements Count","default":0},"last_charge_at":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Last Charge At"}},"type":"object","required":["name","amount","id","created_at","updated_at"],"title":"SubscriptionDetailResponse","description":"Single-subscription view with computed extras."},"SubscriptionResponse":{"properties":{"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"vendor":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Vendor"},"counterparty_pattern":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Counterparty Pattern"},"amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Amount"},"currency":{"type":"string","maxLength":3,"minLength":3,"title":"Currency","default":"EUR"},"cadence":{"type":"string","enum":["weekly","monthly","quarterly","yearly"],"title":"Cadence","default":"monthly"},"treasury_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Treasury Id"},"category_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Category Id"},"started_on":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Started On"},"next_charge_at":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Next Charge At"},"is_active":{"type":"boolean","title":"Is Active","default":true},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Notes"},"id":{"type":"string","format":"uuid","title":"Id"},"auto_detected":{"type":"boolean","title":"Auto Detected","default":false},"detection_confidence":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Detection Confidence"},"cancelled_on":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Cancelled On"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["name","amount","id","created_at","updated_at"],"title":"SubscriptionResponse"},"SubscriptionUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":120,"minLength":1},{"type":"null"}],"title":"Name"},"vendor":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Vendor"},"counterparty_pattern":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Counterparty Pattern"},"amount":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Amount"},"currency":{"anyOf":[{"type":"string","maxLength":3,"minLength":3},{"type":"null"}],"title":"Currency"},"cadence":{"anyOf":[{"type":"string","enum":["weekly","monthly","quarterly","yearly"]},{"type":"null"}],"title":"Cadence"},"treasury_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Treasury Id"},"category_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Category Id"},"started_on":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Started On"},"next_charge_at":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Next Charge At"},"cancelled_on":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Cancelled On"},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"},"auto_detected":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Auto Detected"},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Notes"}},"type":"object","title":"SubscriptionUpdate"},"SubscriptionsSummary":{"properties":{"total_monthly_eur":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Monthly Eur"},"total_yearly_eur":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Yearly Eur"},"active_count":{"type":"integer","title":"Active Count"},"by_category":{"items":{"$ref":"#/components/schemas/SummaryByCategory"},"type":"array","title":"By Category","default":[]},"next_charges":{"items":{"$ref":"#/components/schemas/SummaryNextCharge"},"type":"array","title":"Next Charges","default":[]}},"type":"object","required":["total_monthly_eur","total_yearly_eur","active_count"],"title":"SubscriptionsSummary"},"SummaryByCategory":{"properties":{"category_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Category Id"},"category_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category Name"},"monthly":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Monthly"}},"type":"object","required":["monthly"],"title":"SummaryByCategory"},"SummaryNextCharge":{"properties":{"subscription_id":{"type":"string","format":"uuid","title":"Subscription Id"},"name":{"type":"string","title":"Name"},"amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Amount"},"date":{"type":"string","format":"date","title":"Date"}},"type":"object","required":["subscription_id","name","amount","date"],"title":"SummaryNextCharge"},"SwitchTenantRequest":{"properties":{"tenant_id":{"type":"string","format":"uuid","title":"Tenant Id"}},"type":"object","required":["tenant_id"],"title":"SwitchTenantRequest"},"TaxAnalyticsResponse":{"properties":{"from_date":{"type":"string","format":"date","title":"From Date"},"to_date":{"type":"string","format":"date","title":"To Date"},"total_sales":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Sales"},"total_vat_collected":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Vat Collected"},"b2b_total":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"B2B Total"},"b2c_total":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"B2C Total"},"by_country":{"items":{"$ref":"#/components/schemas/CountryRow"},"type":"array","title":"By Country"},"by_regime":{"items":{"$ref":"#/components/schemas/RegimeRow"},"type":"array","title":"By Regime"},"by_month":{"items":{"$ref":"#/components/schemas/MonthlyCountryRow"},"type":"array","title":"By Month"},"top_eu_oss_countries":{"items":{"$ref":"#/components/schemas/CountryRow"},"type":"array","title":"Top Eu Oss Countries"},"top_intra_eu_b2b":{"items":{"$ref":"#/components/schemas/CountryRow"},"type":"array","title":"Top Intra Eu B2B"},"top_intra_eu_acquisitions":{"items":{"$ref":"#/components/schemas/CountryRow"},"type":"array","title":"Top Intra Eu Acquisitions","default":[]},"exports_total":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Exports Total"},"suggestions":{"items":{"type":"string"},"type":"array","title":"Suggestions"}},"type":"object","required":["from_date","to_date","total_sales","total_vat_collected","b2b_total","b2c_total","by_country","by_regime","by_month","top_eu_oss_countries","top_intra_eu_b2b","exports_total","suggestions"],"title":"TaxAnalyticsResponse"},"TaxFilingResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"model_code":{"type":"string","title":"Model Code"},"year":{"type":"integer","title":"Year"},"quarter":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Quarter"},"filed_at":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Filed At"},"reference":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reference"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"attachment_filename":{"type":"string","title":"Attachment Filename"},"uploaded_by_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Uploaded By Name"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","model_code","year","attachment_filename","created_at"],"title":"TaxFilingResponse"},"TaxFilingUpdate":{"properties":{"filed_at":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Filed At"},"reference":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Reference"},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Notes"}},"type":"object","title":"TaxFilingUpdate","description":"Editable metadata. The attached file itself is immutable once uploaded —\nupload a new document instead."},"TaxSuggestionResponse":{"properties":{"tax_type_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Tax Type Id"},"tax_type_code":{"type":"string","title":"Tax Type Code"},"regime":{"type":"string","title":"Regime"},"legal_mention":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Legal Mention"}},"type":"object","required":["tax_type_id","tax_type_code","regime"],"title":"TaxSuggestionResponse"},"TaxTypeCreate":{"properties":{"code":{"type":"string","maxLength":32,"minLength":1,"title":"Code"},"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"rate":{"anyOf":[{"type":"number","maximum":30.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Rate","default":"0"},"re_rate":{"anyOf":[{"type":"number","maximum":30.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Re Rate","default":"0"},"kind":{"type":"string","maxLength":32,"title":"Kind","default":"standard"},"applies_to":{"type":"string","enum":["purchase","sale","both"],"title":"Applies To","default":"both"},"output_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Output Account Id"},"input_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Input Account Id"},"is_active":{"type":"boolean","title":"Is Active","default":true}},"type":"object","required":["code","name"],"title":"TaxTypeCreate"},"TaxTypeResponse":{"properties":{"code":{"type":"string","maxLength":32,"minLength":1,"title":"Code"},"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"rate":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Rate","default":"0"},"re_rate":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Re Rate","default":"0"},"kind":{"type":"string","maxLength":32,"title":"Kind","default":"standard"},"applies_to":{"type":"string","enum":["purchase","sale","both"],"title":"Applies To","default":"both"},"output_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Output Account Id"},"input_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Input Account Id"},"is_active":{"type":"boolean","title":"Is Active","default":true},"id":{"type":"string","format":"uuid","title":"Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["code","name","id","created_at","updated_at"],"title":"TaxTypeResponse"},"TaxTypeUpdate":{"properties":{"code":{"anyOf":[{"type":"string","maxLength":32,"minLength":1},{"type":"null"}],"title":"Code"},"name":{"anyOf":[{"type":"string","maxLength":120,"minLength":1},{"type":"null"}],"title":"Name"},"rate":{"anyOf":[{"type":"number","maximum":30.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Rate"},"re_rate":{"anyOf":[{"type":"number","maximum":30.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Re Rate"},"kind":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Kind"},"applies_to":{"anyOf":[{"type":"string","enum":["purchase","sale","both"]},{"type":"null"}],"title":"Applies To"},"output_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Output Account Id"},"input_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Input Account Id"},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"}},"type":"object","title":"TaxTypeUpdate"},"TenantMe":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"name":{"type":"string","title":"Name"},"vat":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vat"},"nif":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Nif"},"legal_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Legal Name"},"fiscal_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fiscal Address"},"city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"City"},"postal_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Postal Code"},"country":{"type":"string","title":"Country","default":"ES"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website"},"iban":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Iban"},"bic":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Bic"},"logo_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Logo Url"},"brand_color":{"type":"string","title":"Brand Color","default":"#10b981"},"invoice_footer":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Footer"},"invoice_payment_terms_days":{"type":"integer","title":"Invoice Payment Terms Days","default":30},"invoice_default_notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Default Notes"},"invoice_template":{"type":"string","title":"Invoice Template","default":"classic"},"currency":{"type":"string","title":"Currency","default":"EUR"},"locale":{"type":"string","title":"Locale","default":"es-ES"},"ai_model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ai Model"},"is_rate":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Is Rate","default":"25.00"},"is_reduced_first_years":{"type":"boolean","title":"Is Reduced First Years","default":false},"is_company_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Is Company Type"},"founding_year":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Founding Year"},"entity_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entity Type"},"stripe_connected":{"type":"boolean","title":"Stripe Connected","default":false}},"type":"object","required":["id","name"],"title":"TenantMe","description":"Full tenant payload returned by GET /tenants/me."},"TenantUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":120,"minLength":1},{"type":"null"}],"title":"Name"},"vat":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Vat"},"nif":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Nif"},"legal_name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Legal Name"},"fiscal_address":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Fiscal Address"},"city":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"City"},"postal_code":{"anyOf":[{"type":"string","maxLength":16},{"type":"null"}],"title":"Postal Code"},"country":{"anyOf":[{"type":"string","maxLength":2,"minLength":2},{"type":"null"}],"title":"Country"},"phone":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Phone"},"email":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Email"},"website":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Website"},"iban":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Iban"},"bic":{"anyOf":[{"type":"string","maxLength":16},{"type":"null"}],"title":"Bic"},"brand_color":{"anyOf":[{"type":"string","maxLength":9,"minLength":4},{"type":"null"}],"title":"Brand Color"},"invoice_footer":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Invoice Footer"},"invoice_payment_terms_days":{"anyOf":[{"type":"integer","maximum":365.0,"minimum":0.0},{"type":"null"}],"title":"Invoice Payment Terms Days"},"invoice_default_notes":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Invoice Default Notes"},"invoice_template":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Invoice Template"},"currency":{"anyOf":[{"type":"string","maxLength":3,"minLength":3},{"type":"null"}],"title":"Currency"},"locale":{"anyOf":[{"type":"string","maxLength":8},{"type":"null"}],"title":"Locale"},"ai_model":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Ai Model"},"is_rate":{"anyOf":[{"type":"number","maximum":100.0,"minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d{0,2}0*$"},{"type":"null"}],"title":"Is Rate"},"is_reduced_first_years":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Reduced First Years"},"is_company_type":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Is Company Type"},"founding_year":{"anyOf":[{"type":"integer","maximum":2100.0,"minimum":1900.0},{"type":"null"}],"title":"Founding Year"},"entity_type":{"anyOf":[{"type":"string","maxLength":16},{"type":"null"}],"title":"Entity Type"}},"type":"object","title":"TenantUpdate","description":"Editable subset for PATCH /tenants/me.\n\nAny field omitted is left untouched. `nif` is accepted as an alias of\n`vat` for client convenience."},"TreasuryCreate":{"properties":{"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"kind":{"type":"string","maxLength":32,"title":"Kind","default":"bank"},"iban":{"anyOf":[{"type":"string","maxLength":34},{"type":"null"}],"title":"Iban"},"bic":{"anyOf":[{"type":"string","maxLength":16},{"type":"null"}],"title":"Bic"},"currency":{"type":"string","maxLength":3,"minLength":3,"title":"Currency","default":"EUR"},"accounting_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Accounting Account Id"},"income_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Income Account Id"},"fee_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Fee Account Id"},"gateway_provider":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Gateway Provider"},"gateway_account_ref":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Gateway Account Ref"},"opening_balance":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Opening Balance","description":"Saldo inicial del extracto, anterior al primer movimiento importado. El saldo mostrado = opening_balance + suma de movimientos.","default":"0"},"is_active":{"type":"boolean","title":"Is Active","default":true}},"type":"object","required":["name"],"title":"TreasuryCreate"},"TreasuryDetailResponse":{"properties":{"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"kind":{"type":"string","maxLength":32,"title":"Kind","default":"bank"},"iban":{"anyOf":[{"type":"string","maxLength":34},{"type":"null"}],"title":"Iban"},"bic":{"anyOf":[{"type":"string","maxLength":16},{"type":"null"}],"title":"Bic"},"currency":{"type":"string","maxLength":3,"minLength":3,"title":"Currency","default":"EUR"},"accounting_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Accounting Account Id"},"income_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Income Account Id"},"fee_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Fee Account Id"},"gateway_provider":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Gateway Provider"},"gateway_account_ref":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Gateway Account Ref"},"opening_balance":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Opening Balance","description":"Saldo inicial del extracto, anterior al primer movimiento importado. El saldo mostrado = opening_balance + suma de movimientos.","default":"0"},"is_active":{"type":"boolean","title":"Is Active","default":true},"id":{"type":"string","format":"uuid","title":"Id"},"provider":{"type":"string","title":"Provider","default":"manual"},"last_sync_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Sync At"},"last_sync_started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Sync Started At"},"sync_status":{"type":"string","title":"Sync Status","default":"idle"},"last_sync_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Sync Error"},"sync_progress":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Sync Progress"},"live_balance_available":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Live Balance Available"},"live_balance_pending":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Live Balance Pending"},"live_balance_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Live Balance At"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"balance":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Balance"},"pending_count":{"type":"integer","title":"Pending Count"},"reconciled_count":{"type":"integer","title":"Reconciled Count"}},"type":"object","required":["name","id","created_at","updated_at","balance","pending_count","reconciled_count"],"title":"TreasuryDetailResponse","description":"Treasury with computed fields."},"TreasuryResponse":{"properties":{"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"kind":{"type":"string","maxLength":32,"title":"Kind","default":"bank"},"iban":{"anyOf":[{"type":"string","maxLength":34},{"type":"null"}],"title":"Iban"},"bic":{"anyOf":[{"type":"string","maxLength":16},{"type":"null"}],"title":"Bic"},"currency":{"type":"string","maxLength":3,"minLength":3,"title":"Currency","default":"EUR"},"accounting_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Accounting Account Id"},"income_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Income Account Id"},"fee_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Fee Account Id"},"gateway_provider":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Gateway Provider"},"gateway_account_ref":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Gateway Account Ref"},"opening_balance":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Opening Balance","description":"Saldo inicial del extracto, anterior al primer movimiento importado. El saldo mostrado = opening_balance + suma de movimientos.","default":"0"},"is_active":{"type":"boolean","title":"Is Active","default":true},"id":{"type":"string","format":"uuid","title":"Id"},"provider":{"type":"string","title":"Provider","default":"manual"},"last_sync_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Sync At"},"last_sync_started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Sync Started At"},"sync_status":{"type":"string","title":"Sync Status","default":"idle"},"last_sync_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Sync Error"},"sync_progress":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Sync Progress"},"live_balance_available":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Live Balance Available"},"live_balance_pending":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Live Balance Pending"},"live_balance_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Live Balance At"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["name","id","created_at","updated_at"],"title":"TreasuryResponse"},"TreasuryUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":120,"minLength":1},{"type":"null"}],"title":"Name"},"kind":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Kind"},"iban":{"anyOf":[{"type":"string","maxLength":34},{"type":"null"}],"title":"Iban"},"bic":{"anyOf":[{"type":"string","maxLength":16},{"type":"null"}],"title":"Bic"},"currency":{"anyOf":[{"type":"string","maxLength":3,"minLength":3},{"type":"null"}],"title":"Currency"},"accounting_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Accounting Account Id"},"income_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Income Account Id"},"fee_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Fee Account Id"},"gateway_provider":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Gateway Provider"},"gateway_account_ref":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Gateway Account Ref"},"opening_balance":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Opening Balance"},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"}},"type":"object","title":"TreasuryUpdate"},"TrialBalanceResponse":{"properties":{"at_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"At Date"},"accounts":{"items":{"$ref":"#/components/schemas/TrialBalanceRow"},"type":"array","title":"Accounts"},"total_debit":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Debit"},"total_credit":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Credit"}},"type":"object","required":["accounts","total_debit","total_credit"],"title":"TrialBalanceResponse"},"TrialBalanceRow":{"properties":{"account_id":{"type":"string","format":"uuid","title":"Account Id"},"account_number":{"type":"string","title":"Account Number"},"name":{"type":"string","title":"Name"},"debit":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Debit"},"credit":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Credit"},"balance":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Balance"}},"type":"object","required":["account_id","account_number","name","debit","credit","balance"],"title":"TrialBalanceRow"},"UpdateMemberRequest":{"properties":{"role":{"type":"string","title":"Role"}},"type":"object","required":["role"],"title":"UpdateMemberRequest"},"UrlResponse":{"properties":{"url":{"type":"string","title":"Url"}},"type":"object","required":["url"],"title":"UrlResponse"},"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"},"VerifactuPreview":{"properties":{"tipo_factura":{"type":"string","title":"Tipo Factura"},"num_serie":{"type":"string","title":"Num Serie"},"cuota_total":{"type":"string","title":"Cuota Total"},"importe_total":{"type":"string","title":"Importe Total"},"huella":{"type":"string","title":"Huella"},"huella_previa":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Huella Previa"},"huella_string":{"type":"string","title":"Huella String"},"registro_xml":{"type":"string","title":"Registro Xml"},"qr_url":{"type":"string","title":"Qr Url"},"would_chain_index":{"type":"integer","title":"Would Chain Index"}},"type":"object","required":["tipo_factura","num_serie","cuota_total","importe_total","huella","huella_string","registro_xml","qr_url","would_chain_index"],"title":"VerifactuPreview"},"VerifactuRecordOut":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"document_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Document Id"},"tipo":{"type":"string","title":"Tipo"},"chain_index":{"type":"integer","title":"Chain Index"},"num_serie":{"type":"string","title":"Num Serie"},"fecha_expedicion":{"type":"string","format":"date","title":"Fecha Expedicion"},"tipo_factura":{"type":"string","title":"Tipo Factura"},"cuota_total":{"type":"string","title":"Cuota Total"},"importe_total":{"type":"string","title":"Importe Total"},"huella":{"type":"string","title":"Huella"},"huella_previa":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Huella Previa"},"estado":{"type":"string","title":"Estado"},"env":{"type":"string","title":"Env"},"aeat_estado":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Aeat Estado"},"aeat_csv":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Aeat Csv"},"aeat_codigo_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Aeat Codigo Error"},"aeat_descripcion_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Aeat Descripcion Error"},"qr_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Qr Url"},"attempts":{"type":"integer","title":"Attempts","default":0},"sent_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Sent At"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","tipo","chain_index","num_serie","fecha_expedicion","tipo_factura","cuota_total","importe_total","huella","estado","env","created_at"],"title":"VerifactuRecordOut"},"VerifactuSettings":{"properties":{"enabled":{"type":"boolean","title":"Enabled","default":false},"env":{"type":"string","title":"Env","default":"test"},"cert_uploaded":{"type":"boolean","title":"Cert Uploaded","default":false},"cert_subject":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cert Subject"},"cert_nif":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cert Nif"},"cert_expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Cert Expires At"},"cert_uploaded_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Cert Uploaded At"},"cert_expired":{"type":"boolean","title":"Cert Expired","default":false},"nif":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Nif"},"legal_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Legal Name"},"ready_to_enable":{"type":"boolean","title":"Ready To Enable","default":false},"blockers":{"items":{"type":"string"},"type":"array","title":"Blockers"},"total_records":{"type":"integer","title":"Total Records","default":0},"records_by_estado":{"additionalProperties":{"type":"integer"},"type":"object","title":"Records By Estado"}},"type":"object","title":"VerifactuSettings","description":"Status payload for GET /verifactu/settings (never leaks secrets)."},"VerifactuSettingsUpdate":{"properties":{"enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enabled"},"env":{"anyOf":[{"type":"string","pattern":"^(test|prod)$"},{"type":"null"}],"title":"Env"}},"type":"object","title":"VerifactuSettingsUpdate"},"WidgetConfigField":{"properties":{"key":{"type":"string","title":"Key"},"label":{"type":"string","title":"Label"},"type":{"type":"string","enum":["select","text","number","boolean"],"title":"Type"},"options":{"anyOf":[{"items":{"additionalProperties":{"type":"string"},"type":"object"},"type":"array"},{"type":"null"}],"title":"Options"},"default":{"title":"Default"},"required":{"type":"boolean","title":"Required","default":false}},"type":"object","required":["key","label","type"],"title":"WidgetConfigField"},"WidgetDataRequest":{"properties":{"type":{"type":"string","title":"Type"},"config":{"additionalProperties":true,"type":"object","title":"Config","default":{}}},"type":"object","required":["type"],"title":"WidgetDataRequest"},"WidgetSpec":{"properties":{"id":{"type":"string","maxLength":64,"minLength":4,"title":"Id"},"type":{"type":"string","enum":["kpi","timeseries","top_list","treasury_list","pending_reconciliation","runway","top_expense_accounts","upcoming_taxes","recent_invoices","recent_purchases","subscriptions_summary","uncategorized_movements","sales_by_country","markdown"],"title":"Type"},"title":{"type":"string","maxLength":120,"title":"Title"},"x":{"type":"integer","maximum":11.0,"minimum":0.0,"title":"X"},"y":{"type":"integer","minimum":0.0,"title":"Y"},"w":{"type":"integer","maximum":12.0,"minimum":1.0,"title":"W"},"h":{"type":"integer","maximum":20.0,"minimum":1.0,"title":"H"},"config":{"additionalProperties":true,"type":"object","title":"Config"}},"type":"object","required":["id","type","title","x","y","w","h"],"title":"WidgetSpec","description":"One widget in a dashboard layout."},"WidgetTypeDef":{"properties":{"type":{"type":"string","enum":["kpi","timeseries","top_list","treasury_list","pending_reconciliation","runway","top_expense_accounts","upcoming_taxes","recent_invoices","recent_purchases","subscriptions_summary","uncategorized_movements","sales_by_country","markdown"],"title":"Type"},"label":{"type":"string","title":"Label"},"description":{"type":"string","title":"Description"},"default_w":{"type":"integer","title":"Default W"},"default_h":{"type":"integer","title":"Default H"},"config_schema":{"items":{"$ref":"#/components/schemas/WidgetConfigField"},"type":"array","title":"Config Schema"},"data_endpoint":{"type":"string","title":"Data Endpoint"},"category":{"type":"string","enum":["kpi","chart","list","ops","content"],"title":"Category"}},"type":"object","required":["type","label","description","default_w","default_h","config_schema","data_endpoint","category"],"title":"WidgetTypeDef"}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT or agl_ API key","description":"Session JWT from `/api/v1/auth/login` or long-lived API key from `/api/v1/auth/api-keys` (prefix `agl_`)."}}},"security":[{"BearerAuth":[]}]}