{"openapi":"3.0.0","paths":{"/api/v1/health":{"get":{"operationId":"getHealth","summary":"Liveness and database readiness","description":"Returns overall status. `database` is `up` when the migrate pool can execute a trivial query.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponseDto"}}}}},"tags":["health"]}},"/api/v1/core/access-requests":{"post":{"operationId":"requestAccess","summary":"Ask organization admins for access to a restricted area.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAccessRequestDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccessRequestResponseDto"}}}},"400":{"description":"Missing tenant context or invalid request body."},"401":{"description":"JWT access token is missing or invalid."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.access-requests"],"security":[{"bearer":[]}]}},"/api/v1/core/access-requests/feature-activation":{"post":{"operationId":"requestFeatureActivation","summary":"Ask the Givearoo team to switch on a switched-off or plan-gated feature.","description":"Sends the Givearoo support desk the organization id, the feature key and the requester email. Repeating the same request for the same organization and feature within 24 hours is acknowledged without sending again. Does not enable anything.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestFeatureActivationDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeatureActivationResponseDto"}}}},"400":{"description":"Unknown feature key or missing tenant context."},"401":{"description":"JWT access token is missing or invalid."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.access-requests"],"security":[{"bearer":[]}]}},"/api/v1/admin/platform-settings/support-contact":{"get":{"operationId":"getAdminPlatformSupportContact","x-charidy-permissions":["platform.settings.manage"],"summary":"Read the platform support address shown to organizations.","description":"Returns the configured address, or the compiled-in default with `isDefault: true` when none has been set. This is the address behind the \"contact us to increase quota\" CTA on the tenant communications settings page.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupportContactResponseDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.platform-settings"],"security":[{"bearer":[]}]},"put":{"operationId":"updateAdminPlatformSupportContact","x-charidy-permissions":["platform.settings.manage"],"summary":"Set the platform support address shown to organizations.","description":"Takes effect immediately for every organization — the tenant quota cards read this value rather than a compiled-in constant. Must be a deliverable mailbox somebody reads; it is shown to customers.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSupportContactDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupportContactResponseDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.platform-settings"],"security":[{"bearer":[]}]}},"/api/v1/auth/register-organization":{"post":{"operationId":"registerOrganization","summary":"Self-signup: create an organisation + owner account in one step.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterOrganizationBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterOrganizationResponseDto"}}}},"400":{"description":"AUTH_PASSWORD_WEAK / AUTH_TERMS_NOT_ACCEPTED / LEGAL_DOCUMENT_VERSION_UNKNOWN / ORG_SIGNUP_INVALID_REGION / ORG_SIGNUP_INVALID_REFERRER"},"409":{"description":"ORG_SIGNUP_DUPLICATE_EMAIL / ORG_SIGNUP_SLUG_RESERVED / ORG_SIGNUP_SLUG_TAKEN"}},"tags":["auth"]}},"/api/v1/auth/login":{"post":{"operationId":"login","summary":"Email + password login.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponseDto"}}}},"401":{"description":"AUTH_INVALID_CREDENTIALS / AUTH_LOCKED_OUT"},"429":{"description":"AUTH_ACCOUNT_LOCKED (per-account) / RATE_LIMIT_EXCEEDED (per-IP)"}},"tags":["auth"]}},"/api/v1/auth/otp/request":{"post":{"operationId":"requestEmailOtp","summary":"Email a 6-character one-time code (sign-in or signup verification).","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OtpRequestBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OtpStatusResponseDto"}}}},"409":{"description":"ORG_SIGNUP_DUPLICATE_EMAIL when purpose=signup and the email is taken. purpose=login with no account returns 200 and flow=signup after emailing a registration code."},"429":{"description":"AUTH_OTP_RATE_LIMITED / RATE_LIMIT_EXCEEDED"}},"tags":["auth"]}},"/api/v1/auth/otp/verify-signup":{"post":{"operationId":"verifySignupEmailOtp","summary":"Verify the signup code; returns the single-use proof to pass to registerOrganization.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OtpVerifyBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OtpSignupProofResponseDto"}}}},"400":{"description":"AUTH_OTP_INVALID"}},"tags":["auth"]}},"/api/v1/auth/otp/login":{"post":{"operationId":"loginWithEmailOtp","summary":"Sign in with the emailed code.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OtpVerifyBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponseDto"}}}},"401":{"description":"AUTH_OTP_INVALID"}},"tags":["auth"]}},"/api/v1/auth/oauth/google":{"post":{"operationId":"oauthGoogleLogin","summary":"Exchange a Google OAuth authorization code and issue a Charidy session.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OauthCodeExchangeBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponseDto"}}}},"400":{"description":"AUTH_TERMS_NOT_ACCEPTED / LEGAL_DOCUMENT_VERSION_UNKNOWN — only on the branch that creates a NEW account (see IdentityService.loginWithOAuth)."},"401":{"description":"AUTH_OAUTH_CODE_EXCHANGE_FAILED / AUTH_SOCIAL_ACCOUNT_INVALID / AUTH_SOCIAL_ACCOUNT_CONFLICT"}},"tags":["auth"]}},"/api/v1/auth/oauth/microsoft":{"post":{"operationId":"oauthMicrosoftLogin","summary":"Exchange a Microsoft OAuth authorization code and issue a Charidy session.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OauthCodeExchangeBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponseDto"}}}},"400":{"description":"AUTH_TERMS_NOT_ACCEPTED / LEGAL_DOCUMENT_VERSION_UNKNOWN — only on the branch that creates a NEW account (see IdentityService.loginWithOAuth)."},"401":{"description":"AUTH_OAUTH_CODE_EXCHANGE_FAILED / AUTH_SOCIAL_ACCOUNT_INVALID / AUTH_SOCIAL_ACCOUNT_CONFLICT"}},"tags":["auth"]}},"/api/v1/auth/oauth/apple":{"post":{"operationId":"oauthAppleLogin","summary":"Exchange a Sign in with Apple authorization code and issue a Charidy session.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OauthCodeExchangeBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponseDto"}}}},"400":{"description":"AUTH_TERMS_NOT_ACCEPTED / LEGAL_DOCUMENT_VERSION_UNKNOWN — only on the branch that creates a NEW account (see IdentityService.loginWithOAuth)."},"401":{"description":"AUTH_OAUTH_CODE_EXCHANGE_FAILED / AUTH_SOCIAL_ACCOUNT_INVALID / AUTH_SOCIAL_ACCOUNT_CONFLICT"}},"tags":["auth"]}},"/api/v1/auth/refresh":{"post":{"operationId":"refreshSession","summary":"Rotate a refresh token. Single-use; reuse triggers family-revoke.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponseDto"}}}},"401":{"description":"AUTH_REFRESH_INVALID / AUTH_REFRESH_REUSED"}},"tags":["auth"]}},"/api/v1/auth/logout":{"post":{"operationId":"logout","summary":"Revoke the supplied refresh token (single device).","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LogoutBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponseDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."}},"tags":["auth"],"security":[{"bearer":[]}]}},"/api/v1/auth/logout-all":{"post":{"operationId":"logoutAll","summary":"Revoke every active refresh session for the authenticated user.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponseDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."}},"tags":["auth"],"security":[{"bearer":[]}]}},"/api/v1/auth/verify-email":{"post":{"operationId":"verifyEmail","summary":"Consume an email-verification token.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyEmailBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponseDto"}}}},"400":{"description":"AUTH_VERIFICATION_TOKEN_INVALID"}},"tags":["auth"]}},"/api/v1/auth/resend-verification":{"post":{"operationId":"resendEmailVerification","summary":"Re-send the email-verification link to the authenticated user.","description":"Returns `sent=false` with a reason when the address is already verified, or when a link was issued less than a minute ago (double-submit). Never reveals anything about other accounts.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResendVerificationResponseDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."}},"tags":["auth"],"security":[{"bearer":[]}]}},"/api/v1/auth/forgot-password":{"post":{"operationId":"forgotPassword","summary":"Request a password-reset link. Always returns ok=true to prevent enumeration.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForgotPasswordBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponseDto"}}}},"429":{"description":"RATE_LIMIT_EXCEEDED (per-IP)"}},"tags":["auth"]}},"/api/v1/auth/reset-password":{"post":{"operationId":"resetPassword","summary":"Consume a password-reset token and set a new password.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetPasswordBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponseDto"}}}},"400":{"description":"AUTH_RESET_TOKEN_INVALID / AUTH_PASSWORD_WEAK"},"429":{"description":"RATE_LIMIT_EXCEEDED (per-IP)"}},"tags":["auth"]}},"/api/v1/auth/whoami":{"post":{"operationId":"whoami","summary":"Return the authenticated user summary derived from the access token.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhoAmIResponseDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."}},"tags":["auth"],"security":[{"bearer":[]}]}},"/api/v1/public/sales-representatives":{"get":{"operationId":"listPublicSalesRepresentatives","summary":"List active Charidy sales representatives shown on the org signup referral dropdown.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicSalesRepresentativesListResponseDto"}}}}},"tags":["sales-representatives"]}},"/api/v1/admin/billing-addons":{"get":{"operationId":"listAdminBillingAddons","summary":"List editable add-ons, including drafts and archived entries.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AdminBillingAddonDto"}}}}},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/billing-addons/features/{featureKey}/plans/{planKey}":{"put":{"operationId":"setAdminPlanFeatureAvailability","x-charidy-human-only":true,"summary":"Set a plan feature to included, blocked, or a purchasable add-on.","description":"VALIDATION_FAILED rejects unknown/unimplemented features. PLAN_ADDON_NOT_PRICED requires an existing price. Applies plan flag and purchasable prices atomically; existing paid rights remain valid.","parameters":[{"name":"featureKey","required":true,"in":"path","schema":{"type":"string"}},{"name":"planKey","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetPlanFeatureAvailabilityDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AdminBillingAddonDto"}}}}},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/billing-addons/{key}":{"put":{"operationId":"saveAdminBillingAddon","x-charidy-human-only":true,"summary":"Create or update a quota or capability add-on.","description":"VALIDATION_FAILED rejects unknown/unimplemented targets. Published targets are immutable. Publishing requires an active compatible price set through setAdminBillingPlanPrice. Saving never charges a customer.","parameters":[{"name":"key","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveBillingAddonDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminBillingAddonDto"}}}},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/subscription":{"get":{"operationId":"getAdminOrganizationSubscription","x-charidy-permissions":["organizations.plan.manage"],"summary":"Read an organization’s current subscription (super-admin).","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponseDto"}}}},"403":{"description":"Missing required permission for this operation."},"404":{"description":"SUBSCRIPTION_NOT_FOUND."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/plan":{"put":{"operationId":"assignAdminOrganizationPlan","x-charidy-permissions":["organizations.plan.manage"],"x-charidy-destructive":true,"summary":"Assign an organization to a package (super-admin).","description":"Unlike the tenant route this MAY assign a quote-only package — that is how a negotiated Federation deal is applied. Closes the current subscription row and opens a successor, so the previous commercial terms stay reconstructible for invoicing.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangePlanDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponseDto"}}}},"400":{"description":"PLAN_NOT_PUBLISHED."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"PLAN_NOT_FOUND."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/subscription/payment-failed":{"post":{"operationId":"markAdminOrganizationPaymentFailed","x-charidy-permissions":["organizations.plan.manage"],"x-charidy-destructive":true,"summary":"Record that a payment did not go through, marking the org past due on its plan.","description":"Policy (docs/PRICING_PLAN.md §7.6, docs/PRICING_IMPLEMENTATION_PLAN.md §3): a paying customer whose payment fails is NOT frozen, NOT cut off and NOT moved — they keep the plan they are on and are marked `past_due` until they settle. There is no free plan to fall back to any more (every tier is priced and trialed), so a demotion would mean moving a customer who owes money onto a different paid plan. This is an explicit human/PSP-webhook action on purpose: with no payment terminal wired the platform cannot observe a failed charge, so nothing may infer one.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarkPaymentFailedDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponseDto"}}}},"403":{"description":"Missing required permission for this operation."},"404":{"description":"SUBSCRIPTION_NOT_FOUND."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/subscription/reinstate":{"post":{"operationId":"reinstateAdminOrganizationSubscription","x-charidy-permissions":["organizations.plan.manage"],"x-charidy-destructive":true,"summary":"The money arrived (or the freeze was wrong) — restore the account.","description":"Downgraded for non-payment → back onto the remembered plan. Frozen after a trial → unfrozen on the same plan. Either way the dunning marks and the retention clock are cleared, so a paid-for account never keeps a deletion date hanging over it.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponseDto"}}}},"400":{"description":"SUBSCRIPTION_NOT_REINSTATABLE (not frozen / not past due) or PLAN_NOT_PUBLISHED."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"SUBSCRIPTION_NOT_FOUND."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/effective-settings":{"get":{"operationId":"getAdminOrganizationEffectiveSettings","x-charidy-permissions":["organizations.plan.manage"],"summary":"Inspect an organization’s resolved entitlements + flags (super-admin).","description":"The support answer to \"why can this org not do X\" — shows the resolved values and whether an override is contributing.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EffectiveSettingsResponseDto"}}}},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/contract":{"get":{"operationId":"getAdminTenantContract","x-charidy-permissions":["organizations.plan.manage"],"summary":"Read TenantContract for an organization (super-admin only).","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantContractResponseDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"TenantContract not found for this organization."}},"tags":["admin.billing"],"security":[{"bearer":[]}]},"put":{"operationId":"upsertAdminTenantContract","x-charidy-permissions":["organizations.plan.manage"],"summary":"Create or update the TenantContract for an organization (super-admin only).","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertTenantContractDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantContractResponseDto"}}}},"400":{"description":"activeUntil must be strictly later than activeFrom."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/billing/monthly-overage":{"get":{"operationId":"getAdminMonthlyOverage","x-charidy-permissions":["organizations.plan.manage"],"summary":"Compute the monthly overage usage + cost for an organization.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"periodYyyymm","required":true,"in":"query","description":"YYYYMM. Example: 202605 for May 2026.","schema":{"minimum":200001,"maximum":209912,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonthlyOverageResponseDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/billing-credit":{"post":{"operationId":"grantAdminOrganizationBillingCredit","x-charidy-permissions":["organizations.plan.manage"],"x-charidy-human-only":true,"x-charidy-destructive":true,"summary":"Credit an organization — reduces its next Stripe invoice, when it has one.","description":"Writes an audit row on every attempt. When the organization has no Stripe customer (every organization today, since collection is off everywhere), the call fails with CREDIT_REQUIRES_STRIPE_PROVIDER rather than recording a credit that will never actually apply.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantBillingCreditDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingCreditDto"}}}},"400":{"description":"CREDIT_REQUIRES_STRIPE_PROVIDER / VALIDATION_FAILED."},"403":{"description":"Missing required permission for this operation."},"503":{"description":"STRIPE_BALANCE_TRANSACTION_FAILED."}},"tags":["admin.billing"],"security":[{"bearer":[]}]},"get":{"operationId":"listAdminOrganizationBillingCredits","x-charidy-permissions":["organizations.plan.manage"],"summary":"Every credit attempt for this organization, newest first — the audit trail.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/BillingCreditDto"}}}}},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/billing-coupons":{"get":{"operationId":"listAdminBillingCoupons","x-charidy-permissions":["organizations.plan.manage"],"summary":"Every coupon, including drafts and archived ones, newest first.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AdminCouponDto"}}}}},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.billing"],"security":[{"bearer":[]}]},"post":{"operationId":"createAdminBillingCoupon","x-charidy-permissions":["organizations.plan.manage"],"x-charidy-human-only":true,"x-charidy-destructive":true,"summary":"Create a coupon. Starts as a draft — publish it to make it redeemable.","description":"For a five-calendar-month access grant, set grantsFullAccess, a repeating 100% discount, durationInMonths 5, and no eligibility restrictions.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCouponDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminCouponDto"}}}},"400":{"description":"VALIDATION_FAILED."},"403":{"description":"Missing required permission for this operation."},"409":{"description":"COUPON_CODE_TAKEN."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/billing-coupons/{code}":{"patch":{"operationId":"updateAdminBillingCoupon","x-charidy-permissions":["organizations.plan.manage"],"x-charidy-human-only":true,"x-charidy-destructive":true,"summary":"Change a coupon’s label, eligibility or caps.","description":"The discount itself cannot be changed — issue a new code instead. Only the supplied fields change; sending maxRedemptions or redeemBy as null clears them.","parameters":[{"name":"code","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCouponDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminCouponDto"}}}},"403":{"description":"Missing required permission for this operation."},"404":{"description":"COUPON_NOT_FOUND."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/billing-coupons/{code}/publish":{"post":{"operationId":"publishAdminBillingCoupon","x-charidy-permissions":["organizations.plan.manage"],"x-charidy-human-only":true,"x-charidy-destructive":true,"summary":"Publish a coupon so organizations can redeem it.","description":"Invoice discounts are synchronized to the payment provider when available. A full-access grant uses its own billing lifecycle.","parameters":[{"name":"code","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminCouponDto"}}}},"403":{"description":"Missing required permission for this operation."},"404":{"description":"COUPON_NOT_FOUND."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/billing-coupons/{code}/sync-provider":{"post":{"operationId":"syncAdminBillingCouponToProvider","x-charidy-permissions":["organizations.plan.manage"],"x-charidy-human-only":true,"x-charidy-destructive":true,"summary":"Give a published coupon the provider copy it is missing.","description":"For the one state publishing cannot reach: a coupon published while no payment terminal was configured has no provider counterpart, and a published coupon is otherwise only offered Archive. Until it is mirrored, the code reduces the amount-due figure we show and is ignored by the provider at checkout. A coupon that already has a reference is returned untouched — provider coupons are immutable and organizations hold snapshots of the terms, so repointing a live code would let two customers on one code pay different amounts.","parameters":[{"name":"code","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminCouponDto"}}}},"400":{"description":"COUPON_NOT_PUBLISHED."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"COUPON_NOT_FOUND."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/billing-coupons/{code}/archive":{"post":{"operationId":"archiveAdminBillingCoupon","x-charidy-permissions":["organizations.plan.manage"],"x-charidy-human-only":true,"x-charidy-destructive":true,"summary":"Stop new redemptions of a coupon.","description":"Organizations already discounted keep their discount — archiving is not a revocation. Withdraw a running discount with revokeAdminOrganizationCoupon.","parameters":[{"name":"code","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminCouponDto"}}}},"403":{"description":"Missing required permission for this operation."},"404":{"description":"COUPON_NOT_FOUND."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/billing-coupons/{code}/redemptions":{"get":{"operationId":"listAdminBillingCouponRedemptions","x-charidy-permissions":["organizations.plan.manage"],"summary":"Which organizations used this code, and where their discount stands.","parameters":[{"name":"code","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AdminCouponRedemptionDto"}}}}},"403":{"description":"Missing required permission for this operation."},"404":{"description":"COUPON_NOT_FOUND."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/coupon":{"post":{"operationId":"grantAdminOrganizationCoupon","x-charidy-permissions":["organizations.plan.manage"],"x-charidy-destructive":true,"summary":"Apply a coupon to one organization on its behalf (the anchor-customer path).","description":"Runs the same eligibility rules a self-serve redemption would, including the one-active-discount limit. Support granting a discount is not a way around the caps — issue a dedicated code instead.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyCouponDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminCouponRedemptionDto"}}}},"400":{"description":"COUPON_NOT_FOUND / COUPON_ANOTHER_ACTIVE / …"},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/coupon/revoke":{"post":{"operationId":"revokeAdminOrganizationCoupon","x-charidy-permissions":["organizations.plan.manage"],"x-charidy-human-only":true,"x-charidy-destructive":true,"summary":"Withdraw the discount an organization is currently on.","description":"Never automatic. The reason is stored on the row so \"why did this customer’s price go up\" stays answerable.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevokeCouponRedemptionDto"}}}},"responses":{"200":{"description":"The discount was withdrawn."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"COUPON_REDEMPTION_NOT_FOUND."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/billing-plans":{"get":{"operationId":"listAdminBillingPlans","x-charidy-permissions":["organizations.plan.manage"],"summary":"List every plan in the catalog, including drafts and archived ones.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AdminBillingPlanDto"}}}}},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.billing"],"security":[{"bearer":[]}]},"post":{"operationId":"createAdminBillingPlan","x-charidy-permissions":["organizations.plan.manage"],"x-charidy-destructive":true,"summary":"Create a new package. Starts as a draft — set a price, then publish.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBillingPlanDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminBillingPlanDto"}}}},"400":{"description":"VALIDATION_FAILED / PLAN_OVERRIDE_KEY_UNKNOWN / PLAN_FLAG_KEY_UNKNOWN."},"403":{"description":"Missing required permission for this operation."},"409":{"description":"PLAN_KEY_TAKEN."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/billing-plans/stats":{"get":{"operationId":"getAdminBillingPlanStats","x-charidy-permissions":["organizations.plan.manage"],"summary":"Subscription statistics: organizations per (plan, status), SaaS MRR-equivalent by currency, and plan-change/downgrade/cancellation counts for a time window.","description":"Read-only aggregation, no side effects. \"SaaS MRR\" here is platform subscription revenue and is unrelated to the donor recurring-donation MRR reported elsewhere in the admin — do not confuse the two. fromIso/toIso default to the last 30 days.","parameters":[{"name":"fromIso","required":false,"in":"query","description":"Start of the plan-change/downgrade/cancellation window. Defaults to 30 days before toIso.","schema":{"format":"date-time","type":"string"}},{"name":"toIso","required":false,"in":"query","description":"End of the plan-change/downgrade/cancellation window. Defaults to now.","schema":{"format":"date-time","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminBillingPlanStatsDto"}}}},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/billing-plans/overrides":{"get":{"operationId":"listAdminBillingPlanOverrides","x-charidy-permissions":["organizations.plan.manage"],"summary":"Every organization currently holding an active per-org entitlement exception.","description":"Read-only. Join against GET /admin/organizations client-side for organization names — this endpoint only knows organization ids.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AdminPlanOverrideDto"}}}}},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/billing-plans/{planKey}":{"patch":{"operationId":"updateAdminBillingPlan","x-charidy-permissions":["organizations.plan.manage"],"x-charidy-human-only":true,"x-charidy-destructive":true,"summary":"Change a package’s limits, capability defaults, fee, trial or copy keys.","description":"Only the supplied fields change. WARNING: `entitlements` applies immediately to every organization already on this plan, because entitlements are read live rather than snapshotted. Use the per-org override routes for a single customer.","parameters":[{"name":"planKey","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBillingPlanCatalogDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminBillingPlanDto"}}}},"400":{"description":"PLAN_OVERRIDE_KEY_UNKNOWN / PLAN_OVERRIDE_VALUE_INVALID / PLAN_FLAG_KEY_UNKNOWN."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"PLAN_NOT_FOUND."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/billing-plans/{planKey}/prices":{"put":{"operationId":"setAdminBillingPlanPrice","x-charidy-permissions":["organizations.plan.manage"],"x-charidy-destructive":true,"summary":"Set the price for one (currency, interval) — of the plan, or of an add-on on it.","description":"Omit `addonKey` for the package base price. Existing subscribers are NOT re-priced: their amount was snapshotted at sale time.","parameters":[{"name":"planKey","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetBillingPriceDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminBillingPlanDto"}}}},"400":{"description":"VALIDATION_FAILED."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"PLAN_NOT_FOUND / PLAN_ADDON_NOT_FOUND."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/billing-plans/{planKey}/publish":{"post":{"operationId":"publishAdminBillingPlan","x-charidy-permissions":["organizations.plan.manage"],"x-charidy-destructive":true,"summary":"Make a package assignable and publicly listable.","description":"Refused with PLAN_NOT_PUBLISHABLE until at least one base price exists.","parameters":[{"name":"planKey","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminBillingPlanDto"}}}},"400":{"description":"PLAN_NOT_PUBLISHABLE."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/billing-plans/{planKey}/archive":{"post":{"operationId":"archiveAdminBillingPlan","x-charidy-permissions":["organizations.plan.manage"],"x-charidy-destructive":true,"summary":"Stop offering a package. Existing subscribers keep their terms.","description":"Refused with PLAN_IS_SIGNUP_DEFAULT while it is the plan new signups land on.","parameters":[{"name":"planKey","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminBillingPlanDto"}}}},"403":{"description":"Missing required permission for this operation."},"409":{"description":"PLAN_IS_SIGNUP_DEFAULT."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/billing-plans/{planKey}/default-signup":{"post":{"operationId":"setAdminBillingPlanAsSignupDefault","x-charidy-permissions":["organizations.plan.manage"],"x-charidy-human-only":true,"x-charidy-destructive":true,"summary":"Make this the package new organizations open on.","description":"The signup default is data, not a code constant. Exactly one plan holds it; assigning it here clears the previous holder in the same transaction.","parameters":[{"name":"planKey","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminBillingPlanDto"}}}},"400":{"description":"PLAN_NOT_PUBLISHED / PLAN_NOT_SELF_SERVE."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/plan-override":{"put":{"operationId":"upsertAdminOrganizationPlanOverride","x-charidy-permissions":["organizations.plan.manage"],"x-charidy-destructive":true,"summary":"Grant one organization an entitlement exception, optionally time-boxed.","description":"The canonical case from SPEC/15: raise an SMS quota for a campaign weekend without moving the customer to a different package. Sparse — only the keys you send change. Append-only: the previous override is closed, not overwritten, so a dispute can be reconstructed. Refused with OVERRIDE_EXCEEDS_PLAN_CEILING when it would push the platform-fee ceiling above what the plan allows.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertPlanOverrideDto"}}}},"responses":{"200":{"description":"The organization’s resolved entitlements after the override."},"400":{"description":"PLAN_OVERRIDE_KEY_UNKNOWN / PLAN_OVERRIDE_VALUE_INVALID / OVERRIDE_EXCEEDS_PLAN_CEILING."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.billing"],"security":[{"bearer":[]}]},"delete":{"operationId":"revokeAdminOrganizationPlanOverride","x-charidy-permissions":["organizations.plan.manage"],"summary":"Revoke the active exception; the organization falls back to its plan.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"204":{"description":"Override revoked."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"PLAN_OVERRIDE_NOT_FOUND."}},"tags":["admin.billing"],"security":[{"bearer":[]}]}},"/api/v1/core/billing/checkout":{"post":{"operationId":"startMyBillingCheckout","x-charidy-permissions":["billing.manage"],"x-charidy-destructive":true,"summary":"Open a hosted checkout so the organization can pay for its subscription.","description":"Returns a provider-hosted URL to redirect to. NOTHING is charged on this call — the organization moves onto the paid rail only when the provider confirms the checkout. Any discount already redeemed is carried into the session. REFUSED with BILLING_ALREADY_SUBSCRIBED when the organization already has a provider subscription: a checkout session CREATES one, so a second would bill the customer twice a month — an existing subscriber changes package with changeMySubscriptionPlan and changes card through startMyBillingPortal. Package selection is applied only after verified provider confirmation. purpose=trial collects a card and starts the seven-day evaluation; purpose=activate ends an existing trial on the same provider subscription and requests immediate payment. Returns 503 PAYMENT_TERMINAL_NOT_CONFIGURED where collection is not enabled.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartCheckoutDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutSessionDto"}}}},"400":{"description":"BILLING_ALREADY_SUBSCRIBED / PLAN_NOT_PUBLISHED / PLAN_NOT_SELF_SERVE / PLAN_NOT_PRICED."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"SUBSCRIPTION_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."},"503":{"description":"PAYMENT_TERMINAL_NOT_CONFIGURED."}},"tags":["billing"],"security":[{"bearer":[]}]}},"/api/v1/core/billing/checkout/confirm":{"post":{"operationId":"confirmMyBillingCheckout","x-charidy-permissions":["billing.manage"],"x-charidy-destructive":true,"summary":"Apply a finished checkout now instead of waiting for the provider webhook.","description":"Reads the session back from the provider and applies it through the same handler as the completion webhook (idempotent — the webhook arriving later changes nothing). Only the session id is taken from the caller: the session must be a SaaS checkout of the calling organization. Returns confirmed=false while the session is still open. 404 BILLING_CHECKOUT_NOT_FOUND for a session of another organization.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmCheckoutDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmCheckoutResultDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"BILLING_CHECKOUT_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."},"503":{"description":"PAYMENT_TERMINAL_NOT_CONFIGURED."}},"tags":["billing"],"security":[{"bearer":[]}]}},"/api/v1/core/billing/portal":{"post":{"operationId":"startMyBillingPortal","x-charidy-permissions":["billing.manage"],"x-charidy-destructive":true,"summary":"Open the provider’s self-service page for cards and invoices.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartBillingPortalDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingPortalSessionDto"}}}},"400":{"description":"BILLING_CUSTOMER_NOT_FOUND — no card on file yet."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."},"503":{"description":"PAYMENT_TERMINAL_NOT_CONFIGURED."}},"tags":["billing"],"security":[{"bearer":[]}]}},"/api/v1/core/billing/invoices":{"get":{"operationId":"listMyBillingInvoices","x-charidy-permissions":["identity.view_self"],"summary":"Platform-subscription invoices for the calling organization, newest first.","description":"A local projection of what the provider charged — every row exists because the provider reported it, never because we assumed it. Empty for an organization invoiced offline.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/BillingInvoiceDto"}}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["billing"],"security":[{"bearer":[]}]}},"/api/v1/core/billing/coupon/preview":{"post":{"operationId":"previewMyCoupon","x-charidy-permissions":["billing.manage"],"summary":"Check a coupon code and see what it would be worth, without claiming it.","description":"Read-only, so a customer can try more than one code without burning any. Rejections carry a specific code (COUPON_EXPIRED, COUPON_PLAN_NOT_ELIGIBLE, …); an unknown code and an ineligible one both answer COUPON_NOT_FOUND so the code list cannot be probed.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyCouponDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CouponPreviewDto"}}}},"400":{"description":"COUPON_NOT_FOUND or a specific eligibility code."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["billing"],"security":[{"bearer":[]}]}},"/api/v1/core/billing/coupon":{"post":{"operationId":"redeemMyCoupon","x-charidy-permissions":["billing.manage"],"x-charidy-destructive":true,"summary":"Claim a coupon code for the calling organization.","description":"Applies a discount to a provider subscription or opens a time-limited full-access grant.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyCouponDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CouponRedemptionDto"}}}},"400":{"description":"COUPON_NOT_FOUND / COUPON_EXHAUSTED / COUPON_ANOTHER_ACTIVE / …"},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["billing"],"security":[{"bearer":[]}]},"get":{"operationId":"listMyCouponRedemptions","x-charidy-permissions":["identity.view_self"],"summary":"Discounts this organization has redeemed, newest first.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CouponRedemptionDto"}}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["billing"],"security":[{"bearer":[]}]}},"/api/v1/public/billing-plans":{"get":{"operationId":"publicListBillingPlans","summary":"Published, self-serve plans for the public pricing page.","description":"Filters out drafts, archived plans, and quote-only (isSelfServe: false) plans — those need a human sales conversation, not a self-serve signup link. Returns ONLY presentation-safe fields: key, sortOrder, trialDays, prices, advertised limits, and marketing copy. Raw entitlement bundles and boolean flag defaults are never exposed on this route.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PublicBillingPlanDto"}}}}}},"tags":["public.billing"]}},"/api/v1/core/billing/effective-settings":{"get":{"operationId":"getMyEffectiveSettings","x-charidy-permissions":["identity.view_self"],"summary":"Resolved entitlements + capability flags for the calling organization.","description":"The ONLY sanctioned way to learn what an organization may do (MASTER §10 rule 17). A null entitlement value means unlimited; an absent key means the plan declares no limit. Clients must never read plans or overrides directly.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EffectiveSettingsResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.billing"],"security":[{"bearer":[]}]}},"/api/v1/core/billing/usage":{"get":{"operationId":"getMyPlanUsage","x-charidy-permissions":["identity.view_self"],"summary":"Live usage against every numeric entitlement for the calling organization.","description":"Returns all 12 quantity entitlement paths, including currently unenforced ones, as live COUNT/SUM/MAX measurements. Monthly usage is the current UTC calendar month. A null limit means unlimited or undeclared; it does not mean zero.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyPlanUsageResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.billing"],"security":[{"bearer":[]}]}},"/api/v1/core/billing/subscription":{"get":{"operationId":"getMySubscription","x-charidy-permissions":["identity.view_self"],"summary":"The calling organization’s current subscription, or 404 when it has none.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"This organization has no open subscription."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.billing"],"security":[{"bearer":[]}]}},"/api/v1/core/billing/plans":{"get":{"operationId":"listAvailableBillingPlans","x-charidy-permissions":["identity.view_self"],"summary":"Published packages with prices, limits and per-plan add-ons (the upgrade menu).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/BillingPlanDto"}}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.billing"],"security":[{"bearer":[]}]}},"/api/v1/core/billing/subscription/plan/reconcile":{"post":{"operationId":"reconcileMySubscriptionPlanChange","x-charidy-permissions":["billing.manage"],"summary":"Refresh a pending plan payment or release an expired change so the customer may retry.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"SUBSCRIPTION_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.billing"],"security":[{"bearer":[]}]}},"/api/v1/core/billing/subscription/plan-preview":{"post":{"operationId":"previewMySubscriptionPlanChange","x-charidy-permissions":["billing.manage"],"summary":"Preview the provider-calculated price and timing before changing subscription.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangePlanDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionPlanPreviewDto"}}}},"400":{"description":"PLAN_NOT_SELF_SERVE / PLAN_NOT_PRICED / SUBSCRIPTION_COMMITMENT_ACTIVE."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.billing"],"security":[{"bearer":[]}]}},"/api/v1/core/billing/subscription/change-plan":{"post":{"operationId":"changeMySubscriptionPlan","x-charidy-permissions":["billing.manage"],"x-charidy-destructive":true,"summary":"Move the calling organization to another self-serve package.","description":"A trial selection preserves its original deadline. A paid upgrade grants capabilities only after provider payment succeeds; unpaid changes remain pending. Downgrades are scheduled for renewal and respect the annual commitment.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangePlanDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponseDto"}}}},"400":{"description":"PLAN_NOT_PUBLISHED or PLAN_NOT_SELF_SERVE."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"PLAN_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.billing"],"security":[{"bearer":[]}]}},"/api/v1/core/billing/subscription/addons":{"post":{"operationId":"setMySubscriptionAddonQuantity","x-charidy-permissions":["billing.manage"],"x-charidy-destructive":true,"summary":"Set how many units of an add-on the organization has purchased (0 removes it).","description":"Starts a paid add-on change. Increasing quantity can charge the attached payment method immediately. Quota/capability access changes only after verified payment and applied provider items. Decreases/cancellation preserve paid access until period end. Pending changes can be retried through reconcileMySubscriptionAddons; never promise payment succeeded from this response alone.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetAddonQuantityDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponseDto"}}}},"400":{"description":"PLAN_ADDON_NOT_PRICED or VALIDATION_FAILED."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"PLAN_ADDON_NOT_FOUND or SUBSCRIPTION_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.billing"],"security":[{"bearer":[]}]}},"/api/v1/core/billing/subscription/addons/reconcile":{"post":{"operationId":"reconcileMySubscriptionAddons","x-charidy-permissions":["billing.manage"],"x-charidy-destructive":true,"summary":"Reconcile pending add-on payment and retry its original idempotent request.","description":"Never creates a new purchase intent. Verifies provider invoice and applied item; uses the original idempotency key after uncertain failures. Billing must be enabled.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.billing"],"security":[{"bearer":[]}]}},"/api/v1/core/billing/payment-method":{"get":{"operationId":"getMyBillingPaymentMethod","x-charidy-permissions":["identity.view_self"],"summary":"Whether a payment method can be attached, and why not.","description":"Whether this environment can actually take money, and why not when it cannot. `canCollect: true` means a real terminal is wired and a card form may be shown; `false` comes with a `reasonCode` (`PAYMENT_TERMINAL_NOT_CONFIGURED` when charging is switched off or no platform key is present), and the client must then render an explicit \"billing handled by our team\" state rather than a card form. Read this rather than assuming from the presence of a subscription: the two are independent, and a client that guesses will eventually tell a customer they were charged when they were not.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingCapabilityDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.billing"],"security":[{"bearer":[]}]}},"/api/v1/core/billing/subscription/resume":{"post":{"operationId":"resumeMySubscription","x-charidy-permissions":["billing.manage"],"x-charidy-destructive":true,"summary":"Undo a pending cancellation while the period is still running.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponseDto"}}}},"400":{"description":"SUBSCRIPTION_NOT_RESUMABLE — it has already ended."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"SUBSCRIPTION_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.billing"],"security":[{"bearer":[]}]}},"/api/v1/core/billing/subscription/cancel":{"post":{"operationId":"cancelMySubscription","x-charidy-permissions":["billing.manage"],"x-charidy-destructive":true,"summary":"Cancel the subscription at period end (default) or immediately.","description":"Defaults to period end on purpose: pulling entitlements from an organization mid-campaign is a reputational failure, not a billing win.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelSubscriptionDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"SUBSCRIPTION_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.billing"],"security":[{"bearer":[]}]}},"/api/v1/core/billing/contract":{"get":{"operationId":"getTenantContract","x-charidy-permissions":["communications.read"],"summary":"Read the calling tenant’s TenantContract (read-only).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"TenantContract for the tenant context.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantContractResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"TenantContract not found for this organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.billing"],"security":[{"bearer":[]}]}},"/api/v1/core/billing/communication-usage":{"get":{"operationId":"getTenantCommunicationUsage","x-charidy-permissions":["communications.read"],"summary":"Per-channel message usage for one period, against the contracted quota.","description":"Answers \"how many messages did we send this month and how much quota is left\" for email, SMS and WhatsApp. Every channel is always returned. `includedQuota`/`remainingQuota` are null — not 0 — when no quota is contracted for that channel, and `contractMissing` says whether that is because the organization has no contract at all. Buying extra quota is NOT self-serve: `quotaIncreaseSelfServe` is always false and there is no purchase endpoint, so an agent must direct the customer to support instead of promising an upgrade.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"periodYyyymm","required":false,"in":"query","description":"YYYYMM. Defaults to the current UTC month when omitted.","schema":{"minimum":200001,"maximum":209912,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunicationUsageResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.billing"],"security":[{"bearer":[]}]}},"/api/v1/core/billing/monthly-overage":{"get":{"operationId":"getTenantMonthlyOverage","x-charidy-permissions":["communications.read"],"summary":"Compute the calling tenant’s monthly overage cost.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"periodYyyymm","required":true,"in":"query","description":"YYYYMM. Example: 202605 for May 2026.","schema":{"minimum":200001,"maximum":209912,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonthlyOverageResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.billing"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/settings":{"get":{"operationId":"getAdminOrganizationSettings","x-charidy-permissions":["organizations.plan.manage"],"summary":"Get admin settings for an organization","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminOrganizationSettingsResponseDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Organization was not found."}},"tags":["admin.organizations"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/payment-gateways":{"get":{"operationId":"getAdminOrganizationPaymentGatewayStatus","x-charidy-permissions":["organizations.read_all"],"summary":"Payment gateway connection status for an organization (support triage).","description":"Reports Stripe / Grow (Meshulam + wallet) / Crowded connection health per organization: whether credentials exist, sandbox vs production, whether the provider confirmed it can charge, outstanding onboarding requirements, and the last failed checkout / webhook. Read-only and offline — it never calls the providers, so it is safe to open on any organization and renders even while a provider is down.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminPaymentGatewayStatusResponseDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Organization was not found."}},"tags":["admin.organizations"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/profile":{"patch":{"operationId":"updateAdminOrganizationProfile","x-charidy-permissions":["settings.manage"],"summary":"Update editable organization profile fields","description":"Updates organization slug, legal name, country, or default currency. Slug changes write slug_history for redirect and reuse protection.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateOrganizationProfileDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminOrganizationSettingsResponseDto"}}}},"400":{"description":"Invalid organization profile payload."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Organization was not found."}},"tags":["admin.organizations"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/status":{"put":{"operationId":"updateAdminOrganizationStatus","x-charidy-permissions":["organizations.approve","organizations.suspend"],"summary":"Update organization lifecycle status","description":"Sets an organization to pending_approval, active, suspended, pending_deletion, or disabled. Public donations only work for active or pending_approval organizations.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateOrganizationStatusDto"}}}},"responses":{"204":{"description":""},"400":{"description":"Invalid organization status."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Organization was not found."}},"tags":["admin.organizations"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations":{"get":{"operationId":"listAdminOrganizations","x-charidy-permissions":["organizations.read_all"],"summary":"List organizations across tenants (super-admin control plane).","parameters":[{"name":"search","required":false,"in":"query","description":"Free-text search query.","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"Maximum rows to return.","schema":{"type":"number","default":50}},{"name":"status","required":false,"in":"query","schema":{"enum":["pending_approval","active","suspended","pending_deletion","disabled"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminOrganizationListResponseDto"}}}},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.organizations"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/feature-flags/{flagKey}":{"put":{"operationId":"upsertAdminOrganizationFeatureFlag","x-charidy-permissions":["organizations.feature_flags.manage"],"summary":"Create a feature-flag override for an organization","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"flagKey","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertFeatureFlagDto"}}}},"responses":{"204":{"description":""},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Organization was not found."}},"tags":["admin.organizations"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/billing-plan":{"put":{"operationId":"updateAdminOrganizationBillingPlan","x-charidy-permissions":["organizations.plan.manage"],"x-charidy-destructive":true,"summary":"DEPRECATED — writes the legacy `charidy_organizations.billing_plan_id` pointer.","deprecated":true,"description":"Superseded by `assignAdminOrganizationPlan` (PUT /admin/organizations/:id/plan). This route accepts ANY uuid with no catalog validation and creates no subscription, so it neither grants entitlements nor produces an invoiceable record — a typo is stored silently. `organization_subscriptions` is the source of truth. Kept only so existing callers do not break; do not build on it.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBillingPlanDto"}}}},"responses":{"204":{"description":""},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Organization was not found."}},"tags":["admin.organizations"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/comms/provision-twilio":{"post":{"operationId":"provisionTwilioSubaccountForOrganization","x-charidy-permissions":["organizations.plan.manage"],"summary":"Provision a Twilio Subaccount for the organization (mocked while WABA_MOCK_MODE=true).","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TwilioSubaccountProvisionResponseDto"}}}},"400":{"description":"organizationId must be a UUID."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"501":{"description":"Real Twilio Subaccount provisioning has not been wired yet (WABA_MOCK_MODE=false)."}},"tags":["admin.organizations"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/soft-delete":{"post":{"operationId":"softDeleteAdminOrganization","x-charidy-permissions":["organizations.suspend"],"summary":"Soft delete (disable) organization while preserving linked data.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminSoftDeleteDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminMutationResultDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Organization was not found."}},"tags":["admin.organizations"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/hard-delete":{"post":{"operationId":"hardDeleteAdminOrganization","x-charidy-permissions":["organizations.suspend"],"summary":"Hard delete organization only after safety checks pass.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminHardDeleteDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminMutationResultDto"}}}},"400":{"description":"Hard delete confirmation is missing."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.organizations"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/comms/integrations":{"get":{"operationId":"getAdminOrganizationCommsIntegrations","x-charidy-permissions":["organizations.read_all"],"summary":"List SendGrid / Twilio integration status for an organization (masked).","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminCommsIntegrationsResponseDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Organization was not found."}},"tags":["admin.organizations.comms"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/comms/integrations/twilio":{"put":{"operationId":"putAdminOrganizationTwilioIntegration","x-charidy-permissions":["organizations.plan.manage"],"summary":"Store encrypted Twilio Account SID + Auth Token for the organization tenant.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminTwilioIntegrationDto"}}}},"responses":{"204":{"description":""},"400":{"description":"Validation error or secrets key not configured on API."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Organization was not found."}},"tags":["admin.organizations.comms"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/comms/integrations/test-twilio":{"post":{"operationId":"testAdminOrganizationTwilioIntegration","x-charidy-permissions":["organizations.plan.manage"],"summary":"Validate stored Twilio credentials against the Twilio API.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminIntegrationTestResultDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Organization was not found."}},"tags":["admin.organizations.comms"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/comms/deliverability":{"get":{"operationId":"getAdminOrganizationCommsDeliverability","x-charidy-permissions":["organizations.read_all"],"x-charidy-human-only":true,"summary":"Read an organization's marketing circuit-breaker state and shared-lane cap override.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminDeliverabilityResponseDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Organization was not found."}},"tags":["admin.organizations.comms"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/comms/deliverability/clear":{"post":{"operationId":"clearAdminOrganizationMarketingBreaker","x-charidy-permissions":["organizations.plan.manage"],"x-charidy-human-only":true,"summary":"Lift an organization's marketing pause/stop after review.","description":"Resets the breaker to `ok` and restarts its 7-day window from now so the sends that tripped it are not counted again. Transactional email is never affected by the breaker. Human-only: a platform admin must make this call.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClearMarketingBreakerDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminDeliverabilityResponseDto"}}}},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Organization was not found."}},"tags":["admin.organizations.comms"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/comms/shared-lane-cap":{"put":{"operationId":"putAdminOrganizationSharedLaneCap","x-charidy-permissions":["organizations.plan.manage"],"x-charidy-human-only":true,"summary":"Override one organization's monthly cap on the shared marketing lane.","description":"`monthlyCap: null` removes the override (the platform default applies).","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetSharedLaneCapDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminDeliverabilityResponseDto"}}}},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Organization was not found."}},"tags":["admin.organizations.comms"],"security":[{"bearer":[]}]}},"/api/v1/admin/users":{"get":{"operationId":"listAdminUsers","x-charidy-permissions":["organizations.read_all"],"summary":"List users across tenants (super-admin control plane).","parameters":[{"name":"search","required":false,"in":"query","description":"Free-text search query.","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"Maximum rows to return.","schema":{"type":"number","default":50}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminUserListResponseDto"}}}},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.users"]}},"/api/v1/admin/users/system-roles":{"get":{"operationId":"listAdminSystemRoles","x-charidy-permissions":["roles.read"],"summary":"List platform system roles assignable from the super-admin user screen.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminSystemRoleListResponseDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.users"]}},"/api/v1/admin/users/{userId}":{"get":{"operationId":"getAdminUser","x-charidy-permissions":["organizations.read_all"],"summary":"Get a single user with cross-tenant organization memberships.","parameters":[{"name":"userId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminUserDetailResponseDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"User was not found."}},"tags":["admin.users"]}},"/api/v1/admin/users/{userId}/system-roles":{"put":{"operationId":"updateAdminUserSystemRoles","x-charidy-permissions":["roles.manage"],"summary":"Replace a user platform system-role assignments.","description":"Controls platform-level admin access such as super_admin_tier_1, super_admin_tier_2, and super_admin_tier_3.","parameters":[{"name":"userId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAdminUserSystemRolesDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminUserDetailResponseDto"}}}},"400":{"description":"One or more system roles cannot be assigned."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"User was not found."}},"tags":["admin.users"]}},"/api/v1/admin/users/{userId}/soft-delete":{"post":{"operationId":"softDeleteAdminUser","x-charidy-permissions":["organizations.suspend"],"summary":"Soft delete (disable) user while preserving linked data.","parameters":[{"name":"userId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminSoftDeleteDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminMutationResultDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"User was not found."}},"tags":["admin.users"]}},"/api/v1/admin/users/{userId}/hard-delete":{"post":{"operationId":"hardDeleteAdminUser","x-charidy-permissions":["organizations.suspend"],"summary":"Hard delete user only after safety checks pass.","parameters":[{"name":"userId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminHardDeleteDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminMutationResultDto"}}}},"400":{"description":"Hard delete confirmation is missing."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.users"]}},"/api/v1/admin/campaigns":{"get":{"operationId":"listAdminCampaigns","x-charidy-permissions":["organizations.read_all"],"summary":"List campaigns across tenants (super-admin control plane).","parameters":[{"name":"search","required":false,"in":"query","description":"Free-text search query.","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"Maximum rows to return.","schema":{"type":"number","default":50}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminCampaignListResponseDto"}}}},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.campaigns"]}},"/api/v1/admin/campaigns/{campaignId}":{"get":{"operationId":"getAdminCampaign","x-charidy-permissions":["organizations.read_all"],"summary":"Get a single campaign with owning organization context.","parameters":[{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminCampaignDetailResponseDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign was not found."}},"tags":["admin.campaigns"]},"patch":{"operationId":"patchAdminCampaign","x-charidy-permissions":["organizations.suspend"],"summary":"Super-admin patch for campaign lifecycle fields.","parameters":[{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminPatchCampaignDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminMutationResultDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign was not found."}},"tags":["admin.campaigns"]}},"/api/v1/admin/campaigns/{campaignId}/soft-delete":{"post":{"operationId":"softDeleteAdminCampaign","x-charidy-permissions":["organizations.suspend"],"summary":"Soft delete (archive) campaign while preserving linked data.","parameters":[{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminSoftDeleteDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminMutationResultDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign was not found."}},"tags":["admin.campaigns"]}},"/api/v1/admin/campaigns/{campaignId}/hard-delete":{"post":{"operationId":"hardDeleteAdminCampaign","x-charidy-permissions":["organizations.suspend"],"summary":"Hard delete campaign only after safety checks pass.","parameters":[{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminHardDeleteDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminMutationResultDto"}}}},"400":{"description":"Hard delete confirmation is missing."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.campaigns"]}},"/api/v1/admin/campaigns/{campaignId}/duplicate":{"post":{"operationId":"duplicateAdminCampaign","x-charidy-permissions":["organizations.suspend"],"summary":"Duplicate campaign as draft in the same tenant.","parameters":[{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminMutationResultDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign was not found."}},"tags":["admin.campaigns"]}},"/api/v1/admin/impersonate/start":{"post":{"operationId":"startAdminImpersonation","x-charidy-permissions":["identity.impersonate"],"summary":"Start a time-limited support session as a user of the target organization.","description":"Issues an impersonation JWT carrying the target tenant plus an `act` claim naming the real operator, who is recorded on the session and in the audit log (CHAR-147: no reason text is required or collected).","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartImpersonationDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImpersonationTokenResponseDto"}}}},"400":{"description":"Target organization/user relation is invalid."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.impersonation"]}},"/api/v1/admin/impersonate/exit":{"post":{"operationId":"exitAdminImpersonation","summary":"End an active support session.","description":"Callable with the impersonation token (session read from its claims) or with the operator’s own token plus `sessionId`.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExitImpersonationDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminMutationResultDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Caller did not start this impersonation session."}},"tags":["admin.impersonation"]}},"/api/v1/admin/permissions":{"get":{"operationId":"listAdminPermissions","x-charidy-permissions":["roles.read"],"summary":"List the global permission catalog for admin RBAC management","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminPermissionCatalogResponseDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.rbac"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/members":{"get":{"operationId":"listAdminOrganizationMembers","x-charidy-permissions":["team.read"],"summary":"List organization memberships for super-admin role assignment","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"search","required":false,"in":"query","description":"Free-text search by email or display name.","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"Maximum rows to return.","schema":{"type":"number","default":100}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminOrganizationMembersResponseDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Organization was not found."}},"tags":["admin.rbac"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/members/{membershipId}/role":{"patch":{"operationId":"updateAdminOrganizationMemberRole","x-charidy-permissions":["team.update"],"summary":"Change an organization member primary role","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"membershipId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAdminMemberRoleDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminOrganizationMemberDto"}}}},"400":{"description":"Role is not assignable for this organization."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Organization membership was not found."}},"tags":["admin.rbac"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/roles":{"get":{"operationId":"listAdminOrganizationRoles","x-charidy-permissions":["roles.read"],"summary":"List system and custom roles available to an organization","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminRoleListResponseDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Organization was not found."}},"tags":["admin.rbac"],"security":[{"bearer":[]}]},"post":{"operationId":"createAdminOrganizationRole","x-charidy-permissions":["roles.manage"],"summary":"Create a custom role for an organization","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAdminRoleDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminRoleDto"}}}},"400":{"description":"Invalid role payload."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Organization was not found."}},"tags":["admin.rbac"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/roles/{roleId}":{"patch":{"operationId":"updateAdminOrganizationRole","x-charidy-permissions":["roles.manage"],"summary":"Update a custom organization role","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"roleId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAdminRoleDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminRoleDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"System roles are immutable."},"404":{"description":"Role was not found."}},"tags":["admin.rbac"],"security":[{"bearer":[]}]}},"/api/v1/admin/organizations/{organizationId}/roles/{roleId}/permissions":{"get":{"operationId":"getAdminOrganizationRolePermissions","x-charidy-permissions":["roles.read"],"summary":"Get a role permission matrix for admin RBAC editing","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"roleId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminRolePermissionMatrixResponseDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Role was not found."}},"tags":["admin.rbac"],"security":[{"bearer":[]}]},"put":{"operationId":"updateAdminOrganizationRolePermissions","x-charidy-permissions":["roles.manage"],"summary":"Replace a custom role permission grants list","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"roleId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAdminRolePermissionsDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminRolePermissionMatrixResponseDto"}}}},"400":{"description":"Unknown permission key."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"System roles are immutable."},"404":{"description":"Role was not found."}},"tags":["admin.rbac"],"security":[{"bearer":[]}]}},"/api/v1/admin/page-policies/{key}":{"get":{"operationId":"getAdminPagePolicy","x-charidy-permissions":["admin.page_policies.manage"],"summary":"Read a Freeform Page Engine policy by key (e.g. \"default\").","parameters":[{"name":"key","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PagePolicyResponseDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Page policy was not found."}},"tags":["admin.page-policies"],"security":[{"bearer":[]}]},"put":{"operationId":"upsertAdminPagePolicy","x-charidy-permissions":["admin.page_policies.manage"],"summary":"Create or update a Freeform Page Engine policy (required capabilities, allowlist, concerns).","parameters":[{"name":"key","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertPagePolicyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PagePolicyResponseDto"}}}},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.page-policies"],"security":[{"bearer":[]}]}},"/api/v1/core/communication-templates":{"get":{"operationId":"listCommunicationTemplates","x-charidy-permissions":["communications.read"],"summary":"List comms templates.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":100,"default":50,"type":"number"}},{"name":"channel","required":false,"in":"query","schema":{"enum":["email","sms","whatsapp"],"type":"string"}},{"name":"locale","required":false,"in":"query","schema":{"enum":["en","he"],"type":"string"}},{"name":"category","required":false,"in":"query","schema":{"enum":["transactional","marketing","ambassador","system"],"type":"string"}},{"name":"isActive","required":false,"in":"query","schema":{"type":"boolean"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunicationTemplatesListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]},"post":{"operationId":"createCommunicationTemplate","x-charidy-permissions":["communications.manage"],"summary":"Create a comms template.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCommunicationTemplateDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunicationTemplateResponseDto"}}}},"400":{"description":"Validation failed or email subject is missing."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"409":{"description":"Template key already exists for this channel and locale."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communication-templates/{templateId}":{"get":{"operationId":"getCommunicationTemplate","x-charidy-permissions":["communications.read"],"summary":"Read one template.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"templateId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunicationTemplateResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Template not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]},"patch":{"operationId":"updateCommunicationTemplate","x-charidy-permissions":["communications.manage"],"summary":"Update a template.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"templateId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCommunicationTemplateDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunicationTemplateResponseDto"}}}},"400":{"description":"Validation failed or email subject would be missing."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Template not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]},"delete":{"operationId":"deleteCommunicationTemplate","x-charidy-permissions":["communications.manage"],"summary":"Soft-delete a template.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"templateId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":""},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Template not found or already deleted."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communication-templates/{templateId}/preview":{"post":{"operationId":"previewCommunicationTemplate","x-charidy-permissions":["communications.manage"],"summary":"Render template against sample context.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"templateId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreviewCommunicationTemplateDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreviewCommunicationTemplateResponseDto"}}}},"400":{"description":"Template body engine is not supported."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Template not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communication-templates/{templateId}/submit-meta":{"post":{"operationId":"submitCommunicationTemplateForMetaApproval","x-charidy-permissions":["communications.manage"],"summary":"Frozen for the email-only launch. WhatsApp template submission is not available.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"templateId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WabaSubmitResponseDto"}}}},"400":{"description":"Only whatsapp templates can be submitted for Meta approval."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Template not found."},"409":{"description":"Template is already pending or approved."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communication-templates/seed-defaults":{"post":{"operationId":"seedDefaultEmailTemplates","x-charidy-permissions":["communications.manage"],"summary":"Seed the default email templates + automation rules (and a default sender) for this organization. Idempotent.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SeedDefaultCommsResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communication-templates/{templateId}/send-test":{"post":{"operationId":"sendTestEmail","x-charidy-permissions":["communications.manage"],"x-charidy-feature-flag":"comms.manual.enabled","summary":"Send a live test of an email template (rendered + branded) to an address.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"templateId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendTestEmailDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendTestEmailResponseDto"}}}},"400":{"description":"Template is not an email template or no sender identity is configured."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED — feature is disabled for this organization."},"404":{"description":"Template not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communication-sender-identities":{"get":{"operationId":"listCommunicationSenderIdentities","x-charidy-permissions":["communications.read"],"summary":"List verified senders.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":100,"default":50,"type":"number"}},{"name":"channel","required":false,"in":"query","schema":{"enum":["email","sms","whatsapp"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunicationSenderIdentitiesListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communication-sender-identities/{senderIdentityId}/verify":{"post":{"operationId":"verifyCommunicationSenderIdentity","x-charidy-permissions":["communications.manage"],"summary":"Verify a sender identity against its connected, provider-validated sending domain.","description":"An email sender identity becomes verified only when its domain is a connected sending domain (see `createCommunicationSendingDomain`) that the email provider has validated: this call re-checks the DNS records with the provider and returns 409 `SENDING_DOMAIN_NOT_CONNECTED` or `SENDER_DOMAIN_NOT_VERIFIED` (with a per-record report) otherwise. It no longer marks an address verified without that evidence. Non-email identities return 409 `SENDER_VERIFICATION_UNSUPPORTED`.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"senderIdentityId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunicationSenderIdentityResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"409":{"description":"SENDING_DOMAIN_NOT_CONNECTED, SENDER_DOMAIN_NOT_VERIFIED or SENDER_VERIFICATION_UNSUPPORTED."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communication-sending-domains":{"get":{"operationId":"listCommunicationSendingDomains","x-charidy-permissions":["communications.read"],"summary":"List the domains this organization has connected for sending email.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendingDomainsListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]},"post":{"operationId":"createCommunicationSendingDomain","x-charidy-permissions":["communications.manage"],"x-charidy-feature-flag":"comms.sendingDomain.enabled","summary":"Start connecting a sending domain: returns the DNS records to publish.","description":"Registers the domain with the email provider (SendGrid Domain Authentication) and returns the DNS records the organization (or its IT person) must add. By default a subdomain (`news.<domain>`) is authenticated, which isolates sending reputation and leaves existing email DNS untouched; pass `mode: \"root\"` to authenticate the domain itself. The domain stays `pending` until the provider confirms the records: it is re-checked automatically in the background and on `verifyCommunicationSendingDomain`.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSendingDomainDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendingDomainResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"FEATURE_DISABLED — feature is disabled for this organization."},"409":{"description":"SENDING_DOMAIN_EXISTS, SENDGRID_NOT_CONFIGURED or COMMS_PROVIDER_ACCOUNT_MISSING."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communication-sending-domains/{sendingDomainId}":{"get":{"operationId":"getCommunicationSendingDomain","x-charidy-permissions":["communications.read"],"summary":"Read one sending domain: the DNS records to publish, verification status, last check and the detected DNS host.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"sendingDomainId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendingDomainResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"SENDING_DOMAIN_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]},"delete":{"operationId":"deleteCommunicationSendingDomain","x-charidy-permissions":["communications.manage"],"summary":"Disconnect a sending domain.","description":"Removes the domain here and (best effort) at the email provider. Sender addresses at the domain stop counting as verified.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"sendingDomainId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":""},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"SENDING_DOMAIN_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communication-sending-domains/{sendingDomainId}/verify":{"post":{"operationId":"verifyCommunicationSendingDomain","x-charidy-permissions":["communications.manage"],"x-charidy-feature-flag":"comms.sendingDomain.enabled","summary":"Check the DNS records now.","description":"Asks the email provider to validate the domain and also looks the records up in DNS. The domain becomes `verified` only when the PROVIDER confirms every record; otherwise the response carries a per-record report (`lastValidation`) explaining what is missing. Safe to call repeatedly.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"sendingDomainId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendingDomainResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"FEATURE_DISABLED — feature is disabled for this organization."},"404":{"description":"SENDING_DOMAIN_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communication-sending-domains/{sendingDomainId}/send-instructions":{"post":{"operationId":"sendCommunicationSendingDomainInstructions","x-charidy-permissions":["communications.manage"],"x-charidy-feature-flag":"comms.sendingDomain.enabled","summary":"Email the DNS records to the person who manages the domain (\"send to my IT person\").","description":"Sends a system email (no donor consent involved) with the records and short instructions to the given address. At most 5 per domain per 24 hours; the same recipient within the same hour is a no-op (`already_queued`).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"sendingDomainId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendSendingDomainInstructionsDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendSendingDomainInstructionsResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"FEATURE_DISABLED — feature is disabled for this organization."},"404":{"description":"SENDING_DOMAIN_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communication-settings":{"get":{"operationId":"getCommunicationSettings","x-charidy-permissions":["communications.read"],"summary":"Email sending settings: reply-to address, default marketing sender, the lane marketing mail would use now, shared-lane cap usage, the marketing circuit breaker and any domain warm-up.","description":"Marketing email goes from the organization's own VERIFIED sending domain when it has one; otherwise from the platform shared marketing lane, which is capped per calendar month (over the cap marketing is skipped with `shared_lane_cap` until a domain is connected). Transactional, system and ambassador email always uses the platform sender, co-branded with the organization name and the Reply-To below.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunicationSettingsResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]},"put":{"operationId":"updateCommunicationSettings","x-charidy-permissions":["communications.manage"],"summary":"Set the reply-to address and/or the default marketing sender.","description":"Fields that are omitted are left unchanged; `null` clears a field. `replyToEmail` must be a single valid mailbox. `defaultMarketingSenderIdentityId` must be an email sender on one of the organization's verified sending domains (connect a domain first).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCommunicationSettingsDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunicationSettingsResponseDto"}}}},"400":{"description":"INVALID_REPLY_TO or DEFAULT_SENDER_NOT_ON_VERIFIED_DOMAIN."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communication-provider-accounts":{"get":{"operationId":"listCommunicationProviderAccounts","x-charidy-permissions":["communications.manage"],"summary":"List per-org provider sub-accounts (masked).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunicationProviderAccountsListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communication-provider-accounts/readiness":{"get":{"operationId":"getCommunicationReadiness","x-charidy-permissions":["communications.manage"],"summary":"Read email provider readiness for this organization.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunicationReadinessResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communication-provider-accounts/twilio-sms":{"put":{"operationId":"putOrganizationTwilioSmsIntegration","x-charidy-permissions":["communications.manage"],"summary":"Store encrypted Twilio SMS credentials for this organization.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PutOrganizationTwilioSmsIntegrationDto"}}}},"responses":{"204":{"description":""},"400":{"description":"Validation failed or integration secrets are not configured."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]},"delete":{"operationId":"disconnectOrganizationTwilioSmsIntegration","x-charidy-permissions":["communications.manage"],"summary":"Disconnect the stored Twilio SMS credentials for this organization.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"responses":{"204":{"description":""},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communication-provider-accounts/twilio-sms/test":{"post":{"operationId":"testOrganizationTwilioSmsIntegration","x-charidy-permissions":["communications.manage"],"summary":"Validate stored Twilio SMS credentials for this organization.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunicationIntegrationTestResultDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communication-provider-accounts/twilio-whatsapp":{"put":{"operationId":"putOrganizationTwilioWhatsappIntegration","x-charidy-permissions":["communications.manage"],"summary":"Store encrypted Twilio WhatsApp credentials for this organization.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PutOrganizationTwilioWhatsappIntegrationDto"}}}},"responses":{"204":{"description":""},"400":{"description":"Validation failed or integration secrets are not configured."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]},"delete":{"operationId":"disconnectOrganizationTwilioWhatsappIntegration","x-charidy-permissions":["communications.manage"],"summary":"Disconnect the stored Twilio WhatsApp credentials for this organization.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"responses":{"204":{"description":""},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communication-provider-accounts/twilio-whatsapp/test":{"post":{"operationId":"testOrganizationTwilioWhatsappIntegration","x-charidy-permissions":["communications.manage"],"summary":"Validate stored Twilio WhatsApp credentials for this organization.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunicationIntegrationTestResultDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communication-suppressions":{"get":{"operationId":"listCommunicationSuppressions","x-charidy-permissions":["communications.suppressions.manage"],"summary":"List active suppressions.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":100,"default":50,"type":"number"}},{"name":"channel","required":false,"in":"query","schema":{"enum":["email","sms","whatsapp"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunicationSuppressionsListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]},"post":{"operationId":"createCommunicationSuppression","x-charidy-permissions":["communications.suppressions.manage"],"summary":"Add a suppression entry.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCommunicationSuppressionDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunicationSuppressionResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communication-suppressions/{suppressionId}":{"delete":{"operationId":"liftCommunicationSuppression","x-charidy-permissions":["communications.suppressions.manage"],"summary":"Lift / remove a suppression.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"suppressionId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":""},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Suppression entry not found or already lifted."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/public/unsubscribe/{token}":{"get":{"operationId":"previewUnsubscribe","summary":"Resolve a token and show current opt-out state without applying changes.","parameters":[{"name":"token","required":true,"in":"path","description":"Per-contact opaque token from email/SMS link.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnsubscribePreviewResponseDto"}}}},"404":{"description":"Token does not match any contact."}},"tags":["public.communications"]},"post":{"operationId":"applyUnsubscribe","summary":"Apply opt-out for the given channels (default: [\"email\"]).","parameters":[{"name":"token","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnsubscribeRequestDto"}},"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/UnsubscribeRequestDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnsubscribePreviewResponseDto"}}}}},"tags":["public.communications"]}},"/api/v1/core/broadcasts":{"get":{"operationId":"listBroadcasts","x-charidy-permissions":["communications.read"],"summary":"List broadcasts.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":100,"default":50,"type":"number"}},{"name":"status","required":false,"in":"query","schema":{"enum":["draft","scheduled","sending","completed","canceled","failed"],"type":"string"}},{"name":"channel","required":false,"in":"query","schema":{"enum":["email","sms","whatsapp"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastsListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]},"post":{"operationId":"createBroadcast","x-charidy-permissions":["communications.broadcasts.send"],"x-charidy-destructive":true,"summary":"Create a broadcast (draft, scheduled, or send-now).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBroadcastDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"AUTH_EMAIL_NOT_VERIFIED — the acting user has not confirmed their email address yet (POST /auth/resend-verification issues a fresh link), or FEATURE_DISABLED / missing permission."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/broadcasts/{broadcastId}":{"get":{"operationId":"getBroadcast","x-charidy-permissions":["communications.read"],"summary":"Read one broadcast.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"broadcastId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Broadcast not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/broadcasts/{broadcastId}/cancel":{"post":{"operationId":"cancelBroadcast","x-charidy-permissions":["communications.broadcasts.send"],"x-charidy-destructive":true,"summary":"Cancel a draft / scheduled / sending broadcast.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"broadcastId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelBroadcastDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/broadcasts/{broadcastId}/recipients":{"get":{"operationId":"listBroadcastRecipients","x-charidy-permissions":["communications.read"],"summary":"List recipients of a broadcast (paged).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"broadcastId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastRecipientsListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/public/webhooks/sendgrid/events":{"post":{"operationId":"sendgridWebhookEvents","summary":"Buffer SendGrid event batch (delivered, opened, clicked, bounced, etc.).","description":"Provider-only endpoint. Verifies the SendGrid signature when `SENDGRID_WEBHOOK_VERIFY=true`, buffers events, and enqueues ingest workers. AI agents must not invoke this — it is signed by SendGrid.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"array","items":{"type":"string"}}}}},"responses":{"202":{"description":""}},"tags":["public.communications.webhooks"]}},"/api/v1/public/webhooks/twilio/status":{"post":{"operationId":"twilioSmsStatusWebhook","summary":"Buffer Twilio SMS status callback (sent / delivered / failed / undelivered).","description":"Provider-only Twilio SMS status callback. Signature is verified when `TWILIO_WEBHOOK_VERIFY=true`. Not callable by AI agents.","parameters":[],"responses":{"202":{"description":""}},"tags":["public.communications.webhooks"]}},"/api/v1/public/webhooks/twilio/whatsapp/status":{"post":{"operationId":"twilioWhatsAppStatusWebhook","summary":"Buffer Twilio WhatsApp status callback.","description":"Provider-only WhatsApp status callback. Not callable by AI agents.","parameters":[],"responses":{"202":{"description":""}},"tags":["public.communications.webhooks"]}},"/api/v1/public/webhooks/twilio/sms/inbound":{"post":{"operationId":"twilioSmsInboundWebhook","summary":"Buffer inbound SMS (used for STOP keyword detection + suppression).","description":"Provider-only inbound SMS. Not callable by AI agents.","parameters":[],"responses":{"202":{"description":""}},"tags":["public.communications.webhooks"]}},"/api/v1/public/webhooks/twilio/whatsapp/inbound":{"post":{"operationId":"twilioWhatsAppInboundWebhook","summary":"Buffer inbound WhatsApp (STOP / session resets).","description":"Provider-only inbound WhatsApp. Not callable by AI agents.","parameters":[],"responses":{"202":{"description":""}},"tags":["public.communications.webhooks"]}},"/api/v1/core/communication-logs":{"get":{"operationId":"listCommunicationLogs","x-charidy-permissions":["communications.read"],"summary":"Filter the unified messages log.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":100,"default":50,"type":"number"}},{"name":"channel","required":false,"in":"query","schema":{"enum":["email","sms","whatsapp"],"type":"string"}},{"name":"status","required":false,"in":"query","schema":{"enum":["queued","sent","delivered","failed","bounced","complained","opened","clicked","unsubscribed","skipped_no_consent","skipped_suppressed"],"type":"string"}},{"name":"templateId","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"contactId","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"sourceKind","required":false,"in":"query","description":"broadcast | automation_rule | manual | system","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunicationLogsListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communication-logs/{logId}":{"get":{"operationId":"getCommunicationLog","x-charidy-permissions":["communications.read"],"summary":"Read one log row.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"logId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunicationLogResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communications/copy-performance":{"get":{"operationId":"getCommunicationCopyPerformance","x-charidy-permissions":["communications.read"],"summary":"Top-performing message copy, aggregated PII-safe at the template level.","description":"Joins broadcast engagement counters (sent/opened/clicked/unsubscribed) to their template (subject with merge tags UN-rendered, channel, locale, category) and returns the top entries by openRate then clickRate. Entries need at least `minSends` total sends (k-anonymity floor) so no individual recipient behavior is inferable; when nothing passes the floor the response is an honest `dataThin: true`, never invented baselines. Per-recipient rendered content is never read.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":50,"default":10,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopyPerformanceResponseDto"}}}},"400":{"description":"Missing or invalid tenant context."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED — the `comms.email.enabled` flag is off for this organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communications/performance":{"get":{"operationId":"getCommunicationPerformance","x-charidy-permissions":["communications.read"],"summary":"Email performance grouped by broadcast, automation, automation step, template or campaign.","description":"Funnel per group for emails SENT in the time range: sent, delivered, bounced, unsubscribed, opens (human vs total, unique), clicks (unique) and donations attributed to the emails (last click within 7 days) with revenue per currency. Opens are approximate (automatic opens are flagged). Defaults to the last 90 days. For `automation_step`, pass the automation id as `id`.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"dimension","required":false,"in":"query","schema":{"default":"broadcast","enum":["broadcast","automation","automation_step","template","campaign"],"type":"string"}},{"name":"from","required":false,"in":"query","description":"Start of the range (send time). Default: 90 days ago.","schema":{"format":"date-time","type":"string"}},{"name":"to","required":false,"in":"query","description":"End of the range (exclusive). Default: now.","schema":{"format":"date-time","type":"string"}},{"name":"id","required":false,"in":"query","description":"Narrow to one broadcast / automation / template / campaign (required for dimension `automation_step`: the automation id).","schema":{"format":"uuid","type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":200,"default":50,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunicationPerformanceResponseDto"}}}},"400":{"description":"INVALID_RANGE, RANGE_TOO_LARGE or AUTOMATION_ID_REQUIRED."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED — `comms.email.enabled` is off for this organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communications/broadcasts/{broadcastId}/performance":{"get":{"operationId":"getBroadcastPerformance","x-charidy-permissions":["communications.read"],"summary":"Performance of one broadcast, with its most-clicked links.","description":"Sent, delivered, bounced, unsubscribed, opens (human vs total), unique clicks, attributed donations (revenue per currency) and the top clicked links for one broadcast.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"broadcastId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"from","required":false,"in":"query","description":"Start of the range (send time). Default: 90 days ago.","schema":{"format":"date-time","type":"string"}},{"name":"to","required":false,"in":"query","description":"End of the range (exclusive). Default: now.","schema":{"format":"date-time","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastPerformanceResponseDto"}}}},"400":{"description":"INVALID_RANGE or RANGE_TOO_LARGE."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communications/automations/{automationId}/performance":{"get":{"operationId":"getAutomationPerformance","x-charidy-permissions":["communications.read"],"summary":"Performance of one automation, in total and per email step.","description":"Same funnel as a broadcast, for emails an automation sent, plus one row per email step so you can see which step opens, clicks and brings donations.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"automationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"from","required":false,"in":"query","description":"Start of the range (send time). Default: 90 days ago.","schema":{"format":"date-time","type":"string"}},{"name":"to","required":false,"in":"query","description":"End of the range (exclusive). Default: now.","schema":{"format":"date-time","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationPerformanceResponseDto"}}}},"400":{"description":"INVALID_RANGE or RANGE_TOO_LARGE."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/communications/contacts/{contactId}/email-activity":{"get":{"operationId":"getContactEmailActivity","x-charidy-permissions":["communications.read"],"summary":"Emails one contact received, with opens, clicks and the donations attributed to each.","description":"Recent emails sent to the contact (template subject, merge tags un-rendered), when they were delivered, opened (flagged when the open looks automatic) and clicked, and any donation by the contact attributed to that email.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactEmailActivityResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/{contactId}/emails":{"post":{"operationId":"sendContactEmail","x-charidy-permissions":["communications.broadcasts.send"],"x-charidy-destructive":true,"x-charidy-feature-flag":"comms.manual.enabled","summary":"Send one email to one contact (from the contact card).","description":"Sends a personal one-to-one email through the normal send pipeline (queue, worker, suppression check, tracking, communication log). Content is EITHER `templateId` (an active marketing email template, optional `locale`) OR `subject` + `body` (free text). Consent: only SUPPRESSION is checked (suppression list, explicit unsubscribe, do-not-contact); marketing opt-in is not required for this one-to-one endpoint. Lane: never the transactional lane. It goes out on the organization verified sending domain, else the shared marketing lane (monthly cap); with neither available the call fails with CHANNEL_NOT_READY. The log row carries `source = personal` and the sending user, and the email shows up in `getContactEmailActivity` and the contact timeline. Returns 201 with the log id; delivery is asynchronous. Repeating a request with the same Idempotency-Key returns the same log with `replayed = true` and sends nothing new.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendContactEmailDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendContactEmailResponseDto"}}}},"400":{"description":"CONTACT_NO_EMAIL, CONTACT_EMAIL_CONTENT_INVALID (neither or both content modes, empty body), TEMPLATE_NOT_FOUND, TEMPLATE_NOT_SENDABLE, SENDER_IDENTITY_UNAVAILABLE, or request validation errors."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED — feature is disabled for this organization."},"404":{"description":"CONTACT_NOT_FOUND."},"409":{"description":"CONTACT_SUPPRESSED (unsubscribed, bounced, complained, blocked or do-not-contact) or CHANNEL_NOT_READY (no verified sending domain and no available shared marketing lane, or no sender identity)."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.communications"],"security":[{"bearer":[]}]}},"/api/v1/public/t/c/{token}":{"get":{"operationId":"trackEmailClick","summary":"Record an email link click and redirect to the original URL.","description":"Public, opaque signed token. Redirects (302) to the URL stored for that email link with UTM parameters appended; an invalid or expired token redirects to the site root. Never redirects to a caller-supplied URL. Not callable by AI agents.","parameters":[{"name":"token","required":true,"in":"path","description":"Opaque signed click token from a tracked email link.","schema":{"type":"string"}}],"responses":{"302":{"description":"Redirect to the destination URL (or the site root)."}},"tags":["public.communications.tracking"]}},"/api/v1/public/t/o/{file}":{"get":{"operationId":"trackEmailOpen","summary":"Record an email open and return a 1x1 transparent GIF.","description":"Public open-tracking pixel (`<token>.gif`). Always returns the same GIF whether or not the token is valid. Opens are approximate: mail privacy proxies load the pixel automatically, so likely-machine opens are flagged and reported separately. Not callable by AI agents.","parameters":[{"name":"file","required":true,"in":"path","description":"Opaque signed open token with a .gif suffix.","schema":{"type":"string"}}],"responses":{"200":{"description":"1x1 transparent GIF."}},"tags":["public.communications.tracking"]}},"/api/v1/core/tasks":{"get":{"operationId":"listTasks","x-charidy-permissions":["tasks.read"],"summary":"List unified tasks for the caller (or org-wide with tasks.manage).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"assignee","required":false,"in":"query","description":"Whose tasks to return. 'me' scopes to the caller's assigned/created/co-assigned tasks; 'all' requires tasks.manage and returns org-wide tasks.","schema":{"default":"me","enum":["me","all"],"type":"string"}},{"name":"type","required":false,"in":"query","schema":{"enum":["call","email","meeting","whatsapp","sms","todo","donation_chase","custom"],"type":"string"}},{"name":"status","required":false,"in":"query","schema":{"enum":["open","in_progress","completed","snoozed","skipped","canceled","expired","blocked"],"type":"string"}},{"name":"priority","required":false,"in":"query","schema":{"enum":["low","normal","high","urgent"],"type":"string"}},{"name":"source","required":false,"in":"query","schema":{"enum":["manual","system","automation","ai_advisor","reminder"],"type":"string"}},{"name":"contactId","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"contributionId","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"campaignId","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"teamId","required":false,"in":"query","description":"Campaign team node this task hangs off.","schema":{"format":"uuid","type":"string"}},{"name":"dueBefore","required":false,"in":"query","description":"Only return tasks due before this timestamp.","schema":{"format":"date-time","type":"string"}},{"name":"includeCompleted","required":false,"in":"query","description":"Include completed/canceled tasks in the result.","schema":{"default":false,"type":"boolean"}},{"name":"isBlocking","required":false,"in":"query","description":"When true, return only tasks flagged as blocking — the ones that hold up a campaign phase (and, for orgs with tasks.publish_gating.enabled, block publishing). Lets a caller answer \"what is still in my way?\" without filtering client-side. Pass false for only the advisory ones; omit for both.","schema":{"type":"boolean"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive search over title and description.","schema":{"maxLength":200,"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":100,"default":50,"type":"number"}},{"name":"offset","required":false,"in":"query","schema":{"minimum":0,"default":0,"type":"number"}},{"name":"locale","required":false,"in":"query","description":"Locale used to localize system-task titles and descriptions.","schema":{"default":"en","enum":["en","he"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Org-wide listing requires tasks.manage."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tasks"],"security":[{"bearer":[]}]},"post":{"operationId":"createTask","x-charidy-permissions":["tasks.manage"],"summary":"Create a unified task (call/email/todo/etc.).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTaskDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskResponseDto"}}}},"400":{"description":"Payload is invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tasks"],"security":[{"bearer":[]}]}},"/api/v1/core/tasks/insight":{"get":{"operationId":"getTasksInsight","x-charidy-permissions":["tasks.read"],"summary":"AI summary + next-best-action across the caller’s open tasks (deterministic fallback when LLM is off).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"locale","required":false,"in":"query","description":"Response locale (en | he). Defaults to en.","schema":{"type":"string"}},{"name":"campaignId","required":false,"in":"query","description":"Scope the insight to a single campaign.","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TasksInsightResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tasks"],"security":[{"bearer":[]}]}},"/api/v1/core/tasks/{taskId}":{"get":{"operationId":"getTask","x-charidy-permissions":["tasks.read"],"summary":"Get a single task by id.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"taskId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Task not found or not visible to the caller."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tasks"],"security":[{"bearer":[]}]},"patch":{"operationId":"updateTask","x-charidy-permissions":["tasks.read"],"summary":"Update a task (status, priority, dates, outcome).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"taskId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTaskDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Caller lacks tasks.manage and does not own the task."},"404":{"description":"Task not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tasks"],"security":[{"bearer":[]}]},"delete":{"operationId":"deleteTask","x-charidy-permissions":["tasks.manage"],"summary":"Soft-delete a task.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"taskId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Task soft-deleted."},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Caller lacks tasks.manage and does not own the task."},"404":{"description":"Task not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tasks"],"security":[{"bearer":[]}]}},"/api/v1/core/tasks/{taskId}/assign":{"post":{"operationId":"assignTask","x-charidy-permissions":["tasks.assign"],"summary":"Assign or reassign a task owner and co-assignees.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"taskId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssignTaskDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Task not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tasks"],"security":[{"bearer":[]}]}},"/api/v1/core/tasks/{taskId}/comments":{"get":{"operationId":"listTaskComments","x-charidy-permissions":["tasks.read"],"summary":"List comments on a task.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"taskId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskCommentsListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Task not found or not visible to the caller."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tasks"],"security":[{"bearer":[]}]},"post":{"operationId":"addTaskComment","x-charidy-permissions":["tasks.read"],"summary":"Add a comment to a task.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"taskId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTaskCommentDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskCommentResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Caller lacks tasks.manage and does not own the task."},"404":{"description":"Task not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tasks"],"security":[{"bearer":[]}]}},"/api/v1/core/tasks/feed":{"get":{"operationId":"listTaskFeed","x-charidy-permissions":["tasks.read"],"summary":"List the campaign copilot task feed for this tenant.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"lifecyclePhase","required":false,"in":"query","schema":{"enum":["pre_campaign","soft_launch","live_campaign","post_campaign"],"type":"string"}},{"name":"status","required":false,"in":"query","schema":{"enum":["open","in_progress","completed","snoozed","skipped","canceled","expired","blocked"],"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":100,"default":50,"type":"number"}},{"name":"locale","required":false,"in":"query","description":"Locale used to localize system-task titles and descriptions in the feed.","schema":{"default":"en","enum":["en","he"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskFeedResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tasks"],"security":[{"bearer":[]}]}},"/api/v1/core/tasks/manual":{"post":{"operationId":"createManualTask","x-charidy-permissions":["tasks.manage"],"summary":"Create a manual campaign copilot task in the feed.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateManualTaskDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskResponseDto"}}}},"400":{"description":"Manual tasks are disabled or payload is invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tasks"],"security":[{"bearer":[]}]}},"/api/v1/core/tasks/{taskId}/execute":{"post":{"operationId":"executeTaskAction","x-charidy-permissions":["tasks.manage"],"summary":"Execute a task's click-to-execute action with org policy mode.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"taskId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteTaskActionDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteTaskActionResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Task not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tasks"],"security":[{"bearer":[]}]}},"/api/v1/core/tasks/{taskId}/complete":{"post":{"operationId":"completeTask","x-charidy-permissions":["tasks.manage"],"summary":"Mark a task as completed.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"taskId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteTaskDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Task not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tasks"],"security":[{"bearer":[]}]}},"/api/v1/core/tasks/{taskId}/snooze":{"post":{"operationId":"snoozeTask","x-charidy-permissions":["tasks.manage"],"summary":"Snooze a task by assigning a later due time.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"taskId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SnoozeTaskDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Task not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tasks"],"security":[{"bearer":[]}]}},"/api/v1/core/tasks/phase-gates/{campaignId}":{"get":{"operationId":"getPhaseGateStatus","x-charidy-permissions":["tasks.read"],"summary":"Get phase gate lock status for a campaign.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignPhaseGatesResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tasks"],"security":[{"bearer":[]}]}},"/api/v1/core/tasks/copilot-preference":{"get":{"operationId":"getCopilotTasksPreference","x-charidy-permissions":["settings.manage"],"summary":"Read the organization's Campaign Copilot preference.","description":"Returns the tenant preference plus what is actually in effect (the preference AND the tasks.copilot_feed.enabled capability flag), so a settings screen can tell \"you turned it off\" apart from \"we have not enabled it for you yet\".","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotTasksPreferenceResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tasks"],"security":[{"bearer":[]}]},"put":{"operationId":"updateCopilotTasksPreference","x-charidy-permissions":["settings.manage"],"x-charidy-destructive":true,"summary":"Turn Campaign Copilot tasks on or off for the organization.","description":"When switched off, the rule engine stops generating system tasks, the copilot tab is hidden, phase gates are cleared, and open blocking tasks stop gating publish. Tasks already created are left in place — dismiss those individually.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCopilotTasksPreferenceDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotTasksPreferenceResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tasks"],"security":[{"bearer":[]}]}},"/api/v1/core/tasks/policy":{"get":{"operationId":"getTaskExecutionPolicy","x-charidy-permissions":["organizations.feature_flags.manage"],"summary":"Get organization task execution policy.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskExecutionPolicyResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tasks"],"security":[{"bearer":[]}]},"put":{"operationId":"updateTaskExecutionPolicy","x-charidy-permissions":["organizations.feature_flags.manage"],"summary":"Update organization task execution mode and manual-task policy.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTaskExecutionPolicyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskExecutionPolicyResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tasks"],"security":[{"bearer":[]}]}},"/api/v1/core/segments":{"get":{"operationId":"listSegments","x-charidy-permissions":["communications.read"],"summary":"List saved audience segments.","description":"Returns reusable donor/contact segments for the active organization.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":100,"default":50,"type":"number"}},{"name":"isActive","required":false,"in":"query","description":"Filter by active flag.","schema":{"type":"boolean"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive match on segment name.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentsListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.segments"],"security":[{"bearer":[]}]},"post":{"operationId":"createSegment","x-charidy-permissions":["communications.manage"],"summary":"Create a saved audience segment.","description":"Persists a reusable segment definition (donor filters) usable as a broadcast target.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSegmentDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentResponseDto"}}}},"400":{"description":"Segment definition is malformed."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.segments"],"security":[{"bearer":[]}]}},"/api/v1/core/segments/presets":{"get":{"operationId":"listSegmentPresets","x-charidy-permissions":["communications.read"],"summary":"List the ready-made audiences (first-time donors, lapsed, major donors, a campaign's donors, ...).","description":"Each preset says in plain language who it finds and what it needs (a campaign, an amount). Pass its key to createSegmentFromPreset. Dates inside presets are relative (\"nothing in the last 12 months\"), so a saved preset segment stays correct over time.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentPresetsListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.segments"],"security":[{"bearer":[]}]}},"/api/v1/core/segments/from-preset":{"post":{"operationId":"createSegmentFromPreset","x-charidy-permissions":["communications.manage"],"summary":"Save a ready-made audience as a segment of this organization.","description":"Creates the segment once: asking again for the same preset (and campaign) returns the one already made. Campaign presets need campaignId; major_donors takes an optional minTotalMinor threshold.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSegmentFromPresetDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentResponseDto"}}}},"400":{"description":"Unknown preset, or a missing/invalid parameter."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.segments"],"security":[{"bearer":[]}]}},"/api/v1/core/segments/preview":{"post":{"operationId":"previewSegment","x-charidy-permissions":["communications.read"],"summary":"Preview an ad-hoc segment definition (count + sample) without saving.","description":"Compiles the supplied definition into a tenant-scoped query and returns the matching contact count plus a small sample. Used by the audience builder for live previews.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreviewSegmentDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentPreviewResponseDto"}}}},"400":{"description":"Segment definition is malformed."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.segments"],"security":[{"bearer":[]}]}},"/api/v1/core/segments/{segmentId}":{"get":{"operationId":"getSegment","x-charidy-permissions":["communications.read"],"summary":"Read one saved segment.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"segmentId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Segment not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.segments"],"security":[{"bearer":[]}]},"patch":{"operationId":"updateSegment","x-charidy-permissions":["communications.manage"],"summary":"Update a saved segment.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"segmentId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSegmentDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentResponseDto"}}}},"400":{"description":"Segment definition is malformed."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Segment not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.segments"],"security":[{"bearer":[]}]},"delete":{"operationId":"deleteSegment","x-charidy-permissions":["communications.manage"],"summary":"Soft-delete a saved segment.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"segmentId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":""},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Segment not found or already deleted."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.segments"],"security":[{"bearer":[]}]}},"/api/v1/core/segments/{segmentId}/preview":{"post":{"operationId":"previewSavedSegment","x-charidy-permissions":["communications.read"],"summary":"Preview a saved segment (count + sample) and record the evaluated count.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"segmentId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentPreviewResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Segment not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.segments"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/{contactId}/segments":{"get":{"operationId":"listContactSegments","x-charidy-permissions":["communications.read"],"summary":"List active segments a contact currently belongs to.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactSegmentsResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Contact not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.segments"],"security":[{"bearer":[]}]}},"/api/v1/advisor/state":{"get":{"operationId":"getAdvisorState","summary":"Read the current advisor stage + evidence for the active organization.","description":"The chat-runtime calls this on every turn so the LLM knows what stage the organization is in. The response is also safe to surface in the dashboard UI as a \"Next step\" badge.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorStateDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["advisor"],"security":[{"bearer":[]}]}},"/api/v1/advisor/state/recompute":{"post":{"operationId":"recomputeAdvisorState","summary":"Re-resolve the advisor stage from fresh evidence and persist the result.","description":"Called by other services after any mutation that may move the stage forward (diagnostic update, campaign auto-create, contact import). Idempotent — re-running with the same evidence is a no-op.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorStateDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["advisor"],"security":[{"bearer":[]}]}},"/api/v1/advisor/opener":{"get":{"operationId":"getAdvisorOpener","summary":"Get the proactive opener line the chat should display the moment it opens.","description":"Drives the \"no blank chat\" experience: instead of asking \"what would you like to do?\" the chat opens with a stage-aware coach line. Mirrors `getAdvisorState` but adds the localized opener string.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorOpenerDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["advisor"],"security":[{"bearer":[]}]}},"/api/v1/advisor/matcher-pitch-deck":{"post":{"operationId":"generateAdvisorMatcherPitchDeck","summary":"Generate a CEO-facing pitch deck for recruiting anchor / matcher donors.","description":"Returns Markdown + print-ready HTML + a shortlist of 5 candidate matchers pulled from the organization's top-scored contacts.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateMatcherPitchDeckRequestDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateMatcherPitchDeckResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"404":{"description":"ADVISOR_CAMPAIGN_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["advisor"],"security":[{"bearer":[]}]}},"/api/v1/advisor/campaign-in-a-box":{"post":{"operationId":"generateAdvisorCampaignInABox","summary":"Generate the full marketing bundle for a campaign (page + emails + posts + SMS + video).","description":"Returns a canonical page-builder layout + 3 staged emails + 5 social posts + 3 SMS templates + a 30-second video script. Outputs are sector-aware and locale-aware. Idempotent — re-running overwrites nothing on the server, the front end decides what to publish.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateCampaignBoxRequestDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateCampaignBoxResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"404":{"description":"ADVISOR_CAMPAIGN_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["advisor"],"security":[{"bearer":[]}]}},"/api/v1/advisor/ambassador-invite-pack":{"post":{"operationId":"generateAdvisorAmbassadorInvitePack","summary":"Generate WhatsApp + email invitations for the top ambassador candidates.","description":"Builds a personalised WhatsApp message (with wa.me deep link) and a matching HTML email for each contact. Defaults to the top 25 TIER_2 contacts; pass `contactIds` to target an explicit list.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateAmbassadorInvitePackRequestDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateAmbassadorInvitePackResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"404":{"description":"ADVISOR_CAMPAIGN_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["advisor"],"security":[{"bearer":[]}]}},"/api/v1/advisor/donation-ladder/propose":{"post":{"operationId":"proposeAdvisorDonationLadder","x-charidy-feature-flag":"advisor.donation_ladder","summary":"Propose a donation-tier ladder (a scale of gift AMOUNTS) for a campaign.","description":"Reads the organization persona (donor + financial profile), the campaign goal and the sector to derive a typical gift, then returns a DRAFT ladder of recommended amounts (goal-gradient default rung + contrast-effect anchor rung, prettified to culturally-appropriate round numbers) plus the clarifying questions to ask the client. Read-only — re-call with the client's answers in `signals` to refine. NOT a commitment: call `commitAdvisorDonationLadder` to write the real donation levels.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProposeDonationLadderRequestDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProposeDonationLadderResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"FEATURE_DISABLED — feature is disabled for this organization."},"404":{"description":"ADVISOR_CAMPAIGN_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["advisor"],"security":[{"bearer":[]}]}},"/api/v1/advisor/donation-ladder/commit":{"post":{"operationId":"commitAdvisorDonationLadder","x-charidy-permissions":["campaigns.manage"],"x-charidy-feature-flag":"advisor.donation_ladder","summary":"Commit a confirmed donation-tier ladder into the campaign's real donation levels.","description":"Materializes the client-confirmed rungs into real `CampaignDonationLevel` records (via the campaigns levels service, so each carries tenant scope, a unique slug, the 100-level cap, and an outbox event). This is the human-in-the-loop step — it changes what donors are asked to give, so it requires the `campaigns.manage` permission and an explicit list of rungs rather than re-deriving them.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommitDonationLadderRequestDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommitDonationLadderResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"FEATURE_DISABLED — feature is disabled for this organization."},"404":{"description":"CAMPAIGN_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["advisor"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns":{"get":{"operationId":"listCampaigns","x-charidy-permissions":["campaigns.read"],"summary":"List tenant campaigns.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":100,"type":"number"}},{"name":"cursor","required":false,"in":"query","description":"Opaque page token taken from a previous response's `pagination.cursor`. Returns the rows immediately AFTER that position in the same `createdAt DESC, id DESC` order, so paging stays stable when campaigns are created between two fetches. Omit for the first page. Composes with every filter below — but the filters must not change between pages, or the cursor describes a position in a different result set. A cursor that is not one we issued is rejected with `INVALID_CURSOR`.","schema":{"maxLength":512,"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive search over campaign name.","schema":{"maxLength":120,"type":"string"}},{"name":"status","required":false,"in":"query","schema":{"enum":["draft","pending_approval","active","paused","ended","completed","archived"],"type":"string"}},{"name":"kind","required":false,"in":"query","schema":{"enum":["classic_blast","year_round","donation_page"],"type":"string"}},{"name":"excludeKind","required":false,"in":"query","description":"Leave out one kind. `excludeKind=donation_page` lists campaigns only (the dashboard Campaigns tab); `kind=donation_page` lists donation pages only.","schema":{"enum":["classic_blast","year_round","donation_page"],"type":"string"}},{"name":"parentCampaignId","required":false,"in":"query","description":"Filter campaigns by parent (umbrella) id.","schema":{"format":"uuid","type":"string"}},{"name":"includeDeleted","required":false,"in":"query","description":"When true, includes soft-deleted campaigns. Requires campaigns.manage.","schema":{"type":"boolean"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignsListResponseDto"}}}},"400":{"description":"Missing or invalid tenant context."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]},"post":{"operationId":"createCampaign","x-charidy-permissions":["campaigns.create"],"summary":"Create a tenant campaign.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCampaignDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponseDto"}}}},"400":{"description":"Validation, idempotency, or tenant errors."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"409":{"description":"CAMPAIGN_SLUG_TAKEN (the link is in use anywhere on the platform), CAMPAIGN_SLUG_RESERVED (a platform route word) or CAMPAIGN_SLUG_IN_COOLDOWN (released by another organization less than a year ago). Only raised for a slug the caller supplied explicitly — an auto-derived one is suffixed instead."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/raised-summary":{"get":{"operationId":"getCampaignRaisedSummary","x-charidy-permissions":["campaigns.read"],"summary":"Get tenant campaign raised totals.","description":"Returns succeeded contribution totals grouped by currency across all non-deleted campaigns in the active tenant.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignRaisedSummaryDto"}}}},"400":{"description":"Missing or invalid tenant context."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/calendar-check":{"get":{"operationId":"checkCampaignCalendar","x-charidy-permissions":["campaigns.read"],"summary":"Advisory check for calendar events in the organization’s explicitly selected calendar packs.","description":"Computes advisory occurrences in explicitly selected organization calendar packs only. It never infers a calendar from country, language, or user locale. Notes carry stable codes and language-neutral parameters; the API returns no display text. An end before the start returns no notes.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"start","required":true,"in":"query","description":"First campaign day, YYYY-MM-DD (a calendar date, not an instant). Inclusive.","schema":{"example":"2027-05-20","type":"string"}},{"name":"end","required":true,"in":"query","description":"Last campaign day, YYYY-MM-DD. Inclusive. An end before start returns no notes (nothing to advise on an empty range).","schema":{"example":"2027-06-10","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignCalendarCheckResponseDto"}}}},"400":{"description":"Missing tenant context or malformed query."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"Impossible date (`CAMPAIGN_CALENDAR_DATE_INVALID`) or range too long (`CAMPAIGN_CALENDAR_RANGE_TOO_LONG`)."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/slug-availability":{"get":{"operationId":"checkCampaignSlugAvailability","x-charidy-permissions":["campaigns.read"],"summary":"Check whether a campaign link is free across the whole platform.","description":"Tests a candidate slug against the platform-GLOBAL root namespace WITHOUT writing anything, so a link can be validated before it is saved. Since 31.8.2026 a campaign's public address is `/<slug>` with no organization segment, so the slug competes with every other organization's campaigns, with organization slugs, and with reserved platform words — claimed first come, first served like a username. Returns whether it is available and why not: `taken` (one of YOUR campaigns holds it — resolvable via slug-takeover), `taken_other_organization` (somebody else does — a plain refusal, the holder is never named), `reserved`, `in_cooldown` (released by another organization less than a year ago) or `invalid_format`. Always call this before createCampaign or updateCampaign.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"slug","required":true,"in":"query","description":"Candidate slug to test. Accepts free text so malformed input is reported as invalid_format rather than rejected — the caller gets a reason and a suggestion instead of a validation error.","schema":{"maxLength":200,"example":"spring-giving-2026","type":"string"}},{"name":"campaignId","required":false,"in":"query","description":"The campaign being edited. Excludes its own slug from the conflict check, so re-saving an unchanged slug reports 'unchanged' instead of 'taken'. Omit when checking a slug for a campaign that does not exist yet.","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignSlugAvailabilityResponseDto"}}}},"400":{"description":"Missing tenant context or malformed query."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"campaignId was supplied but no such campaign exists."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/preview-settings":{"get":{"operationId":"getCampaignPreviewSettings","x-charidy-permissions":["settings.manage"],"summary":"Read the organization's campaign-preview demo-overlay preference.","description":"Returns whether campaign preview pages currently overlay synthetic demo donors/ambassadors/visit-counts/raised-totals. Default false — a preview shows real figures until the org opts in.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignPreviewSettingsResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]},"put":{"operationId":"updateCampaignPreviewSettings","x-charidy-permissions":["settings.manage"],"x-charidy-destructive":true,"summary":"Turn a campaign preview's demo overlay on or off for the organization.","description":"When false (the default), preview pages show real donors/ambassadors/visit-counts/raised-totals, including a genuine zero. When true, previews overlay the synthetic demo data seeded at onboarding or via the demo-seed endpoints.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignPreviewSettingsDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignPreviewSettingsResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}":{"get":{"operationId":"getCampaign","x-charidy-permissions":["campaigns.read"],"summary":"Read one campaign with effective UI.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]},"patch":{"operationId":"updateCampaign","x-charidy-permissions":["campaigns.update"],"x-charidy-destructive":true,"summary":"Update campaign metadata + settings.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponseDto"}}}},"400":{"description":"Validation or umbrella rules."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign not found."},"409":{"description":"CAMPAIGN_SLUG_TAKEN (the link is in use anywhere on the platform), CAMPAIGN_SLUG_RESERVED or CAMPAIGN_SLUG_IN_COOLDOWN. Renaming also RELEASES the current slug into a namespace shared with every other organization — it keeps redirecting here, and stays reserved to this organization for a year."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]},"delete":{"operationId":"deleteCampaign","x-charidy-permissions":["campaigns.delete"],"summary":"Soft-delete a campaign.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":""},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign not found or already deleted."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/attention":{"get":{"operationId":"getCampaignAttention","x-charidy-permissions":["campaigns.read"],"summary":"List operational items that need attention in a campaign.","description":"Combines failed donations, receipt emails blocked by missing donor email, matchers ending within 48 hours, zero-raised teams, open campaign tasks, and the same publish-readiness evaluation used by the publish dialog.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignAttentionDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign was not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/counts":{"get":{"operationId":"getCampaignCounts","x-charidy-permissions":["campaigns.read"],"summary":"Get campaign workspace navigation counts.","description":"Returns donation, distinct donor, team, active task, donation-level, and matcher counts for the active tenant campaign.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignCountsDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign was not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/slug":{"get":{"operationId":"getCampaignSlug","x-charidy-permissions":["campaigns.read"],"summary":"The campaign's public link, plus every link that still redirects to it.","description":"The campaign's address today and the slugs it used to answer on, newest release first. Every released slug keeps redirecting here until another organization claims it, and stays reserved to this organization for a year — so this is the list of printed links that are still live. Replaces the CHAR-60 getCampaignShortLink: there is no separate short link any more, the slug IS the short link.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignSlugResponseDto"}}}},"400":{"description":"Missing tenant context."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"CAMPAIGN_NOT_FOUND — no such campaign in this organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/slug-takeover":{"post":{"operationId":"takeOverCampaignSlug","x-charidy-permissions":["campaigns.update"],"x-charidy-destructive":true,"summary":"Take a slug from the campaign holding it, moving that one to a slug you choose.","description":"The 'new edition of an annual campaign' move: `elul` is held by last year's campaign, you rename that one to whatever you pick (`elulold`, `elul-2025`, …) and this campaign takes `elul`. Both slugs change in one transaction. The new slug for the existing campaign is REQUIRED and is your decision — releasing a slug means choosing where that campaign lives afterwards, and the API will not pick for you. Call checkCampaignSlugAvailability first: it names the holder and offers a dated suggestion to prefill. Note this REDIRECTS links — anything already circulating with the taken slug now leads to this campaign instead of the one that gave it up — so when the holder is still active or paused the call is refused with CAMPAIGN_SLUG_TAKEOVER_REQUIRES_ACK until acknowledgeActiveCampaign is set.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TakeOverCampaignSlugDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignSlugTakeoverResponseDto"}}}},"400":{"description":"Validation, tenant context, or the slug is already this campaign's."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign not found."},"409":{"description":"CAMPAIGN_SLUG_TAKEOVER_REQUIRES_ACK (holder still accepting donations), CAMPAIGN_SLUG_NOT_TAKEN (nobody holds it — update directly), or CAMPAIGN_SLUG_RETIREMENT_SLUG_TAKEN (the slug you chose for the existing campaign is itself in use)."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/settings/sharing":{"patch":{"operationId":"updateCampaignSharingSettings","x-charidy-permissions":["campaigns.update"],"summary":"Update campaign sharing, SEO, and directory visibility settings.","description":"Configures the default share message, email subject, social preview metadata, and directory visibility. Share destinations are not stored here: clients must use the campaign publicUrl (or getCampaignPublicLink over MCP), and the dashboard derives valid WhatsApp, Facebook, and email actions from that canonical URL. To change the canonical link, update the campaign slug or use the dedicated short-link operations; never save an environment-specific share URL in the message.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignSharingSettingsDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponseDto"}}}},"400":{"description":"Validation or tenant errors."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/settings/checkout":{"patch":{"operationId":"updateCampaignCheckoutSettings","x-charidy-permissions":["campaigns.update"],"summary":"Update campaign checkout and payment-behavior settings.","description":"Sets the public checkout policy: whether money is accepted, which billing types the donor may choose, the pre-selected default, the minimum amount, and the extra fields asked at checkout. This object is the single source of truth for billing types — donation levels only pre-select a mode that is enabled here (a level marked recurring on a campaign whose checkout does not enable `recurring` is rejected with LEVEL_RECURRING_NOT_ENABLED). Fields are merged key-wise, so omitted fields keep their current value; the billing-type invariants are checked against the merged result. Enabling a type is necessary but not sufficient for the donor to see it — read `donationCurrencies` on the campaign response for what the currency's acquirer can actually charge.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignCheckoutSettingsDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponseDto"}}}},"400":{"description":"Validation, checkout policy, or tenant errors. Codes: FIELD_REQUIRED_BUT_HIDDEN (a merged required field is hidden), NO_BILLING_TYPE_ENABLED (`enabledBillingTypes: []`), DEFAULT_BILLING_TYPE_NOT_ENABLED (the merged default is not among the merged enabled types — send both fields together)."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/settings/payments":{"patch":{"operationId":"updateCampaignPaymentSettings","x-charidy-permissions":["campaigns.update"],"summary":"Update which acquirers this campaign uses and its manual currency conversion rates.","description":"CHAR-55: controls acquirers and conversion rates for ONE campaign. Acquirer switches are NOT flag-gated; MULTI_CURRENCY_DONATIONS_ENABLED governs conversion rates only. Sending `fxRates` while the flag is off rejects the entire request with 403 FEATURE_DISABLED, without saving acquirer changes. `enabledAcquirers` narrows the organization's connected acquirers to the ones this campaign should use — omit it to mean 'all connected', which is the default and what makes a newly connected acquirer light up automatically. `fxRates` maps a CHARGED currency to a decimal-string rate against the campaign's own currency ({\"USD\":\"3.65\"} on an ILS campaign = 1 USD buys 3.65 ILS); rates are MAJOR-unit to MAJOR-unit so 0-decimal (JPY) and 3-decimal (KWD) currencies stay correct. A non-base currency is offered to donors only when all three hold: an enabled acquirer can settle it, AND it has a valid rate here, AND the platform flag is on. Each donation stores BOTH the amount charged and the amount converted at the rate quoted at that moment, so later edits to a rate never restate past donations. Read `donationCurrencies` on the campaign response to see the resulting offer, including the `rateToBase` each donor is quoted.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignPaymentSettingsDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponseDto"}}}},"400":{"description":"Validation errors. Codes: FX_RATE_BASE_CURRENCY_NOT_ALLOWED (a rate was given for the campaign's own currency, which is always 1), FX_RATE_INVALID (`details.invalid` lists each offending currency and why: not_a_number / not_positive / out_of_range / too_precise), ACQUIRER_NOT_CONNECTED (`details.unknown` lists acquirers the organization has not connected)."},"403":{"description":"FEATURE_DISABLED — `fxRates` was supplied while multi-currency donations are switched off in this environment (MULTI_CURRENCY_DONATIONS_ENABLED). Refused rather than silently ignored, because a rate that appears saved but is never offered is worse than a rejection."},"404":{"description":"Campaign not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/settings/general":{"patch":{"operationId":"updateCampaignGeneralSettings","x-charidy-permissions":["campaigns.update"],"summary":"Update campaign general donor-experience settings.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignGeneralSettingsDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponseDto"}}}},"400":{"description":"Validation or tenant errors."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/settings/about":{"patch":{"operationId":"updateCampaignAboutSettings","x-charidy-permissions":["campaigns.update"],"summary":"Replace the campaign About content (per language).","description":"Stores the campaign-owned About copy per language. The page template renders it as a language pill switcher (default language first when a viewer language has no entry). Replaces the whole about object; send an empty languages array to clear it.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignAboutSettingsDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponseDto"}}}},"400":{"description":"Validation or tenant errors."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/effective-ui":{"get":{"operationId":"getEffectiveCampaignUi","x-charidy-permissions":["campaigns.read"],"summary":"Resolve campaign_ui.* booleans (org default ↔ campaign override).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EffectiveCampaignUiDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/publish":{"post":{"operationId":"publishCampaign","x-charidy-permissions":["campaigns.publish"],"x-charidy-destructive":true,"summary":"Publish a draft / paused campaign.","description":"Activates the campaign lifecycle. CHAR-34: runs the pre-publish readiness gate first, so this is refused with `CAMPAIGN_PUBLISH_BLOCKED` when something is broken for donors (no acquirer for the currency, no page to serve), and with `CAMPAIGN_PUBLISH_REQUIRES_ACK` when nothing is broken but items need a human eye — show `details.warnings` to the person publishing and call again with those keys in `acknowledgeWarnings`. Nothing is written on either refusal. Note this activates the LIFECYCLE only; use publishCampaignLive to publish the page and activate together, which is what the dashboard button does.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignLifecycleActionDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponseDto"}}}},"400":{"description":"CAMPAIGN_PUBLISH_BLOCKED — `details` carries the full readiness report (blockers, warnings, summary). Nothing was published."},"403":{"description":"Missing required permission for this operation."},"409":{"description":"CAMPAIGN_PUBLISH_REQUIRES_ACK — publishable, but `details.warnings` must be reviewed by a human first. Nothing was published."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/pause":{"post":{"operationId":"pauseCampaign","x-charidy-permissions":["campaigns.publish"],"summary":"Pause an active campaign.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignLifecycleActionDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/resume":{"post":{"operationId":"resumeCampaign","x-charidy-permissions":["campaigns.publish"],"summary":"Resume a paused campaign.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignLifecycleActionDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/end":{"post":{"operationId":"endCampaign","x-charidy-permissions":["campaigns.publish"],"summary":"End an active or paused campaign.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignLifecycleActionDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/archive":{"post":{"operationId":"archiveCampaign","x-charidy-permissions":["campaigns.archive"],"summary":"Archive an ended campaign.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignLifecycleActionDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/layout":{"patch":{"operationId":"updateCampaignLayout","x-charidy-permissions":["campaigns.layout.update"],"summary":"Replace the campaign page-builder layout config (opaque JSONB).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignLayoutDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponseDto"}}}},"400":{"description":"layoutConfig is invalid. Possible error codes: `CAMPAIGN_LAYOUT_INVALID` (not an object / wrong shape), `LAYOUT_BLOCK_TYPE_UNKNOWN` (a block.type is not in the canonical widget registry — see @charidy/shared/page-builder), `LAYOUT_VALIDATION_FAILED` (a known block has invalid props), `DESIGN_VALIDATION_FAILED` (raw CSS keys present)."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/design":{"get":{"operationId":"getCampaignDesign","x-charidy-permissions":["campaigns.read"],"summary":"Read the campaign page-builder draft and live design state.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDesignResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/design/nodes":{"get":{"operationId":"listCampaignDesignNodes","x-charidy-permissions":["campaigns.design.manage"],"x-charidy-feature-flag":"page_engine.manual_edit.enabled","summary":"List the addressable, override-capable nodes on the campaign page draft.","description":"Read-only. Returns every editable node (text, image, button, container) with its current data-charidy-node address AND its stable (sectionEditId, pathWithinSection) identity, plus a short label — so an agent that has no live click-selection can resolve \"the donate button\" or \"the hero heading\" to a node and then style/edit it via setCampaignNodeOverride. Addresses are recomputed from the current draft with the same canonical stamping the write path validates against.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDesignNodesResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"FEATURE_DISABLED — feature is disabled for this organization."},"404":{"description":"Campaign not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/design/preview-link":{"get":{"operationId":"getCampaignDesignPreviewLink","x-charidy-permissions":["campaigns.design.manage"],"summary":"Create a signed external preview link for the campaign page-builder draft.","description":"Returns a URL that renders campaign_design.draft_settings without changing campaign lifecycle status or exposing the draft through the normal public campaign route. The link does not expire (`expiresAt` is always null) — it keeps working until someone calls revokeCampaignDesignPreviewLinks, which stops every link issued for the campaign so far.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDesignPreviewLinkResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/design/preview-link/revoke":{"post":{"operationId":"revokeCampaignDesignPreviewLinks","x-charidy-permissions":["campaigns.design.manage"],"x-charidy-destructive":true,"summary":"Stop every design preview link that has been shared for this campaign.","description":"Bumps the campaign’s preview-link generation, so every preview link issued so far stops resolving at once — there is no per-link revocation. Anyone still holding an old link gets the same response as an invalid one. getCampaignDesignPreviewLink immediately mints a fresh, working link. Nothing else about the campaign, the draft, or the public page changes.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDesignPreviewLinksRevokedResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/design/draft":{"patch":{"operationId":"saveCampaignDesignDraft","x-charidy-permissions":["campaigns.design.manage"],"summary":"Autosave the campaign page-builder draft without changing the public page.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveCampaignDesignDraftDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDesignResponseDto"}}}},"400":{"description":"draftSettings is invalid. Possible error codes: `CAMPAIGN_LAYOUT_INVALID` (wrong shape), `LAYOUT_BLOCK_TYPE_UNKNOWN` (block.type is not in the canonical widget registry — agents must use only types listed in @charidy/shared/page-builder BUILDER_BLOCK_TYPES), `LAYOUT_VALIDATION_FAILED` (a known block has invalid props), `DESIGN_VALIDATION_FAILED` (raw CSS keys present)."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/design/node-override":{"patch":{"operationId":"setCampaignNodeOverride","x-charidy-permissions":["campaigns.design.manage"],"x-charidy-feature-flag":"page_engine.manual_edit.enabled","summary":"Set one node-keyed manual-edit override (text, image, style, or repeat settings) on the page draft.","description":"PAGE_DESIGN_OVERHAUL §5א — persists ONE manual edit keyed by the element's `data-charidy-node` address, without rewriting the authored document. `kind=text` replaces plain text; `kind=image` replaces an allowlisted image; `kind=style` writes one closed-catalog style property. `kind=gallerySettings` patches a gallery frame: autoplayMs is 0 or 3000..60000, slideOrder and hiddenSlides are unique zero-based authored indices; unnamed slides follow in authored order and at least one slide must remain visible. Null clears one key; remove:true clears the entry. Adding a slide waits on the editor-insert capability. `kind=repeatSettings` targets a node carrying `data-charidy-repeat` and patches its component semantics: `sort` (`recent|top`), `limit` (1..9999), and `level` (1..10, teams only). A null repeat-setting clears that key and falls back to the authored attribute; `remove:true` clears the whole node entry. This is the agent/chat surface for requests such as “show the top 8 donors” or “show rank 2 teams.” Every write is snapshotted and coalesced with nearby manual edits; stale addresses can always be removed.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetCampaignNodeOverrideDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDesignResponseDto"}}}},"400":{"description":"The override was rejected and NOT stored. Possible codes: `CAMPAIGN_NODE_OVERRIDE_INVALID` (empty node, or a text value over 5000 chars), `CAMPAIGN_NODE_OVERRIDE_MEDIA_HOST_DISALLOWED` (an image value whose host is not on the media allowlist), `CAMPAIGN_NODE_OVERRIDE_NODE_NOT_FOUND` (the current page has no such node, the run index is out of range, or the node cannot carry this kind of override — the message names the address that would work), `CAMPAIGN_NODE_STYLE_UNKNOWN` (no such property in the design catalog, or a style removal with no property named — the message lists what is available), `CAMPAIGN_NODE_STYLE_INVALID` (the value is outside the property's server-enforced range — the message names the range; out-of-range is rejected, never silently clamped), `TENANT_CONTEXT_MISSING`."},"403":{"description":"FEATURE_DISABLED — feature is disabled for this organization."},"404":{"description":"Campaign not found (`CAMPAIGN_NOT_FOUND`) or the campaign has no page design yet to override (`CAMPAIGN_DESIGN_NOT_FOUND` — generate or save a draft first)."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/design/token-overrides":{"get":{"operationId":"getCampaignDesignTokenOverrides","x-charidy-permissions":["campaigns.read"],"summary":"Read page-wide design tokens stored on the campaign draft.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignTokenOverridesResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]},"patch":{"operationId":"setCampaignDesignTokenOverrides","x-charidy-permissions":["campaigns.design.manage"],"x-charidy-feature-flag":"page_engine.manual_edit.enabled","summary":"Retune page-wide design tokens on the campaign draft.","description":"Merges CSS custom properties such as `--cg-ink` into the draft document. A null value clears one key. This is the design-studio colour/radius/heading control. It does not depend on `page_engine.concept.enabled`. The public page picks the change up on publish; the studio preview reads the draft immediately.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetCampaignTokenOverridesDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignTokenOverridesResponseDto"}}}},"400":{"description":"Possible codes: `CAMPAIGN_TOKEN_OVERRIDE_EMPTY` (no key to change), `CAMPAIGN_TOKEN_OVERRIDE_INVALID` (name or value outside the safe token allowlist), `TENANT_CONTEXT_MISSING`."},"403":{"description":"FEATURE_DISABLED — feature is disabled for this organization."},"404":{"description":"CAMPAIGN_DESIGN_NOT_FOUND — generate or save a draft first."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/design/publish":{"post":{"operationId":"publishCampaignDesign","x-charidy-permissions":["campaigns.design.publish"],"x-charidy-destructive":true,"summary":"Publish the current campaign page-builder draft to the public page.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDesignResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/design/versions":{"get":{"operationId":"listCampaignPageVersions","x-charidy-permissions":["campaigns.design.manage"],"x-charidy-feature-flag":"page_engine.manual_edit.enabled","summary":"List the campaign page version history (undo / restore points).","description":"Every transition that changes what a visitor could see — AI generate, AI refine, a manual/API draft save, an agent submit, a publish, and a restore — snapshots the page into campaign_page_versions. This returns that history newest-first (metadata only: version number, source write path, actor, timestamp; the snapshot HTML/CSS blobs are not included). Restore a point with restoreCampaignPageVersion. Retention: the most recent 50 draft snapshots per campaign plus every publish-sourced snapshot are kept.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignPageVersionListDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"FEATURE_DISABLED — feature is disabled for this organization."},"404":{"description":"Campaign not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/design/versions/{version}/restore":{"post":{"operationId":"restoreCampaignPageVersion","x-charidy-permissions":["campaigns.design.manage"],"x-charidy-feature-flag":"page_engine.manual_edit.enabled","summary":"Restore the campaign page draft to a prior version (non-destructive).","description":"Rewinds the editor DRAFT to the snapshot at `version` and saves it as a NEW version (source = \"restore\"), so restoring never destroys history — the draft you are replacing was already snapshotted, and you can restore forward again. It re-runs the restored document through the SAME enforcement gate as any write, so an old snapshot whose contract has since tightened fails with the usual `FREEFORM_*` / `CAMPAIGN_LAYOUT_*` code rather than shipping. Restore only changes the draft; the public page is untouched until publishCampaignDesign. Returns the refreshed design state.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"version","required":true,"in":"path","description":"The version number to restore.","schema":{"type":"number"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDesignResponseDto"}}}},"400":{"description":"The restored document failed the enforcement gate. Possible codes: `FREEFORM_*` (freeform sanitize/island/capability/CSS/mobile failure), `CAMPAIGN_LAYOUT_INVALID`, `TENANT_CONTEXT_MISSING`."},"403":{"description":"FEATURE_DISABLED — feature is disabled for this organization."},"404":{"description":"Campaign not found (`CAMPAIGN_NOT_FOUND`) or version not found for this campaign (`CAMPAIGN_PAGE_VERSION_NOT_FOUND`)."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/publish-live":{"post":{"operationId":"publishCampaignLive","x-charidy-permissions":["campaigns.design.publish","campaigns.publish"],"x-charidy-destructive":true,"summary":"One-click publish: publish the page AND activate the campaign together.","description":"The Design Studio and dashboard \"Publish\" action, and the one to prefer. Publishes the current page/design draft to the public page AND, when the campaign is still a draft, activates it — atomically, in a single server call. Prevents the trust-breaking state where the page shows \"Published\" but the public link serves an empty page because only one half happened. CHAR-34: the pre-publish readiness gate runs first — `CAMPAIGN_PUBLISH_BLOCKED` when something is broken for donors, `CAMPAIGN_PUBLISH_REQUIRES_ACK` when a human must review `details.warnings` and re-call with those keys in `acknowledgeWarnings`. On either refusal the whole call rolls back and NOTHING is published. Publishing a campaign whose start date is in the future is legitimate — it becomes \"scheduled\" with a public countdown. Returns the true combined `publicationStatus`. For lifecycle-only activation use publishCampaign; for page-only republish use publishCampaignDesign.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignLifecycleActionDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignPublishResultDto"}}}},"400":{"description":"Publish gate failed — CAMPAIGN_PUBLISH_BLOCKED (`details` carries the readiness report), TASK_BLOCKING_PHASE, ORGANIZATION_NOT_PUBLIC, CAMPAIGN_LIFECYCLE_INVALID_TRANSITION. Nothing was published."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign not found."},"409":{"description":"CAMPAIGN_PUBLISH_REQUIRES_ACK — publishable, but `details.warnings` needs human review first. Nothing was published."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/design/validate":{"post":{"operationId":"validateCampaignPage","x-charidy-feature-flag":"page_engine.freeform.enabled","x-charidy-permissions":["campaigns.design.manage"],"summary":"Dry-run the design enforcement gate without persisting (blocks or freeform v2).","description":"Runs the same validation as saveCampaignDesignDraft but does not persist. For freeform (renderMode: \"freeform\") documents it sanitizes HTML/CSS and validates islands + required capabilities, returning a 400 with a `FREEFORM_*` code on failure so an agent can repair and retry. See SPEC/29.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveCampaignDesignDraftDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidateCampaignDesignResponseDto"}}}},"400":{"description":"Document failed validation. Freeform codes: `FREEFORM_DOCUMENT_INVALID`, `FREEFORM_ISLAND_UNKNOWN`, `FREEFORM_ISLAND_PROPS_INVALID`, `FREEFORM_ISLAND_ORPHAN`, `FREEFORM_CAPABILITY_MISSING`, `FREEFORM_SANITIZE_REJECTED`, `FREEFORM_CSS_ILLEGAL`, `FREEFORM_FONT_NOT_SELF_HOSTED` (the response names every unavailable family and lists the self-hosted packs), `FREEFORM_CSS_MOBILE_UNSAFE` (a fixed pixel width wider than a phone, or a grid that collapses to one column, outside a desktop `@media` block — the message names the offending declaration), `FREEFORM_CSS_SPECIFICITY_EXCEEDED` (an authored selector exceeds the scoped `(1,3,0)` cap — simplify the named selector). Block codes: `LAYOUT_BLOCK_TYPE_UNKNOWN`, `LAYOUT_VALIDATION_FAILED`, `DESIGN_VALIDATION_FAILED`."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/design/generate":{"post":{"operationId":"generateCampaignPage","x-charidy-feature-flag":"page_engine.freeform.enabled","x-charidy-permissions":["campaigns.design.manage"],"summary":"Build a campaign landing page with AI (freeform HTML/CSS + functional islands). The preferred way for an AI/MCP agent to create, design, or redo a campaign page.","description":"Builds the approved persona kit deterministically when selected; otherwise uses the server model (Design Engine v2). An explicit templateId overrides the proposal kit. Clear kitKey in the proposal to request freeform AI generation. Existing kit pages are not silently replaced. Initial draft generation requires the shared story-profile proposal to be approved first; non-draft campaigns may regenerate. Given a natural-language `brief` (plus optional `tone`/`locale`), the server-side model authors a freeform HTML/CSS document with functional islands, passes the enforcement gate, then saves it as the campaign design draft. An external agent authoring with its own model may instead use saveCampaignDesignDraft without this model-production gate. Never auto-publishes.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateCampaignPageDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDesignResponseDto"}}}},"400":{"description":"Generation failed validation after the repair budget (`FREEFORM_GENERATION_FAILED`) or AI generation is unavailable (`PAGE_GENERATION_UNAVAILABLE`)."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/publish-readiness":{"get":{"operationId":"getCampaignPublishReadiness","x-charidy-permissions":["campaigns.read"],"summary":"What this campaign still needs before donors see it (CHAR-34).","description":"The pre-publish checklist, evaluated by the same code the publish gate enforces — so what this returns is exactly what publishCampaign / publishCampaignLive will decide. `blockers` must be fixed; `warnings` need a human to look and then be passed back in `acknowledgeWarnings` on the publish call. `summary` carries the dates, donation window, goal, currency, charging acquirer and visible level count so a caller can show the organizer what they are about to make public. Read-only: calling this never changes anything, and publishing does not require calling it first.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignPublishReadinessDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"CAMPAIGN_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/pipeline-status":{"get":{"operationId":"getCampaignGenerationPipelineStatus","x-charidy-permissions":["campaigns.read"],"summary":"Inspect the AI page-generation pipeline status for ANY tenant campaign.","description":"Generic counterpart of getOnboardingCampaignPipelineStatus: returns the same generation signals (levelsSeeded, contentGenerated, mediaPresent, mobileOptimized, requiredCapabilitiesSatisfied, pageGenerationStatus, designPublished, publish gate) for any campaign in the active tenant, WITHOUT requiring the onboarding auto-created marker. Use it to poll a page enqueued via enqueueCampaignPageGeneration.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignGenerationPipelineStatusDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"CAMPAIGN_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/generate-page-async":{"post":{"operationId":"enqueueCampaignPageGeneration","x-charidy-feature-flag":"campaign_genesis.enabled","x-charidy-permissions":["campaigns.design.manage"],"summary":"Enqueue background AI page generation for ANY tenant campaign (async counterpart of generateCampaignPage).","description":"Requires the shared onboarding generation proposal to be approved first. Its selected kit is composed as a ready draft without AI; otherwise a job is enqueued and status is pending. An explicit templateId overrides the proposal kit. The donation tiers of the approved plan REPLACE the donation levels of the campaign (the automatic goal-derived ladder is only used when there is no approved plan; a retry over the same ladder writes nothing), and the plan plus the confirmed story profile are carried into the brief. The untouched default starting page is refreshed from the campaign as it is now before the job is queued. MCP callers must follow extractCampaignOnboardingStoryProfile → confirmCampaignOnboardingStoryProfile → getCampaignOnboardingGenerationProposal → approveCampaignOnboardingGenerationProposal → this endpoint. Then poll getCampaignGenerationPipelineStatus. The optional `brief`/`tone`/`locale` override defaults. Never auto-publishes an already-published design; the worker writes the campaign design DRAFT. REGENERATION GUARD: generation overwrites `draft_settings` wholesale, so a campaign that already has a generated draft or a published design is REFUSED with `CAMPAIGN_PAGE_ALREADY_BUILT` unless `rebuild: true` states that intent.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnqueueCampaignPageGenerationDto"}}}},"responses":{"202":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnqueueCampaignPageGenerationResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"FEATURE_DISABLED — the `campaign_genesis.enabled` flag is off for this organization."},"404":{"description":"CAMPAIGN_NOT_FOUND"},"409":{"description":"CAMPAIGN_PAGE_ALREADY_BUILT — a generated draft or published design already exists; pass `rebuild: true` to overwrite it. `details` names the page-generation status, whether it is published, and when the draft last changed. Nothing is written when this refuses."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/design/refine":{"post":{"operationId":"refineCampaignPageDesign","x-charidy-feature-flag":"page_engine.freeform.enabled","x-charidy-permissions":["campaigns.design.manage"],"summary":"Apply a targeted AI edit to the current freeform campaign page draft.","description":"Loads the existing freeform draft, applies a natural-language instruction (optionally scoped to a clicked region via selectedEditId), runs the enforcement gate with repair loop, and saves the updated draft. Direct agent authoring through saveCampaignDesignDraft or submitCampaignPageDesign remains ungated.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefineCampaignPageDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDesignResponseDto"}}}},"400":{"description":"Refinement failed (`FREEFORM_GENERATION_FAILED`), no freeform draft exists (`FREEFORM_DRAFT_REQUIRED`), or AI is unavailable (`PAGE_GENERATION_UNAVAILABLE`)."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/design/submit":{"post":{"operationId":"submitCampaignPageDesign","x-charidy-feature-flag":"page_engine.freeform.enabled","x-charidy-permissions":["campaigns.design.manage"],"summary":"Save a freeform campaign page the agent designed itself (no server-side AI regeneration), then return a preview link.","description":"Submit a complete Design Engine v2 freeform document (`{ version: 2, renderMode: \"freeform\", document: { html, css }, islands, capabilities }`) that the calling agent authored. Runs the exact same enforcement gate as generateCampaignPage — HTML sanitize, `<script>`/`<style>`/`<iframe>`/inline-handler ban, island + capability + CSS validation — saves it as the campaign design draft, and returns a signed preview link. Unlike generateCampaignPage, no server-side model rewrites the design, so the agent-authored HTML/CSS/animations are preserved verbatim; this is the way to keep a high-fidelity design instead of a simplified regeneration. Only freeform documents are accepted (block layouts are rejected with `FREEFORM_DOCUMENT_INVALID`). Never auto-publishes — preview via the returned previewUrl, then publish on explicit approval via publishCampaignDesign. On failure returns a 400 with a `FREEFORM_*` code so the agent can repair the document and resubmit. See SPEC/29.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmitCampaignPageDesignDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmitCampaignPageDesignResponseDto"}}}},"400":{"description":"Document failed the enforcement gate. Possible codes: `FREEFORM_DOCUMENT_INVALID` (not a freeform v2 document / wrong shape), `FREEFORM_SANITIZE_REJECTED` (script/style/iframe/event handlers), `FREEFORM_CSS_ILLEGAL` (@import/expression/behavior/etc.), `FREEFORM_FONT_NOT_SELF_HOSTED` (the response names every unavailable family and lists the self-hosted packs), `FREEFORM_ISLAND_UNKNOWN`, `FREEFORM_ISLAND_PROPS_INVALID`, `FREEFORM_ISLAND_ORPHAN`, `FREEFORM_CAPABILITY_MISSING`, `FREEFORM_CSS_MOBILE_UNSAFE` (fixed pixel width wider than a phone, or a one-column grid collapse, outside a desktop `@media` block), `FREEFORM_CSS_SPECIFICITY_EXCEEDED` (an authored selector exceeds the scoped `(1,3,0)` cap; simplify the selector named in the response)."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/concept/generate":{"post":{"operationId":"generateCampaignConcept","x-charidy-feature-flag":"page_engine.concept.enabled","x-charidy-permissions":["campaigns.design.manage"],"summary":"Generate the campaign concept — narrative beats, headline, pull quotes, palette and typography — for client approval before the page is authored.","description":"Server-side model production requiring the shared generation proposal to be approved for draft campaigns. The stage that stops every generated page looking the same. Instead of authoring HTML from a facts list, the platform first proposes a CONCEPT: up to 7 narrative beats in page order, one declarative headline with its accent words, 2-3 pull quotes, a colour palette as story-named CSS custom properties, and a type pairing from the platform font families. HONESTY IS THE CONTRACT: every beat must cite real inputs (the team's own campaign purpose, website-scan findings, detected programs, an approved media-library image, a computed campaign number, or the CHOSEN strategic direction of this campaign's Journey), each citation is resolved server-side against those inputs, and a beat whose citations do not resolve is DELETED — never back-filled. `groundedBeatCount` then decides `route`: >=5 → `story_first`, 2-4 → `hybrid`, 0-1 → `warm_generic`. A thin-data organization honestly receiving `warm_generic` with few or no beats is the CORRECT result, not an error. When the LLM is off/fails/cannot be grounded, the concept is assembled deterministically from the same real inputs (`provenance.source: 'deterministic'`) rather than failing — no drama is ever invented. Re-generating bumps `version`, clears the approval, and clears the override maps. Never auto-approves: review, PATCH, then approveCampaignConcept.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateCampaignConceptDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignConceptResponseDto"}}}},"400":{"description":"Missing or invalid tenant context (`TENANT_CONTEXT_MISSING`)."},"403":{"description":"FEATURE_DISABLED — the `page_engine.concept.enabled` flag is off for this organization."},"404":{"description":"CAMPAIGN_NOT_FOUND — no such campaign in the active tenant."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/concept":{"get":{"operationId":"getCampaignConcept","x-charidy-feature-flag":"page_engine.concept.enabled","x-charidy-permissions":["campaigns.read"],"summary":"Read the campaign concept (story beats + art direction) and its approval state.","description":"Returns the persisted concept, the client override maps layered over it at render time (`tokenOverrides` / `textOverrides`), the approval stamp, and `version`. `concept.beats` may legitimately be short or empty — unevidenced beats are deleted, and `concept.route` reports how much story the page is entitled to tell as a result.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignConceptResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"FEATURE_DISABLED — the `page_engine.concept.enabled` flag is off for this organization."},"404":{"description":"CAMPAIGN_CONCEPT_NOT_FOUND — this campaign has no concept yet; generate one first."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]},"patch":{"operationId":"updateCampaignConcept","x-charidy-feature-flag":"page_engine.concept.enabled","x-charidy-permissions":["campaigns.design.manage"],"summary":"Edit the campaign concept — story/art-direction fields while unapproved, colour/copy overrides always.","description":"Two surfaces in one call. STRUCTURAL fields (`headline`, `pullQuotes`, `beats`, `palette`, `typography`, `mood`) rewrite the concept itself and are accepted only while it is UNAPPROVED — an approved concept is never mutated in place. OVERRIDE maps (`tokenOverrides`, `textOverrides`) are always accepted and layer over the stored concept at render time (send `null` for a key to clear it). Edited beats go through the SAME evidence resolution as generated ones: citations are re-checked against this campaign’s real inputs, unresolvable beats are deleted, and `groundedBeatCount`/`route` are recomputed — the edit surface is not a way around the evidence rule.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatchCampaignConceptDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignConceptResponseDto"}}}},"400":{"description":"Possible codes: `CAMPAIGN_CONCEPT_INVALID` (the edited concept fails the concept contract — details list the field errors), `CAMPAIGN_CONCEPT_PATCH_EMPTY` (no field to change), `TENANT_CONTEXT_MISSING`."},"403":{"description":"FEATURE_DISABLED — the `page_engine.concept.enabled` flag is off for this organization."},"404":{"description":"CAMPAIGN_CONCEPT_NOT_FOUND"},"409":{"description":"Possible codes: `CAMPAIGN_CONCEPT_APPROVED` (structural edit of an approved concept — use the override maps or re-generate), `CAMPAIGN_CONCEPT_CORRUPT` (the stored concept no longer matches the contract; re-generate)."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/concept/approve":{"post":{"operationId":"approveCampaignConcept","x-charidy-feature-flag":"page_engine.concept.enabled","x-charidy-permissions":["campaigns.design.manage"],"summary":"Approve the campaign concept, freezing its story and art direction for page authoring.","description":"Records the client sign-off (`approvedAt` / `approvedByUserId`) and emits `campaign.concept.approved`. After approval the story and art direction are frozen: further tweaks go through `tokenOverrides` / `textOverrides`, or a re-generation which starts a new `version` and clears the approval. An approved concept is also what a later campaign can inherit its palette + typography from (`inheritFromPreviousCampaign`). Idempotent: re-approving keeps the original approver and timestamp.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignConceptResponseDto"}}}},"400":{"description":"Missing tenant/user context (`TENANT_CONTEXT_MISSING`, `USER_CONTEXT_MISSING`)."},"403":{"description":"FEATURE_DISABLED — the `page_engine.concept.enabled` flag is off for this organization."},"404":{"description":"CAMPAIGN_CONCEPT_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/content-overrides":{"patch":{"operationId":"updateCampaignContentOverrides","x-charidy-permissions":["campaigns.content_overrides.update"],"summary":"Replace state-keyed content overrides (default | countdown | primary_goal_reached | bonus_goal_reached | completed).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignContentOverridesDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/tracking":{"patch":{"operationId":"updateCampaignTracking","x-charidy-permissions":["campaigns.tracking.update"],"summary":"Configure tracking pixels (GA, FB Pixel, GTM, Google Ads).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignTrackingDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/submit-for-approval":{"post":{"operationId":"submitCampaignForApproval","x-charidy-permissions":["campaigns.approval.submit"],"summary":"Submit a draft campaign for super-admin approval.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmitForApprovalDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponseDto"}}}},"400":{"description":"Only draft campaigns can be submitted."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/approve":{"post":{"operationId":"approveCampaign","x-charidy-permissions":["campaigns.approval.review"],"summary":"Approve a campaign awaiting review (super-admin scope).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponseDto"}}}},"400":{"description":"Only campaigns awaiting approval can be approved."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/reject":{"post":{"operationId":"rejectCampaign","x-charidy-permissions":["campaigns.approval.review"],"summary":"Reject a campaign awaiting review with a reason (super-admin scope).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RejectCampaignDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/duplicate":{"post":{"operationId":"duplicateCampaign","x-charidy-permissions":["campaigns.duplicate"],"summary":"Deep clone a campaign (levels / matchers / design optional).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DuplicateCampaignDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DuplicateCampaignResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/children":{"get":{"operationId":"listUmbrellaChildren","x-charidy-permissions":["campaigns.read"],"summary":"List Giving Day children.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"properties":{"rows":{"items":{"$ref":"#/components/schemas/UmbrellaChildSummaryDto"},"type":"array"}}}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]},"post":{"operationId":"addChildCampaign","x-charidy-permissions":["campaigns.manage"],"summary":"Add a campaign as a Giving Day child.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddChildCampaignDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/leaderboard":{"get":{"operationId":"getUmbrellaLeaderboard","x-charidy-permissions":["campaigns.read"],"summary":"Top children by raised amount.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UmbrellaLeaderboardResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/children/{childCampaignId}":{"delete":{"operationId":"removeChildCampaign","x-charidy-permissions":["campaigns.manage"],"summary":"Remove a child from this umbrella.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"childCampaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/summary":{"get":{"operationId":"getCampaignSummary","x-charidy-permissions":["campaigns.read"],"summary":"Get campaign contribution totals.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignSummaryDto"}}}},"400":{"description":"Missing or invalid tenant context."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign was not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/demo/seed":{"post":{"operationId":"seedCampaignDemoData","x-charidy-permissions":["campaigns.manage"],"summary":"Seed preview-only demo data (donors, ambassadors, matcher) so a draft page looks alive.","description":"Writes a deterministic, non-AI demo overlay under settings_json.demo, shaped by the campaign recommendation (ambassadors when peer fundraising is part of the strategy, a matcher when an anchor donor is confirmed). The overlay renders ONLY through the signed draft-preview surface and is automatically discarded when the design or campaign is published — it never touches real contributions/ambassadors. Idempotent: re-seeding a campaign produces the same overlay. Returns a summary plus the campaign-brain strategy notes for the page.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SeedCampaignDemoDataDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDemoDataResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/demo":{"delete":{"operationId":"clearCampaignDemoData","x-charidy-permissions":["campaigns.manage"],"x-charidy-destructive":true,"summary":"Remove the preview-only demo overlay so the page shows real data only.","description":"Deletes settings_json.demo. Idempotent no-op when no overlay exists. Publishing the design or campaign clears it automatically; this is the explicit escape hatch.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDemoDataResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/campaigns/{campaignId}/design/template":{"post":{"operationId":"applyCampaignPageTemplate","x-charidy-feature-flag":"page_engine.freeform.enabled","x-charidy-permissions":["campaigns.design.manage"],"summary":"Compose and save a campaign page from a deterministic template.","description":"Reads campaign, confirmed organisation identity/palette, confirmed story-profile facts, donation-level count, and approved media server-side; invents nothing. replace clears old manual overrides. keep-overrides remaps them by template section plus path and reports every override that could not be carried.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyCampaignPageTemplateDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyCampaignPageTemplateResponseDto"}}}},"400":{"description":"Invalid template input or the composed document failed the normal freeform enforcement gate. Correct the named field/gate failure and retry."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"CAMPAIGN_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["campaigns.page-engine"],"security":[{"bearer":[]}]}},"/api/v1/campaigns/{campaignId}/design/persona-kit":{"post":{"operationId":"applyCampaignPersonaKit","x-charidy-feature-flag":"page_engine.freeform.enabled","x-charidy-permissions":["campaigns.design.manage"],"summary":"Compose and save a cause-specific campaign-page starting point.","description":"Applies a shipped page template, then deterministic palette, hero typography, section, and localized-copy defaults. keep-overrides carries compatible manual edits over those defaults. When seed=true, campaign data is created only for kinds that are currently empty; existing levels, teams, matchers, deadline, and recurring policy are never overwritten.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyCampaignPersonaKitDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyCampaignPersonaKitResponseDto"}}}},"400":{"description":"Invalid kit input, a named template/section refusal, or a normal freeform enforcement failure. Follow the named refusal and retry; existing campaign data is never overwritten."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"CAMPAIGN_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["campaigns.page-engine"],"security":[{"bearer":[]}]}},"/api/v1/campaigns/{campaignId}/design/persona-kit/seed":{"post":{"operationId":"seedCampaignPersonaKit","x-charidy-feature-flag":"page_engine.freeform.enabled","x-charidy-permissions":["campaigns.design.manage"],"summary":"Create missing campaign data for a persona kit after its page draft is saved.","description":"Create-only follow-up for Design Studio: seeds levels, teams, matcher, deadline, and recurring policy only when each kind is empty. Existing campaign data is never overwritten. Donation-level defaults use the resolved campaign-page locale and include the other kit locale as translations.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SeedCampaignPersonaKitDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SeedCampaignPersonaKitResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"CAMPAIGN_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["campaigns.page-engine"],"security":[{"bearer":[]}]}},"/api/v1/campaigns/{campaignId}/design/sections":{"post":{"operationId":"applyCampaignSectionAction","x-charidy-feature-flag":"page_engine.freeform.enabled","x-charidy-permissions":["campaigns.design.manage"],"summary":"Move, hide, duplicate, remove, reset, swap, insert, or edit a node within a campaign-page section.","description":"Every structural edit runs on the server, remaps text/image/style/repeatSettings overrides by section identity plus within-section path, and snapshots source section-edit. duplicate-node/remove-node additionally shift the within-section path of every later sibling override so a mid-section insert/removal never drops an unrelated edit. Removing/hiding the last donate or mandatory carrier, moving past an edge, and unsafe node targets are refused with actionable named codes.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyCampaignSectionActionDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyCampaignSectionActionResponseDto"}}}},"400":{"description":"Named refusals: SECTION_LAST_DONATE / SECTION_MANDATORY_CARRIER (add another carrier first), SECTION_AT_EDGE (choose the opposite direction), SECTION_VARIANT_BLOCK_MISMATCH (choose a recipe from the same block), SECTION_TEMPLATE_REQUIRED (apply a template before reset/variant), or the duplicate-node/remove-node refusals NODE_NOT_FOUND, NODE_IS_SECTION (use the section-level action instead), NODE_INSIDE_REPEAT (edit the underlying data instead), NODE_SINGLETON (this element must stay unique), NODE_PARENT_MIXED_CONTENT (select a different element), NODE_LAST_DONATE, and NODE_MANDATORY_CARRIER."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["campaigns.page-engine"],"security":[{"bearer":[]}]}},"/api/v1/campaigns/{campaignId}/design/content/accessibility-review":{"get":{"operationId":"getCampaignAccessibilityReview","x-charidy-feature-flag":"page_engine.freeform.enabled","x-charidy-permissions":["campaigns.read"],"summary":"Review the current draft for possible accessibility issues.","description":"Advisory static checks and image-description suggestions. This is not a WCAG conformance assessment; review suggestions before applying them.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignAccessibilityReviewDto"}}}},"400":{"description":"ACCESSIBILITY_REVIEW_NOT_READY: no page exists yet."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"CAMPAIGN_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["campaigns.page-engine"],"security":[{"bearer":[]}]}},"/api/v1/campaigns/{campaignId}/design/content/accessibility-review/image":{"patch":{"operationId":"updateCampaignAccessibilityImage","x-charidy-feature-flag":"page_engine.freeform.enabled","x-charidy-permissions":["campaigns.design.manage"],"summary":"Set an alternative on one image in a freeform draft.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAccessibilityDraftImageDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDesignResponseDto"}}}},"400":{"description":"ACCESSIBILITY_ALT_INVALID or ACCESSIBILITY_USE_PAGE_CONTENT."},"403":{"description":"Missing required permission for this operation."},"409":{"description":"PAGE_CONTENT_DRAFT_CHANGED or ACCESSIBILITY_IMAGE_CHANGED."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["campaigns.page-engine"],"security":[{"bearer":[]}]}},"/api/v1/campaigns/{campaignId}/design/content":{"get":{"operationId":"getCampaignPageContent","x-charidy-feature-flag":"page_engine.freeform.enabled","x-charidy-permissions":["campaigns.read"],"summary":"Read editable story, FAQ, statistics, and gallery collections for a campaign draft.","description":"Returns saved editorial content or initial content from the current page, confirmed story and approved library images. Item IDs are stable; array order is display order. The returned draftUpdatedAt is required when saving.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"locale","required":false,"in":"query","description":"Page language to read. Omitted means the campaign page language. A different language is rejected until the campaign has more than one language.","schema":{"enum":["en","he"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignPageContentResponseDto"}}}},"400":{"description":"PAGE_CONTENT_LOCALE_UNSUPPORTED."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"CAMPAIGN_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["campaigns.page-engine"],"security":[{"bearer":[]}]},"patch":{"operationId":"updateCampaignPageContent","x-charidy-feature-flag":"page_engine.freeform.enabled","x-charidy-permissions":["campaigns.design.manage"],"summary":"Edit campaign page content and add, remove, reorder or hide collection items in the draft.","description":"Omitted fields stay unchanged; supplied collections replace that collection in display order (use [] to clear). Keep item IDs stable. Images use tenant-owned assetId values; selecting a pending upload approves it for use. Rejected, archived, internal and other-campaign assets are refused. Saves through the normal design gate and version history. Changes reach the public page only when the design is published. Current projection supports Bright Futures content components.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignPageContentDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignPageContentResponseDto"}}}},"400":{"description":"PAGE_CONTENT_INVALID, PAGE_CONTENT_MEDIA_UNAVAILABLE, PAGE_CONTENT_LAYOUT_UNSUPPORTED, PAGE_CONTENT_LOCALE_UNSUPPORTED or a named freeform gate failure."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"CAMPAIGN_NOT_FOUND or MEDIA_ASSET_NOT_FOUND."},"409":{"description":"PAGE_CONTENT_DRAFT_CHANGED: reload content before retrying."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["campaigns.page-engine"],"security":[{"bearer":[]}]}},"/api/v1/campaigns/{campaignId}/design/content/about-translations":{"post":{"operationId":"createCampaignAboutTranslation","summary":"Queue a faithful About translation for review; never replace content.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","required":true,"in":"header","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAboutTranslationDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AboutTranslationResponseDto"}}}},"400":{"description":"ABOUT_TRANSLATION_SAME_LANGUAGE or IDEMPOTENCY_KEY_REQUIRED."},"403":{"description":"FEATURE_DISABLED — feature is disabled for this organization."},"404":{"description":"CAMPAIGN_NOT_FOUND or ABOUT_TRANSLATION_NOT_FOUND."},"409":{"description":"IDEMPOTENCY_KEY_REUSED."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."},"429":{"description":"ABOUT_TRANSLATION_RATE_LIMITED: tenant minute/day queue-admission limit reached."}},"tags":["campaigns.page-engine"],"security":[{"bearer":[]}]}},"/api/v1/campaigns/{campaignId}/design/content/about-translations/{jobId}":{"get":{"operationId":"getCampaignAboutTranslation","summary":"Read a tenant-scoped translation preview or its failure.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"jobId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AboutTranslationResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"FEATURE_DISABLED — feature is disabled for this organization."},"404":{"description":"CAMPAIGN_NOT_FOUND or ABOUT_TRANSLATION_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["campaigns.page-engine"],"security":[{"bearer":[]}]}},"/api/v1/campaigns/{campaignId}/design/content/about-translations/{jobId}/cancel":{"post":{"operationId":"cancelCampaignAboutTranslation","summary":"Discard a translation preview, including one already running.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"jobId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AboutTranslationResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"FEATURE_DISABLED — feature is disabled for this organization."},"404":{"description":"CAMPAIGN_NOT_FOUND or ABOUT_TRANSLATION_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["campaigns.page-engine"],"security":[{"bearer":[]}]}},"/api/v1/core/campaign-journeys/next-campaign-insights":{"get":{"operationId":"getNextCampaignInsights","x-charidy-permissions":["campaigns.read"],"summary":"Org performance digest for the next campaign — 'here's what we learned'.","description":"Tenant-scoped, computed at read time: raised last 12 months per currency (with median gift), donation count, active/lapsed/recurring donor counts, the last campaign top-line (raised vs goal, donors) when one exists, and media/brand presence booleans. Thin data returns honest zeros/nulls — never invented baselines. Org-scoped: no journey needed.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NextCampaignInsightsResponseDto"}}}},"400":{"description":"Missing or invalid tenant context."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED — the `campaign_journey.enabled` flag is off for this organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaign-journeys/{journeyId}/strategy-directions":{"post":{"operationId":"generateCampaignJourneyDirections","x-charidy-permissions":["campaigns.design.manage"],"summary":"Generate exactly 3 ranked campaign directions grounded in the org’s own numbers.","description":"Inputs: the journey’s Discovery Brief (required), the computed facts digest, and journey-tip knowledge (inspiration, cited — never rules). LLM-composed when the strategy LLM is enabled, with server-side grounding validation (every numeric claim must exist in the provided facts); an honest deterministic template fallback otherwise (`source: deterministic`). Also derives goal options (lower/fits/higher) from last-campaign performance bounded by donor capacity. Persists to `artifacts.strategy.directions`. Directions are free strategic text + a capability plan — `campaign.kind` stays a technical container (plan principle 6).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateDirectionsResponseDto"}}}},"400":{"description":"Missing or invalid tenant context."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"CAMPAIGN_JOURNEY_NOT_FOUND"},"409":{"description":"State conflict. Possible codes: `DISCOVERY_BRIEF_REQUIRED` (compile the Discovery Brief first), `STRATEGY_PHASE_INVALID` (journey past the strategy phase), `CAMPAIGN_JOURNEY_NOT_ACTIVE`."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaign-journeys/{journeyId}/strategy-choice":{"post":{"operationId":"chooseCampaignJourneyDirection","x-charidy-permissions":["campaigns.design.manage"],"summary":"Choose a strategy direction (omit directionId to auto-pick rank #1) and set the goal.","description":"The locked product shape: the client picks one of the 3 generated directions, and when they don’t, rank #1 auto-picks. The goal defaults to the chosen direction’s data-derived goalSeed unless overridden. Records the choice in the StrategyDecision ledger (learning loop, journeyId in provenance), persists `artifacts.strategy.chosen` as the contract for production stages, and advances the journey phase discovery → strategy when still in discovery.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChooseDirectionDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChooseDirectionResponseDto"}}}},"400":{"description":"Validation failed. Possible codes: `STRATEGY_DIRECTION_NOT_FOUND` (directionId not in the generated set), `STRATEGY_GOAL_CURRENCY_REQUIRED` (goal override without a currency and no goal seed)."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"CAMPAIGN_JOURNEY_NOT_FOUND"},"409":{"description":"State conflict. Possible codes: `STRATEGY_DIRECTIONS_REQUIRED` (generate directions first), `STRATEGY_PHASE_INVALID`, `CAMPAIGN_JOURNEY_NOT_ACTIVE`."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaign-journeys/capability-catalog":{"get":{"operationId":"getCampaignJourneyCapabilityCatalog","x-charidy-permissions":["campaigns.read"],"summary":"What a campaign page can do live, how to explain each capability, and what to decide to configure it.","description":"The vocabulary the journey brain needs in order to both TEACH and CONFIGURE. Per capability: a plain-language he+en explanation a nonprofit manager understands without platform jargon (\"a matcher is a donor who multiplies every gift up to a ceiling he sets in advance\"), and `configuration` — the decisions and inputs the capability cannot be wired without (levels need amounts and titles, and optionally stock quantities; a matcher needs a coefficient, a ceiling, a label and a currency; media needs an asset from the org’s own library). Derived from the shared page-engine registry, so it is exactly what the renderer and the enforcement gate support — never a parallel hand-maintained list. `orgSignal` adds a FACT from this tenant’s own data when one makes a capability concretely available (matchers already run, ambassadors already active, approved media on hand, the median gift); it is null when the data says nothing, and the catalog never argues that a capability is wrong for an organization. Org-scoped and read-only: no journey needed, nothing is filtered out per org.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignJourneyCapabilityCatalogResponseDto"}}}},"400":{"description":"Missing or invalid tenant context."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED — the `campaign_journey.enabled` flag is off for this organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaign-journeys":{"post":{"operationId":"createCampaignJourney","x-charidy-permissions":["campaigns.design.manage"],"summary":"Start a campaign journey (agency-engagement flow) in the discovery phase.","description":"Starts the guided journey that produces a campaign — BEFORE the campaign exists (the campaign is created mid-journey and linked via updateCampaignJourney). Idempotent-ish: when the org already has an active journey that is not yet linked to a campaign, that journey is returned (`reused: true`) instead of creating a duplicate.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCampaignJourneyResponseDto"}}}},"400":{"description":"Missing or invalid tenant context."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED — the `campaign_journey.enabled` flag is off for this organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]},"get":{"operationId":"listCampaignJourneys","x-charidy-permissions":["campaigns.read"],"summary":"List campaign journeys for the active tenant (default: active, newest first).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"status","required":false,"in":"query","description":"Filter by journey status. Defaults to `active`.","schema":{"enum":["active","completed","abandoned"],"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":50,"type":"number"}},{"name":"offset","required":false,"in":"query","schema":{"minimum":0,"type":"number"}},{"name":"campaignId","required":false,"in":"query","description":"Only the journey linked to this campaign. The campaign wizard resumes by campaign id; without this filter a lookup depends on the campaign being inside the first page of rows.","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignJourneysListResponseDto"}}}},"400":{"description":"Missing or invalid tenant context."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaign-journeys/{journeyId}":{"get":{"operationId":"getCampaignJourney","x-charidy-permissions":["campaigns.read"],"summary":"Read one campaign journey (resume the flow from its current phase).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignJourneyResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"CAMPAIGN_JOURNEY_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]},"patch":{"operationId":"updateCampaignJourney","x-charidy-permissions":["campaigns.design.manage"],"summary":"Advance/revisit the journey phase, merge artifacts, link the campaign, or close the journey.","description":"Phase moves forward one step at a time (backward may jump to any earlier phase) and every change is appended to phaseHistory. `artifacts` shallow-merges per top-level key (null deletes a key; >64KB patches rejected), but `blueprint.onboardingProposal` is server-owned and must be changed only through the campaign onboarding proposal endpoints. `campaignId` links the mid-journey-created campaign exactly once. `status` closes the journey (active → completed | abandoned). Typical journey flow: createCampaign → link it here via `{ campaignId }` → enqueueCampaignPageGeneration → poll getCampaignGenerationPipelineStatus.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignJourneyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignJourneyResponseDto"}}}},"400":{"description":"Validation failed. Possible codes: `CAMPAIGN_JOURNEY_PHASE_INVALID` (illegal forward jump), `CAMPAIGN_JOURNEY_ARTIFACTS_TOO_LARGE` (>64KB patch), `CAMPAIGN_JOURNEY_PROPOSAL_ARTIFACT_RESERVED` (attempted to write the server-owned proposal through generic artifacts)."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"CAMPAIGN_JOURNEY_NOT_FOUND or CAMPAIGN_NOT_FOUND."},"409":{"description":"State conflict. Possible codes: `CAMPAIGN_JOURNEY_ALREADY_LINKED` (campaignId is settable once), `CAMPAIGN_ALREADY_HAS_JOURNEY` (one journey per campaign), `CAMPAIGN_JOURNEY_STATUS_INVALID` (only active → completed|abandoned), `CAMPAIGN_JOURNEY_NOT_ACTIVE` (closed journeys are immutable)."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaign-journeys/{journeyId}/discovery-plan":{"get":{"operationId":"getCampaignJourneyDiscoveryPlan","x-charidy-permissions":["campaigns.read"],"summary":"Compute the adaptive discovery interview plan for a campaign journey.","description":"For every catalog topic, runs its tenant-scoped data inference: topics the data answers come back `inferred` with a filled confirm question (he+en) and the structured evidence facts; topics it cannot answer come back honestly `unknown` with the open ask question. Answers already recorded on the journey mark topics `confirmed`/`answered`. Evidence is recomputed per call and never persisted.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DiscoveryPlanResponseDto"}}}},"400":{"description":"Missing or invalid tenant context."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED — the `campaign_journey.enabled` flag is off for this organization."},"404":{"description":"CAMPAIGN_JOURNEY_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaign-journeys/{journeyId}/discovery-answers":{"post":{"operationId":"recordCampaignJourneyDiscoveryAnswer","x-charidy-permissions":["campaigns.design.manage"],"summary":"Record one discovery answer (confirm / edit / open answer) on the journey.","description":"Persists `{kind, value, at}` under `artifacts.discovery.answers[topicKey]` via the journey artifact merge (emitting `campaign_journey.updated`). `confirm` accepts the data inference as-is; `edit` and `answer` carry the user’s verbatim value — special requests are recorded word-for-word for the capability-mapping stage.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordDiscoveryAnswerDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordDiscoveryAnswerResponseDto"}}}},"400":{"description":"Validation failed. Possible codes: `DISCOVERY_TOPIC_UNKNOWN`, `DISCOVERY_ANSWER_VALUE_REQUIRED` (edit/answer without a value), `DISCOVERY_ANSWER_VALUE_TOO_LONG`."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"CAMPAIGN_JOURNEY_NOT_FOUND"},"409":{"description":"CAMPAIGN_JOURNEY_NOT_ACTIVE — answers cannot be recorded on a closed journey."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaign-journeys/{journeyId}/discovery-findings":{"post":{"operationId":"recordCampaignJourneyDiscoveryFindings","x-charidy-permissions":["campaigns.design.manage","campaigns.create"],"summary":"Record a whole conversational turn — free-form findings, topic answers and floor fields — in one write.","description":"The brain names its OWN finding keys (no closed enum) and may record several from a single client message. Findings are APPENDED to `artifacts.discovery.findings` as `{key,label,value,at}` with the client’s words verbatim — recording the same key twice keeps both entries, nothing is ever replaced or lost. Legacy topic-keyed answers and mechanical-floor fields (`campaignSeed`: title / goalMinor / currency / startDate / endDate) may ride along in the SAME payload, and the whole batch is one read-modify-write performed inside the journey row lock, so concurrent turns cannot silently overwrite one another. Once the floor is complete the campaign is auto-created as a `draft` (not publicly visible) and linked to the journey; before that nothing is fabricated and the response reports which fields are still missing. Emits `campaign_journey.updated` (and `campaign.created` when the campaign is created) — no new event types.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordDiscoveryFindingsDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordDiscoveryFindingsResponseDto"}}}},"400":{"description":"Validation failed. Possible codes: `DISCOVERY_FINDINGS_EMPTY` (no findings, answers or seed), `DISCOVERY_FINDINGS_TOO_MANY` (over the per-request cap), `DISCOVERY_FINDINGS_LIMIT_EXCEEDED` (over the per-journey cap), `DISCOVERY_FINDING_KEY_INVALID`, `DISCOVERY_FINDING_LABEL_INVALID`, `DISCOVERY_FINDING_VALUE_REQUIRED`, `DISCOVERY_FINDING_VALUE_TOO_LONG`, `DISCOVERY_TOPIC_UNKNOWN`, `DISCOVERY_ANSWER_VALUE_REQUIRED`, `DISCOVERY_ANSWER_VALUE_TOO_LONG`, `CAMPAIGN_JOURNEY_ARTIFACTS_TOO_LARGE`."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"CAMPAIGN_JOURNEY_NOT_FOUND"},"409":{"description":"State conflict. Possible codes: `CAMPAIGN_JOURNEY_NOT_ACTIVE`, `CAMPAIGN_JOURNEY_ALREADY_LINKED`, `CAMPAIGN_ALREADY_HAS_JOURNEY`."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaign-journeys/{journeyId}/discovery-brief":{"post":{"operationId":"compileCampaignJourneyDiscoveryBrief","x-charidy-permissions":["campaigns.design.manage"],"summary":"Compile the Discovery Brief from recorded answers + computed facts and persist it.","description":"Builds the structured Discovery Brief — every numeric claim comes from tenant-computed facts, free text is either the user’s verbatim answer or a provenance-marked inference, and `dataGaps` honestly lists the topics still unknown. Persisted under `artifacts.discovery.brief`. Allowed only while the journey is in the discovery or strategy phase.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompileDiscoveryBriefResponseDto"}}}},"400":{"description":"Missing or invalid tenant context."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"CAMPAIGN_JOURNEY_NOT_FOUND"},"409":{"description":"State conflict. Possible codes: `DISCOVERY_BRIEF_PHASE_INVALID` (journey past the strategy phase), `CAMPAIGN_JOURNEY_NOT_ACTIVE`."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaign-journeys/{journeyId}/outline":{"patch":{"operationId":"updateCampaignJourneyOutline","x-charidy-permissions":["campaigns.design.manage"],"summary":"Declare or fill the outline components the brain itself decided this campaign needs.","description":"The brain names its OWN component keys (no closed enum — an emergency campaign may need no ambassador plan; a school campaign may need three things nobody anticipated). Goals are UPSERTED by `key`: a new key is declared (`label` + `why` required) with `status: open`; an existing key is updated field-by-field, and supplying non-empty `content` flips it to `filled`. Goals not mentioned in the patch are preserved — this endpoint cannot drop a component the brain declared earlier, so the client can always see what was never covered. Persisted under `artifacts.outline` in ONE read-modify-write performed inside the journey row lock, so concurrent turns cannot silently overwrite one another. Emits `campaign_journey.updated`.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignJourneyOutlineDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignJourneyOutlineResponseDto"}}}},"400":{"description":"Validation failed. Possible codes: `CAMPAIGN_JOURNEY_OUTLINE_GOALS_EMPTY`, `CAMPAIGN_JOURNEY_OUTLINE_GOALS_TOO_MANY`, `CAMPAIGN_JOURNEY_OUTLINE_GOALS_LIMIT_EXCEEDED`, `CAMPAIGN_JOURNEY_OUTLINE_GOAL_DUPLICATE`, `CAMPAIGN_JOURNEY_OUTLINE_GOAL_KEY_INVALID`, `CAMPAIGN_JOURNEY_OUTLINE_GOAL_LABEL_INVALID`, `CAMPAIGN_JOURNEY_OUTLINE_GOAL_WHY_INVALID`, `CAMPAIGN_JOURNEY_OUTLINE_GOAL_CONTENT_TOO_LONG`, `CAMPAIGN_JOURNEY_OUTLINE_GOAL_INCOMPLETE` (a newly declared goal without label/why), `CAMPAIGN_JOURNEY_ARTIFACTS_TOO_LARGE`."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED — the `campaign_journey.enabled` flag is off for this organization."},"404":{"description":"CAMPAIGN_JOURNEY_NOT_FOUND"},"409":{"description":"CAMPAIGN_JOURNEY_NOT_ACTIVE — the outline of a closed journey can no longer change."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaign-journeys/{journeyId}/outline/readiness":{"post":{"operationId":"assessCampaignJourneyOutlineReadiness","x-charidy-permissions":["campaigns.design.manage"],"summary":"Record the brain’s readiness self-critique and report whether the journey may proceed.","description":"The brain submits what IT judges is still missing (`missing[]` + `rationale`) and whether it declares the outline ready. The server validates ONLY the mechanical floor — a message/title, a goal + currency, and a start date — because without those no campaign row and no page can exist; it does NOT check the brain’s components against any list of ours. Declaring ready while the floor is incomplete is REFUSED with `CAMPAIGN_JOURNEY_OUTLINE_FLOOR_INCOMPLETE`, naming exactly which mechanical fields are missing so the brain knows what to ask for. Declaring ready with the brain’s own goals still `open` is ALLOWED — they are its goals — and those goals come back in `openGoals` and stay on `artifacts.outline` so the client can see what was never covered. The critique is persisted under `artifacts.outline.selfCritique` (and `declaredReadyAt` on acceptance) via the same locked write. Emits `campaign_journey.updated`; the phase is reported on, never advanced here.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssessCampaignJourneyOutlineReadinessDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignJourneyOutlineReadinessResponseDto"}}}},"400":{"description":"Validation failed. Possible codes: `CAMPAIGN_JOURNEY_OUTLINE_FLOOR_INCOMPLETE` (declared ready with `details.missingFloorFields` naming the gaps), `CAMPAIGN_JOURNEY_OUTLINE_CRITIQUE_RATIONALE_INVALID`, `CAMPAIGN_JOURNEY_OUTLINE_CRITIQUE_MISSING_TOO_MANY`, `CAMPAIGN_JOURNEY_OUTLINE_CRITIQUE_MISSING_TOO_LONG`."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED — the `campaign_journey.enabled` flag is off for this organization."},"404":{"description":"CAMPAIGN_JOURNEY_NOT_FOUND"},"409":{"description":"CAMPAIGN_JOURNEY_NOT_ACTIVE"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaign-journeys/{journeyId}/wizard":{"get":{"operationId":"getCampaignWizardState","x-charidy-permissions":["campaigns.read"],"summary":"Read the campaign wizard state (answers so far and what still blocks each step).","description":"Returns the eight-step campaign wizard state stored on the journey (`artifacts.wizard`): name, goal, dates, donation buttons, about, banners, groups, summary. `progress` is computed server-side from the shared step registry: per step, `complete` and machine-readable `blockers[]`, plus `firstIncompleteStep` and `canFinish`. An absent answer is a blocker — nothing is defaulted. Read-only.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignWizardStateResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED — the `onboarding.wizard_v2.enabled` flag is off for this organization."},"404":{"description":"CAMPAIGN_JOURNEY_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]},"patch":{"operationId":"updateCampaignWizardState","x-charidy-permissions":["campaigns.design.manage"],"summary":"Save answers into the campaign wizard state (partial update).","description":"Each step section in the body merges field-by-field into the stored state (patching only `dates.endDate` keeps `dates.startDate`); arrays such as `donationButtons.amountsMinor` are replaced. Incomplete drafts are allowed — missing or inconsistent answers are reported as `progress` blockers rather than rejected. Runs inside the journey row lock, so concurrent saves cannot overwrite each other, and emits `campaign_journey.updated`. A closed journey is immutable.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignWizardStateDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignWizardStateResponseDto"}}}},"400":{"description":"Validation failed, or `CAMPAIGN_JOURNEY_ARTIFACTS_TOO_LARGE`."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED — the `onboarding.wizard_v2.enabled` flag is off for this organization."},"404":{"description":"CAMPAIGN_JOURNEY_NOT_FOUND"},"409":{"description":"CAMPAIGN_JOURNEY_NOT_ACTIVE — a closed journey can no longer change."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaign-journeys/{journeyId}/wizard/finish":{"post":{"operationId":"finishCampaignWizard","x-charidy-permissions":["campaigns.design.manage"],"summary":"Finish the shared campaign wizard and enqueue its approved page build.","description":"Server-owned completion command for dashboard and MCP clients. It refuses incomplete wizard state, writes the resolved campaign core, requires the confirmed story and approved proposal, then queues (or recognizes) the page build before marking `pageBuildRequested`. Donation-page variants instead finish the compact design directly, with details > design > review (name > banners > summary), without an AI build. It never publishes.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FinishCampaignWizardDto"}}}},"responses":{"202":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FinishCampaignWizardResponseDto"}}}},"400":{"description":"CAMPAIGN_WIZARD_INCOMPLETE, CAMPAIGN_WIZARD_CAMPAIGN_REQUIRED, or proposal/story approval is still missing."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED — the `onboarding.wizard_v2.enabled` flag is off for this organization."},"409":{"description":"A conflicting campaign page build is already in progress."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaign-journeys/{journeyId}/page-spec":{"patch":{"operationId":"updateCampaignJourneyPageSpec","x-charidy-permissions":["campaigns.design.manage"],"summary":"Record what the brain and the client agreed the campaign page must contain.","description":"Writes `artifacts.blueprint.pageSpec` — the chosen live `capabilities[]` each with the configuration decided for it, the campaign’s `message` in the CLIENT’s own words (verbatim) plus any headline the brain proposed, verbatim `specialRequests[]`, and an OPTIONAL `donationTiers[]` ladder. MERGE semantics throughout: capabilities are upserted by id and their configuration is merged key-by-key (a key set to null drops that one decision), a capability the patch does not mention is preserved untouched, and dropping one requires an explicit `remove: true` — this endpoint cannot silently lose a capability that was agreed. Special requests are APPENDED, never rewritten. Every chosen capability is validated against the capability catalog’s REQUIRED configuration keys (see getCampaignJourneyCapabilityCatalog), so a matcher cannot be stored without a coefficient and a ceiling: the write fails with `CAMPAIGN_JOURNEY_PAGE_SPEC_CONFIG_INCOMPLETE` naming the capability and the missing keys. `donationTiers` is an ordered whole — supplying it replaces any previous ladder and it then WINS over the automatic goal-derived ladder at build time; `clearDonationTiers: true` reverts to the automatic one. The whole patch is applied in ONE read-modify-write inside the journey row lock, so concurrent turns cannot overwrite each other. Moves the journey `strategy → blueprint` (specifying the page IS entering the blueprint phase); other phases are left where they are. The response reports `readyToBuild` + `gaps`, computed by the same rules buildCampaignJourneyPage refuses on. Emits `campaign_journey.updated`.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignJourneyPageSpecDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignJourneyPageSpecResponseDto"}}}},"400":{"description":"Validation failed. Possible codes: `CAMPAIGN_JOURNEY_PAGE_SPEC_EMPTY`, `CAMPAIGN_JOURNEY_PAGE_SPEC_CAPABILITY_UNKNOWN`, `CAMPAIGN_JOURNEY_PAGE_SPEC_CAPABILITY_DUPLICATE`, `CAMPAIGN_JOURNEY_PAGE_SPEC_CAPABILITIES_TOO_MANY`, `CAMPAIGN_JOURNEY_PAGE_SPEC_CONFIG_KEY_INVALID`, `CAMPAIGN_JOURNEY_PAGE_SPEC_CONFIG_KEY_UNKNOWN`, `CAMPAIGN_JOURNEY_PAGE_SPEC_CONFIG_VALUE_INVALID`, `CAMPAIGN_JOURNEY_PAGE_SPEC_CONFIG_TOO_MANY_KEYS`, `CAMPAIGN_JOURNEY_PAGE_SPEC_CONFIG_INCOMPLETE` (with `details.capability` + `details.missingKeys`), `CAMPAIGN_JOURNEY_PAGE_SPEC_MESSAGE_INVALID`, `CAMPAIGN_JOURNEY_PAGE_SPEC_SPECIAL_REQUEST_TOO_LONG`, `CAMPAIGN_JOURNEY_PAGE_SPEC_SPECIAL_REQUESTS_LIMIT_EXCEEDED`, `CAMPAIGN_JOURNEY_PAGE_SPEC_TIERS_EMPTY`, `CAMPAIGN_JOURNEY_PAGE_SPEC_TIERS_TOO_MANY`, `CAMPAIGN_JOURNEY_PAGE_SPEC_TIERS_CONFLICT`, `CAMPAIGN_JOURNEY_PAGE_SPEC_TIER_INVALID`, `CAMPAIGN_JOURNEY_ARTIFACTS_TOO_LARGE`."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED — the `campaign_journey.enabled` flag is off for this organization."},"404":{"description":"CAMPAIGN_JOURNEY_NOT_FOUND"},"409":{"description":"CAMPAIGN_JOURNEY_NOT_ACTIVE — the page spec of a closed journey can no longer change."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaign-journeys/{journeyId}/build-page":{"post":{"operationId":"buildCampaignJourneyPage","x-charidy-permissions":["campaigns.design.manage"],"summary":"Build the campaign page ONCE from the agreed page spec, after explicit approval.","description":"Generates the page from `artifacts.blueprint.pageSpec` and `artifacts.outline` — NOT from the generic website-scan brief. MCP callers must first follow getCampaignOnboardingStoryProfile → confirmCampaignOnboardingStoryProfile → getCampaignOnboardingGenerationProposal → approveCampaignOnboardingGenerationProposal; each response supplies the nextInstruction. Call this only after that shared proposal and the journey specification are approved, never after every message: generation is up to five model calls in a 75s budget and it overwrites `campaign_design.draft_settings` wholesale. What happens, in order: (1) the spec must be complete — a message in the client’s own words and every chosen capability’s required configuration present, else `CAMPAIGN_JOURNEY_PAGE_SPEC_INCOMPLETE` names each gap (same rules as `readyToBuild` on updateCampaignJourneyPageSpec); (2) the brief is composed from the client’s verbatim message, the brain’s headline, the filled outline components, the verbatim special requests and the per-capability configuration; (3) the spec’s capability set (plus the `donate` floor a campaign page cannot exist without) travels to the worker as `requiredCapabilities`, so the enforcement gate judges the page against THIS plan; (4) when the spec defined `donationTiers` they REPLACE the campaign’s donation levels and the automatic goal-derived ladder is not seeded — when it did not, the automatic ladder is seeded as before; (5) the journey advances `blueprint → production`. REGENERATION GUARD: a campaign that already has a generated draft or a published design is REFUSED with `CAMPAIGN_PAGE_ALREADY_BUILT` unless `rebuild: true` states the intent — regenerating discards refine edits. Nothing is written when either guard refuses. Poll progress via getCampaignGenerationPipelineStatus; the worker writes the DRAFT and never auto-publishes.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuildCampaignJourneyPageDto"}}}},"responses":{"202":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuildCampaignJourneyPageResponseDto"}}}},"400":{"description":"Validation failed. Possible codes: `CAMPAIGN_PROPOSAL_APPROVAL_REQUIRED` (includes nextInstruction), `CAMPAIGN_JOURNEY_PAGE_SPEC_INCOMPLETE` (with `details.gaps` naming the missing message and/or each capability + its missing configuration keys), `TENANT_CONTEXT_MISSING`, `USER_CONTEXT_MISSING`."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED — the `campaign_journey.enabled` flag is off for this organization."},"404":{"description":"CAMPAIGN_JOURNEY_NOT_FOUND / CAMPAIGN_NOT_FOUND"},"409":{"description":"Possible codes: `CAMPAIGN_PAGE_ALREADY_BUILT` (a page already exists — pass `rebuild: true`; `details` names the status, whether it is published, and when the draft last changed), `CAMPAIGN_JOURNEY_PAGE_BUILD_PHASE_INVALID` (the journey has not reached the blueprint phase), `CAMPAIGN_JOURNEY_CAMPAIGN_REQUIRED` (no campaign linked yet), `CAMPAIGN_JOURNEY_NOT_ACTIVE`."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/campaign-journeys/{journeyId}/copy-pack":{"post":{"operationId":"generateCampaignJourneyCopyPack","x-charidy-permissions":["campaigns.design.manage"],"summary":"Generate the campaign copy pack (3 emails + WhatsApp + SMS) as editable draft templates.","description":"The journey copywriter: one LLM run over the Discovery Brief, the CHOSEN strategy direction (+goal), the org persona (flag-gated), and the PII-safe copy-performance digest (\"these subject styles performed well\" — inspiration, not rules). Every numeric claim is validated against the chosen goal / facts digest (one repair re-prompt, then an honest 422 — no deterministic fallback fakes creativity) and merge tags come from the existing platform vocabulary only. Each piece is saved as an INACTIVE DRAFT CommunicationTemplate (nothing is sent, no automation rules are created) and `artifacts.production.copyPack` records the template ids.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateCopyPackResponseDto"}}}},"400":{"description":"Missing or invalid tenant context."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED — the `campaign_journey.enabled` flag is off for this organization."},"404":{"description":"CAMPAIGN_JOURNEY_NOT_FOUND"},"409":{"description":"State conflict. Possible codes: `STRATEGY_CHOICE_REQUIRED` (choose a direction first), `COPY_PACK_PHASE_INVALID` (journey not in strategy/blueprint/production), `CAMPAIGN_JOURNEY_NOT_ACTIVE`, `COPY_PACK_LLM_DISABLED` (the copywriter LLM is off on this environment — reported honestly, no fake copy)."},"422":{"description":"COPY_PACK_GROUNDING_FAILED — the model output failed numeric-grounding / merge-tag validation even after a repair attempt. Nothing was saved."},"502":{"description":"COPY_PACK_GENERATION_FAILED — the LLM call itself failed. Nothing was saved."}},"tags":["core.campaigns"],"security":[{"bearer":[]}]}},"/api/v1/core/page-engine/capabilities":{"get":{"operationId":"getPageEngineCapabilities","x-charidy-permissions":["campaigns.design.manage"],"summary":"List freeform functional islands: types, capabilities, DOM contracts, and props JSON Schema.","description":"The capability registry an AI/MCP client uses to author freeform pages. Each island type maps to a logical capability (donate, progress, ...) and exposes a props JSON Schema and a <charidy-island> DOM contract. See SPEC/29 §8A.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageEngineCapabilitiesResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.page-engine"],"security":[{"bearer":[]}]}},"/api/v1/core/page-engine/style-catalog":{"get":{"operationId":"getCampaignStyleCatalog","x-charidy-permissions":["campaigns.design.manage"],"x-charidy-feature-flag":"page_engine.manual_edit.enabled","summary":"List the closed design-catalog properties a manual style override may set, with their enforced ranges.","description":"The catalog `setCampaignNodeOverride` validates `kind=style` writes against. A client — panel or agent — sends a property id and a NUMBER, never CSS, and the server composes the responsive declaration; this endpoint is how it learns which ids exist and what each one accepts. Reading it before writing is what turns a rejected guess into a correct first attempt: an id outside this list is refused with `CAMPAIGN_NODE_STYLE_UNKNOWN`, and a value outside the published range with `CAMPAIGN_NODE_STYLE_INVALID`. Bounds are in pixels and are the SAME object the server validates against, so a control cannot offer a value the write path would reject. Gated by the manual-editor flag, like the write path it describes.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignStyleCatalogResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"FEATURE_DISABLED — feature is disabled for this organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.page-engine"],"security":[{"bearer":[]}]}},"/api/v1/campaigns/page-engine/templates":{"get":{"operationId":"listCampaignPageTemplates","x-charidy-permissions":["campaigns.design.manage"],"summary":"List deterministic campaign-page templates and their recipe compositions.","description":"AI-ready catalog for choosing General, Bold, Subtle, or Network. Each entry explains when to use it and names the component-library recipes that will be composed by applyCampaignPageTemplate.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignPageTemplateCatalogDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["campaigns.page-engine"],"security":[{"bearer":[]}]}},"/api/v1/campaigns/page-engine/persona-kits":{"get":{"operationId":"listCampaignPersonaKits","x-charidy-permissions":["campaigns.design.manage"],"summary":"List cause-specific campaign-page kits and their deterministic defaults.","description":"AI-ready catalog for choosing a cause-specific starting point. Each kit layers palette, hero typography, section actions, localized copy, and optional create-only campaign seeds over a shipped page template.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignPersonaKitCatalogDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["campaigns.page-engine"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/levels":{"post":{"operationId":"createCampaignLevel","x-charidy-permissions":["campaigns.manage"],"summary":"Create one donation level.","description":"A level is a preset giving tier, not a billing policy: it may pre-select a billing type but never adds one. `isRecurring: true` requires that the campaign checkout already enables `recurring` (settings.checkout.enabledBillingTypes) — otherwise the tier could never be charged and the call is rejected with LEVEL_RECURRING_NOT_ENABLED.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDonationLevelDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DonationLevelResponseDto"}}}},"400":{"description":"Validation failed or cap/recurring constraints violated. Codes: TOO_MANY_LEVELS, LEVEL_CAP_REQUIRES_QUANTITY, RECURRING_REQUIRES_FREQUENCY, LEVEL_RECURRING_NOT_ENABLED (the campaign checkout does not enable `recurring`)."},"401":{"description":"JWT missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.levels"],"security":[{"bearer":[]}]},"get":{"operationId":"listCampaignLevels","x-charidy-permissions":["campaigns.read"],"summary":"List campaign donation levels.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"includeHidden","required":false,"in":"query","schema":{"type":"boolean"}},{"name":"includeDeleted","required":false,"in":"query","schema":{"type":"boolean"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DonationLevelsListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.levels"],"security":[{"bearer":[]}]},"delete":{"operationId":"deleteCampaignLevels","x-charidy-permissions":["campaigns.manage"],"summary":"Atomically soft-delete selected donation levels.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkDeleteDonationLevelsDto"}}}},"responses":{"204":{"description":""},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign or one of the selected active donation levels was not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.levels"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/levels/{id}":{"get":{"operationId":"getCampaignLevel","x-charidy-permissions":["campaigns.read"],"summary":"Read one donation level + translations.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DonationLevelResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Level not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.levels"],"security":[{"bearer":[]}]},"patch":{"operationId":"updateCampaignLevel","x-charidy-permissions":["campaigns.manage"],"summary":"Update donation level.","description":"Patching `isRecurring: true` requires that the campaign checkout enables `recurring` (LEVEL_RECURRING_NOT_ENABLED otherwise). A level that is ALREADY recurring on a campaign that has since disabled the mode stays editable — including setting `isRecurring: false` to fix it.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDonationLevelDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DonationLevelResponseDto"}}}},"400":{"description":"Validation or cap-quantity rules violated. Codes: LEVEL_CAP_REQUIRES_QUANTITY, LEVEL_CAP_BELOW_CONSUMED, RECURRING_REQUIRES_FREQUENCY, LEVEL_RECURRING_NOT_ENABLED."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Level not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.levels"],"security":[{"bearer":[]}]},"delete":{"operationId":"deleteCampaignLevel","x-charidy-permissions":["campaigns.manage"],"summary":"Soft-delete a donation level.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":""},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Level not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.levels"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/levels/{id}/visibility":{"patch":{"operationId":"setCampaignLevelVisibility","x-charidy-permissions":["campaigns.manage"],"summary":"Toggle visibility on a donation level.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetDonationLevelVisibilityDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DonationLevelResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.levels"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/levels/reorder":{"post":{"operationId":"reorderCampaignLevels","x-charidy-permissions":["campaigns.manage"],"summary":"Atomic reorder of all levels.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReorderDonationLevelsDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DonationLevelsBulkResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Reorder list does not match current levels."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.levels"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/levels/bulk":{"post":{"operationId":"bulkCreateCampaignLevels","x-charidy-permissions":["campaigns.manage"],"summary":"Create N levels in one transaction.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkCreateDonationLevelsDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DonationLevelsBulkResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.levels"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/levels/copy-from":{"post":{"operationId":"copyCampaignLevels","x-charidy-permissions":["campaigns.manage"],"summary":"Clone levels from another campaign in same org.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopyDonationLevelsDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DonationLevelsCopyResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.levels"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/levels/{id}/translations/{locale}":{"put":{"operationId":"upsertCampaignLevelTranslation","x-charidy-permissions":["campaigns.manage"],"summary":"Create or replace a translation row for a level.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"locale","required":true,"in":"path","description":"BCP-47 short tag (lowercase)","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertDonationLevelTranslationDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DonationLevelTranslationResponseDto"}}}},"400":{"description":"Locale invalid or amount/currency pair not honored."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.levels"],"security":[{"bearer":[]}]},"delete":{"operationId":"deleteCampaignLevelTranslation","x-charidy-permissions":["campaigns.manage"],"summary":"Reset a level translation.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"locale","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":""},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.levels"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/levels/{id}/translations":{"get":{"operationId":"listCampaignLevelTranslations","x-charidy-permissions":["campaigns.read"],"summary":"List all translations for a donation level.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DonationLevelTranslationResponseDto"}}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.levels"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/levels/{id}/reserve-slot":{"post":{"operationId":"reserveCampaignLevelSlot","x-charidy-permissions":["campaigns.manage"],"summary":"Pre-charge cap reservation hold (SPEC/04 iter 8).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReserveDonationLevelSlotDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DonationLevelHoldResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.levels"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/matchers":{"get":{"operationId":"listCampaignMatchers","x-charidy-permissions":["campaigns.read"],"summary":"List matchers on a campaign.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignMatchersListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.matchers"],"security":[{"bearer":[]}]},"post":{"operationId":"createCampaignMatcher","x-charidy-permissions":["campaigns.matchers.manage"],"x-charidy-destructive":true,"summary":"Create a matcher.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCampaignMatcherDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignMatcherResponseDto"}}}},"400":{"description":"Coefficient out of bounds."},"401":{"description":"JWT missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.matchers"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/matchers/{id}":{"patch":{"operationId":"updateCampaignMatcher","x-charidy-permissions":["campaigns.matchers.manage"],"x-charidy-destructive":true,"summary":"Update matcher identity, copy, window, and pool.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignMatcherDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignMatcherResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.matchers"],"security":[{"bearer":[]}]},"delete":{"operationId":"deleteCampaignMatcher","x-charidy-permissions":["campaigns.matchers.manage"],"summary":"Soft-delete a matcher.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":""},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.matchers"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/matchers/{id}/coefficient":{"patch":{"operationId":"setMatcherCoefficient","x-charidy-permissions":["campaigns.matchers.manage"],"summary":"Self-serve: change coefficient within configured bounds.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetMatcherCoefficientDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignMatcherResponseDto"}}}},"400":{"description":"MATCHER_COEFFICIENT_OUT_OF_BOUNDS — coefficient outside (min, max)."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.matchers"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/matchers/{id}/activate":{"post":{"operationId":"activateCampaignMatcher","x-charidy-permissions":["campaigns.matchers.manage"],"summary":"Activate a scheduled matcher (transitions status → active).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignMatcherResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.matchers"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/matchers/{id}/featured":{"patch":{"operationId":"setCampaignMatcherFeatured","x-charidy-permissions":["campaigns.matchers.manage"],"summary":"Pin or unpin a matcher on the public matchers strip.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetCampaignMatcherFeaturedDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignMatcherResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.matchers"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/streams":{"get":{"operationId":"listCampaignStreams","x-charidy-permissions":["campaigns.read"],"summary":"List donation streams on a campaign.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"includeDeleted","required":false,"in":"query","description":"Include soft-deleted streams.","schema":{"type":"boolean"}},{"name":"showOnPageOnly","required":false,"in":"query","description":"Only streams visible on the public page.","schema":{"type":"boolean"}},{"name":"showOnCheckoutOnly","required":false,"in":"query","description":"Only streams visible at checkout.","schema":{"type":"boolean"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignStreamsListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.streams"],"security":[{"bearer":[]}]},"post":{"operationId":"createCampaignStream","x-charidy-permissions":["campaigns.streams.manage"],"summary":"Create a donation stream.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCampaignStreamDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignStreamResponseDto"}}}},"400":{"description":"Validation failed."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.streams"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/streams/{streamId}":{"get":{"operationId":"getCampaignStream","x-charidy-permissions":["campaigns.read"],"summary":"Read a single donation stream.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"streamId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignStreamResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Stream not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.streams"],"security":[{"bearer":[]}]},"patch":{"operationId":"updateCampaignStream","x-charidy-permissions":["campaigns.streams.manage"],"summary":"Update a donation stream.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"streamId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignStreamDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignStreamResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.streams"],"security":[{"bearer":[]}]},"delete":{"operationId":"deleteCampaignStream","x-charidy-permissions":["campaigns.streams.manage"],"summary":"Soft-delete a donation stream.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"streamId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":""},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.streams"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/streams/reorder":{"post":{"operationId":"reorderCampaignStreams","x-charidy-permissions":["campaigns.streams.manage"],"summary":"Atomically rewrite stream display order.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReorderCampaignStreamsDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignStreamsListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.streams"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/streams/{streamId}/set-default":{"post":{"operationId":"setCampaignStreamDefault","x-charidy-permissions":["campaigns.streams.manage"],"summary":"Mark a stream as the default at checkout.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"streamId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignStreamResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.streams"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/teams":{"get":{"operationId":"listCampaignTeams","x-charidy-permissions":["campaigns.read"],"summary":"Flat list of teams (an \"ambassador\" is just a team of one). Every row carries parentTeamId + levelId so the client builds the tree itself. Use parentId for direct children; descendantsOf for ALL descendants regardless of depth. Filter with levelId, status, search.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"parentId","required":false,"in":"query","description":"Filter to direct children of this team id (use for tree expansion).","schema":{"format":"uuid","type":"string"}},{"name":"descendantsOf","required":false,"in":"query","description":"Return ALL descendants of this team id regardless of depth (recursive CTE). Mutually exclusive with parentId.","schema":{"format":"uuid","type":"string"}},{"name":"levelId","required":false,"in":"query","description":"Filter to a single level of the campaign's level scheme.","schema":{"format":"uuid","type":"string"}},{"name":"status","required":false,"in":"query","description":"Filter by approval status (e.g. status=pending for the approval queue).","schema":{"enum":["pending","approved","suspended","archived"],"type":"string"}},{"name":"isFeatured","required":false,"in":"query","description":"Filter to featured teams only.","schema":{"type":"boolean"}},{"name":"isHidden","required":false,"in":"query","description":"Filter by the hidden flag (decision ה-11).","schema":{"type":"boolean"}},{"name":"search","required":false,"in":"query","description":"Search over team name and leader name.","schema":{"maxLength":120,"type":"string"}},{"name":"includeDeleted","required":false,"in":"query","description":"Include soft-deleted teams.","schema":{"type":"boolean"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":200,"default":50,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignTeamsListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.teams"],"security":[{"bearer":[]}]},"post":{"operationId":"createCampaignTeam","x-charidy-permissions":["campaigns.teams.manage"],"summary":"Create a team node at any level — a region, a class, or a single ambassador. Pass parentTeamId to nest it, levelId to tag it, and `contact` to create-or-link the person behind it (dedup by email).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCampaignTeamDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignTeamResponseDto"}}}},"400":{"description":"Validation, slug, or hierarchy rules violated."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Campaign not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.teams"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/teams/{teamId}":{"get":{"operationId":"getCampaignTeam","x-charidy-permissions":["campaigns.read"],"summary":"Read a single team with live subtree totals and its ancestor breadcrumb (root-first, excluding itself).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"teamId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignTeamResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Team not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.teams"],"security":[{"bearer":[]}]},"patch":{"operationId":"updateCampaignTeam","x-charidy-permissions":["campaigns.teams.manage"],"summary":"Update a team — including MOVING it (parentTeamId, cycle- and depth-checked server-side) and APPROVING/SUSPENDING/ARCHIVING it (status). Status is changed here; there are deliberately no approve/suspend/archive sub-endpoints.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"teamId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignTeamDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignTeamResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.teams"],"security":[{"bearer":[]}]},"delete":{"operationId":"deleteCampaignTeam","x-charidy-permissions":["campaigns.teams.manage"],"summary":"Soft-delete a team. Refused with 409 while it still has active sub-teams — move or delete those first, or archive this one instead (PATCH status=archived).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"teamId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"204":{"description":""},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"409":{"description":"CAMPAIGN_TEAM_HAS_ACTIVE_CHILDREN — the team still has active sub-teams."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.teams"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/teams/{teamId}/donors":{"get":{"operationId":"listCampaignTeamDonors","x-charidy-permissions":["campaigns.read"],"summary":"Donors of this team and all descendant teams (single recursive CTE round-trip). Each row carries the \"via\" chain down to the node the donation was attributed to, and a shared-split marker with the full donation amount alongside this team's share.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"teamId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignTeamDonorsResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.teams"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/teams/{teamId}/pin-donation":{"post":{"operationId":"pinTeamDonation","x-charidy-permissions":["campaigns.teams.manage"],"summary":"Pin a donation to the team feed.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"teamId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PinDonationDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignTeamResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.teams"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/teams/{teamId}/pin-donation/{donationId}":{"delete":{"operationId":"unpinTeamDonation","x-charidy-permissions":["campaigns.teams.manage"],"summary":"Unpin a donation from the team feed.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"teamId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"donationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignTeamResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.teams"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/team-levels":{"get":{"operationId":"getCampaignTeamLevels","x-charidy-permissions":["campaigns.read"],"summary":"The campaign's level scheme (e.g. Region → Grade → Class → Student), ordered top-first, each with a live team count.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignTeamLevelsResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.teams"],"security":[{"bearer":[]}]},"put":{"operationId":"setCampaignTeamLevels","x-charidy-permissions":["campaigns.teams.manage"],"summary":"Replace the WHOLE level scheme. A level sent with its id keeps that id when its rank changes, so its teams stay attached. A level sent without an id is matched by rank. Removing a level that teams still use is refused with 409.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetCampaignTeamLevelsDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignTeamLevelsResponseDto"}}}},"400":{"description":"Duplicate ranks, or invalid labels."},"403":{"description":"Missing required permission for this operation."},"409":{"description":"CAMPAIGN_TEAM_LEVEL_IN_USE — a removed level still has teams assigned to it."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.teams"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/team-settings":{"get":{"operationId":"getCampaignTeamSettings","x-charidy-permissions":["campaigns.read"],"summary":"The campaign's two team toggles: whether a donor may split one gift across several nodes, and whether public self-signups go live without staff approval. Both default to off.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignTeamSettingsResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.teams"],"security":[{"bearer":[]}]},"patch":{"operationId":"updateCampaignTeamSettings","x-charidy-permissions":["campaigns.teams.manage"],"summary":"Turn the team toggles on or off. An omitted toggle is left as it was, so one switch can be flipped without echoing the other.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignTeamSettingsDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignTeamSettingsResponseDto"}}}},"400":{"description":"CAMPAIGN_TEAM_SETTINGS_EMPTY — the body changed no toggle."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.teams"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/updates":{"get":{"operationId":"listCampaignUpdates","x-charidy-permissions":["campaigns.read"],"summary":"List campaign updates.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"includeDrafts","required":false,"in":"query","description":"Include unpublished drafts.","schema":{"type":"boolean"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":200,"default":50,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignUpdatesListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.updates"],"security":[{"bearer":[]}]},"post":{"operationId":"createCampaignUpdate","x-charidy-permissions":["campaigns.updates.manage"],"summary":"Author a new campaign update.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCampaignUpdateDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignUpdateResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.updates"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/updates/{updateId}":{"patch":{"operationId":"editCampaignUpdate","x-charidy-permissions":["campaigns.updates.manage"],"summary":"Edit a draft or published update.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"updateId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignUpdateDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignUpdateResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.updates"],"security":[{"bearer":[]}]},"delete":{"operationId":"deleteCampaignUpdate","x-charidy-permissions":["campaigns.updates.manage"],"summary":"Soft-delete an update.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"updateId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":""},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.updates"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/updates/{updateId}/publish":{"post":{"operationId":"publishCampaignUpdate","x-charidy-permissions":["campaigns.updates.manage"],"summary":"Publish a draft update to the public feed.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"updateId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignUpdateResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.updates"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/email-templates":{"get":{"operationId":"listCampaignEmailTemplates","x-charidy-permissions":["campaigns.read"],"summary":"List campaign-scoped email template overrides.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignEmailTemplatesListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.email_templates"],"security":[{"bearer":[]}]},"post":{"operationId":"upsertCampaignEmailTemplate","x-charidy-permissions":["campaigns.email_templates.manage"],"summary":"Insert or update a campaign-scoped email template override.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertCampaignEmailTemplateDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignEmailTemplateResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.email_templates"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/email-templates/{templateKey}":{"delete":{"operationId":"deleteCampaignEmailTemplate","x-charidy-permissions":["campaigns.email_templates.manage"],"summary":"Remove a campaign-scoped email template override.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"templateKey","required":true,"in":"path","schema":{"enum":["donation_confirmation","receipt_email","team_created","share_invite","matcher_update","team_leader_alert"],"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":""},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.email_templates"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/receipts/export":{"post":{"operationId":"exportCampaignReceipts","x-charidy-permissions":["campaigns.receipts.export"],"summary":"Enqueue an asynchronous ZIP export of campaign receipts. Returns 202 immediately; signed URL emailed when ready.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateReceiptArchiveJobDto"}}}},"responses":{"202":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptArchiveJobAcceptedDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.receipts"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/receipts/exports":{"get":{"operationId":"listCampaignReceiptArchiveJobs","x-charidy-permissions":["campaigns.receipts.export"],"summary":"List receipts archive export jobs for this campaign.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"status","required":false,"in":"query","schema":{"enum":["queued","running","succeeded","failed","expired"],"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":100,"default":20,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptArchiveJobsListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.receipts"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/receipts/exports/{jobId}":{"get":{"operationId":"getCampaignReceiptArchiveJob","x-charidy-permissions":["campaigns.receipts.export"],"summary":"Read a single receipts archive export job.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"jobId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptArchiveJobResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.receipts"],"security":[{"bearer":[]}]}},"/api/v1/core/campaigns/{campaignId}/receipts/exports/{jobId}/download-url":{"get":{"operationId":"getCampaignReceiptArchiveDownloadUrl","x-charidy-permissions":["campaigns.receipts.export"],"summary":"Issue a fresh short-lived signed URL to download the archive.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"jobId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptArchiveDownloadUrlDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.campaigns.receipts"],"security":[{"bearer":[]}]}},"/api/v1/public/receipt-archives/{jobId}/file":{"get":{"operationId":"downloadReceiptArchive","summary":"Stream a finished receipts archive ZIP as an attachment (token-authorized).","description":"Serves the stored ZIP from the Givearoo origin so the browser never navigates to the raw Azure Blob host. Error codes: RECEIPT_ARCHIVE_DOWNLOAD_TOKEN_INVALID, CAMPAIGN_RECEIPT_ARCHIVE_JOB_NOT_FOUND, CAMPAIGN_RECEIPT_ARCHIVE_NOT_READY, CAMPAIGN_RECEIPT_ARCHIVE_EXPIRED, CAMPAIGN_RECEIPT_ARCHIVE_NOT_FOUND.","parameters":[{"name":"jobId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"token","required":true,"in":"query","description":"Signed archive download token.","schema":{}}],"responses":{"200":{"description":"The archive ZIP, as an attachment."}},"tags":["public.receipt-archives"]}},"/api/v1/public/links/{slug}":{"get":{"operationId":"publicResolveLink","summary":"What answers on a one-segment public address?","description":"Resolves `givearoo.com/<slug>` — the only address a campaign is handed out at since 31.8.2026. One namespace holds campaigns, organization root addresses and reserved platform words, so the answer says WHICH: `campaign` (render it), `organization` (the tenant's own root), or not found. `moved: true` means the word was resolved from release history and the caller should permanently redirect to `campaignSlug`, which is the current address.","parameters":[{"name":"slug","required":true,"in":"path","description":"The single path segment to resolve.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicRootSlugResolutionDto"}}}}},"tags":["public.campaigns"]}},"/api/v1/public/campaigns/{campaignSlug}":{"get":{"operationId":"publicGetCampaignBySlug","summary":"Public read of a single campaign by its slug alone.","description":"Same payload as publicGetCampaign, keyed on the campaign slug only — which is sufficient because the slug is unique across the platform. This is the read the donor-facing page uses; the org-scoped variant remains for links issued before 31.8.2026.","parameters":[{"name":"campaignSlug","required":true,"in":"path","description":"Platform-unique slug of the campaign.","schema":{"type":"string"}},{"name":"locale","required":false,"in":"query","description":"Visitor language for system labels and authored About translations. Missing About translations fall back to the campaign language. Does not change the campaign default.","schema":{"enum":["en","he"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCampaignResponseDto"}}}},"404":{"description":"Campaign not found."}},"tags":["public.campaigns"]}},"/api/v1/public/campaigns/{campaignSlug}/timeline":{"get":{"operationId":"publicGetCampaignTimelineBySlug","summary":"Public donation timeline for a campaign, by slug alone.","description":"Buckets succeeded contributions over time for the public progress chart. Same payload as publicGetCampaignTimeline without the organization segment.","parameters":[{"name":"campaignSlug","required":true,"in":"path","description":"Platform-unique slug of the campaign.","schema":{"type":"string"}},{"name":"bucket","required":false,"in":"query","schema":{"enum":["day","week","month"],"type":"string"}},{"name":"from","required":false,"in":"query","description":"Inclusive lower bound (ISO-8601). Defaults to the campaign start.","schema":{"format":"date-time","type":"string"}},{"name":"to","required":false,"in":"query","description":"Inclusive upper bound (ISO-8601). Defaults to now.","schema":{"format":"date-time","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCampaignTimelineResponseDto"}}}},"404":{"description":"Campaign not found."}},"tags":["public.campaigns"]}},"/api/v1/public/{orgSlug}/campaigns/{campaignSlug}":{"get":{"operationId":"publicGetCampaign","summary":"Public read of a single campaign by org + campaign slug.","description":"Returns the full public-shape campaign DTO (live layout, totals, effective status, supported currencies). Used by the donor-facing landing page and any AI agent that needs to introspect a public campaign.","parameters":[{"name":"orgSlug","required":true,"in":"path","description":"URL slug of the host organization.","schema":{"type":"string"}},{"name":"campaignSlug","required":true,"in":"path","description":"URL slug of the campaign.","schema":{"type":"string"}},{"name":"locale","required":false,"in":"query","description":"Visitor language for system labels and authored About translations. Missing About translations fall back to the campaign language. Does not change the campaign default.","schema":{"enum":["en","he"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCampaignResponseDto"}}}},"404":{"description":"Organization or campaign not found."}},"tags":["public.campaigns"]}},"/api/v1/public/{orgSlug}/campaigns/{campaignSlug}/link-resolution":{"get":{"operationId":"publicResolveCampaignLink","summary":"Resolve a campaign link that may carry a former org or campaign slug.","description":"Answers \"where does this address point now\" for a link that no longer resolves — a campaign or organization that has since been renamed. Consulted only after a normal read misses, so a slug currently in use always wins over history. Returns the current slugs plus which segment moved, so the caller can issue a permanent redirect instead of a 404.","parameters":[{"name":"orgSlug","required":true,"in":"path","description":"Organization slug from the link (may be a former one).","schema":{"type":"string"}},{"name":"campaignSlug","required":true,"in":"path","description":"Campaign slug from the link (may be a former one).","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCampaignLinkResolutionDto"}}}}},"tags":["public.campaigns"]}},"/api/v1/public/campaign-previews/{token}/donations":{"get":{"operationId":"publicListCampaignPreviewDonations","summary":"Sort and page a signed draft preview donor wall.","description":"Uses the same donor projection and sorting as the public wall. The signed token fixes the organization and campaign; it does not publish the campaign.","parameters":[{"name":"token","required":true,"in":"path","description":"Signed campaign draft preview token.","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"Max rows to return (clamped to 100).","schema":{"minimum":1,"maximum":100,"type":"number"}},{"name":"offset","required":false,"in":"query","description":"Row offset for pagination.","schema":{"minimum":0,"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Sort order. Defaults to newest.","schema":{"enum":["newest","oldest","highest","lowest"],"type":"string"}},{"name":"q","required":false,"in":"query","description":"Case-insensitive search across donor display name and contribution note.","schema":{"maxLength":80,"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicDonorWallResponseDto"}}}},"401":{"description":"Preview token is invalid or expired."},"404":{"description":"Organization or campaign not found."}},"tags":["public.campaigns"]}},"/api/v1/public/campaign-previews/{token}":{"get":{"operationId":"publicGetCampaignPreview","summary":"Public preview read of a campaign page-builder draft by signed token.","description":"Returns the public campaign DTO using campaign_design.draft_settings. The signed token is bound to organization and campaign and does not make the draft campaign shareable.","parameters":[{"name":"token","required":true,"in":"path","description":"Signed campaign draft preview token.","schema":{"type":"string"}},{"name":"locale","required":false,"in":"query","description":"Visitor language for system labels and authored About translations. Missing About translations fall back to the campaign language. Does not change the campaign default.","schema":{"enum":["en","he"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCampaignResponseDto"}}}},"401":{"description":"Preview token is invalid or expired."},"404":{"description":"Organization or campaign not found."}},"tags":["public.campaigns"]}},"/api/v1/public/{orgSlug}/campaigns/{campaignSlug}/timeline":{"get":{"operationId":"publicGetCampaignTimeline","summary":"Public time-series of succeeded contribution totals for a campaign.","description":"Returns one point per bucket (day / week / month) over the window [from, to], plus a cumulative running total. Powers the `progress_chart` page-builder block and any other curve-style fundraising visualization. The window defaults to the campaign start → now.","parameters":[{"name":"orgSlug","required":true,"in":"path","description":"URL slug of the host organization.","schema":{"type":"string"}},{"name":"campaignSlug","required":true,"in":"path","description":"URL slug of the campaign.","schema":{"type":"string"}},{"name":"bucket","required":false,"in":"query","schema":{"enum":["day","week","month"],"type":"string"}},{"name":"from","required":false,"in":"query","description":"Inclusive lower bound (ISO-8601). Defaults to the campaign start.","schema":{"format":"date-time","type":"string"}},{"name":"to","required":false,"in":"query","description":"Inclusive upper bound (ISO-8601). Defaults to now.","schema":{"format":"date-time","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCampaignTimelineResponseDto"}}}},"404":{"description":"Organization or campaign not found."}},"tags":["public.campaigns"]}},"/api/v1/public/{orgSlug}/campaigns/{campaignSlug}/donations":{"get":{"operationId":"publicListCampaignDonations","summary":"Public donor wall entries for a campaign landing page.","description":"Paginated, searchable donor wall feed. Use `q` for case-insensitive donor-name search, `sort` to switch between newest / oldest / highest / lowest, and `limit`+`offset` to page through results. The response carries `totalCount` and `hasMore` so the UI can show a \"718 donors\" header without a second round trip.","parameters":[{"name":"orgSlug","required":true,"in":"path","schema":{"type":"string"}},{"name":"campaignSlug","required":true,"in":"path","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"Max rows to return (clamped to 100).","schema":{"minimum":1,"maximum":100,"type":"number"}},{"name":"offset","required":false,"in":"query","description":"Row offset for pagination.","schema":{"minimum":0,"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Sort order. Defaults to newest.","schema":{"enum":["newest","oldest","highest","lowest"],"type":"string"}},{"name":"q","required":false,"in":"query","description":"Case-insensitive search across donor display name and contribution note.","schema":{"maxLength":80,"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicDonorWallResponseDto"}}}},"404":{"description":"Organization or campaign not found."}},"tags":["public.campaigns.landing"]}},"/api/v1/public/{orgSlug}/campaigns/{campaignSlug}/teams/{teamId}/donations":{"get":{"operationId":"publicListCampaignTeamDonations","summary":"Public donor wall entries credited to one team and its descendants.","description":"The same paginated public donor-wall rows as the campaign donations endpoint, filtered to gifts credited to this visible, approved team or a descendant. It returns display name (or Anonymous), amount, currency, date, public note, level, reactions and public team attribution only; it never returns contact ids, person ids, email addresses, phone numbers, payment metadata or receipts. The shared donor-wall projection is the single anonymity boundary.","parameters":[{"name":"orgSlug","required":true,"in":"path","schema":{"type":"string"}},{"name":"campaignSlug","required":true,"in":"path","schema":{"type":"string"}},{"name":"teamId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"limit","required":false,"in":"query","description":"Max rows to return (clamped to 100).","schema":{"minimum":1,"maximum":100,"type":"number"}},{"name":"offset","required":false,"in":"query","description":"Row offset for pagination.","schema":{"minimum":0,"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Sort order. Defaults to newest.","schema":{"enum":["newest","oldest","highest","lowest"],"type":"string"}},{"name":"q","required":false,"in":"query","description":"Case-insensitive search across donor display name and contribution note.","schema":{"maxLength":80,"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicDonorWallResponseDto"}}}},"404":{"description":"Campaign or visible approved team not found."}},"tags":["public.campaigns.landing"]}},"/api/v1/public/{orgSlug}/campaigns/{campaignSlug}/donations/{contributionId}/reactions":{"post":{"operationId":"publicCreateCampaignDonationReaction","summary":"React to a public donor wall entry.","parameters":[{"name":"orgSlug","required":true,"in":"path","schema":{"type":"string"}},{"name":"campaignSlug","required":true,"in":"path","schema":{"type":"string"}},{"name":"contributionId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for public reaction writes.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePublicDonorReactionDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicDonorReactionResponseDto"}}}},"400":{"description":"Invalid reaction payload."},"404":{"description":"Contribution was not found."}},"tags":["public.campaigns.landing"]}},"/api/v1/public/{orgSlug}/campaigns/{campaignSlug}/matchers":{"get":{"operationId":"publicListCampaignMatchers","summary":"Public list of active/scheduled matchers for a campaign landing page.","parameters":[{"name":"orgSlug","required":true,"in":"path","schema":{"type":"string"}},{"name":"campaignSlug","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCampaignMatchersListDto"}}}},"404":{"description":"Organization or campaign not found."}},"tags":["public.campaigns.landing"]}},"/api/v1/public/{orgSlug}/campaigns/{campaignSlug}/events":{"get":{"operationId":"publicStreamCampaignLandingEvents","summary":"Server-sent public campaign landing events.","parameters":[{"name":"orgSlug","required":true,"in":"path","schema":{"type":"string"}},{"name":"campaignSlug","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"text/event-stream of public-safe campaign landing notifications.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicLandingEventDto"}}}}},"tags":["public.campaigns.landing"]}},"/api/v1/public/{orgSlug}/campaigns/{campaignSlug}/streams":{"get":{"operationId":"publicListCampaignStreams","summary":"Public list of streams visible on the campaign page.","parameters":[{"name":"orgSlug","required":true,"in":"path","schema":{"type":"string"}},{"name":"campaignSlug","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCampaignStreamsListDto"}}}},"404":{"description":"Organization or campaign not found."}},"tags":["public.campaigns.streams"]}},"/api/v1/public/{orgSlug}/campaigns/{campaignSlug}/teams":{"get":{"operationId":"publicListCampaignTeams","summary":"Public list of a campaign's teams (leaderboard / picker). Always excludes hidden and non-approved nodes.","parameters":[{"name":"orgSlug","required":true,"in":"path","schema":{"type":"string"}},{"name":"campaignSlug","required":true,"in":"path","schema":{"type":"string"}},{"name":"levelId","required":false,"in":"query","description":"Only nodes on this level.","schema":{"format":"uuid","type":"string"}},{"name":"parentId","required":false,"in":"query","description":"Only direct children of this node.","schema":{"format":"uuid","type":"string"}},{"name":"search","required":false,"in":"query","schema":{"maxLength":120,"type":"string"}},{"name":"topN","required":false,"in":"query","schema":{"minimum":1,"maximum":200,"default":50,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCampaignTeamsListDto"}}}},"404":{"description":"Campaign not found."}},"tags":["public.campaigns.teams"]},"post":{"operationId":"publicCreateCampaignTeam","summary":"Public self-signup: create your own team node at the campaign's bottom level, under an existing parent. Status honours the campaign signupAutoApprove toggle and defaults to pending.","parameters":[{"name":"orgSlug","required":true,"in":"path","schema":{"type":"string"}},{"name":"campaignSlug","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCreateCampaignTeamDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCreateCampaignTeamResponseDto"}}}},"400":{"description":"Validation, captcha, or parent-selection failure."},"404":{"description":"Campaign not found."}},"tags":["public.campaigns.teams"]}},"/api/v1/public/{orgSlug}/campaigns/{campaignSlug}/team-scheme":{"get":{"operationId":"publicGetCampaignTeamScheme","summary":"The campaign's team level scheme (labels + ranks) and the donor-facing multi-team toggle.","description":"Read this BEFORE rendering a public team surface: the level labels are per-campaign words (Region / Grade / Class), so a page cannot title its leaderboard tabs without them, and `multiTeamDonationEnabled` decides whether the donation form may offer more than one team at all. Returns `levels: []` for a campaign with no level scheme, which is a valid flat configuration.","parameters":[{"name":"orgSlug","required":true,"in":"path","schema":{"type":"string"}},{"name":"campaignSlug","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCampaignTeamSchemeDto"}}}},"404":{"description":"Campaign not found."}},"tags":["public.campaigns.teams"]}},"/api/v1/public/{orgSlug}/campaigns/{campaignSlug}/teams/{teamSlug}":{"get":{"operationId":"publicGetCampaignTeam","summary":"Public team page: the node, its ancestor breadcrumb, its visible children and its donors. Works for a hidden node reached by direct link.","parameters":[{"name":"orgSlug","required":true,"in":"path","schema":{"type":"string"}},{"name":"campaignSlug","required":true,"in":"path","schema":{"type":"string"}},{"name":"teamSlug","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCampaignTeamDetailDto"}}}},"404":{"description":"Team not found, or not approved yet."}},"tags":["public.campaigns.teams"]}},"/api/v1/public/{orgSlug}/campaigns/{campaignSlug}/levels":{"get":{"operationId":"publicListCampaignLevels","summary":"Public donation level list for a campaign (locale-resolved).","parameters":[{"name":"orgSlug","required":true,"in":"path","schema":{"type":"string"}},{"name":"campaignSlug","required":true,"in":"path","schema":{"type":"string"}},{"name":"locale","required":false,"in":"query","schema":{"type":"string"}},{"name":"keyword","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicListDonationLevelsResponseDto"}}}},"404":{"description":"Organization or campaign not found."}},"tags":["public.campaigns.levels"]}},"/api/v1/organization-intelligence/scan":{"post":{"operationId":"startOrganizationIntelligenceScan","x-charidy-permissions":["organization.intelligence.run"],"summary":"Start a deep organization website intelligence scan","description":"Creates a research run and enqueues an async crawl (BullMQ). Returns 202 + runId. Poll GET runs/:runId until completed/partial/failed. Idempotent: a recent completed run for the same domain is reused unless forceRefresh=true.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Repeat keys return the same run.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartOrganizationScanDto"}}}},"responses":{"202":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartOrganizationScanResponseDto"}}}},"400":{"description":"Missing tenant context, idempotency key, or invalid/blocked URL."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["organization.intelligence"],"security":[{"bearer":[]}]}},"/api/v1/organization-intelligence/runs/{runId}":{"get":{"operationId":"getOrganizationIntelligenceRun","x-charidy-permissions":["organization.intelligence.read"],"summary":"Get the status of an organization intelligence research run","description":"Returns lifecycle + progress counters (pages discovered/scanned, findings, assets) for one run.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"runId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationResearchRunResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Run not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["organization.intelligence"],"security":[{"bearer":[]}]}},"/api/v1/organization-intelligence/profile/{organizationId}":{"get":{"operationId":"getOrganizationIntelligenceProfile","x-charidy-permissions":["organization.intelligence.read"],"summary":"Get the organization intelligence profile + confirmation payload","description":"Returns the current structured profile plus a compact \"Does this look right?\" confirmation payload (identity, story signals, logo, palette, top images, social, payment, missing info, recommended next action).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationIntelligenceProfileResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["organization.intelligence"],"security":[{"bearer":[]}]}},"/api/v1/organization-intelligence/profile/{organizationId}/confirm":{"post":{"operationId":"confirmOrganizationIntelligenceProfile","x-charidy-permissions":["organization.intelligence.manage"],"summary":"Confirm the organization intelligence profile","description":"Marks the profile as user-confirmed. Does NOT mutate any campaign data.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Repeat keys return the same run.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmOrganizationProfileResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"No profile to confirm for this organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["organization.intelligence"],"security":[{"bearer":[]}]}},"/api/v1/organization-intelligence/profile/{organizationId}/reject-finding":{"post":{"operationId":"rejectOrganizationIntelligenceFinding","x-charidy-permissions":["organization.intelligence.manage"],"summary":"Reject a single research finding","description":"Marks one finding as rejected so it is excluded from the profile and downstream recommendations.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Repeat keys return the same run.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RejectOrganizationFindingDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RejectOrganizationFindingResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Finding not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["organization.intelligence"],"security":[{"bearer":[]}]}},"/api/v1/organization-intelligence/profile/{organizationId}/persona":{"get":{"operationId":"getOrganizationPersona","x-charidy-permissions":["organization.intelligence.read"],"x-charidy-feature-flag":"organization.persona","summary":"Read the synthesized organization persona","description":"Returns the derived organization persona (archetype, voice/tone, primary audience, donor/financial/digital posture, strategic posture, provenance) that every AI surface consumes as tone/grounding guidance. Absence is not an error: hasPersona=false (200) when no persona has been synthesized yet, so an agent can decide to trigger resynthesis. The `stale` flag signals a re-synthesis is due (the profile changed since the last synthesis).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetOrganizationPersonaResponseDto"}}}},"400":{"description":"ORG_INTEL_ORG_MISMATCH — organizationId does not match the tenant context."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED — organization.persona is off for this organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["organization.intelligence"],"security":[{"bearer":[]}]}},"/api/v1/organization-intelligence/profile/{organizationId}/resynthesize-persona":{"post":{"operationId":"resynthesizeOrganizationPersona","x-charidy-permissions":["organization.intelligence.manage"],"x-charidy-feature-flag":"organization.persona","summary":"Re-synthesize the organization persona (async)","description":"Enqueues a background job that rebuilds the organization persona (archetype, voice, audience, financial/digital posture) from the latest intelligence signals. Returns 202 + a correlation runId; poll the profile once persona_synthesized fires. Heavy LLM work runs in the worker.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Repeat keys return the same run.","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResynthesizeOrganizationPersonaResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED — organization.persona is off for this organization."},"404":{"description":"No intelligence profile exists to synthesize a persona from."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["organization.intelligence"],"security":[{"bearer":[]}]}},"/api/v1/organizations":{"post":{"operationId":"createOrganization","summary":"Create a new organization and add the caller as owner","description":"Creates a `CharidyOrganization` (status `active`) and a membership row linking the authenticated user as `org_owner` in a single transaction. Used by the org-selector empty-state to bootstrap a tenant.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrganizationDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatedOrganizationResponseDto"}}}},"400":{"description":"AUTH_TERMS_NOT_ACCEPTED (caller has no acceptance of the current documents on record) / LEGAL_DOCUMENT_VERSION_UNKNOWN"},"401":{"description":"JWT access token is missing or invalid."},"409":{"description":"Organization slug already in use."}},"tags":["organizations"],"security":[{"bearer":[]}]}},"/api/v1/core/organization":{"get":{"operationId":"getOrganizationContext","summary":"Return tenant organization context for the authenticated user.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationContextResponseDto"}}}},"400":{"description":"Missing or invalid tenant header context."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"User is not an active member of this organization."},"404":{"description":"Organization not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["organizations"],"security":[{"bearer":[]}]}},"/api/v1/core/organization/feature-flags":{"get":{"operationId":"getEffectiveFeatureFlags","summary":"Resolve effective boolean feature flags for the tenant organization.","description":"Read-only resolution of org override > registered code default, for the requested keys. Exists so a dashboard can HIDE a dark feature instead of rendering a button that 403s. Unknown keys resolve to the platform fail-open default rather than erroring.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"keys","required":true,"in":"query","description":"Comma-separated flag keys (1-20), each of [a-z0-9_.].","schema":{"maxLength":1700,"example":"donation_pages.enabled","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EffectiveFeatureFlagsResponseDto"}}}},"400":{"description":"VALIDATION_FAILED — malformed or too many flag keys."},"401":{"description":"JWT access token is missing or invalid."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["organizations"],"security":[{"bearer":[]}]}},"/api/v1/core/organization/profile":{"get":{"operationId":"getOrganizationProfileSettings","summary":"Read organization identity settings (name, logo, address, contact, tax status).","description":"Returns three blocks: `editable` (client-owned), `readOnly` (platform-administered org record) and `taxStatus` (compliance verification output — סעיף 46 for IL, 501(c)(3) for US; never client-declared).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationProfileResponseDto"}}}},"400":{"description":"Missing or invalid tenant header context."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"User is not an active member of this organization."},"404":{"description":"Organization not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["organizations"],"security":[{"bearer":[]}]},"patch":{"operationId":"updateOrganizationProfileSettings","x-charidy-permissions":["settings.manage"],"summary":"Update organization identity settings (name, logo, address, contact details).","description":"Only the fields present in the body are written. An empty string clears a field. The one-line address consumed by receipts and email footers is re-derived from the structured address fields on every write.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateOrganizationProfileSettingsDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationProfileResponseDto"}}}},"400":{"description":"Validation failed, or no updatable field was supplied."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Caller lacks the settings.manage permission."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["organizations"],"security":[{"bearer":[]}]}},"/api/v1/compliance/verification":{"get":{"operationId":"getComplianceVerification","x-charidy-scope":"tenant","summary":"Read the latest nonprofit legal/KYB verification result for the org.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ComplianceVerificationDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["compliance"],"security":[{"bearer":[]}]},"post":{"operationId":"triggerComplianceVerification","x-charidy-permissions":["settings.manage"],"x-charidy-scope":"tenant","summary":"Re-run nonprofit legal/KYB verification for this organization and report changed facts.","description":"Safe to call repeatedly. Each request queries the configured external registry again, replaces the latest raw evidence snapshot, audits the write, and returns the material fields that changed since the preceding snapshot. A failed, stub, unmatched, or inconclusive re-check clears the receipt-safe verified-tax projection.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TriggerVerificationBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ComplianceVerificationDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."},"409":{"description":"COMPLIANCE_VERIFICATION_DISABLED"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["compliance"],"security":[{"bearer":[]}]}},"/api/v1/core/media/upload-session":{"post":{"operationId":"createMediaUploadSession","x-charidy-permissions":["media.assets.manage"],"summary":"Create a tenant-scoped image upload session for browser-side uploads.","description":"Use this from the dashboard / browser UI to obtain a short-lived Azure Blob PUT URL the browser uploads the file to, plus a stable Charidy `publicUrl` / `assetKey` to store in any image-capable field (hero, gallery, branding, broadcast media). NOT for ChatGPT / MCP — those clients cannot PUT to Azure Blob; use `ingestMediaAsset` to get a `publicUrl` and pass it into a `generateCampaignPage` / `refineCampaignPageDesign` instruction. Local filesystem paths are never accepted.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateMediaUploadSessionDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaUploadSessionResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.media"],"security":[{"bearer":[]}]}},"/api/v1/core/media/assets/complete":{"post":{"operationId":"completeMediaUpload","x-charidy-permissions":["media.assets.manage"],"summary":"Finalize a browser media upload and persist it in the Media OS library.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteMediaUploadDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaAssetResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.media"],"security":[{"bearer":[]}]}},"/api/v1/core/media/ingest":{"post":{"operationId":"ingestMediaAsset","x-charidy-permissions":["media.assets.manage"],"summary":"Upload / store an image into Charidy media storage from an AI / MCP client.","description":"Use this whenever an AI or MCP client (ChatGPT, Claude, agent) needs to upload, add, replace, or attach an image / photo / picture / banner / cover / hero artwork / תמונה for a campaign or the organization. Accepts EITHER `imageBase64` (raw base64 or `data:image/...;base64,...`) OR `sourceUrl` (a publicly fetchable https image URL). Returns a stable Charidy `publicUrl` plus `assetKey` you can store in any image-capable field (broadcast media, organization branding, etc.) or reference from a freeform page design. This is the MCP-safe path because the Charidy API cannot read local file paths from ChatGPT or another remote client. To use an image on the campaign page, ingest it here and then mention its `publicUrl` in a `generateCampaignPage` brief or a `refineCampaignPageDesign` instruction — the AI authors it into the page design.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestMediaAssetDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaAssetResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.media"],"security":[{"bearer":[]}]}},"/api/v1/core/media/generate":{"post":{"operationId":"generateCampaignImage","x-charidy-permissions":["media.assets.manage"],"summary":"Generate a text-free image (background / icon / pattern) for a campaign page.","description":"Use this to CREATE original imagery for a campaign page when no suitable photo exists — a styled background for a donate / monthly-giving call-to-action band, a symbolic icon for a donation-level tile, or a subtle decorative pattern. The image is ALWAYS text-free (the service forbids words/letters/numbers), because raster models render text — especially Hebrew — poorly; you overlay all labels, amounts, and titles yourself as crisp HTML/CSS on the page. The result is stored in the media library and returns a stable `publicUrl` + `assetKey`: put the `assetKey` on a donation level via `updateCampaignLevel` / `createCampaignLevel` (imageAssetKey), or reference the `publicUrl` from a `generateCampaignPage` / `refineCampaignPageDesign` instruction. Returns 409 IMAGE_GENERATION_UNAVAILABLE when AI image generation is disabled for this environment — design with CSS/SVG instead.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateCampaignImageDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeneratedImageResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.media"],"security":[{"bearer":[]}]}},"/api/v1/core/media/assets":{"get":{"operationId":"listMediaAssets","x-charidy-permissions":["media.assets.read"],"summary":"List tenant-scoped Media OS assets.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"assetType","required":false,"in":"query","schema":{"enum":["logo","hero_image","activity_image","event_image","staff_image","community_image","testimonial_image","gallery_image","video","youtube_video","reel","document","social_post","generated_image","generated_video"],"type":"string"}},{"name":"assetSource","required":false,"in":"query","schema":{"enum":["website","social","chat","upload","whatsapp","email","generated","manual"],"type":"string"}},{"name":"status","required":false,"in":"query","schema":{"enum":["pending","approved","rejected","archived"],"type":"string"}},{"name":"campaignId","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":100,"default":50,"type":"number"}},{"name":"includeDerivatives","required":false,"in":"query","schema":{"default":"false","enum":["true","false"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaAssetsListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.media"],"security":[{"bearer":[]}]}},"/api/v1/core/media/assets/{assetId}":{"get":{"operationId":"getMediaAsset","x-charidy-permissions":["media.assets.read"],"summary":"Get one tenant-scoped Media OS asset.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"assetId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaAssetResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.media"],"security":[{"bearer":[]}]},"patch":{"operationId":"updateMediaAsset","x-charidy-permissions":["media.assets.manage"],"summary":"Update approval, classification, and usage metadata for a Media OS asset.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"assetId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateMediaAssetDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaAssetResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.media"],"security":[{"bearer":[]}]},"delete":{"operationId":"archiveMediaAsset","x-charidy-permissions":["media.assets.manage"],"summary":"Archive a Media OS asset without deleting object storage bytes.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"assetId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaAssetResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.media"],"security":[{"bearer":[]}]}},"/api/v1/core/media/assets/{assetId}/analyze":{"post":{"operationId":"analyzeMediaAsset","x-charidy-permissions":["media.assets.manage"],"summary":"Queue AI analysis (caption, labels, focal point, per-surface scores) for one asset.","description":"Analysis normally runs once automatically when an asset is created. Call this to re-run it — after a bad or empty result, or for assets created while analysis was unavailable. The work is ASYNCHRONOUS: this returns the asset as it is now, so poll `analyzedAt` (or re-read the asset) rather than expecting the response to already carry the new labels.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"assetId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaAssetResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.media"],"security":[{"bearer":[]}]}},"/api/v1/core/media/assets/{assetId}/crop":{"post":{"operationId":"cropMediaAsset","x-charidy-permissions":["media.assets.manage"],"summary":"Crop an asset into a NEW asset, leaving the original untouched.","description":"Non-destructive: the source keeps its bytes and its assetKey, so anything already referencing it (a live page, a sent email) cannot break — the crop is returned as a new asset with its own assetKey. Pass EITHER `rect` (exact source pixels), `normalizedRect` (fractions of the source dimensions) OR `aspectRatio` like \"16:9\" (what an agent sends, since it cannot see the image). With `gravity: \"auto\"` the window is centred on the focal point AI analysis found, so a wide crop of a portrait does not cut off the subject; on an unanalysed asset it falls back to a centre crop. Only one axis is ever trimmed, so no resolution is invented. Output is WebP.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"assetId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CropMediaAssetDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaAssetResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.media"],"security":[{"bearer":[]}]}},"/api/v1/core/media/albums":{"get":{"operationId":"listMediaAlbums","x-charidy-permissions":["media.assets.read"],"summary":"List tenant-scoped Media OS albums.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaAlbumsListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.media"],"security":[{"bearer":[]}]},"post":{"operationId":"createMediaAlbum","x-charidy-permissions":["media.assets.manage"],"summary":"Create a Media OS album.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateMediaAlbumDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaAlbumResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.media"],"security":[{"bearer":[]}]}},"/api/v1/core/media/albums/{albumId}":{"patch":{"operationId":"updateMediaAlbum","x-charidy-permissions":["media.assets.manage"],"summary":"Update a Media OS album.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"albumId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateMediaAlbumDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaAlbumResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.media"],"security":[{"bearer":[]}]}},"/api/v1/core/media/albums/{albumId}/items":{"post":{"operationId":"addMediaAlbumItem","x-charidy-permissions":["media.assets.manage"],"summary":"Add or reorder an asset in a Media OS album.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"albumId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddMediaAlbumItemDto"}}}},"responses":{"204":{"description":"Asset is linked to the album."},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.media"],"security":[{"bearer":[]}]}},"/api/v1/core/media/albums/{albumId}/items/{assetId}":{"delete":{"operationId":"removeMediaAlbumItem","x-charidy-permissions":["media.assets.manage"],"summary":"Remove an asset from a Media OS album.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"albumId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"assetId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Asset is removed from the album."},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.media"],"security":[{"bearer":[]}]}},"/api/v1/core/media/recommendations/{campaignId}":{"get":{"operationId":"getMediaRecommendations","x-charidy-permissions":["media.assets.read"],"summary":"Recommend Media OS assets and expose completeness signals for a campaign.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":20,"default":5,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaRecommendationsResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.media"],"security":[{"bearer":[]}]}},"/api/v1/public/media":{"get":{"operationId":"getPublicMediaAsset","summary":"Stream a stored public media asset from the Givearoo origin.","description":"Returns the bytes themselves (not a redirect to storage) so Front Door can cache them. Images default to the display-sized WebP sibling when it exists; `variant=original` returns the uploaded file. Honors a single Range header so video can seek.","parameters":[{"name":"assetKey","required":true,"in":"query","schema":{"type":"string"}},{"name":"variant","required":false,"in":"query","description":"display (default) serves the page-sized WebP when one exists. original serves the uploaded file.","schema":{"enum":["display","original"],"type":"string"}}],"responses":{"200":{"description":"The media bytes, with a public Cache-Control header."}},"tags":["public.media"]}},"/api/v1/onboarding/diagnostic":{"post":{"operationId":"patchOnboardingDiagnostic","x-charidy-scope":"tenant","summary":"Upsert (partial) diagnostic answers and recompute readiness.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartialDiagnosticAnswersDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingProfileDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]},"get":{"operationId":"getOnboardingDiagnostic","x-charidy-scope":"tenant","summary":"Read the current diagnostic + readiness assessment.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingProfileDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/website-scan":{"get":{"operationId":"getOnboardingWebsiteScan","x-charidy-scope":"tenant","summary":"Read saved website intelligence without rescanning.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingWebsiteScanResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]},"post":{"operationId":"scanOnboardingWebsite","x-charidy-scope":"tenant","summary":"Scan an organization website and persist AI profile inference.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user. Informational only — the effective value is the JWT-validated identity set by `JwtAuditPopulateGuard`, not this header.","required":true,"schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingWebsiteScanBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingWebsiteScanResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/registration-number":{"post":{"operationId":"confirmOnboardingRegistrationNumber","x-charidy-scope":"tenant","summary":"Confirm or manually set the organization registration number (ע.ר. / EIN).","description":"Called after the client confirms the number detected from their website, or enters it manually when the scan found none. Persists it as a probable registry match and kicks off KYB verification in the background.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user. Informational only — the effective value is the JWT-validated identity set by `JwtAuditPopulateGuard`, not this header.","required":true,"schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingRegistrationNumberBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingRegistryEnrichmentDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/recommendation":{"get":{"operationId":"getOnboardingRecommendation","x-charidy-scope":"tenant","summary":"Return the current AI onboarding recommendation bundle.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingRecommendationDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/story-draft":{"post":{"operationId":"draftOnboardingStory","x-charidy-scope":"tenant","summary":"Draft a first-person campaign story from scan + diagnostic signals.","description":"Returns an editable campaign story draft so the user confirms/tweaks copy instead of writing from a blank box. LLM-authored when enabled; deterministic template otherwise. Always non-empty.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingStoryDraftBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingStoryDraftResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/story-improve":{"post":{"operationId":"improveOnboardingStory","x-charidy-scope":"tenant","summary":"Rewrite the campaign About text the person wrote, keeping every fact.","description":"Returns the person's own text, rewritten for clarity, structure and the chosen tone/audience, as safe HTML to put back in the editor. It never adds facts, numbers or placeholders. When the model is off, fails, or the result is not a faithful rewrite, `source` is \"unavailable\" with a `reason` and `improved` is null: the text stays as it was (nothing is invented).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingStoryImproveBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingStoryImproveResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/campaigns/draft":{"post":{"operationId":"createCampaignOnboardingDraft","summary":"Open the campaign draft for unified onboarding (continue the unfinished one by default).","description":"Continues the latest unfinished onboarding draft, which the wizard reopens preloaded with the values it already holds. Send `startNew: true` only when the person explicitly chose to start a different campaign.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user. Informational only — the effective value is the JWT-validated identity set by `JwtAuditPopulateGuard`, not this header.","required":true,"schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCampaignOnboardingDraftBodyDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCampaignOnboardingDraftResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/donation-pages/draft":{"post":{"operationId":"createDonationPageOnboardingDraft","summary":"Create (or resume) the draft for the short donation-page wizard.","description":"Opens the donation-page creation wizard: a goal-less `donation_page` draft campaign plus its journey, whose wizard state has `variant: \"donation_page\"` (steps name > banners > summary). Name includes optional description and amount cards; banners is the compact page design. The draft offers one-time and monthly giving, one-time pre-selected, until the wizard says otherwise. Resumes the organization's unfinished donation-page draft instead of opening a second one; never resumes a campaign draft. Then use getCampaignWizardState / updateCampaignWizardState / finishCampaignWizard with the returned campaign's journey. 403 FEATURE_DISABLED when donation pages or wizard v2 are off.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user. Informational only — the effective value is the JWT-validated identity set by `JwtAuditPopulateGuard`, not this header.","required":true,"schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCampaignOnboardingDraftResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/campaigns/{campaignId}/onboarding-core":{"get":{"operationId":"getCampaignOnboardingCore","summary":"Read the persisted campaign-scoped answers for unified onboarding.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignOnboardingCoreDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"CAMPAIGN_ONBOARDING_DRAFT_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]},"patch":{"operationId":"patchCampaignOnboardingCore","summary":"Persist campaign name, purpose, goal, currency, dates and cadence on its draft.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user. Informational only — the effective value is the JWT-validated identity set by `JwtAuditPopulateGuard`, not this header.","required":true,"schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatchCampaignOnboardingCoreDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignOnboardingCoreDto"}}}},"400":{"description":"Campaign core or donation window is invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"CAMPAIGN_ONBOARDING_DRAFT_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/campaigns/{campaignId}/story-profile":{"get":{"operationId":"getCampaignOnboardingStoryProfile","summary":"Read the story profile shared with the Campaign Journey Discovery Brief.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignStoryProfileResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]},"patch":{"operationId":"confirmCampaignOnboardingStoryProfile","summary":"Confirm or edit only the story facts that were extracted or explicitly supplied.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmCampaignStoryProfileBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignStoryProfileResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/campaigns/{campaignId}/story-profile/extract":{"post":{"operationId":"extractCampaignOnboardingStoryProfile","summary":"Run the one LLM story extraction for this flow and propose crowd shape from campaign math.","description":"The LLM omits unknown fields instead of fabricating them. Follow nextInstruction to confirm the profile, propose the editable generation plan, approve it, and only then generate.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractCampaignStoryProfileBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignStoryProfileResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/campaigns/{campaignId}/generation-proposal":{"get":{"operationId":"getCampaignOnboardingGenerationProposal","summary":"Read or create the editable plan that must be approved before generation.","description":"MCP sequence: extractCampaignOnboardingStoryProfile → confirmCampaignOnboardingStoryProfile → this proposal → approveCampaignOnboardingGenerationProposal → enqueueCampaignPageGeneration. Follow nextInstruction.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignGenerationProposalResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]},"patch":{"operationId":"saveCampaignOnboardingGenerationProposal","summary":"Save edits to the generation plan without approving or enqueueing it.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveCampaignGenerationProposalBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignGenerationProposalResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/campaigns/{campaignId}/generation-proposal/approve":{"post":{"operationId":"approveCampaignOnboardingGenerationProposal","summary":"Persist the final editable plan; generation remains a separate, approval-gated action.","description":"Approval does not silently generate. The response nextInstruction directs MCP callers to enqueueCampaignPageGeneration; every generation endpoint independently verifies this approval.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveCampaignGenerationProposalBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignGenerationProposalResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/campaigns/{campaignId}/approved-generation-plan":{"get":{"operationId":"getApprovedCampaignGenerationPlan","summary":"Read the approved story, tiers, boosters, goal and currency before page design.","description":"MCP agents should call this after proposal approval and design according to the returned plan. The plan is authoritative; an agent using its own model may author freely through saveCampaignDesignDraft, while generateCampaignPage invokes Givearoo’s gated server model.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovedCampaignGenerationPlanResponseDto"}}}},"400":{"description":"CAMPAIGN_PROPOSAL_APPROVAL_REQUIRED"},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/auto-create-campaign":{"post":{"operationId":"autoCreateOnboardingCampaign","x-charidy-scope":"tenant","summary":"Validate onboarding gates before auto-creating the first campaign.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Required for campaign auto-create mutation requests.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user. Informational only — the effective value is the JWT-validated identity set by `JwtAuditPopulateGuard`, not this header.","required":true,"schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoCreateCampaignBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoCreateCampaignGuardResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"409":{"description":"Idempotency-Key was reused with a different payload."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/hatrama/{campaignId}":{"get":{"operationId":"getOnboardingHatramaInvitationManager","x-charidy-scope":"tenant","summary":"Load the Hatrama invitation manager state for a campaign.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HatramaInvitationManagerDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"CAMPAIGN_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]},"post":{"operationId":"saveOnboardingHatramaInvitationManager","x-charidy-scope":"tenant","summary":"Save Hatrama event details and invitee statuses for a campaign.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for Hatrama invitation manager mutations.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user. Informational only — the effective value is the JWT-validated identity set by `JwtAuditPopulateGuard`, not this header.","required":true,"schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveHatramaInvitationManagerDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HatramaInvitationManagerDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"CAMPAIGN_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/campaigns/{campaignId}/pipeline-status":{"get":{"operationId":"getOnboardingCampaignPipelineStatus","x-charidy-scope":"tenant","summary":"Inspect the end-to-end onboarding campaign generation status.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingCampaignPipelineStatusDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"CAMPAIGN_NOT_FOUND or ONBOARDING_CAMPAIGN_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/campaigns/{campaignId}/apply-content-brief":{"post":{"operationId":"applyOnboardingContentBrief","x-charidy-scope":"tenant","summary":"Apply a confirmed content brief and (re)generate the campaign page.","description":"The strategy brain PROPOSES a content brief (on advisorNextStep); the client reviews/edits it and confirms it here. This validates the brief, merges it into the page-generation brief, resets the draft, and enqueues generation only after the shared onboarding generation proposal has also been approved. The LLM never writes — this endpoint is the app-layer write. Gated by STRATEGY_CONTENT_BRIEF_ENABLED (403 FEATURE_DISABLED when off).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for content-brief apply mutations.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user. Informational only — the effective value is the JWT-validated identity set by `JwtAuditPopulateGuard`, not this header.","required":true,"schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyContentBriefRequestDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyContentBriefResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"FEATURE_DISABLED — STRATEGY_CONTENT_BRIEF_ENABLED is off."},"404":{"description":"CAMPAIGN_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/setup-hub":{"get":{"operationId":"getOnboardingSetupHub","x-charidy-scope":"tenant","summary":"List the current setup-hub steps and per-step completion state.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetupHubDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/next-missing-fields":{"get":{"operationId":"getOnboardingNextMissingFields","x-charidy-scope":"tenant","summary":"Get the next unresolved registry fields for an organization or campaign context.","description":"Composes existing organization, intelligence, brand and onboarding stores. Intent is always returned alone when unanswered. Inferred values require confirm/decline; missing values require a real user answer.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"context","required":true,"in":"query","schema":{"enum":["org","campaign"],"type":"string"}},{"name":"intent","required":false,"in":"query","schema":{"enum":["campaign","donors","both"],"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NextMissingFieldsResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/fields/{fieldKey}/answer":{"post":{"operationId":"answerOnboardingField","x-charidy-scope":"tenant","summary":"Persist a real user answer for one registered onboarding field.","description":"Writes through the registry facade to the field's existing canonical store. Omitted/skipped answers must not call this endpoint; the field stays missing.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"fieldKey","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user. Informational only — the effective value is the JWT-validated identity set by `JwtAuditPopulateGuard`, not this header.","required":true,"schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnswerOnboardingFieldBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingFieldMutationResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/fields/{fieldKey}/confirm":{"post":{"operationId":"confirmOnboardingField","x-charidy-scope":"tenant","summary":"Confirm one value inferred from scan or external data.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"fieldKey","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user. Informational only — the effective value is the JWT-validated identity set by `JwtAuditPopulateGuard`, not this header.","required":true,"schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingFieldMutationResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/fields/{fieldKey}/decline":{"post":{"operationId":"declineOnboardingField","x-charidy-scope":"tenant","summary":"Reject one inferred value or decline the optional previous-system question.","description":"No replacement value is fabricated. Inferred fields return to missing; org.previousSystem may be explicitly declined while absent.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"fieldKey","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user. Informational only — the effective value is the JWT-validated identity set by `JwtAuditPopulateGuard`, not this header.","required":true,"schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingFieldMutationResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/setup-tasks":{"get":{"operationId":"getOnboardingSetupTasks","x-charidy-scope":"tenant","summary":"List the per-area setup tasks with derived completion state.","description":"The onboarding checklist as the dashboard shows it. Completion is DERIVED from the organization's own state (an active acquirer, contacts that exist, a published campaign) rather than from checkboxes, so `completed: true` means the system observed the thing — see each task's `completionSource`. `honestNoteKey` carries a caveat when part of what a task promises is not live yet.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"area","required":false,"in":"query","description":"Return tasks for one setup area while retaining whole-organization progress summaries.","schema":{"enum":["dashboard","contacts","donations","campaigns","comms","ambassadors"],"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetupTasksResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/setup-tasks/tour/skip":{"post":{"operationId":"skipOnboardingSetupTour","x-charidy-scope":"tenant","summary":"Save a preference not to auto-open one system-tour variant.","description":"Stores no stop index or parallel progress. The current stop remains derived from setup tasks; this only honors Esc across refreshes and devices.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user. Informational only — the effective value is the JWT-validated identity set by `JwtAuditPopulateGuard`, not this header.","required":true,"schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SkipSetupTourBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SkipSetupTourResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/setup-tasks/{taskKey}/complete":{"post":{"operationId":"completeOnboardingSetupTask","x-charidy-scope":"tenant","summary":"Mark a manual setup task complete.","description":"Only tasks the system cannot observe (e.g. sharing a campaign link) may be completed this way. An automatically-derived task returns 400 SETUP_TASK_NOT_MANUAL rather than letting the checklist claim something untrue.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"taskKey","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user. Informational only — the effective value is the JWT-validated identity set by `JwtAuditPopulateGuard`, not this header.","required":true,"schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetupTaskCompletionResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/setup-tasks/{taskKey}/dismiss":{"post":{"operationId":"dismissOnboardingSetupTask","x-charidy-scope":"tenant","summary":"Dismiss a setup task as not relevant to this organization.","description":"The \"not relevant / I am starting from scratch\" path. A dismissed task leaves the progress denominator, so an organization that legitimately skips work can still reach 100%. Tasks that define activation (taking payments, publishing) are not dismissible and return 400 SETUP_TASK_NOT_DISMISSIBLE.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"taskKey","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user. Informational only — the effective value is the JWT-validated identity set by `JwtAuditPopulateGuard`, not this header.","required":true,"schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetupTaskDismissalResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/setup-tasks/intent":{"get":{"operationId":"getOnboardingSetupIntent","x-charidy-scope":"tenant","summary":"Read what the organization said brought them to the platform.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetupIntentResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]},"post":{"operationId":"setOnboardingSetupIntent","x-charidy-scope":"tenant","summary":"Record what brought the organization here (orders the checklist only).","description":"Never blocks navigation and never hides a capability: the answer only weights the order of the global checklist. Leaving it unanswered is equivalent to \"campaign\".","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user. Informational only — the effective value is the JWT-validated identity set by `JwtAuditPopulateGuard`, not this header.","required":true,"schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetupIntentBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetupIntentResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/setup-tasks/intent/skip":{"post":{"operationId":"skipOnboardingSetupIntent","x-charidy-scope":"tenant","summary":"Persist campaign-first ordering without answering the intent question.","description":"Skip is a first-class answer: it keeps the campaign-first default and prevents the intent question from reopening on later dashboard visits.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user. Informational only — the effective value is the JWT-validated identity set by `JwtAuditPopulateGuard`, not this header.","required":true,"schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SkipSetupIntentResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/setup-hub/{stepKey}/complete":{"post":{"operationId":"completeOnboardingSetupStep","x-charidy-scope":"tenant","summary":"Mark a setup-hub step complete with an optional payload.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"stepKey","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user. Informational only — the effective value is the JWT-validated identity set by `JwtAuditPopulateGuard`, not this header.","required":true,"schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteSetupStepBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteSetupStepResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"409":{"description":"Step belongs to a track different from the org track."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/setup-hub/pre-campaign/contacts/checkpoint":{"get":{"operationId":"getPreCampaignContactsCheckpoint","x-charidy-scope":"tenant","summary":"Load saved pre-campaign contacts checkpoint for a campaign.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreCampaignContactsCheckpointResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]},"post":{"operationId":"savePreCampaignContactsCheckpoint","x-charidy-scope":"tenant","summary":"Save in-progress pre-campaign contacts checkpoint for a campaign.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user. Informational only — the effective value is the JWT-validated identity set by `JwtAuditPopulateGuard`, not this header.","required":true,"schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavePreCampaignContactsCheckpointBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreCampaignContactsCheckpointResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/wizard/checkpoint":{"get":{"operationId":"getOnboardingWizardCheckpoint","x-charidy-scope":"tenant","summary":"Load the saved campaign-wizard checkpoint (step + choices) for this org.","description":"Returns null before the first step is saved. Used to resume the wizard with content — not just the step — after an abandoned session or an emailed deep link.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WizardCheckpointResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]},"post":{"operationId":"saveOnboardingWizardCheckpoint","x-charidy-scope":"tenant","summary":"Save the campaign-wizard position and the choices made so far.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user. Informational only — the effective value is the JWT-validated identity set by `JwtAuditPopulateGuard`, not this header.","required":true,"schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveWizardCheckpointBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WizardCheckpointResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/wizard/complete":{"post":{"operationId":"completeOnboardingWizard","x-charidy-scope":"tenant","summary":"Mark the campaign wizard as completed (the page exists).","description":"Idempotent — the first timestamp wins. Called once the generated page is ready; the generation worker stamps the same column, so a customer who closed the tab mid-generation is not left mid-wizard either way.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteWizardResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/coach-tips":{"get":{"operationId":"getOnboardingCoachTips","x-charidy-scope":"tenant","summary":"Resolve contextual KB tips for a given screen.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"screen","required":true,"in":"query","schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user. Informational only — the effective value is the JWT-validated identity set by `JwtAuditPopulateGuard`, not this header.","required":true,"schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CoachTipsResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/coach-tips/{tipId}/dismiss":{"post":{"operationId":"dismissOnboardingCoachTip","summary":"Mark a coachmark tip dismissed for the current user.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"tipId","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user. Informational only — the effective value is the JWT-validated identity set by `JwtAuditPopulateGuard`, not this header.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DismissCoachTipResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/publish-gate":{"get":{"operationId":"getOnboardingPublishGate","x-charidy-scope":"tenant","summary":"Inspect the first-campaign publish-gate state.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishGateStateDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"ONBOARDING_PROFILE_MISSING"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/publish-gate/override":{"post":{"operationId":"overrideOnboardingPublishGate","x-charidy-scope":"tenant","summary":"Force-unlock the publish gate (yellow tier only). Audited.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user. Informational only — the effective value is the JWT-validated identity set by `JwtAuditPopulateGuard`, not this header.","required":true,"schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishGateOverrideBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishGateOverrideResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"409":{"description":"Override unavailable — readiness tier is not yellow."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-coach"],"security":[{"bearer":[]}]}},"/api/v1/admin/onboarding/journey/sliders":{"get":{"operationId":"getAdminOnboardingJourneySliderSettings","x-charidy-permissions":["onboarding.journey.manage"],"summary":"List global onboarding journey slider settings.","deprecated":true,"description":"Deprecated (CHAR-68): the quest questionnaire these bounds applied to is no longer part of the live onboarding flow, so changing them has no user-visible effect.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminJourneySliderSettingsResponseDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin-onboarding"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/onboarding/journey/sliders/{questId}":{"patch":{"operationId":"updateAdminOnboardingJourneySliderSetting","x-charidy-permissions":["onboarding.journey.manage"],"summary":"Update global onboarding journey slider bounds and default value.","deprecated":true,"description":"Deprecated (CHAR-68): writes settings that the live onboarding wizard never reads.","parameters":[{"name":"questId","required":true,"in":"path","schema":{"enum":["inner_circle_size","weekly_hours","let_us_show_what_is_achievable"],"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAdminJourneySliderSettingDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminJourneySliderSettingDto"}}}},"400":{"description":"ONBOARDING_SLIDER_BOUNDS_INVALID"},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"ONBOARDING_QUEST_NOT_FOUND"}},"tags":["admin-onboarding"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/onboarding/{orgId}/internal-summary":{"get":{"operationId":"getAdminOnboardingInternalSummary","summary":"Read the internal onboarding readiness summary for Charidy staff.","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReadinessSummaryDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"404":{"description":"RESOURCE_NOT_FOUND"}},"tags":["admin-onboarding"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/onboarding/{orgId}/intake-decision":{"get":{"operationId":"getAdminOnboardingIntakeDecision","summary":"Read website-first intake decision snapshot for internal routing.","parameters":[{"name":"orgId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntakeDecisionSummaryDto"}}}},"400":{"description":"INTAKE_DECISION_NOT_READY"},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"404":{"description":"RESOURCE_NOT_FOUND"}},"tags":["admin-onboarding"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/onboarding/donation-suggestions":{"post":{"operationId":"suggestOnboardingDonationButtons","x-charidy-feature-flag":"onboarding.wizard_v2.enabled","x-charidy-permissions":["onboarding.access"],"summary":"Suggest editable donation amounts and story-grounded titles.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-organization-id","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DonationSuggestionInputDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DonationSuggestionsResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding"]}},"/api/v1/strategy-engine/advisor-next-step":{"post":{"operationId":"advisorNextStep","summary":"Return the single next best action the advisor should drive right now.","description":"Assembles the current organization/campaign strategic state, runs rule-based readiness scoring, resolves exactly one next best action, and persists the decision (with transcript) for the learning loop. Call this after any state change to stay proactive.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorNextStepRequestDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorNextStepResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"404":{"description":"STRATEGY_ORGANIZATION_NOT_FOUND / STRATEGY_CAMPAIGN_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["strategy-engine"],"security":[{"bearer":[]}]}},"/api/v1/strategy-engine/readiness-diagnostic":{"post":{"operationId":"runReadinessDiagnostic","summary":"Run the rule-based readiness diagnostic and snapshot the result.","description":"Computes the campaign readiness score (overall + component scores, blockers, warnings) from the existing onboarding diagnostic answers, persists a snapshot, and records the diagnostic decision. Returns null readiness when the diagnostic answers are not complete enough to score.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunReadinessDiagnosticRequestDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunReadinessDiagnosticResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"404":{"description":"STRATEGY_ORGANIZATION_NOT_FOUND / STRATEGY_CAMPAIGN_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["strategy-engine"],"security":[{"bearer":[]}]}},"/api/v1/strategy-engine/organization-state":{"get":{"operationId":"getOrganizationState","summary":"Read the assembled organization strategic state.","description":"Returns the read-model the strategy engine consumes: profile completeness, diagnostic completeness, relationship-capital counts, and campaign summary — assembled from the existing org / onboarding / contacts tables.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationStrategicStateDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"404":{"description":"STRATEGY_ORGANIZATION_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["strategy-engine"],"security":[{"bearer":[]}]}},"/api/v1/strategy-engine/campaign-state":{"get":{"operationId":"getCampaignState","summary":"Read the assembled campaign strategic state.","description":"Returns the campaign read-model: goal, status, derived story signals, and ambassador / major-donor candidate counts (from campaign_contact_profiles).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"query","description":"Campaign UUID.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignStrategicStateDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"404":{"description":"STRATEGY_CAMPAIGN_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["strategy-engine"],"security":[{"bearer":[]}]}},"/api/v1/strategy-engine/decisions/{decisionId}/accept":{"post":{"operationId":"recordUserAcceptedDecision","summary":"Mark a strategy decision as accepted by the user.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"decisionId","required":true,"in":"path","description":"Strategy decision UUID.","schema":{"type":"string"}}],"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StrategicDecisionDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"404":{"description":"STRATEGY_DECISION_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["strategy-engine"],"security":[{"bearer":[]}]}},"/api/v1/strategy-engine/decisions/{decisionId}/reject":{"post":{"operationId":"recordUserRejectedDecision","summary":"Mark a strategy decision as rejected by the user, with an optional reason.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"decisionId","required":true,"in":"path","description":"Strategy decision UUID.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RejectDecisionRequestDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StrategicDecisionDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"404":{"description":"STRATEGY_DECISION_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["strategy-engine"],"security":[{"bearer":[]}]}},"/api/v1/strategy-engine/decisions/{decisionId}/implemented":{"post":{"operationId":"recordDecisionImplemented","summary":"Mark a strategy decision as implemented by the user.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"decisionId","required":true,"in":"path","description":"Strategy decision UUID.","schema":{"type":"string"}}],"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StrategicDecisionDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"404":{"description":"STRATEGY_DECISION_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["strategy-engine"],"security":[{"bearer":[]}]}},"/api/v1/strategy-engine/campaigns/{campaignId}/outcome":{"post":{"operationId":"recordCampaignOutcome","summary":"Record end-of-campaign results and link them to prior decisions.","description":"Stores a campaign_outcomes row (learning-loop input) and links it to every strategy decision recorded for the campaign so future analysis can evaluate decision quality. Phase 5 will add the AI evaluation on top of these links.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","description":"Campaign UUID.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordCampaignOutcomeRequestDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordCampaignOutcomeResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"404":{"description":"STRATEGY_CAMPAIGN_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["strategy-engine"],"security":[{"bearer":[]}]}},"/api/v1/admin/advisor-brain/documents":{"get":{"operationId":"listAdvisorKnowledgeDocuments","x-charidy-permissions":["organizations.read_all"],"summary":"List advisor brain knowledge documents (optionally filtered by status/category).","parameters":[{"name":"status","required":false,"in":"query","schema":{"enum":["draft","published","archived"],"type":"string"}},{"name":"category","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorKnowledgeDocumentListDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]},"post":{"operationId":"createAdvisorKnowledgeDocument","x-charidy-permissions":["organizations.feature_flags.manage"],"summary":"Create a new draft advisor brain knowledge document.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAdvisorKnowledgeDocumentDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorKnowledgeDocumentDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."},"409":{"description":"A document with that slug already exists."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/documents/{id}":{"get":{"operationId":"getAdvisorKnowledgeDocument","x-charidy-permissions":["organizations.read_all"],"summary":"Get a single advisor brain knowledge document.","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorKnowledgeDocumentDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Document not found."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]},"patch":{"operationId":"updateAdvisorKnowledgeDocument","x-charidy-permissions":["organizations.feature_flags.manage"],"summary":"Update an advisor brain knowledge document (re-chunks if a published body changes).","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAdvisorKnowledgeDocumentDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorKnowledgeDocumentDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Document not found."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/documents/upload":{"post":{"operationId":"uploadAdvisorKnowledgeDocument","x-charidy-permissions":["organizations.feature_flags.manage"],"summary":"Upload a file (PDF/DOCX/HTML/TXT/MD) into the advisor brain as a knowledge document.","description":"Decodes the base64 payload, stores the original in the imports container for provenance, extracts text, creates a draft document, and (by default) publishes it so it chunks and queues embedding.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadAdvisorKnowledgeDocumentDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorKnowledgeDocumentDto"}}}},"400":{"description":"Unsupported/oversized file or no extractable text."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/documents/{id}/publish":{"post":{"operationId":"publishAdvisorKnowledgeDocument","x-charidy-destructive":true,"x-charidy-permissions":["organizations.feature_flags.manage"],"summary":"Publish a document so the advisor grounds on it; re-chunks and queues embedding.","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorKnowledgeDocumentDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Document not found."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/documents/{id}/archive":{"post":{"operationId":"archiveAdvisorKnowledgeDocument","x-charidy-destructive":true,"x-charidy-permissions":["organizations.feature_flags.manage"],"summary":"Archive a document so it no longer grounds the advisor; drops its chunks.","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorKnowledgeDocumentDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Document not found."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/proactivity-rules":{"get":{"operationId":"listAdvisorProactivityRules","x-charidy-permissions":["organizations.read_all"],"summary":"List per-stage advisor proactivity rules (suggested actions emitted at session start).","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorProactivityRuleListDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/proactivity-rules/{stage}":{"put":{"operationId":"upsertAdvisorProactivityRule","x-charidy-permissions":["organizations.feature_flags.manage"],"summary":"Create or update the proactivity rule for an advisor stage.","parameters":[{"name":"stage","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertAdvisorProactivityRuleDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorProactivityRuleDto"}}}},"400":{"description":"Invalid stage."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/retrieval-test":{"post":{"operationId":"testAdvisorBrainRetrieval","x-charidy-permissions":["organizations.read_all"],"summary":"Preview what the brain would retrieve for a given advisor stage / next-action.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorBrainRetrievalTestDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorBrainRetrievalResultDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/chat":{"post":{"operationId":"chatAdvisorBrain","x-charidy-permissions":["organizations.read_all"],"summary":"Ask the advisor brain a question; returns a grounded answer with cited snippets.","description":"Retrieves the most relevant published knowledge (vector RAG when embeddings are on, else keyword overlap) and asks the LLM to answer using only those snippets. Returns a clear notice when the LLM is not configured.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorBrainChatRequestDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorBrainChatResultDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/health":{"get":{"operationId":"getAdvisorBrainHealth","x-charidy-permissions":["organizations.read_all"],"summary":"Advisor brain health: document/chunk/embedding counts and retrieval configuration.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorBrainHealthDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/insights":{"get":{"operationId":"getAdvisorBrainInsights","x-charidy-permissions":["organizations.read_all"],"summary":"Campaign-success analytics: which advisor next-actions correlate with reaching goal.","description":"Platform-wide (cross-org) aggregation over strategy_decisions, decision_outcome_links and campaign_outcomes. Read-only.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorBrainInsightsDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/decisions":{"get":{"operationId":"listAdvisorDecisions","x-charidy-permissions":["organizations.read_all"],"summary":"List recorded advisor strategy decisions (the brain conclusions), cross-org.","description":"Platform-wide (cross-org) browse over strategy_decisions. Read-only — acting on a decision (accept/reject/implement) stays on the tenant strategy-engine endpoints.","parameters":[{"name":"organizationId","required":false,"in":"query","schema":{"type":"string"}},{"name":"campaignId","required":false,"in":"query","schema":{"type":"string"}},{"name":"actionKey","required":false,"in":"query","schema":{"type":"string"}},{"name":"userResponse","required":false,"in":"query","schema":{"enum":["pending","accepted","rejected","ignored","implemented"],"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"integer"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorDecisionListDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/decisions/{id}":{"get":{"operationId":"getAdvisorDecision","x-charidy-permissions":["organizations.read_all"],"summary":"Get one advisor decision with its rationale, full payload, knowledge refs, outcomes.","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorDecisionDetailDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Decision not found."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/self-improvement/run":{"post":{"operationId":"generateAdvisorImprovementProposal","x-charidy-permissions":["organizations.feature_flags.manage"],"summary":"Draft a self-improvement knowledge proposal from outcome analytics (human-approved).","description":"Deterministically summarises which methods correlate with met-goal campaigns into a DRAFT knowledge document (source=self_improvement). Nothing is auto-adopted — a super-admin must publish it.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorKnowledgeDocumentDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/reembed":{"post":{"operationId":"reembedAdvisorBrain","x-charidy-permissions":["organizations.feature_flags.manage"],"summary":"Re-embed all published knowledge (after an embedding model/dimension change).","description":"Clears stored vectors of every published document and re-enqueues embedding jobs so the worker refills them with the current model. Keyword/FTS retrieval keeps working throughout.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReembedResultDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/documents/{id}/versions":{"get":{"operationId":"listAdvisorKnowledgeDocumentVersions","x-charidy-permissions":["organizations.read_all"],"summary":"List the published version history of a knowledge document (for diff / rollback).","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorKnowledgeDocumentVersionListDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Document not found."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/documents/{id}/versions/{version}/rollback":{"post":{"operationId":"rollbackAdvisorKnowledgeDocument","x-charidy-destructive":true,"x-charidy-permissions":["organizations.feature_flags.manage"],"summary":"Restore a document to a prior version and re-publish it (snapshots a new version).","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"version","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorKnowledgeDocumentDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Document or version not found."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/teach/sessions":{"get":{"operationId":"listAdvisorTeachSessions","x-charidy-permissions":["organizations.read_all"],"summary":"List advisor brain teaching sessions.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorTeachSessionListDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]},"post":{"operationId":"createAdvisorTeachSession","x-charidy-permissions":["organizations.feature_flags.manage"],"summary":"Start a new advisor brain teaching session.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAdvisorTeachSessionDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorTeachSessionDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/teach/sessions/{id}":{"get":{"operationId":"getAdvisorTeachSession","x-charidy-permissions":["organizations.read_all"],"summary":"Get a teaching session with its full message history.","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorTeachSessionDetailDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Session not found."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/teach/sessions/{id}/attachments":{"post":{"operationId":"uploadAdvisorTeachAttachment","x-charidy-permissions":["organizations.feature_flags.manage"],"summary":"Attach a file to a teaching conversation without publishing it to the live brain.","description":"Extracts PDF, DOCX, HTML, TXT, or Markdown text, stores the original for provenance, and keeps the extracted content as private context for this teaching session.","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadAdvisorTeachAttachmentDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorTeachAttachmentDto"}}}},"400":{"description":"Unsupported, oversized, invalid, or empty file."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Session not found."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/teach/sessions/{id}/finalize":{"post":{"operationId":"finalizeAdvisorTeachSession","x-charidy-permissions":["organizations.feature_flags.manage"],"summary":"Organize a teaching conversation and its files into one reviewable draft.","description":"Synthesizes the conversation and attachments into a DRAFT knowledge document. It never publishes automatically; the operator must explicitly publish the returned proposal.","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorTeachFinalizeResultDto"}}}},"400":{"description":"The teaching session has no messages or attachments."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Session not found."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/teach/sessions/{id}/archive":{"post":{"operationId":"archiveAdvisorTeachSession","x-charidy-permissions":["organizations.feature_flags.manage"],"summary":"Archive a teaching session.","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorTeachSessionDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Session not found."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/teach/sessions/{id}/messages":{"post":{"operationId":"sendAdvisorTeachMessage","x-charidy-permissions":["organizations.feature_flags.manage"],"summary":"Teach the advisor brain a turn; curates it into a reviewable DRAFT (never auto-published).","description":"Records the operator turn, uses the LLM to curate it into a draft knowledge document (source=conversation, created or merged into the running draft), writes a best-effort recall memory, and returns the advisor reply plus the proposal.","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorTeachMessageRequestDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorTeachTurnResultDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Session not found."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/memory":{"get":{"operationId":"listAdvisorMemoryBlocks","x-charidy-permissions":["organizations.read_all"],"summary":"List advisor brain memory blocks (core / archival / recall).","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorMemoryBlockListDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]},"post":{"operationId":"createAdvisorMemoryBlock","x-charidy-permissions":["organizations.feature_flags.manage"],"summary":"Create an advisor brain memory block.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertAdvisorMemoryBlockDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorMemoryBlockDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/memory/{id}/delete":{"post":{"operationId":"deleteAdvisorMemoryBlock","x-charidy-permissions":["organizations.feature_flags.manage"],"summary":"Delete an advisor brain memory block.","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"Deleted."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Memory block not found."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/graph/stats":{"get":{"operationId":"getAdvisorGraphStats","x-charidy-permissions":["organizations.read_all"],"summary":"GraphRAG stats: entity / edge / community counts and whether expansion is enabled.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorGraphStatsDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/admin/advisor-brain/graph/rebuild":{"post":{"operationId":"rebuildAdvisorGraph","x-charidy-permissions":["organizations.feature_flags.manage"],"summary":"Rebuild the knowledge graph from published documents (entities, edges, communities).","description":"Extracts entities/relationships from every published document via the LLM and recomputes community summaries. Best-effort; requires the reasoning LLM to be configured.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvisorGraphStatsDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin"],"security":[{"bearer":[]},{"bearer":[]}]}},"/api/v1/core/design/brand":{"get":{"operationId":"getOrganizationBrandSettings","x-charidy-permissions":["communications.read"],"summary":"Get the organization's email/brand design language.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrandSettingsResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.design"],"security":[{"bearer":[]}]},"put":{"operationId":"updateOrganizationBrandSettings","x-charidy-permissions":["communications.manage"],"summary":"Update the organization's email/brand design language (logo, colours, font).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBrandSettingsDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrandSettingsResponseDto"}}}},"400":{"description":"Validation failed (e.g. invalid hex colour)."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.design"],"security":[{"bearer":[]}]}},"/api/v1/advisor-orchestrator/next-step":{"post":{"operationId":"advisorOrchestrateNextStep","x-charidy-permissions":["campaigns.design.manage"],"x-charidy-feature-flag":"advisor.orchestrator","summary":"Run the advisor brain and, on confirmation, produce the content it recommends.","description":"Runs the strategy brain to pick the single next action. If that action is a content capability (build the campaign page / messaging pack / ambassador pack), returns mode=\"propose\" and asks the user to confirm — it generates nothing until you call again with `confirm`. On confirmation it invokes the matching generator, records the outcome for the learning loop, and returns the draft plus the next step. Non-content actions return mode=\"recommend\", identical to advisorNextStep. `build_campaign_page` additionally requires the shared campaign generation proposal to have been approved through the dedicated proposal endpoint; a generic journey artifact cannot supply approval.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Client-supplied idempotency key for this orchestration turn.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrchestrateNextStepRequestDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrchestrateNextStepResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"FEATURE_DISABLED — feature is disabled for this organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["advisor-orchestrator"],"security":[{"bearer":[]}]}},"/api/v1/agent/tools":{"get":{"operationId":"listAgentTools","x-charidy-scope":"anonymous","summary":"List MCP tool descriptors the AI agent is allowed to invoke.","description":"Returns the runtime tool catalog the global AI agent (and any human introspection UI) should use to discover Charidy OS capabilities. Tools marked `humanOnly: true` (webhooks, raw provider intake) and super-admin tools are filtered out. The shape mirrors `@charidy/shared` `GeneratedMcpToolDescriptor` so the same list can be fed directly into LangChain / Vercel AI SDK / OpenAI function-calling without further transformation.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentToolCatalogResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/agent/tools/{operationId}/dispatch":{"post":{"operationId":"dispatchAgentTool","x-charidy-scope":"anonymous","summary":"Dispatch a single MCP tool operation through the centralized agent execution plane.","description":"Validates policy/tenant constraints, applies quotas and sanitization, and forwards the invocation to the target API operation.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"operationId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentDispatchRequestDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentDispatchResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/agent/runs":{"post":{"operationId":"createAgentRun","summary":"Create a durable agent run and enqueue background execution.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAgentRunRequestDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAgentRunResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/agent/runs/{runId}":{"get":{"operationId":"getAgentRun","summary":"Get active agent run state and audit context.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"runId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRunRecordDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/agent/runs/{runId}/approve":{"post":{"operationId":"approveAgentRun","summary":"Submit a human-in-the-loop decision for an active run.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"runId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRunApprovalDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRunRecordDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/agent/runs/{runId}/cancel":{"post":{"operationId":"cancelAgentRun","summary":"Cancel an in-flight run.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"runId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRunRecordDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/agent/runs/{runId}/feedback":{"post":{"operationId":"recordAgentRunFeedback","summary":"Record recommendation quality feedback for RAG tuning.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"runId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRunFeedbackDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRunRecordDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/agent/onboarding/url":{"post":{"operationId":"createAgentOnboardingFromUrl","summary":"Analyze an organization URL and generate a page-builder landing layout preview.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentUrlOnboardingRequestDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentUrlOnboardingResponseDto"}}}},"400":{"description":"WEBSITE_LANDING_PROFILE_FAILED — URL scan failed or confidence was too low."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/agent/knowledge/ingest":{"post":{"operationId":"ingestAgentKnowledge","summary":"Ingest fresh knowledge documents into tenant-scoped RAG memory.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentKnowledgeIngestRequestDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"ingested":{"type":"boolean"},"entryId":{"type":"string"},"aiAssisted":{"type":"boolean"},"aiGenerationVersion":{"type":"string"}},"required":["ingested","entryId","aiAssisted","aiGenerationVersion"]}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/agent/rag/retrieve":{"post":{"operationId":"retrieveAgentRagContext","summary":"Retrieve tenant-scoped RAG context with recency-aware ranking.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRagRetrieveRequestDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","additionalProperties":true}},"query":{"type":"string"},"aiAssisted":{"type":"boolean"},"aiGenerationVersion":{"type":"string"}},"required":["items","query","aiAssisted","aiGenerationVersion"]}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/agent/compliance/purge":{"post":{"operationId":"purgeAgentComplianceData","summary":"Purge memory/vector context for GDPR and tenant deletion sync.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentCompliancePurgeRequestDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"purged":{"type":"boolean"},"receipts":{"type":"array","items":{"type":"string"}}},"required":["purged","receipts"]}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/agent/traces":{"get":{"operationId":"listAgentTraces","summary":"List LLM tracing records for observability and debugging.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"traces":{"type":"array","items":{"type":"object","additionalProperties":true}},"totalCount":{"type":"number"}},"required":["traces","totalCount"]}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/agent/telemetry/batch":{"post":{"operationId":"recordAgentTelemetryBatch","summary":"Record a batch of agent observability events / errors / session lifecycle markers.","description":"Single batched write path used by the web `useTelemetry` hook. The shared @charidy/shared/observability redactor runs server-side on every payload (4 KiB cap, secret-key allow-list, free-text email/phone/IBAN heuristics). Failures inside the observability pipeline never bubble back to the caller — partial batches are accepted; the response surfaces accepted counts.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentTelemetryBatchDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentTelemetryBatchResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/admin/agent-activity/overview":{"get":{"operationId":"getAgentAnalysisOverview","x-charidy-permissions":["organizations.read_all"],"summary":"KPIs for the /admin/agent-activity Overview tab.","description":"Returns counts (sessions, events, errors), error rate %, top tools, top blocks added, the page-builder funnel, and the top recurring error groups for the requested organization over the supplied window (1–90 days, default 7).","parameters":[{"name":"organizationId","required":true,"in":"query","schema":{"type":"string"}},{"name":"windowDays","required":false,"in":"query","schema":{"type":"integer"}},{"name":"channel","required":false,"in":"query","schema":{"enum":["web","mcp"],"type":"string"}}],"responses":{"200":{"description":"AgentAnalysisOverview as documented in agent-analysis.service.ts."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/admin/agent-activity/events":{"get":{"operationId":"listAgentAnalysisEvents","x-charidy-permissions":["organizations.read_all"],"summary":"Paginated raw event feed for the /admin/agent-activity log, filterable by channel.","description":"Returns the most recent agent_events for the org (events-only, no message bodies), filterable by channel (web vs mcp) and eventName. Surfaces session-less MCP tool-call events that the Sessions tab does not show.","parameters":[{"name":"organizationId","required":true,"in":"query","schema":{"type":"string"}},{"name":"channel","required":false,"in":"query","schema":{"enum":["web","mcp"],"type":"string"}},{"name":"eventName","required":false,"in":"query","schema":{"type":"string"}},{"name":"windowDays","required":false,"in":"query","schema":{"type":"integer"}},{"name":"limit","required":false,"in":"query","schema":{"type":"integer"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"AgentAnalysisEventItem[] + nextCursor (null when no more pages)."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/admin/agent-activity/sessions":{"get":{"operationId":"listAgentAnalysisSessions","x-charidy-permissions":["organizations.read_all"],"summary":"Paginated session list for the /admin/agent-activity Sessions tab.","parameters":[{"name":"organizationId","required":true,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"integer"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"surface","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"AgentAnalysisSessionListItem[] + nextCursor (null when no more pages)."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/admin/agent-activity/sessions/{sessionId}":{"get":{"operationId":"getAgentAnalysisSession","x-charidy-permissions":["organizations.read_all"],"summary":"Full event timeline for a single session (events-only, no message bodies).","parameters":[{"name":"organizationId","required":true,"in":"query","schema":{"type":"string"}},{"name":"sessionId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"AgentAnalysisSessionDetail with up to 500 ordered events."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/admin/agent-activity/errors":{"get":{"operationId":"listAgentAnalysisErrors","x-charidy-permissions":["organizations.read_all"],"summary":"Recurring error groups for the /admin/agent-activity Errors tab.","parameters":[{"name":"organizationId","required":true,"in":"query","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"integer"}},{"name":"sortBy","required":false,"in":"query","schema":{"enum":["lastSeenAt","occurrenceCount"],"type":"string"}}],"responses":{"200":{"description":"AgentAnalysisErrorGroup[]"},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/admin/agent-activity/alerts":{"get":{"operationId":"listAgentAlerts","x-charidy-permissions":["organizations.read_all"],"summary":"List anomaly alerts, classified system_error vs user_friction.","description":"Returns deduplicated alerts detected over the agent observability stream. system_error alerts are routed into the Marker/Linear debug loop (route=linear); user_friction alerts are usability signals.","parameters":[{"name":"status","required":false,"in":"query","schema":{"enum":["open","acknowledged","resolved"],"type":"string"}},{"name":"classification","required":false,"in":"query","schema":{"enum":["system_error","user_friction"],"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"AgentAlertItem[]"},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/admin/agent-activity/alerts/scan":{"post":{"operationId":"scanAgentAlerts","x-charidy-permissions":["organizations.read_all"],"summary":"Run the anomaly detector now and upsert alerts.","parameters":[],"responses":{"200":{"description":"AgentAlertScanResult"},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/admin/agent-activity/alerts/{id}/status":{"post":{"operationId":"updateAgentAlertStatus","x-charidy-permissions":["organizations.read_all"],"summary":"Acknowledge or resolve an alert.","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"status","required":true,"in":"query","schema":{"enum":["open","acknowledged","resolved"],"type":"string"}}],"responses":{"200":{"description":"Updated AgentAlertItem"},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/agent/chat/sessions":{"get":{"operationId":"listAgentChatSessions","summary":"List recent assistant chat sessions for the current user.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":50,"default":30,"type":"number"}},{"name":"status","required":false,"in":"query","description":"When omitted, returns active sessions only.","schema":{"enum":["active","archived"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentChatSessionListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["agent"],"security":[{"bearer":[]}]},"post":{"operationId":"createAgentChatSession","summary":"Create a new assistant chat session for the current user.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAgentChatSessionDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentChatSessionDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/agent/chat/sessions/{sessionId}":{"get":{"operationId":"getAgentChatSession","summary":"Load an assistant chat session and its messages (resume).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"sessionId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentChatSessionDetailDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"404":{"description":"Session not found for this user."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["agent"],"security":[{"bearer":[]}]},"patch":{"operationId":"updateAgentChatSession","summary":"Rename or archive an assistant chat session.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"sessionId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAgentChatSessionDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentChatSessionDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"404":{"description":"Session not found for this user."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/agent/chat/sessions/{sessionId}/messages":{"post":{"operationId":"appendAgentChatMessages","summary":"Append or upsert chat messages after a completed assistant turn.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"sessionId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppendAgentChatMessagesDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppendAgentChatMessagesResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"404":{"description":"Session not found for this user."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/core/automations/catalog":{"get":{"operationId":"getAutomationCatalog","x-charidy-permissions":["automations.read"],"summary":"Get the generic automation entity catalog for this organization.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"locale","required":false,"in":"query","schema":{"default":"en","enum":["en","he"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationCatalogResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automation-settings":{"get":{"operationId":"getAutomationSettings","x-charidy-permissions":["automations.read"],"summary":"Read when automations may send email and the explicit calendar packs used for campaign scheduling advice. Suggestions are never enabled automatically.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationSettingsResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]},"put":{"operationId":"updateAutomationSettings","x-charidy-permissions":["automations.manage"],"x-charidy-destructive":true,"summary":"Set the organization activity window / calendar packs and the marketing frequency cap. Selected calendar packs also drive campaign scheduling advice; no calendar is inferred from locale or country.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAutomationSettingsDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationSettingsResponseDto"}}}},"400":{"description":"AUTOMATION_SETTINGS_INVALID with the list of problems."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automation-calendar-packs":{"get":{"operationId":"listCalendarPacks","x-charidy-permissions":["automations.read"],"summary":"List the calendar packs an activity window can block (Jewish holidays, Shabbat, US federal holidays) with their options, plus the packs suggested for this organization. Suggestions are never enabled automatically.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarPacksResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/calendar-preferences":{"get":{"operationId":"getCalendarPreferences","x-charidy-permissions":["automations.read"],"summary":"Read this organization’s explicitly selected calendar packs for campaign scheduling advice.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarPreferencesDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.calendar-preferences"],"security":[{"bearer":[]}]},"put":{"operationId":"updateCalendarPreferences","x-charidy-permissions":["automations.manage"],"summary":"Replace the organization’s explicitly selected calendar packs. No religion or calendar is inferred from language or country.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCalendarPreferencesDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarPreferencesDto"}}}},"400":{"description":"CALENDAR_PREFERENCES_INVALID"},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.calendar-preferences"],"security":[{"bearer":[]}]}},"/api/v1/core/calendar-preferences/preview":{"post":{"operationId":"previewCalendarPreferences","x-charidy-permissions":["automations.read"],"summary":"Preview advisory occurrences for an unsaved explicit calendar-pack selection.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreviewCalendarPreferencesDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.calendar-preferences"],"security":[{"bearer":[]}]}},"/api/v1/core/automations":{"get":{"operationId":"listAutomations","x-charidy-permissions":["automations.read"],"summary":"List automations (the generic engine), including the seeded defaults.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"status","required":false,"in":"query","schema":{"enum":["draft","active","paused","archived"],"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":100,"default":50,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationsListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]},"post":{"operationId":"createAutomation","x-charidy-permissions":["automations.manage"],"summary":"Create an automation as a draft (version 1). It does nothing until activated by a human.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAutomationDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationResponseDto"}}}},"400":{"description":"AUTOMATION_DEFINITION_INVALID with the list of problems."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automations/shadow-comparison":{"get":{"operationId":"compareShadowAutomations","x-charidy-permissions":["automations.read"],"summary":"Compare what the legacy rule engine did against what the shadow-mode default automations would have done.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"from","required":false,"in":"query","description":"ISO timestamp, default 24 hours ago.","schema":{"type":"string"}},{"name":"to","required":false,"in":"query","description":"ISO timestamp, default now.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShadowComparisonResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automations/{automationId}":{"get":{"operationId":"getAutomation","x-charidy-permissions":["automations.read"],"summary":"Read one automation with its current definition.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"automationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Automation not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]},"put":{"operationId":"updateAutomation","x-charidy-permissions":["automations.manage"],"summary":"Rename an automation and/or save a new definition as a new version (running enrollments keep their version).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"automationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAutomationDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automations/{automationId}/archive":{"post":{"operationId":"archiveAutomation","x-charidy-permissions":["automations.manage"],"x-charidy-destructive":true,"summary":"Archive an automation (stops it matching new events).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"automationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automations/{automationId}/activate":{"post":{"operationId":"activateAutomation","x-charidy-permissions":["automations.manage"],"x-charidy-destructive":true,"summary":"Turn an automation on so it runs for real people. A human approval gate: agents must get the user's approval first.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"automationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automations/{automationId}/pause":{"post":{"operationId":"pauseAutomation","x-charidy-permissions":["automations.manage"],"summary":"Pause an active automation (stops it matching new events; running enrollments continue).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"automationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automations/{automationId}/scan":{"post":{"operationId":"requestAutomationScan","x-charidy-permissions":["automations.manage"],"x-charidy-destructive":true,"summary":"Ask for an on-demand evaluation of a segment_membership automation now instead of at 02:00. People who entered or left the segment since the last evaluation are enrolled, so it is a human approval gate for agents.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"automationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestAutomationScanResponseDto"}}}},"400":{"description":"AUTOMATION_NOT_ACTIVE or SCAN_NOT_APPLICABLE."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automations/{automationId}/test":{"post":{"operationId":"testAutomation","x-charidy-permissions":["automations.read"],"summary":"Simulate an automation against a real record: shows trigger match, conditions and every step. Writes nothing, sends nothing.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"automationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestAutomationDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestAutomationResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automation-enrollments":{"get":{"operationId":"listAutomationEnrollments","x-charidy-permissions":["automations.read"],"summary":"List automation runs per record (filter by automation, contact record, or status).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"automationId","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"status","required":false,"in":"query","schema":{"enum":["running","waiting","completed","failed","exited","skipped"],"type":"string"}},{"name":"recordEntity","required":false,"in":"query","description":"Restrict runs to the supported contact record entity.","schema":{"nullable":true,"enum":["contact"],"type":"string"}},{"name":"recordId","required":false,"in":"query","description":"Restrict runs to this tenant-local record.","schema":{"format":"uuid","nullable":true,"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":100,"default":50,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentsListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automation-enrollments/{enrollmentId}":{"get":{"operationId":"getAutomationEnrollment","x-charidy-permissions":["automations.read"],"summary":"Read one automation run with its step-by-step history.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"enrollmentId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentDetailResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Enrollment not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automation-enrollments/{enrollmentId}/exit":{"post":{"operationId":"exitAutomationEnrollment","x-charidy-permissions":["automations.manage"],"summary":"Exit an automation run and cancel all pending waits.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"enrollmentId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Enrollment not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automation-enrollments/{enrollmentId}/retry":{"post":{"operationId":"retryAutomationStep","x-charidy-permissions":["automations.manage"],"summary":"Retry a failed automation run from the step that failed.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"enrollmentId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automation-recipes":{"get":{"operationId":"listAutomationRecipes","x-charidy-permissions":["automations.read"],"summary":"List the ready-made email journeys (campaign, donor and operational), with what each sends and when.","description":"Pass campaignId to see, for that campaign, which journeys already exist as automations and in what state. Each recipe says whether a new organization/campaign gets it switched on or as an off draft.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"locale","required":false,"in":"query","description":"Language of the email previews.","schema":{"default":"en","enum":["en","he"],"type":"string"}},{"name":"campaignId","required":false,"in":"query","description":"Also report, for each campaign journey, whether it already exists for THIS campaign (and where).","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationRecipesListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automation-recipes/{recipeKey}/automation":{"post":{"operationId":"createAutomationFromRecipe","x-charidy-permissions":["automations.manage"],"summary":"Create a DRAFT automation (and the audiences it needs) from a recipe. It does nothing until a human activates it.","description":"Creates the journey once: asking again for the same recipe (and campaign) returns the one already made, and never brings back one that was archived. To turn it on, call activateAutomation, which needs the user's approval.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"recipeKey","required":true,"in":"path","description":"A key from listAutomationRecipes.","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAutomationFromRecipeDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationResponseDto"}}}},"400":{"description":"A campaign recipe without campaignId, or an organization recipe with one."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Unknown recipe or campaign."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automations/{automationId}/webhook-endpoints":{"get":{"operationId":"listAutomationWebhookEndpoints","x-charidy-permissions":["automations.read"],"summary":"List the active inbound webhook endpoints of an automation (never the URL token).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"automationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationWebhookEndpointsListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]},"post":{"operationId":"createAutomationWebhookEndpoint","x-charidy-permissions":["automations.manage"],"summary":"Create the inbound webhook URL of a webhook-triggered automation. The secret URL is returned once.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"automationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAutomationWebhookEndpointDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationWebhookEndpointSecretResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automations/{automationId}/webhook-endpoints/{endpointId}/rotate":{"post":{"operationId":"rotateAutomationWebhookEndpoint","x-charidy-permissions":["automations.manage"],"x-charidy-destructive":true,"summary":"Replace the inbound webhook URL (and its signing secret). The old URL stops working immediately, so senders must be updated: a human approval gate for agents.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"automationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"endpointId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationWebhookEndpointSecretResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"WEBHOOK_ENDPOINT_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automations/{automationId}/webhook-endpoints/{endpointId}":{"delete":{"operationId":"deleteAutomationWebhookEndpoint","x-charidy-permissions":["automations.manage"],"x-charidy-destructive":true,"summary":"Revoke an inbound webhook URL; senders using it get 404.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"automationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"endpointId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Revoked."},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"WEBHOOK_ENDPOINT_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automations/{automationId}/webhook-signing-secret":{"get":{"operationId":"getAutomationWebhookSigningSecret","x-charidy-permissions":["automations.manage"],"summary":"Read the secret that signs this automation's OUTBOUND webhook requests (HMAC-SHA256, header X-Givearoo-Signature), so the receiver can verify them.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"automationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationWebhookSigningSecretResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automations/{automationId}/webhook-signing-secret/rotate":{"post":{"operationId":"rotateAutomationWebhookSigningSecret","x-charidy-permissions":["automations.manage"],"x-charidy-destructive":true,"summary":"Replace the outbound webhook signing secret; receivers must adopt the new one: a human approval gate for agents.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"automationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationWebhookSigningSecretResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/public/automations/webhooks/{token}":{"post":{"operationId":"receiveAutomationWebhook","summary":"Receive an inbound webhook for an automation (the URL token is the credential).","description":"Accepts a JSON object body of at most 64 KB and starts the automation with it as `trigger.event.body`. Responds 202 with an empty body: the request body is never echoed.","parameters":[{"name":"token","required":true,"in":"path","description":"The secret token from createAutomationWebhookEndpoint.","schema":{"type":"string"}}],"responses":{"202":{"description":"Accepted; the automation runs asynchronously."}},"tags":["public.automations.webhooks"]}},"/api/v1/core/automation-rules":{"get":{"operationId":"listAutomationRules","x-charidy-permissions":["automations.read"],"summary":"List automation rules in this tenant.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"limit","required":false,"in":"query","description":"Limit per page.","schema":{"minimum":1,"maximum":100,"default":50,"type":"number"}},{"name":"triggerEvent","required":false,"in":"query","schema":{"enum":["contact.created","contact.updated","contribution.created","contribution.succeeded","contribution.receipt_issued","contribution.receipt_selfissued","contribution.failed","contribution.matched","contribution.refunded","contribution.canceled","recurring.renewed","recurring.failed","recurring.canceled","campaign.created","campaign.team.created","campaign.published","campaign.paused","campaign.resumed","campaign.ended","campaign.archived","campaign.duplicated","campaign.matcher.activated","campaign.matcher.exhausted","campaign.umbrella.child_added","campaign.umbrella.child_removed","ambassador.created","ambassador.updated","ambassador.status_changed","task.created","task.completed"],"type":"string"}},{"name":"isEnabled","required":false,"in":"query","description":"Only return enabled / only disabled rules.","schema":{"type":"boolean"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationRulesListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]},"post":{"operationId":"createAutomationRule","x-charidy-permissions":["automations.manage"],"summary":"Create a new automation rule.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAutomationRuleDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationRuleResponseDto"}}}},"400":{"description":"Validation, idempotency, or trigger-allowlist errors."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automation-rules/email":{"post":{"operationId":"createEmailAutomation","x-charidy-permissions":["automations.manage"],"summary":"Create an email automation in one call (trigger + template key + recipient) without hand-building actions.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEmailAutomationDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationRuleResponseDto"}}}},"400":{"description":"Validation, idempotency, or trigger-allowlist errors."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automation-rules/{ruleId}":{"get":{"operationId":"getAutomationRule","x-charidy-permissions":["automations.read"],"summary":"Read one automation rule.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"ruleId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationRuleResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Automation rule not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]},"patch":{"operationId":"updateAutomationRule","x-charidy-permissions":["automations.manage"],"summary":"Update an automation rule.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"ruleId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAutomationRuleDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationRuleResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Automation rule not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]},"delete":{"operationId":"deleteAutomationRule","x-charidy-permissions":["automations.manage"],"summary":"Soft-delete an automation rule.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"ruleId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":""},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Automation rule not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automation-runs":{"get":{"operationId":"listAutomationRuns","x-charidy-permissions":["automations.read"],"summary":"List automation runs (filterable).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":100,"default":50,"type":"number"}},{"name":"ruleId","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"status","required":false,"in":"query","schema":{"enum":["success","failed","partial","skipped"],"type":"string"}},{"name":"outboxId","required":false,"in":"query","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationRunsListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/automation-runs/{runId}":{"get":{"operationId":"getAutomationRun","x-charidy-permissions":["automations.read"],"summary":"Read one automation run.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"runId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationRunResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Automation run not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.automations"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts":{"get":{"operationId":"listContacts","x-charidy-permissions":["contacts.read"],"summary":"List tenant contacts","description":"Returns a page of CRM contacts inside the tenant RLS context, newest first (`createdAt DESC, id DESC`). Paging is keyset-based: pass the `pagination.cursor` from a response back as `cursor` to get the next page, repeating every filter unchanged, and stop when `pagination.hasMore` is false. `totalCount` is the total across all pages. The descriptor-driven DataTable envelope will be expanded in the next CRM iteration.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"limit","required":false,"in":"query","description":"Maximum contacts to return in this page. Page past it with the opaque `cursor` returned in `pagination.cursor`.","schema":{"minimum":1,"maximum":100,"default":50,"type":"number"}},{"name":"cursor","required":false,"in":"query","description":"Opaque keyset cursor from a previous response's `pagination.cursor`. Returns the rows that follow that page in `createdAt DESC, id DESC` order. Pass every filter unchanged alongside it — a cursor is only meaningful for the same filter set that produced it. Omit for the first page. A cursor that cannot be decoded is rejected with `INVALID_CURSOR`.","schema":{"maxLength":512,"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive search over display name, email, and phone.","schema":{"maxLength":120,"type":"string"}},{"name":"source","required":false,"in":"query","description":"Filter contacts by acquisition source.","schema":{"enum":["api","portal","import","donation_form","ambassador","manual","system"],"type":"string"}},{"name":"tagKey","required":false,"in":"query","description":"Filter contacts by CRM tag key, including tags applied by donation levels.","schema":{"maxLength":80,"type":"string"}},{"name":"campaignId","required":false,"in":"query","description":"Campaign context for participation filters and per-campaign CRM workflows.","schema":{"format":"uuid","type":"string"}},{"name":"inCampaignOnly","required":false,"in":"query","description":"When true, returns only contacts that participate in the campaign provided by campaignId.","schema":{"default":false,"type":"boolean"}},{"name":"participationMin","required":false,"in":"query","description":"Minimum number of campaigns this contact participates in.","schema":{"minimum":0,"maximum":100,"type":"number"}},{"name":"participationMax","required":false,"in":"query","description":"Maximum number of campaigns this contact participates in.","schema":{"minimum":0,"maximum":100,"type":"number"}},{"name":"ids","required":false,"in":"query","description":"Filter to exactly these contact ids, comma-separated or repeated. Bypasses `search`/`inCampaignOnly` paging entirely so a caller that already knows which contacts it needs (e.g. the donor names on a page of contribution rows) can fetch them in one bounded round trip instead of paging through `inCampaignOnly` results and hoping the ones it wants are on the page. Maximum 100 ids per request.","schema":{"maxItems":100,"type":"array","items":{"type":"string"}}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactsListResponseDto"}}}},"400":{"description":"Missing or invalid tenant context, or an undecodable `cursor` (`INVALID_CURSOR`)."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contacts"],"security":[{"bearer":[]}]},"post":{"operationId":"createContact","x-charidy-permissions":["contacts.create"],"summary":"Create a tenant contact","description":"Use this to add one person the user names, with their name, email, or phone. For bulk imports or syncing Google contacts or a CSV, use the import endpoints. Creates one CRM contact and appends a `contact.created` outbox event in the same tenant transaction.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage lands with the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateContactDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactResponseDto"}}}},"400":{"description":"Missing tenant context or Idempotency-Key header."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contacts"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/duplicates/lookup":{"get":{"operationId":"lookupContactDuplicate","x-charidy-permissions":["contacts.read"],"summary":"Look up possible duplicate contacts","description":"Finds active contacts matching email, phone, or Israeli ID before create/update/merge flows.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"email","required":false,"in":"query","schema":{"maxLength":320,"type":"string"}},{"name":"phoneE164","required":false,"in":"query","schema":{"type":"string"}},{"name":"ilNationalId","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DuplicateLookupResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contacts"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/address/validate":{"post":{"operationId":"validateContactAddress","x-charidy-permissions":["contacts.update"],"summary":"Validate and normalize a contact address","description":"Server boundary for Google Places address validation. The v1 implementation returns a provider-not-configured placeholder while preserving the stable API contract.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage lands with the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidateContactAddressDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidateContactAddressResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contacts"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/merges/{mergeId}/undo":{"post":{"operationId":"undoContactMerge","x-charidy-permissions":["contacts.update"],"summary":"Undo a contact merge inside the rollback window","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"mergeId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage lands with the shared idempotency module.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contacts"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/{contactId}/profile":{"get":{"operationId":"getContactProfile","x-charidy-permissions":["contacts.read"],"summary":"Read the Contact 360 profile","description":"Returns the contact core row, donor stats, tags, recent timeline rows, and an AI-insight placeholder for the Contact 360 page and MCP agents.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactProfileResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Contact not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contacts"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/{contactId}/timeline":{"get":{"operationId":"listContactTimeline","x-charidy-permissions":["contacts.read"],"summary":"List the Contact 360 activity timeline","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactTimelineResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contacts"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/{contactId}":{"get":{"operationId":"getContact","x-charidy-permissions":["contacts.read"],"summary":"Read a single tenant contact","description":"Returns one CRM contact inside the tenant RLS context. Powers the `/contacts/[contactId]` detail page (donations, campaigns, ambassador roles).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Contact not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contacts"],"security":[{"bearer":[]}]},"patch":{"operationId":"updateContact","x-charidy-permissions":["contacts.update"],"summary":"Update a tenant contact","description":"Updates core contact fields, normalized address metadata, and custom properties; emits `contact.updated`.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage lands with the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateContactDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contacts"],"security":[{"bearer":[]}]},"delete":{"operationId":"deleteContact","x-charidy-permissions":["campaigns.contacts.classify"],"summary":"Delete a contact from the organization","description":"Soft-deletes a tenant contact (removed from CRM views and campaign classification queues) and emits `contact.deleted`.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage lands with the shared idempotency module.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactResponseDto"}}}},"400":{"description":"Missing tenant context or Idempotency-Key header."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Contact not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contacts"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/{contactId}/merge":{"post":{"operationId":"mergeContacts","x-charidy-permissions":["contacts.update"],"summary":"Merge one contact into another contact","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","required":true,"in":"path","description":"Source contact to archive.","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage lands with the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MergeContactsDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MergeContactsResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contacts"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/{contactId}/tags":{"post":{"operationId":"assignContactTag","x-charidy-permissions":["tags.manage"],"summary":"Assign a tag to a contact","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage lands with the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssignContactTagDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactTagAssignmentResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contacts"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/{contactId}/tags/{tagKey}":{"delete":{"operationId":"removeContactTag","x-charidy-permissions":["tags.manage"],"summary":"Remove a tag from a contact","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"tagKey","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage lands with the shared idempotency module.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contacts"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/{contactId}/notes":{"post":{"operationId":"createContactNote","x-charidy-permissions":["contacts.update"],"summary":"Create a note on a contact","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage lands with the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateNoteDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NoteResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contacts"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/{contactId}/followups":{"post":{"operationId":"createContactFollowup","x-charidy-permissions":["contacts.update"],"summary":"Create a follow-up task on a contact","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage lands with the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateFollowupDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FollowupResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contacts"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/{contactId}/followups/{followupId}":{"patch":{"operationId":"updateContactFollowup","x-charidy-permissions":["contacts.update"],"summary":"Update or complete a contact follow-up","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"followupId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage lands with the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateFollowupDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FollowupResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contacts"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/{contactId}/ambassador-participations":{"get":{"operationId":"listContactAmbassadorParticipations","x-charidy-permissions":["contacts.read"],"summary":"List ambassador participations held by a contact","description":"Returns every ambassador role this contact holds, across all campaigns in the tenant. Powers the \"Ambassador roles\" tab of the contact detail page.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactAmbassadorParticipationsResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Contact not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contacts"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/{contactId}/phone":{"delete":{"operationId":"clearContactPhone","x-charidy-permissions":["campaigns.contacts.classify"],"summary":"Clear a contact phone number","description":"Removes the `phone_e164` value from a tenant contact (e.g. switchboard numbers) and emits `contact.phone_cleared`.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage lands with the shared idempotency module.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactResponseDto"}}}},"400":{"description":"Missing tenant context or Idempotency-Key header."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Contact not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contacts"],"security":[{"bearer":[]}]}},"/api/v1/core/contact-tags":{"get":{"operationId":"listContactTags","x-charidy-permissions":["contacts.read"],"summary":"List tenant contact tags","description":"Returns every active contact tag (key + label + color) in the organization, ordered by label. Powers the audience-builder tag filter dropdown so users pick a tag instead of typing its key.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactTagsListResponseDto"}}}},"400":{"description":"Missing or invalid tenant context."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contacts"],"security":[{"bearer":[]}]}},"/api/v1/core/contributions":{"post":{"operationId":"createContribution","x-charidy-permissions":["transactions.manage"],"summary":"Create a tenant contribution","description":"Creates one donor contribution for a contact, audits the financial write, and appends a `contribution.created` outbox event in the same tenant transaction.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant financial mutations.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateContributionDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContributionResponseDto"}}}},"400":{"description":"Missing tenant context or Idempotency-Key header."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Contact or campaign was not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contributions"],"security":[{"bearer":[]}]},"get":{"operationId":"listContributions","x-charidy-permissions":["transactions.read"],"summary":"List tenant contributions","description":"Returns contributions with payment provider, receipt, installment, recurring, and anonymous-donor metadata for CRM and finance dashboards. Keyset-paged newest-first: page through the full history by passing the previous response's `pagination.cursor` back as `cursor` until `pagination.hasMore` is false. `totalCount` is the count of ALL donations matching the filters, not just this page. Cursor paging (not offset) because donations are inserted continuously, so an offset would skip or duplicate rows between page fetches.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"limit","required":false,"in":"query","description":"Page size, 1-100. Defaults to 50.","schema":{"minimum":1,"maximum":100,"default":50,"type":"number"}},{"name":"cursor","required":false,"in":"query","description":"Opaque keyset cursor from a previous response (`pagination.cursor`). Omit for the first page. A cursor this endpoint did not issue is rejected with `INVALID_CURSOR`.","schema":{"maxLength":512,"type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring match on the donor contact display name or email, or on the payment reference (providerChargeId / providerPaymentIntentId). Combines with every other filter.","schema":{"maxLength":120,"example":"rivka","type":"string"}},{"name":"status","required":false,"in":"query","schema":{"enum":["pending","succeeded","failed","refunded","canceled"],"type":"string"}},{"name":"tag","required":false,"in":"query","description":"Only donations carrying this donation tag (exact spelling, see listContributionTags). Not a contact tag.","schema":{"maxLength":60,"example":"major-gift","type":"string"}},{"name":"campaignId","required":false,"in":"query","description":"Campaign UUID.","schema":{"format":"uuid","type":"string"}},{"name":"ambassadorParticipationId","required":false,"in":"query","deprecated":true,"description":"DEPRECATED (Teams unification Wave 6b) — use teamId. Resolved to the team node the ambassador was merged into.","schema":{"format":"uuid","type":"string"}},{"name":"contactId","required":false,"in":"query","description":"Donor contact UUID.","schema":{"format":"uuid","type":"string"}},{"name":"paymentProvider","required":false,"in":"query","schema":{"enum":["stripe","meshulam","wallet","crowded"],"type":"string"}},{"name":"teamId","required":false,"in":"query","description":"Fundraising team UUID.","schema":{"format":"uuid","type":"string"}},{"name":"currency","required":false,"in":"query","description":"ISO-4217 currency code, e.g. USD.","schema":{"example":"USD","type":"string"}},{"name":"amountMinMinor","required":false,"in":"query","description":"Minimum donation amount in minor units (inclusive).","schema":{"minimum":0,"format":"int64","type":"number"}},{"name":"amountMaxMinor","required":false,"in":"query","description":"Maximum donation amount in minor units (inclusive).","schema":{"minimum":0,"format":"int64","type":"number"}},{"name":"createdFrom","required":false,"in":"query","description":"ISO-8601 lower bound on created_at (inclusive).","schema":{"format":"date-time","type":"string"}},{"name":"createdTo","required":false,"in":"query","description":"ISO-8601 upper bound on created_at (inclusive).","schema":{"format":"date-time","type":"string"}},{"name":"from","required":false,"in":"query","description":"Alias of createdFrom. A calendar day (YYYY-MM-DD) is the inclusive start of that UTC day.","schema":{"type":"string"}},{"name":"to","required":false,"in":"query","description":"Alias of createdTo. A calendar day (YYYY-MM-DD) is the inclusive end of that UTC day.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContributionsListResponseDto"}}}},"400":{"description":"Missing tenant context (`TENANT_CONTEXT_MISSING`), an invalid query, or a cursor this endpoint did not issue (`INVALID_CURSOR`)."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contributions"],"security":[{"bearer":[]}]}},"/api/v1/core/contributions/donors":{"get":{"operationId":"listContributionDonors","x-charidy-permissions":["transactions.read"],"summary":"List donors with their aggregated totals","description":"Returns one row per donor per currency — donation count, summed amount, last donation timestamp, and how many of those donations the donor asked to keep anonymous. Aggregated in SQL, so totals stay correct on campaigns with more donations than one page can hold. Anonymity applies to the public campaign page only; the organization still sees the donor, with `anonymousDonationsCount` as the signal not to name them publicly.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":false,"in":"query","description":"Campaign UUID.","schema":{"format":"uuid","type":"string"}},{"name":"status","required":false,"in":"query","description":"Which donation status counts toward each donor total. Defaults to `succeeded`, so pending and failed attempts never inflate a donor.","schema":{"enum":["pending","succeeded","failed","refunded","canceled"],"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":200,"default":50,"type":"number"}},{"name":"offset","required":false,"in":"query","schema":{"minimum":0,"default":0,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDonorsResponseDto"}}}},"400":{"description":"Missing tenant context or invalid query."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contributions"],"security":[{"bearer":[]}]}},"/api/v1/core/contributions/tags":{"get":{"operationId":"listContributionTags","x-charidy-permissions":["transactions.read"],"summary":"List donation tags in use","description":"Distinct tags set on donations in the active organization (up to 200, most used first), for a tag picker or the `tag` filter of `listContributions`. Donation tags are separate from contact tags (`listContactTags`).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContributionTagsListResponseDto"}}}},"400":{"description":"Missing tenant context."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contributions"],"security":[{"bearer":[]}]}},"/api/v1/core/contributions/{contributionId}":{"get":{"operationId":"getContributionById","x-charidy-permissions":["transactions.read"],"summary":"Read a single tenant contribution","description":"Returns one contribution by id inside the active tenant context. Used by the CRM donation detail view.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contributionId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContributionResponseDto"}}}},"400":{"description":"Missing tenant context or invalid contribution id."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Contribution was not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contributions"],"security":[{"bearer":[]}]},"patch":{"operationId":"updateManualContribution","x-charidy-permissions":["transactions.manage"],"summary":"Correct a manually recorded donation","description":"CHAR-239. Changes the amount, payment method, date, or donor contact of a donation staff recorded by hand (no payment provider). Refused with `CONTRIBUTION_NOT_MANUAL` for provider-processed donations, `CONTRIBUTION_RECEIPT_ISSUED` when a receipt was already issued (receipts are legal documents and are never regenerated or altered), and `CONTRIBUTION_STATUS_NOT_EDITABLE` unless the donation is pending or succeeded. Currency, campaign and team do not change. Each applied change is written to the audit log with before/after values.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contributionId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant financial mutations.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateManualContributionDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContributionResponseDto"}}}},"400":{"description":"Missing tenant context / Idempotency-Key, an empty or invalid body, a future date, or a donation that cannot be edited (`CONTRIBUTION_NOT_MANUAL`, `CONTRIBUTION_RECEIPT_ISSUED`, `CONTRIBUTION_STATUS_NOT_EDITABLE`, `CONTRIBUTION_SPLIT_ALLOCATION`)."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Contribution or target contact was not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contributions"],"security":[{"bearer":[]}]}},"/api/v1/core/contributions/{contributionId}/timeline":{"get":{"operationId":"getContributionTimeline","x-charidy-permissions":["transactions.read"],"summary":"Timeline of one donation","description":"Returns what happened to one contribution, newest first: created, succeeded (completed online payment), receipt issued, refunded, canceled, edited, task created, and note added. Built from the donation row, its audit trail, tasks, and notes. Raw audit payloads are not returned. A donation outside the active organization is 404.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contributionId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContributionTimelineResponseDto"}}}},"400":{"description":"Missing tenant context or invalid contribution id."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Contribution was not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contributions"],"security":[{"bearer":[]}]}},"/api/v1/core/contributions/{contributionId}/display-name":{"patch":{"operationId":"updateContributionDisplayName","x-charidy-permissions":["transactions.manage"],"summary":"Set the public display name of one donation","description":"Stores the name shown for this gift on the public campaign page. Send null to clear it and fall back to the contact name. Does not rename the contact, and does not move the gift to another donor.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contributionId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateContributionDisplayNameDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContributionResponseDto"}}}},"400":{"description":"Missing tenant context, Idempotency-Key, or a name over 160 characters."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Contribution was not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contributions"],"security":[{"bearer":[]}]}},"/api/v1/core/contributions/{contributionId}/details":{"patch":{"operationId":"updateContributionDetails","x-charidy-permissions":["transactions.manage"],"summary":"Set the receipt name, dedication or tags of one donation","description":"Sets any of `receiptFirstName`, `receiptLastName`, `dedication` and `tags` on one donation; omitted fields are left as they are, null (or blank) clears a text field, and `tags` replaces the whole list. Allowed on every donation, online or manual, whatever its status, because none of these fields changes money — except the receipt name on a donation whose provider issues its own receipt (Grow), refused with `CONTRIBUTION_RECEIPT_NAME_PROVIDER_ISSUED`. The receipt name is printed on receipts generated AFTER the change; a receipt that was already issued is not regenerated or altered. Both receipt-name parts null = the contact's name. Does not rename the contact. Written to the audit log.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contributionId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateContributionDetailsDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContributionResponseDto"}}}},"400":{"description":"Missing tenant context / Idempotency-Key, an empty body (`CONTRIBUTION_DETAILS_EMPTY`), a receipt-name part over 120 characters, a dedication over 500, or more than 20 tags / a tag over 60 characters."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Contribution was not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contributions"],"security":[{"bearer":[]}]}},"/api/v1/core/contributions/{contributionId}/cancel":{"post":{"operationId":"cancelManualContribution","x-charidy-permissions":["transactions.manage"],"summary":"Cancel (void) a manually recorded donation","description":"CHAR-239. Sets a manually recorded donation to `canceled` so it no longer counts in any total. Nothing is deleted: the donation stays visible with its history, the reason is kept, the change is written to the audit log, and `contribution.canceled` is appended to the outbox. Same refusals as `updateManualContribution`. Provider-processed donations are reversed with `refundContribution` instead.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contributionId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant financial mutations.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelManualContributionDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContributionResponseDto"}}}},"400":{"description":"Missing tenant context / Idempotency-Key, or a donation that cannot be canceled (`CONTRIBUTION_NOT_MANUAL`, `CONTRIBUTION_RECEIPT_ISSUED`, `CONTRIBUTION_STATUS_NOT_EDITABLE`)."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Contribution was not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contributions"],"security":[{"bearer":[]}]}},"/api/v1/core/contributions/{contributionId}/refund":{"post":{"operationId":"refundContribution","x-charidy-permissions":["transactions.refund"],"summary":"Refund a tenant contribution","description":"Refunds a succeeded donation with its payment provider (Grow/Meshulam and Bit — full or partial; Crowded — full only; Stripe — not supported yet), records the refund, and appends a `contribution.refunded` outbox event in the same tenant transaction. A full refund flips the status to `refunded` so donor and campaign totals drop the donation.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contributionId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant financial mutations.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundContributionDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundContributionResponseDto"}}}},"400":{"description":"Missing tenant context / Idempotency-Key, donation not refundable, unsupported provider, or invalid refund amount."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Contribution was not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contributions"],"security":[{"bearer":[]}]}},"/api/v1/core/contributions/{contributionId}/receipt/regenerate":{"post":{"operationId":"regenerateContributionReceipt","x-charidy-permissions":["transactions.manage"],"summary":"Re-issue the Charidy receipt for a contribution","description":"Queues receipt generation for a donation that has none. Use when a receipt is missing after the fact — the charge was reconciled by a build with wrong provider rules, object storage was unconfigured, or PDF rendering failed. It never replaces an existing receipt (that URL is a tax document a donor may already have filed) and refuses providers that issue their own statutory receipt (Grow), which would create a duplicate tax document. A manually recorded donation is issued once it is succeeded and its payment is received; otherwise the reason is `not_succeeded` or `payment_not_received`. Idempotent: the worker skips a contribution that already has `receipt_url`.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contributionId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant financial mutations.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegenerateReceiptResponseDto"}}}},"400":{"description":"Missing tenant context or Idempotency-Key."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Contribution was not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contributions"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/contributions/batch-summary":{"get":{"operationId":"getContactContributionsBatchSummary","x-charidy-permissions":["transactions.read"],"summary":"Get contribution totals for multiple contacts","description":"Returns succeeded contribution totals grouped by contact and currency for up to 200 contacts in the active tenant, including each currency average and the first and last succeeded contribution.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contactIds","required":true,"in":"query","description":"Comma-separated or repeated contact IDs. Maximum 200 contacts per request.","schema":{"minItems":1,"maxItems":200,"example":"00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000002","type":"array","items":{"type":"string"}}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchContactContributionsSummaryResponseDto"}}}},"400":{"description":"Missing tenant context or invalid contactIds query."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contributions"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/{contactId}/contributions/summary":{"get":{"operationId":"getContactContributionsSummary","x-charidy-permissions":["transactions.read"],"summary":"Get contribution totals for a contact","description":"Returns succeeded contribution totals grouped by currency for one contact in the active tenant, including each currency average and the first and last succeeded contribution.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactContributionsSummaryDto"}}}},"400":{"description":"Missing or invalid tenant context."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Contact was not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contributions"],"security":[{"bearer":[]}]}},"/api/v1/public/receipts/{contributionId}/file":{"get":{"operationId":"downloadContributionReceipt","summary":"Stream a self-issued donation receipt PDF, inline or as an attachment (token-authorized).","description":"Serves the stored receipt from the Givearoo origin so the browser never navigates to the raw Azure Blob host. Error codes: RECEIPT_DOWNLOAD_TOKEN_INVALID, RECEIPT_DOWNLOAD_EXPIRED, CONTRIBUTION_NOT_FOUND, RECEIPT_NOT_FOUND.","parameters":[{"name":"contributionId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"disposition","required":false,"in":"query","description":"`inline` serves the PDF for in-browser viewing (open in a new tab); `attachment` (default) forces a download. Does not change authorization.","schema":{"enum":["attachment","inline"],"type":"string"}},{"name":"token","required":true,"in":"query","description":"Signed receipt download token.","schema":{}}],"responses":{"200":{"description":"The receipt PDF (attachment by default, inline with `disposition=inline`)."}},"tags":["public.receipts"]}},"/api/v1/core/contacts/imports/provider-accounts":{"get":{"operationId":"listContactSyncProviderAccounts","x-charidy-permissions":["contacts.imports.read"],"summary":"List connected contact-sync provider accounts","description":"Returns all active Google / Microsoft / CSV provider accounts for the current tenant.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListContactSyncProviderAccountsResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contact-imports"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/imports/write-check":{"get":{"operationId":"checkContactImportWriteAllowed","x-charidy-permissions":["contacts.imports.run"],"summary":"Check, before an upload or connect, whether this organization may write","description":"Applies the same subscription write lock as every other tenant write (trial ended, unpaid, frozen, or no open subscription in production) without changing anything, so the UI can explain it up front instead of after the user has uploaded a file or gone through a provider consent screen.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactImportConnectCheckResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contact-imports"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/imports/connect-check":{"get":{"operationId":"checkContactImportConnectAllowed","x-charidy-permissions":["contacts.imports.connect"],"summary":"Check, before any provider consent, whether this user can connect an import source","description":"Runs the same guards as the connect endpoints (feature flag, contacts.imports.connect, support-session block) without changing anything, so the UI can explain a refusal up front instead of after the provider consent screen.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactImportConnectCheckResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contact-imports"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/imports/provider-accounts/google":{"post":{"operationId":"connectGoogleContactSyncProviderAccount","x-charidy-permissions":["contacts.imports.connect"],"summary":"Connect or refresh a Google People contact-sync provider account","description":"Stores AES-256-GCM-encrypted OAuth tokens, schedules a recurring sync, and emits `crm.contact_sync.provider_account_connected`.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectGoogleProviderAccountDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactSyncProviderAccountResponseDto"}}}},"400":{"description":"Missing tenant context, idempotency key, or invalid tokens."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contact-imports"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/imports/provider-accounts/google/oauth-start":{"post":{"operationId":"startGoogleContactSyncOAuth","x-charidy-permissions":["contacts.imports.connect"],"summary":"Create a Google Contacts OAuth reconnect URL","description":"Returns a browser URL that re-prompts for Google Contacts access and redirects back to a safe chat URL or the Charidy connected interstitial.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartGoogleContactSyncOAuthDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartGoogleContactSyncOAuthResponseDto"}}}},"400":{"description":"Return URL is invalid or tenant context is missing."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contact-imports"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/imports/provider-accounts/google/oauth-exchange":{"post":{"operationId":"connectGoogleContactSyncProviderAccountWithOauth","x-charidy-permissions":["contacts.imports.connect"],"summary":"Connect Google People by exchanging an OAuth authorization code","description":"Exchanges OAuth code + PKCE verifier server-side, stores encrypted provider tokens, and upserts a connector account.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectGoogleProviderAccountOAuthDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactSyncProviderAccountResponseDto"}}}},"400":{"description":"Missing tenant context, idempotency key, invalid OAuth code, or refresh token is missing."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contact-imports"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/imports/provider-accounts/microsoft":{"post":{"operationId":"connectMicrosoftContactSyncProviderAccount","x-charidy-permissions":["contacts.imports.connect"],"summary":"Connect or refresh a Microsoft Graph (Outlook / M365) contact-sync provider account","description":"Stores AES-256-GCM-encrypted OAuth tokens, schedules a recurring sync, and emits `crm.contact_sync.provider_account_connected`.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectMicrosoftProviderAccountDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactSyncProviderAccountResponseDto"}}}},"400":{"description":"Missing tenant context, idempotency key, or invalid tokens."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contact-imports"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/imports/provider-accounts/microsoft/oauth-exchange":{"post":{"operationId":"connectMicrosoftContactSyncProviderAccountWithOauth","x-charidy-permissions":["contacts.imports.connect"],"summary":"Connect Microsoft Graph by exchanging an OAuth authorization code","description":"Exchanges OAuth code + PKCE verifier server-side, stores encrypted provider tokens, and upserts a connector account.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectMicrosoftProviderAccountOAuthDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactSyncProviderAccountResponseDto"}}}},"400":{"description":"Missing tenant context, idempotency key, invalid OAuth code, or refresh token is missing."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contact-imports"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/imports/provider-accounts/{id}":{"patch":{"operationId":"updateContactSyncProviderAccount","x-charidy-permissions":["contacts.imports.connect"],"summary":"Update a contact-sync provider account","description":"Adjusts sync mode, schedule cadence, or display name without re-issuing OAuth tokens.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateContactSyncProviderAccountDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactSyncProviderAccountResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Provider account not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contact-imports"],"security":[{"bearer":[]}]},"delete":{"operationId":"disconnectContactSyncProviderAccount","x-charidy-permissions":["contacts.imports.connect"],"summary":"Disconnect (soft-disable) a contact-sync provider account","description":"Marks the provider account as `disabled`, clears scheduled sync timers, and emits `crm.contact_sync.provider_account_disabled`.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"responses":{"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Provider account not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contact-imports"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/imports/provider-accounts/{id}/sync":{"post":{"operationId":"startContactSyncProviderRun","x-charidy-permissions":["contacts.imports.run"],"summary":"Trigger a contact-sync run for a provider account","description":"Creates a sync job row, enqueues a BullMQ job (`crm.contacts.sync`), and emits `crm.contact_sync.job_started`.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartProviderSyncDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartProviderSyncResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Provider account not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contact-imports"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/imports/csv":{"post":{"operationId":"startCsvContactImport","x-charidy-permissions":["contacts.imports.run"],"summary":"Import contacts from a parsed CSV/XLSX dataset","description":"Performs the import inline within the tenant transaction, deduplicates against existing contacts, and emits per-row contact + job events.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartCsvImportDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartCsvImportResponseDto"}}}},"400":{"description":"Missing tenant context, idempotency key, or invalid rows."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contact-imports"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/imports/jobs":{"get":{"operationId":"listContactSyncJobs","x-charidy-permissions":["contacts.imports.read"],"summary":"List recent contact-sync jobs","description":"Returns the latest sync jobs for the tenant. Filter by provider, account, status, or campaign.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"provider","required":false,"in":"query","schema":{"enum":["google_people","microsoft_graph","csv_upload"],"type":"string"}},{"name":"status","required":false,"in":"query","schema":{"enum":["pending","running","succeeded","failed","cancelled"],"type":"string"}},{"name":"providerAccountId","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"campaignId","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":100,"default":25,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactSyncJobsListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contact-imports"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/imports/jobs/{id}":{"get":{"operationId":"getContactSyncJob","x-charidy-permissions":["contacts.imports.read"],"summary":"Get a contact-sync job","description":"Returns the lifecycle + counters for one sync job. Used by the wizard progress UI.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactSyncJobResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Sync job not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contact-imports"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/campaigns/{campaignId}/contact-profiles":{"get":{"operationId":"listCampaignContactProfiles","x-charidy-permissions":["contacts.read","campaigns.read"],"summary":"List campaign-level recruitment classifications","description":"Returns per-campaign tier/depth labels for the imported contacts plus aggregate counts used by the gamified UX dashboard.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"tier","required":false,"in":"query","schema":{"enum":["unclassified","inner_circle","active_community","wider_community","cold_outreach"],"type":"string"}},{"name":"depth","required":false,"in":"query","schema":{"enum":["unclassified","core","temporary"],"type":"string"}},{"name":"search","required":false,"in":"query","description":"Free-text contact search.","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":5000,"default":50,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignContactProfilesListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contact-imports"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/campaigns/{campaignId}/contact-profiles/classify":{"post":{"operationId":"classifyCampaignContactProfiles","x-charidy-permissions":["campaigns.contacts.classify"],"x-charidy-destructive":true,"summary":"Classify campaign contacts (active community / wider community / cold outreach)","description":"Sets tier + depth for one or many contacts. Inner-circle classification must use the explicit lock endpoint.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClassifyCampaignContactsBatchDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClassifyCampaignContactsBatchResponseDto"}}}},"400":{"description":"Inner-circle tier requires the dedicated lock endpoint."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contact-imports"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/campaigns/{campaignId}/contact-profiles/inner-circle/lock":{"post":{"operationId":"lockCampaignInnerCircle","x-charidy-permissions":["campaigns.contacts.classify"],"x-charidy-destructive":true,"summary":"Lock the inner-circle contacts for a campaign","description":"Marks the supplied contacts as `inner_circle` + `core`, sets the `no_bulk` guard so the comms layer skips them, and emits `crm.campaign_contact_profile.inner_circle_locked` for the tasks module to react.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LockInnerCircleDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LockInnerCircleResponseDto"}}}},"400":{"description":"Inner-circle size must be 5–25 contacts."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contact-imports"],"security":[{"bearer":[]}]}},"/api/v1/core/contacts/campaigns/{campaignId}/contact-profiles/summary":{"get":{"operationId":"getCampaignClassificationSummary","x-charidy-permissions":["contacts.read","campaigns.read"],"summary":"Get the aggregated classification summary for a campaign","description":"Counts of contacts by tier and depth + locked-inner-circle count. Powers the gamified post-import dashboard.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignClassificationSummaryDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.contact-imports"],"security":[{"bearer":[]}]}},"/api/v1/core/custom-fields":{"post":{"operationId":"createCustomFieldDefinition","x-charidy-permissions":["custom_fields.manage"],"summary":"Create a custom field definition","description":"Defines a tenant custom field (MVP: entity_type=contact) and appends a `custom_field.definition.created` outbox event in the same tenant transaction. Values are written later through the host entity API (e.g. PATCH /core/contacts/:id).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Client-generated UUID to make this mutation safely retryable.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCustomFieldDefinitionDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldDefinitionResponseDto"}}}},"400":{"description":"Invalid definition, missing tenant context, or Idempotency-Key header."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"409":{"description":"A field with this key already exists for the entity."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.customFields"],"security":[{"bearer":[]}]},"get":{"operationId":"listCustomFieldDefinitions","x-charidy-permissions":["custom_fields.read"],"summary":"List custom field definitions","description":"Lists custom field definitions for the active organization, optionally filtered.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"entityType","required":false,"in":"query","description":"Filter by host entity type.","schema":{"enum":["contact"],"type":"string"}},{"name":"status","required":false,"in":"query","description":"Filter by lifecycle status.","schema":{"enum":["active","archived"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldDefinitionListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.customFields"],"security":[{"bearer":[]}]}},"/api/v1/core/custom-fields/discovery":{"get":{"operationId":"listOrgCustomFieldsForEntity","x-charidy-permissions":["custom_fields.read"],"summary":"Discover active custom fields for an entity","description":"Returns the ACTIVE custom field definitions for one host entity (default: contact). Single discovery endpoint for AI agents, form renderers, and export tools.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"entityType","required":false,"in":"query","schema":{"enum":["contact"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldDefinitionListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.customFields"],"security":[{"bearer":[]}]}},"/api/v1/core/custom-fields/{id}":{"get":{"operationId":"getCustomFieldDefinition","x-charidy-permissions":["custom_fields.read"],"summary":"Get a custom field definition","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldDefinitionResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Definition not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.customFields"],"security":[{"bearer":[]}]},"patch":{"operationId":"updateCustomFieldDefinition","x-charidy-permissions":["custom_fields.manage"],"summary":"Update a custom field definition","description":"Updates a definition (label / description / display order / required / validation / options). `field_key` and `field_type` are immutable (SPEC/24 I-CFE-4). Emits `custom_field.definition.updated`.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-generated UUID to make this mutation safely retryable.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCustomFieldDefinitionDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldDefinitionResponseDto"}}}},"400":{"description":"Invalid update, missing tenant context, or Idempotency-Key header."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Definition not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.customFields"],"security":[{"bearer":[]}]}},"/api/v1/core/custom-fields/{id}/archive":{"post":{"operationId":"archiveCustomFieldDefinition","x-charidy-permissions":["custom_fields.manage"],"summary":"Archive a custom field definition","description":"Soft-archives a definition (status=archived). Existing stored values are left untouched; the field stops appearing in discovery and stops being validated. Emits `custom_field.definition.archived`.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Client-generated UUID to make this mutation safely retryable.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldDefinitionResponseDto"}}}},"400":{"description":"Missing tenant context or Idempotency-Key header."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Definition not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.customFields"],"security":[{"bearer":[]}]}},"/api/v1/core/import-engine/files":{"post":{"operationId":"uploadImportFile","x-charidy-permissions":["contacts.imports.run"],"summary":"Upload a file (CSV/TSV/XLSX/vCard) to stage for import","description":"Stores the file in blob storage, computes its sha256 + byte size, and enqueues asynchronous parsing (`crm.imports.parse`). `sheetsJson` stays empty until that worker runs — poll `getImportFile` until it is populated before calling `proposeImportMapping`.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadImportFileDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadImportFileResponseDto"}}}},"400":{"description":"IMPORT_FILE_EMPTY / IMPORT_FILE_TOO_LARGE / TENANT_CONTEXT_MISSING."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.import-engine"],"security":[{"bearer":[]}]}},"/api/v1/core/import-engine/files/{id}":{"get":{"operationId":"getImportFile","x-charidy-permissions":["contacts.imports.read"],"summary":"Get an uploaded import file, including parsed sheet/column profiles","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportFileResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"IMPORT_FILE_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.import-engine"],"security":[{"bearer":[]}]}},"/api/v1/core/import-engine/mapping-profiles/propose":{"post":{"operationId":"proposeImportMapping","x-charidy-permissions":["contacts.imports.run"],"summary":"Propose a column → field mapping for a parsed file (dictionary-only in this phase)","description":"Reads the stored column profiles from `getImportFile.sheetsJson` and proposes namespaced target fields (`contact.email`, …) plus Custom Field proposals for confidently-typed unmapped columns. Proposal only — nothing is created. Pass `save: true` + `name` to persist it as a reusable mapping profile.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProposeImportMappingDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProposeImportMappingResponseDto"}}}},"400":{"description":"IMPORT_ENTITY_UNKNOWN / IMPORT_MAPPING_PROFILE_NAME_REQUIRED."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"IMPORT_FILE_NOT_FOUND / IMPORT_FILE_DATASET_NOT_FOUND."},"409":{"description":"IMPORT_FILE_NOT_PARSED (file has not finished parsing) / IMPORT_MAPPING_PROFILE_NAME_EXISTS."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.import-engine"],"security":[{"bearer":[]}]}},"/api/v1/core/import-engine/mapping-profiles":{"get":{"operationId":"listImportMappingProfiles","x-charidy-permissions":["contacts.imports.read"],"summary":"List saved import mapping profiles","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"entity","required":false,"in":"query","description":"Filter by registered entity key.","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":200,"default":50,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportMappingProfilesListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.import-engine"],"security":[{"bearer":[]}]}},"/api/v1/core/import-engine/mapping-profiles/{id}":{"get":{"operationId":"getImportMappingProfile","x-charidy-permissions":["contacts.imports.read"],"summary":"Get a saved import mapping profile","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportMappingProfileResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"IMPORT_MAPPING_PROFILE_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.import-engine"],"security":[{"bearer":[]}]},"patch":{"operationId":"updateImportMappingProfile","x-charidy-permissions":["contacts.imports.run"],"summary":"Update a saved import mapping profile (name / column mappings / value mappings)","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateImportMappingProfileDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportMappingProfileResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"IMPORT_MAPPING_PROFILE_NOT_FOUND."},"409":{"description":"IMPORT_MAPPING_PROFILE_NAME_EXISTS."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.import-engine"],"security":[{"bearer":[]}]},"delete":{"operationId":"deleteImportMappingProfile","x-charidy-permissions":["contacts.imports.run"],"summary":"Delete a saved import mapping profile","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Mapping profile deleted."},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"IMPORT_MAPPING_PROFILE_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.import-engine"],"security":[{"bearer":[]}]}},"/api/v1/core/import-engine/jobs":{"post":{"operationId":"startImportJob","x-charidy-permissions":["contacts.imports.run"],"summary":"Start a dry-run or commit import job","description":"`mode=dry_run` previews the import with no writes. `mode=commit` is REJECTED unless `dryRunJobId` points at a succeeded dry_run job for the same file + mapping profile — normally you do not call this directly for commit, use `approveImportJob` instead. Runs asynchronously on `crm.imports.run`.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartImportJobDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartImportJobResponseDto"}}}},"400":{"description":"IMPORT_ENTITY_UNKNOWN."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"IMPORT_COMMIT_REQUIRES_DRY_RUN."},"404":{"description":"IMPORT_FILE_NOT_FOUND / IMPORT_MAPPING_PROFILE_NOT_FOUND / IMPORT_SESSION_NOT_FOUND."},"409":{"description":"IMPORT_FILE_NOT_PARSED."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.import-engine"],"security":[{"bearer":[]}]}},"/api/v1/core/import-engine/jobs/{id}":{"get":{"operationId":"getImportJob","x-charidy-permissions":["contacts.imports.read"],"summary":"Get an import job, its stats, and its dry-run report","description":"Includes an aggregate report computed from row outcomes (counts by outcome, top reason codes, needsDecisionCount) and, for a dry_run job, its mapping profile's pending Custom Field proposals.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetImportJobResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"IMPORT_JOB_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.import-engine"],"security":[{"bearer":[]}]}},"/api/v1/core/import-engine/jobs/{id}/outcomes":{"get":{"operationId":"listImportJobOutcomes","x-charidy-permissions":["contacts.imports.read"],"summary":"List (or export as CSV) the per-row outcomes of an import job","description":"Paged, filterable by `outcome` and `reasonCode`. Pass `?format=csv` for a `text/csv` download of the current page (original file columns + outcome + reasons); formula-injection characters (`= + - @`) at the start of any cell are escaped with a leading apostrophe.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"outcome","required":false,"in":"query","description":"Use attention to include skipped, ambiguous, and failed rows.","schema":{"enum":["created","merged","updated","rejected","failed","needs_decision","would_create","would_merge","would_update","would_reject","attention"],"type":"string"}},{"name":"reasonCode","required":false,"in":"query","schema":{"maxLength":80,"type":"string"}},{"name":"offset","required":false,"in":"query","schema":{"minimum":0,"default":0,"type":"number"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":500,"default":50,"type":"number"}},{"name":"format","required":false,"in":"query","description":"Pass `csv` to receive the page as a `text/csv` download instead of JSON.","schema":{"enum":["csv"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportJobOutcomesListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"IMPORT_JOB_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.import-engine"],"security":[{"bearer":[]}]}},"/api/v1/core/import-engine/jobs/{id}/approve":{"post":{"operationId":"approveImportJob","x-charidy-permissions":["contacts.imports.run","custom_fields.manage"],"summary":"Approve a succeeded dry-run job: create approved Custom Fields and start the commit job","description":"Only valid on a succeeded dry_run job. Creates any approved Custom Field definitions through `CustomFieldsService` (a plan-gated organization surfaces `403 FEATURE_DISABLED` as-is), maps their columns to `custom.<key>`, then inserts and enqueues a new `mode=commit` job linked via `dryRunJobId`.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApproveImportJobDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportJobResponseDto"}}}},"400":{"description":"IMPORT_JOB_NOT_DRY_RUN / IMPORT_JOB_NOT_SUCCEEDED / IMPORT_CUSTOM_FIELD_PROPOSAL_NOT_FOUND."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED — crm.customFields is not enabled for this organization."},"404":{"description":"IMPORT_JOB_NOT_FOUND / IMPORT_MAPPING_PROFILE_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.import-engine"],"security":[{"bearer":[]}]}},"/api/v1/core/import-engine/sessions":{"post":{"operationId":"createImportSession","x-charidy-permissions":["contacts.imports.run"],"summary":"Create an import session (one upload \"envelope\" spanning several datasets/jobs)","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateImportSessionDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportSessionResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"IMPORT_FILE_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.import-engine"],"security":[{"bearer":[]}]}},"/api/v1/core/import-engine/sessions/{id}":{"get":{"operationId":"getImportSession","x-charidy-permissions":["contacts.imports.read"],"summary":"Get an import session and its jobs","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetImportSessionResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"IMPORT_SESSION_NOT_FOUND."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["crm.import-engine"],"security":[{"bearer":[]}]}},"/api/v1/public/{orgSlug}/campaigns/{campaignSlug}/checkout":{"post":{"operationId":"publicCreatePaymentCheckout","summary":"Create a public donation checkout session.","description":"Creates a pending checkout session for a public campaign. The returned provider URL is only a payment attempt; contribution state is finalized by signed provider webhooks.","parameters":[{"name":"orgSlug","required":true,"in":"path","schema":{"type":"string"}},{"name":"campaignSlug","required":true,"in":"path","schema":{"type":"string"}},{"name":"idempotency-key","required":true,"in":"header","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for public checkout creation.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePublicCheckoutDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCheckoutResponseDto"}}}},"400":{"description":"Invalid amount, billing type, provider, or donor identity. BILLING_TYPE_NOT_ENABLED: campaign policy excludes the requested billing type. CHECKOUT_LEVEL_PRICE_MISMATCH: stale or forged level amount/currency; select and review again. PROVIDER_UNSUPPORTED_BILLING_TYPE: unsupported billing type or level cadence/cycle cap (Stripe/Crowded installments and Grow wallet recurring are unavailable)."},"404":{"description":"Campaign was not found or is not accepting donations."}},"tags":["public.payments"]}},"/api/v1/public/payments/{checkoutId}/status":{"get":{"operationId":"publicGetPaymentCheckoutStatus","summary":"Get public payment checkout status.","description":"Returns the current checkout status. Clients poll this after returning from a provider, but never mark payments paid themselves.","parameters":[{"name":"checkoutId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCheckoutStatusResponseDto"}}}},"404":{"description":"Checkout session was not found."}},"tags":["public.payments"]}},"/api/v1/public/webhooks/payments/{provider}":{"post":{"operationId":"ingestPaymentsWebhook","summary":"Buffer a signed payment-provider webhook.","description":"Verifies provider signature, records a replay-safe webhook event, and queues semantic dispatch. Duplicate provider events are acknowledged without reprocessing.","parameters":[{"name":"provider","required":true,"in":"path","schema":{"enum":["stripe","meshulam","wallet","crowded"],"type":"string"}}],"responses":{"202":{"description":"Webhook accepted for asynchronous processing."},"401":{"description":"Webhook signature is missing or invalid."}},"tags":["public.payments.webhooks"]}},"/api/v1/core/payments/gateways":{"get":{"operationId":"listPaymentGateways","x-charidy-permissions":["transactions.read"],"summary":"List configured payment gateways for the active organization.","description":"Returns masked payment gateway configuration. Raw credentials are never returned.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentGatewaysListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.payments.gateways"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/gateways/{provider}":{"put":{"operationId":"upsertPaymentGateway","x-charidy-permissions":["transactions.manage"],"summary":"Create or update encrypted payment gateway credentials.","description":"Stores provider credentials encrypted with CHARIDY_INTEGRATION_SECRET_KEY. Meshulam and Bit require pageCode + token; Stripe requires either a connected account id (Connect) or a stripeSecretKey + stripePublishableKey pair (manual — verified live against Stripe before saving, and a webhook endpoint is automatically provisioned on the org's own account unless stripeWebhookSecret is explicitly supplied).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"provider","required":true,"in":"path","schema":{"enum":["stripe","meshulam","wallet","crowded"],"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertPaymentGatewayDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentGatewayResponseDto"}}}},"400":{"description":"Validation error or integration secret key not configured."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.payments.gateways"],"security":[{"bearer":[]}]},"delete":{"operationId":"disablePaymentGateway","x-charidy-permissions":["transactions.manage"],"summary":"Disable a payment gateway for the active organization.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"provider","required":true,"in":"path","schema":{"enum":["stripe","meshulam","wallet","crowded"],"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":""},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Payment gateway configuration was not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.payments.gateways"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/stripe-connect/start":{"post":{"operationId":"startStripeConnect","x-charidy-permissions":["transactions.manage"],"summary":"Begin Stripe Connect (Express) onboarding for the active organization.","description":"Creates a Stripe Express account if one does not exist yet, then issues a one-time onboarding URL for the donor to complete in a popup. The URL expires after 5 minutes; clients should refresh if the donor takes longer.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StripeConnectStartDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StripeConnectStartResponseDto"}}}},"400":{"description":"Tenant context missing or platform passphrase not configured."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."},"503":{"description":"Platform STRIPE_SECRET_KEY is not configured."}},"tags":["core.payments.stripe-connect"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/stripe-connect/oauth/start":{"post":{"operationId":"startStripeConnectOAuth","x-charidy-permissions":["transactions.manage"],"summary":"Begin Stripe OAuth for connecting an existing Stripe account.","description":"Issues a Stripe Connect OAuth authorization URL for organizations that already have a Stripe account and do not want Express onboarding. Requires STRIPE_CONNECT_CLIENT_ID on the platform.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StripeConnectOAuthStartDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StripeConnectOAuthStartResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."},"503":{"description":"Platform STRIPE_CONNECT_CLIENT_ID or STRIPE_SECRET_KEY is not configured."}},"tags":["core.payments.stripe-connect"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/stripe-connect/oauth/complete":{"post":{"operationId":"completeStripeConnectOAuth","x-charidy-permissions":["transactions.manage"],"summary":"Persist a Stripe OAuth authorization code as the active org gateway.","description":"Exchanges Stripe OAuth code for a connected account id, stores that account id encrypted for the active organization, and returns the latest Connect status snapshot.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StripeConnectOAuthCompleteDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StripeConnectStatusResponseDto"}}}},"400":{"description":"OAuth state is invalid/expired or Stripe did not return an account id."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.payments.stripe-connect"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/stripe-connect/refresh":{"post":{"operationId":"refreshStripeConnect","x-charidy-permissions":["transactions.manage"],"summary":"Re-issue an onboarding URL after the previous link expired.","description":"Same effect as `start` for an org that already has a Stripe Connect account: re-creates the Account Link without creating a duplicate Stripe account.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StripeConnectStartResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.payments.stripe-connect"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/stripe-connect/status":{"get":{"operationId":"getStripeConnectStatus","x-charidy-permissions":["transactions.read"],"summary":"Return the latest Stripe Connect onboarding status for the active organization.","description":"Polls Stripe for `details_submitted`, `charges_enabled`, `payouts_enabled`, and outstanding requirements, mirroring the snapshot to `payments_provider_accounts.config_json`.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StripeConnectStatusResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.payments.stripe-connect"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/stripe-connect/test":{"post":{"operationId":"testStripeConnect","x-charidy-permissions":["transactions.manage"],"summary":"Run a no-op test PaymentIntent against the connected Stripe account.","description":"Creates a $1 USD PaymentIntent with `capture_method=manual` and immediately cancels it so no donor is charged. Returns the success/failure of the round-trip plus the latest status snapshot.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StripeConnectTestResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.payments.stripe-connect"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/stripe-connect/disconnect":{"post":{"operationId":"disconnectStripeConnect","x-charidy-permissions":["transactions.manage"],"summary":"Disable the Stripe Connect gateway for the active organization.","description":"Marks the gateway row disabled and emits `payments.gateway.disabled`. The Stripe account itself stays alive on Stripe and can be reconnected later via `start`.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":""},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"No Stripe gateway is configured for this organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.payments.stripe-connect"],"security":[{"bearer":[]}]}},"/api/v1/public/payments/stripe-connect/oauth/complete-callback":{"post":{"operationId":"completeStripeConnectOAuthCallback","summary":"Complete Stripe OAuth from the signed state (no session required).","description":"Verifies the HMAC-signed OAuth state, re-confirms the initiating user is an active member of the org, exchanges the single-use Stripe code, and persists the connected account. Returns the connect status plus the origin so the caller can route the user back to chat/MCP or the dashboard. Used by the public OAuth callback page.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StripeConnectOAuthCompleteDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StripeConnectOAuthCallbackResponseDto"}}}},"400":{"description":"OAuth state is invalid/expired/missing user, or Stripe did not return an account id."},"403":{"description":"The signed-state user is no longer an active member of the organization."}},"tags":["public.payments.stripe-connect"]}},"/api/v1/core/payments/crowded-connect/invite":{"post":{"operationId":"createCrowdedOnboardingInvite","x-charidy-permissions":["transactions.manage"],"x-charidy-feature-flag":"payments.crowded_hosted_onboarding.enabled","summary":"Create or reuse a hosted Crowded onboarding invitation.","description":"Ensures the active organization has a Crowded gateway row, then explicitly asks Crowded to issue a single-use child-Chapter onboarding invitation under the configured base Chapter. The invitation write and audit/outbox records are tenant scoped.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCrowdedOnboardingInviteDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrowdedOnboardingInviteStateResponseDto"}}}},"400":{"description":"VALIDATION_FAILED, tenant context missing, contact names supplied without email, or integration-secret configuration missing."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED or missing transactionsManage."},"409":{"description":"The organization already has a claimed Crowded Chapter."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."},"502":{"description":"Crowded returned an invalid invitation contract or omitted the link URL."},"503":{"description":"Crowded platform token or base Chapter UID is not configured."}},"tags":["core.payments.crowded-connect"],"security":[{"bearer":[]}]},"get":{"operationId":"getCrowdedOnboardingInvite","x-charidy-permissions":["transactions.read"],"x-charidy-feature-flag":"payments.crowded_hosted_onboarding.enabled","summary":"Return the latest hosted Crowded onboarding invitation.","description":"Returns the active organization’s latest invitation, including its effective pending, claimed, expired, or revoked state. The read is recorded in the tenant audit trail; invitation handles are never logged.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrowdedOnboardingInviteStateResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED or missing transactionsRead."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.payments.crowded-connect"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/crowded-connect/invite/revoke":{"post":{"operationId":"revokeCrowdedOnboardingInvite","x-charidy-permissions":["transactions.manage"],"x-charidy-feature-flag":"payments.crowded_hosted_onboarding.enabled","summary":"Revoke the latest pending Crowded onboarding invitation.","description":"Marks the latest pending invitation revoked in Charidy and writes its audit and outbox records atomically. It does not delete or disconnect an already claimed Crowded Chapter.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrowdedOnboardingInviteStateResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED or missing transactionsManage."},"404":{"description":"No pending Crowded onboarding invitation exists."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.payments.crowded-connect"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/crowded-connect/start":{"post":{"operationId":"startCrowdedConnect","x-charidy-permissions":["transactions.manage"],"summary":"Begin Crowded onboarding for the active organization.","description":"Creates a Crowded Organization and primary Chapter if they do not exist yet, optionally submits a bank application, and returns the latest onboarding status. Crowded is the default donation provider.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrowdedConnectStartDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrowdedConnectStartResponseDto"}}}},"400":{"description":"Tenant context missing or platform passphrase not configured."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."},"503":{"description":"Platform CROWDED_API_TOKEN is not configured."}},"tags":["core.payments.crowded-connect"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/crowded-connect/refresh":{"post":{"operationId":"refreshCrowdedConnect","x-charidy-permissions":["transactions.manage"],"summary":"Re-poll Crowded onboarding status for the active organization.","description":"Re-reads the Crowded bank application and deposit accounts and mirrors the snapshot to the gateway config. Equivalent to `status` but always forces a fresh poll.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrowdedConnectStatusResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.payments.crowded-connect"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/crowded-connect/status":{"get":{"operationId":"getCrowdedConnectStatus","x-charidy-permissions":["transactions.read"],"summary":"Return the latest Crowded onboarding status for the active organization.","description":"Polls Crowded for the bank application status and deposit-account readiness, mirroring the snapshot to `payments_provider_accounts.config_json`.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrowdedConnectStatusResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.payments.crowded-connect"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/crowded-connect/test":{"post":{"operationId":"testCrowdedConnect","x-charidy-permissions":["transactions.manage"],"summary":"Verify the Crowded chapter is reachable with the platform token.","description":"Lists the chapter deposit accounts to confirm the platform token and chapter are valid. No money moves. Returns the round-trip result plus the latest status snapshot.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrowdedConnectTestResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.payments.crowded-connect"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/crowded-connect/disconnect":{"post":{"operationId":"disconnectCrowdedConnect","x-charidy-permissions":["transactions.manage"],"summary":"Disable the Crowded gateway for the active organization.","description":"Marks the gateway row disabled and emits `payments.gateway.disabled`. The Crowded chapter itself stays alive and can be reconnected later via `start`.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":""},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"No Crowded gateway is configured for this organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.payments.crowded-connect"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/crowded/accounts":{"get":{"operationId":"listCrowdedAccounts","x-charidy-permissions":["transactions.read"],"summary":"List Crowded deposit accounts for the active organization chapter.","description":"Returns the chapter deposit accounts (checking/wallet/hold) and balances.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrowdedAccountsResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."},"503":{"description":"Crowded is not configured for this organization."}},"tags":["core.payments.crowded-finance"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/crowded/transactions":{"get":{"operationId":"listCrowdedTransactions","x-charidy-permissions":["transactions.read"],"summary":"List Crowded transactions for the active organization chapter.","description":"Returns paginated chapter transactions from Crowded.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":100,"default":25,"type":"number"}},{"name":"page","required":false,"in":"query","schema":{"minimum":1,"default":1,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrowdedTransactionsResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."},"503":{"description":"Crowded is not configured for this organization."}},"tags":["core.payments.crowded-finance"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/crowded/release-funds":{"post":{"operationId":"releaseCrowdedFunds","x-charidy-permissions":["transactions.manage"],"summary":"Release available funds for the active organization chapter.","description":"Forwards a release-funds request to Crowded for the org chapter.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrowdedReleaseFundsDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrowdedFinanceResultDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."},"503":{"description":"Crowded is not configured for this organization."}},"tags":["core.payments.crowded-finance"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/crowded/move-fees":{"post":{"operationId":"moveCrowdedFees","x-charidy-permissions":["transactions.manage"],"summary":"Move platform fees for the active organization chapter.","description":"Forwards a move-fees request to Crowded for the org chapter.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrowdedMoveFeesDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrowdedFinanceResultDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."},"503":{"description":"Crowded is not configured for this organization."}},"tags":["core.payments.crowded-finance"],"security":[{"bearer":[]}]}},"/api/v1/me/payouts":{"get":{"operationId":"listMyPayouts","x-charidy-permissions":["transactions.read"],"summary":"List balances and payout activity for the active organization.","description":"Read-only finance view. Stripe reads are scoped to the connected account; Crowded reads are scoped to the organization chapter. This endpoint never changes payout schedules, bank details, or funds.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":100,"default":25,"type":"number"}},{"name":"page","required":false,"in":"query","description":"Crowded transaction page.","schema":{"minimum":1,"default":1,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgPayoutsDashboardResponseDto"}}}},"400":{"description":"Missing tenant context or invalid pagination."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."},"503":{"description":"A configured provider is unavailable."}},"tags":["me.payouts"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/meshulam-connect/start":{"post":{"operationId":"startMeshulamConnect","x-charidy-permissions":["transactions.manage"],"summary":"Begin Grow (Meshulam) onboarding for the active organization.","description":"Returns a secure dashboard URL where the org admin pastes their Grow userId, apiKey, and page codes, plus the current onboarding status. Grow has no OAuth, so credentials are entered in the dashboard form — never in chat. Use this for the Israeli card / Bit / wallet processor.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeshulamConnectStartDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeshulamConnectStartResponseDto"}}}},"400":{"description":"Tenant context missing or platform passphrase not configured."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.payments.meshulam-connect"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/meshulam-connect/refresh":{"post":{"operationId":"refreshMeshulamConnect","x-charidy-permissions":["transactions.manage"],"summary":"Re-validate Grow (Meshulam) credentials for the active organization.","description":"Re-runs the Grow credential probe and mirrors the readiness snapshot to the gateway config. Equivalent to `status` but always forces a fresh probe.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeshulamConnectStatusResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.payments.meshulam-connect"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/meshulam-connect/status":{"get":{"operationId":"getMeshulamConnectStatus","x-charidy-permissions":["transactions.read"],"summary":"Return the latest Grow (Meshulam) onboarding status for the active organization.","description":"Validates the stored Grow credentials with a non-money probe and reports `configured`, `chargesEnabled`, which page codes are set, and outstanding requirements, mirroring the snapshot to `payments_provider_accounts.config_json`.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeshulamConnectStatusResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.payments.meshulam-connect"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/meshulam-connect/test":{"post":{"operationId":"testMeshulamConnect","x-charidy-permissions":["transactions.manage"],"summary":"Verify the Grow (Meshulam) credentials are valid.","description":"Runs a non-money Grow credential probe to confirm the userId + apiKey are accepted. No money moves. Returns the round-trip result plus the latest status snapshot.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeshulamConnectTestResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.payments.meshulam-connect"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/meshulam-connect/auto-receipt":{"post":{"operationId":"setMeshulamAutoReceiptEmail","x-charidy-permissions":["transactions.manage"],"summary":"Toggle the Grow (Meshulam) combined thank-you + tax-receipt email.","description":"When enabled, the donor acknowledgement is deferred so a single branded email (thank-you + the Grow-issued tax receipt PDF) is sent once Grow delivers the invoice document, with a 15-minute fallback to a thank-you-only email. When disabled, the donor receives the immediate thank-you and the receipt URL is only stored on the contribution.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeshulamAutoReceiptUpdateDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeshulamConnectStatusResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"No Grow gateway is configured for this organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.payments.meshulam-connect"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/meshulam-connect/disconnect":{"post":{"operationId":"disconnectMeshulamConnect","x-charidy-permissions":["transactions.manage"],"summary":"Disable the Grow (Meshulam) gateway for the active organization.","description":"Marks the gateway row disabled and emits `payments.gateway.disabled`. The Grow credentials can be re-entered later via the onboarding form.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":""},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"No Grow gateway is configured for this organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.payments.meshulam-connect"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/recurring/plans":{"get":{"operationId":"listRecurringPlans","x-charidy-permissions":["recurring.read"],"summary":"List recurring donation plans (standing orders) for the active organization.","description":"Returns recurring plans with donor + campaign context and a per-plan recorded-cycle count. Filterable by status, campaign, or donor contact.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"status","required":false,"in":"query","description":"Filter by plan status (active | canceled | completed).","schema":{"type":"string"}},{"name":"campaignId","required":false,"in":"query","description":"Filter by campaign UUID.","schema":{"type":"string"}},{"name":"contactId","required":false,"in":"query","description":"Filter by donor contact UUID.","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":200,"default":50,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecurringPlansListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.payments.recurring"],"security":[{"bearer":[]}]}},"/api/v1/core/payments/recurring/plans/{planId}/cancel":{"post":{"operationId":"cancelRecurringPlan","x-charidy-permissions":["recurring.manage"],"summary":"Cancel a recurring donation plan (stop future charges).","description":"Stops future charges at the payment provider, then marks the plan canceled and emits `recurring.canceled`. Wired for Crowded; Grow/Bit return 501 until their cancel API is wired.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"planId","required":true,"in":"path","description":"Recurring plan UUID.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelRecurringPlanResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"Recurring plan was not found in the active organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.payments.recurring"],"security":[{"bearer":[]}]}},"/api/v1/admin/payments/campaign-fee-overrides/{organizationId}":{"get":{"operationId":"listCampaignPlatformFeeOverrides","x-charidy-permissions":["reports.read"],"summary":"List campaign platform-fee overrides for an organization.","description":"Super-admin view of each campaign override. NULL inherits the active organization fee config for the checkout provider.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignPlatformFeeListResponseDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Caller is not an authorized platform super-admin."}},"tags":["admin.payments.campaign-fee-overrides"],"security":[{"bearer":[]}]}},"/api/v1/admin/payments/campaign-fee-overrides/{organizationId}/{campaignId}":{"put":{"operationId":"setCampaignPlatformFeeOverride","x-charidy-permissions":["organizations.plan.manage"],"summary":"Set or clear one campaign platform-fee override.","description":"Super-admin-only financial write. A numeric value overrides the org rate (0 disables it); NULL restores inheritance. The resolved entitlement cap is enforced and the write is audited.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"campaignId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetCampaignPlatformFeeDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignPlatformFeeDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Caller is not an authorized platform super-admin."}},"tags":["admin.payments.campaign-fee-overrides"],"security":[{"bearer":[]}]}},"/api/v1/admin/payments/fee-configs/{organizationId}":{"get":{"operationId":"listOrgPaymentFeeConfigs","x-charidy-permissions":["reports.read"],"summary":"List configured payment revenue-share rates for an organization.","description":"Returns the per-provider Charidy revenue-share configuration (the share each provider remits to Charidy) used to estimate commission on every donation.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgPaymentFeeConfigListResponseDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.payments.fee-configs"],"security":[{"bearer":[]}]},"put":{"operationId":"upsertOrgPaymentFeeConfig","x-charidy-permissions":["organizations.plan.manage"],"summary":"Create or update a payment revenue-share rate for an organization+provider.","description":"Sets the Charidy commission (basis points of gross) and optional provider-fee estimate for one provider. The fee-estimate trigger applies this rate to subsequent donations.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertOrgPaymentFeeConfigDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgPaymentFeeConfigDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.payments.fee-configs"],"security":[{"bearer":[]}]}},"/api/v1/admin/payments/reconciliation/crowded/sync":{"post":{"operationId":"syncCrowdedCollectPayments","x-charidy-permissions":["transactions.manage"],"summary":"Queue a partner-wide Crowded collect-payments reconciliation.","description":"Queues the same idempotent worker used by the schedule. The worker reads succeeded collect-payments across the Crowded Partner, reconciles contribution fees and release/fee-taken metadata, and records missing-contribution or amount-mismatch findings. Returns FEATURE_DISABLED until the environment is explicitly enabled for the controlled first live GET.","parameters":[],"responses":{"202":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrowdedCollectPaymentsSyncQueuedDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED or caller lacks the transactions.manage permission."}},"tags":["admin.payments.reconciliation"],"security":[{"bearer":[]}]}},"/api/v1/admin/payments/reconciliation/exceptions":{"get":{"operationId":"listPaymentReconciliationExceptions","x-charidy-permissions":["transactions.read"],"summary":"List partner-wide payment reconciliation exceptions.","description":"Super-admin-only view of Crowded missing contributions and amount mismatches. Includes organization_id NULL findings that are intentionally invisible through tenant RLS and can only be reviewed from this app_super-backed control-plane route.","parameters":[{"name":"kind","required":false,"in":"query","description":"Return only one Crowded discrepancy kind.","schema":{"enum":["missing_contribution","amount_mismatch"],"type":"string"}},{"name":"status","required":false,"in":"query","description":"Return only one operator resolution status.","schema":{"enum":["open","resolved","ignored"],"type":"string"}},{"name":"organizationId","required":false,"in":"query","description":"Return only findings assigned to this Charidy organization. Omit to include cross-tenant NULL-organization findings.","schema":{"format":"uuid","type":"string"}},{"name":"page","required":false,"in":"query","description":"One-based result page.","schema":{"minimum":1,"default":1,"type":"number"}},{"name":"limit","required":false,"in":"query","description":"Maximum findings returned per page.","schema":{"minimum":1,"maximum":200,"default":100,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentReconciliationExceptionsResponseDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Caller lacks transactions.read or super-admin access."}},"tags":["admin.payments.reconciliation"],"security":[{"bearer":[]}]}},"/api/v1/admin/payments/reconciliation/crowded/{organizationId}":{"post":{"operationId":"reconcileCrowdedProviderFees","x-charidy-permissions":["reports.read"],"summary":"Reconcile an organization’s Crowded donation fees against provider actuals.","description":"Pulls the Crowded chapter transactions feed, overwrites provider_fee_minor on matching contributions with the reported fee, and flips fee_source to reconciled. Emits payments.fee.reconciled. No-ops safely when Crowded is not configured or the feed is unavailable.","parameters":[{"name":"organizationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProviderFeeReconcileResultDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.payments.reconciliation"],"security":[{"bearer":[]}]}},"/api/v1/core/reports":{"post":{"operationId":"createReport","x-charidy-permissions":["reports.read"],"summary":"Create a report from a typed template (inline result or async email delivery).","description":"Runs a canonical, server-defined report. `delivery.mode=\"inline\"` (default) computes and returns facts + an AI insight summary immediately. `delivery.mode=\"email\"` returns a queued job: the worker generates a CSV/XLSX export, stores it, and emails the recipient a signed download link — poll getReport until status is `succeeded`. ALWAYS confirm the recipient email with the user before creating an email-delivery report. Runnable templates: donation_summary (totals, average gift, source/provider/currency breakdowns), campaign_comparison (per-campaign raised vs goal), source_attribution (per-source funnel + share of total), payment_reconciliation (gross/fees/commission/net per processor), ambassador_performance (per-ambassador raised vs goal), top_donors (largest givers; also requires the contacts.read permission), recurring_health (active/new/canceled plans, MRR-equivalent, failed charges), and donor_retention (new vs returning donors, repeat-gift rate, lapsed). For anything the presets cannot express (e.g. a contacts/CRM list, custom breakdowns), set templateId=\"custom\" and supply customSpec — an ad-hoc ReportSpec built from GET /catalog dataset/field/metric ids (never raw SQL). PII fields (contact name/email/phone) require the contacts.read permission. Error codes: REPORT_TEMPLATE_UNKNOWN, REPORT_TEMPLATE_NOT_IMPLEMENTED, REPORT_PARAMS_INVALID, REPORT_DIMENSION_NOT_ALLOWED, REPORT_FILTER_NOT_ALLOWED, REPORT_CUSTOM_SPEC_REQUIRED, REPORT_SPEC_INVALID, REPORT_DATASET_UNKNOWN, REPORT_FIELD_UNKNOWN, REPORT_METRIC_UNKNOWN, REPORT_OPERATOR_NOT_ALLOWED, REPORT_LIMIT_EXCEEDED, REPORT_RECIPIENT_EMAIL_REQUIRED, REPORT_QUERY_FAILED, AUTHORIZATION_DENIED.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateReportDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportJobResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.reports"],"security":[{"bearer":[]}]},"get":{"operationId":"listReports","x-charidy-permissions":["reports.read"],"summary":"List report jobs for the active organization.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"status","required":false,"in":"query","schema":{"enum":["queued","running","succeeded","failed","expired"],"type":"string"}},{"name":"templateId","required":false,"in":"query","schema":{"enum":["donation_summary","campaign_comparison","donor_retention","recurring_health","top_donors","source_attribution","payment_reconciliation","ambassador_performance"],"type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":100,"default":20,"type":"number"}},{"name":"locale","required":false,"in":"query","description":"Locale for DISPLAY labels (dataset name, column headers, enum labels). Defaults to the locale each report was created with. Raw row values and the AI insight text are unaffected.","schema":{"enum":["en","he"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportJobsListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.reports"],"security":[{"bearer":[]}]}},"/api/v1/core/reports/preview":{"post":{"operationId":"previewReport","x-charidy-permissions":["reports.read"],"summary":"Run an ad-hoc report spec synchronously and return the table (no job is created).","description":"Live preview for the report builder. Accepts the same ReportSpec as createReport `customSpec` (rows, aggregate, or pivot) and returns the computed table immediately — nothing is stored, no monthly quota is used. Rows/aggregate previews are capped at 200 rows (`truncated` says when more exist) and every preview has an 8 s statement timeout. `mode=\"pivot\"` with `pivot: { rows, columns, metrics }` returns a cross-tab: one metric column per value of the column dimension plus a total column, and one totals row per currency. A pivot is never truncated; it is rejected over 20 column values or 1000 rows. Money is never summed across currencies. PII dimensions require contacts.read. Error codes: REPORT_SPEC_INVALID, REPORT_DATASET_UNKNOWN, REPORT_FIELD_UNKNOWN, REPORT_FIELD_NOT_GROUPABLE, REPORT_METRIC_UNKNOWN, REPORT_OPERATOR_NOT_ALLOWED, REPORT_PIVOT_COLUMNS_EXCEEDED, REPORT_PIVOT_ROWS_EXCEEDED, REPORT_PREVIEW_TIMEOUT, REPORT_QUERY_FAILED, FEATURE_DISABLED, AUTHORIZATION_DENIED.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportPreviewRequestDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportPreviewResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.reports"],"security":[{"bearer":[]}]}},"/api/v1/core/reports/catalog":{"get":{"operationId":"getReportCatalog","x-charidy-permissions":["reports.read"],"summary":"List the reportable datasets, fields, and metrics for ad-hoc (custom) reports.","description":"Returns the Reportable Dataset Catalog — the allowlist of datasets (contacts, contributions, campaigns, recurring_plans, ambassadors) with their fields (id, type, PII flag, allowed filter operators) and metrics. Build a createReport `customSpec` using ONLY ids returned here — never invent field/metric ids. PII fields (name/email/phone) require the contacts.read permission to export.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportCatalogResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.reports"],"security":[{"bearer":[]}]}},"/api/v1/core/reports/{reportId}":{"get":{"operationId":"getReport","x-charidy-permissions":["reports.read"],"summary":"Read one report job — the status-polling tool for async reports.","description":"Returns the job with status (`queued | running | succeeded | failed | expired`), computed facts, and the insight summary once available. For email-delivery reports, poll this until processing settles, then call getReportDownloadUrl for a fresh signed link whenever an export exists (download is independent of downstream email delivery outcome). Pass `locale` to get display labels (dataset name, column headers, enum labels) in that language — stored reports keep the labels of the locale they were created with. Row values stay RAW (match on `manual`, not on its label), and the insight text is NOT re-translated.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"reportId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"locale","required":false,"in":"query","description":"Locale for DISPLAY labels (dataset name, column headers, enum labels). Defaults to the locale the report was created with. Row values stay raw and the AI insight text is NOT re-translated — it is generated prose, so a different language requires creating the report again.","schema":{"enum":["en","he"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportJobResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.reports"],"security":[{"bearer":[]}]}},"/api/v1/core/reports/{reportId}/rows":{"get":{"operationId":"getReportRows","x-charidy-permissions":["reports.read"],"summary":"Read the rows behind one report — the working table the report screen filters, groups and charts.","description":"For a template report: the individual succeeded donations inside the report window and filters (up to 5000, newest first; `truncated` says when the window held more). Read live, so they add up to the stored totals for any closed window. For a custom report: its stored rows. Donor names require contacts.read (`donorNamesHidden` says when they were left out); anonymous donations never carry a name. Error codes: REPORT_JOB_NOT_FOUND, REPORT_NOT_READY, REPORT_ROWS_UNAVAILABLE, AUTHORIZATION_DENIED.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"reportId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"locale","required":false,"in":"query","description":"Locale for DISPLAY labels (dataset name, column headers, enum labels). Defaults to the locale the report was created with. Row values stay raw and the AI insight text is NOT re-translated — it is generated prose, so a different language requires creating the report again.","schema":{"enum":["en","he"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportRowsResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.reports"],"security":[{"bearer":[]}]}},"/api/v1/core/reports/{reportId}/download-url":{"get":{"operationId":"getReportDownloadUrl","x-charidy-permissions":["reports.export"],"summary":"Issue a fresh short-lived signed URL to download the report export.","description":"Valid once an export exists (including reports whose email delivery later failed). Error codes: REPORT_EXPORT_NOT_READY, REPORT_EXPORT_EXPIRED.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"reportId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportDownloadUrlDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.reports"],"security":[{"bearer":[]}]}},"/api/v1/core/reports/interpret":{"post":{"operationId":"interpretReportRequest","x-charidy-permissions":["reports.read"],"summary":"Translate a free-text (Hebrew/English) report request into a typed template + params.","description":"Uses the platform LLM (structured output constrained to the report template registry; deterministic keyword fallback when the LLM is disabled) to turn a sentence like \"כמה תרומות נכנסו השבוע לפי מקור הגעה וסליקה\" into `{ templateId, params }` ready for createReport. The result is re-validated against the registry, so it is always safe to pass to createReport. When `confidence` is low or `clarification` is set, confirm with the user before running the report.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InterpretReportRequestDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InterpretReportResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.reports"],"security":[{"bearer":[]}]}},"/api/v1/core/report-exports/fields":{"get":{"operationId":"getReportExportFields","x-charidy-permissions":["reports.export"],"summary":"List the columns a Charidy-style export can include.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"kind","required":true,"in":"query","schema":{"enum":["donations","teams","campaigns"],"type":"string"}},{"name":"locale","required":false,"in":"query","schema":{"enum":["en","he"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportExportFieldsDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.reports"],"security":[{"bearer":[]}]}},"/api/v1/core/report-exports/donations":{"post":{"operationId":"createDonationExport","x-charidy-permissions":["reports.export"],"summary":"Queue a donations workbook with status sheets.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCharidyExportDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportJobResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.reports"],"security":[{"bearer":[]}]}},"/api/v1/core/report-exports/teams":{"post":{"operationId":"createTeamsExport","x-charidy-permissions":["reports.export"],"summary":"Queue a teams export.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCharidyExportDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportJobResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.reports"],"security":[{"bearer":[]}]}},"/api/v1/core/report-exports/campaigns":{"post":{"operationId":"createCampaignsExport","x-charidy-permissions":["reports.export"],"summary":"Queue a campaigns export.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCharidyExportDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportJobResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.reports"],"security":[{"bearer":[]}]}},"/api/v1/core/report-exports/{id}":{"get":{"operationId":"getReportExport","x-charidy-permissions":["reports.export"],"summary":"Read a Charidy-style export job.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportJobResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.reports"],"security":[{"bearer":[]}]}},"/api/v1/core/report-exports/{id}/download-url":{"get":{"operationId":"getReportExportDownloadUrl","x-charidy-permissions":["reports.export"],"summary":"Issue a signed download URL for a finished Charidy-style export.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportDownloadUrlDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.reports"],"security":[{"bearer":[]}]}},"/api/v1/core/report-export-presets":{"get":{"operationId":"listReportExportPresets","x-charidy-permissions":["reports.export"],"summary":"List the caller’s saved export column selections.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"kind","required":false,"in":"query","schema":{"enum":["donations","teams","campaigns"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportExportPresetListDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.reports"],"security":[{"bearer":[]}]},"post":{"operationId":"saveReportExportPreset","x-charidy-permissions":["reports.export"],"summary":"Save the caller’s export column selection under a name.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveReportExportPresetDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportExportPresetDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.reports"],"security":[{"bearer":[]}]}},"/api/v1/core/report-export-presets/{id}":{"delete":{"operationId":"deleteReportExportPreset","x-charidy-permissions":["reports.export"],"summary":"Delete one of the caller’s saved export selections.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.reports"],"security":[{"bearer":[]}]}},"/api/v1/core/table-exports":{"get":{"operationId":"getTableExportCatalog","x-charidy-permissions":["reports.export"],"summary":"List the registered tables that have a row-export adapter.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TableExportCatalogDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tables"],"security":[{"bearer":[]}]},"post":{"operationId":"createTableExport","x-charidy-permissions":["reports.export"],"summary":"Export every filtered row of a registered table as CSV or XLSX.","description":"Independent of report-template plan restrictions. Preserves source permissions, tenant boundaries, selected columns, nested filters and sort; exports all result pages asynchronously. Poll getTableExport then getTableExportDownloadUrl. Errors: TABLE_EXPORT_INVALID, TABLE_EXPORT_UNKNOWN, TABLE_EXPORT_FIELD_UNKNOWN, TABLE_EXPORT_FILTER_INVALID, TABLE_EXPORT_SCOPE_INVALID, AUTHORIZATION_DENIED.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTableExportDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportJobResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tables"],"security":[{"bearer":[]}]}},"/api/v1/core/table-exports/{exportId}":{"get":{"operationId":"getTableExport","x-charidy-permissions":["reports.export"],"summary":"Read a table-export job, rechecking its source-table permissions.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"exportId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportJobResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tables"],"security":[{"bearer":[]}]}},"/api/v1/core/table-exports/{exportId}/download-url":{"get":{"operationId":"getTableExportDownloadUrl","x-charidy-permissions":["reports.export"],"summary":"Issue a signed download URL for a completed table export.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"exportId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportDownloadUrlDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tables"],"security":[{"bearer":[]}]}},"/api/v1/public/reports/{reportId}/file":{"get":{"operationId":"downloadReportExport","summary":"Stream a finished report export as an attachment (token-authorized).","description":"Serves the stored CSV/XLSX/PDF export from the Givearoo origin so the browser never navigates to the raw Azure Blob host. Requires the signed `token` issued by getReportDownloadUrl / the report-ready email. Error codes: REPORT_DOWNLOAD_TOKEN_INVALID, REPORT_JOB_NOT_FOUND, REPORT_EXPORT_NOT_READY, REPORT_EXPORT_EXPIRED, REPORT_EXPORT_NOT_FOUND.","parameters":[{"name":"reportId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"token","required":true,"in":"query","description":"Signed report download token.","schema":{}}],"responses":{"200":{"description":"The export file, as an attachment."}},"tags":["public.reports"]}},"/api/v1/core/insights/surface":{"get":{"operationId":"getSurfaceInsight","x-charidy-permissions":["reports.read"],"summary":"Short AI summary of a dashboard surface (campaigns / donations / contacts).","description":"Returns server-computed facts plus a one-to-two sentence localized summary, e.g. \"You have 4 active campaigns, 3 reached their goal; note no payment provider is connected.\" Useful for answering \"מה המצב בקמפיינים\" without running a full report.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"surface","required":true,"in":"query","description":"Which dashboard surface to summarize.","schema":{"enum":["campaigns","donations","contacts"],"type":"string"}},{"name":"locale","required":false,"in":"query","schema":{"default":"en","enum":["en","he"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SurfaceInsightResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.insights"],"security":[{"bearer":[]}]}},"/api/v1/core/tables/interpret":{"post":{"operationId":"interpretTableQuery","summary":"Translate a free-text table request into validated filter/group/hide controls.","description":"Given a free-text request (Hebrew/English) and the calling table's column schema, returns table controls (filter conditions, group-by columns, hidden columns) constrained to the submitted columns and re-validated server-side. Powers the AI-style prompt above dashboard tables; the client keeps a deterministic fallback when this returns matched=false (LLM disabled/unavailable).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InterpretTableQueryDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InterpretTableQueryResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.tables"],"security":[{"bearer":[]}]}},"/api/v1/core/dashboard/overview":{"get":{"operationId":"getOrgDashboardOverview","x-charidy-permissions":["campaigns.read","contacts.read","transactions.read","reports.read"],"summary":"Get the tenant CRM dashboard overview.","description":"Returns org-wide CRM health, raised totals, campaign status counts, and prioritized next actions for the active tenant.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"preset","required":false,"in":"query","description":"Named analysis window. Use `custom` together with fromIso/toIso for an explicit range.","schema":{"default":"last_30_days","enum":["today","last_7_days","this_month","last_month","last_30_days","this_year","custom"],"type":"string"}},{"name":"fromIso","required":false,"in":"query","description":"Inclusive lower bound of a custom analysis window. Requires toIso.","schema":{"format":"date-time","type":"string"}},{"name":"toIso","required":false,"in":"query","description":"Exclusive upper bound of a custom analysis window. Requires fromIso.","schema":{"format":"date-time","type":"string"}},{"name":"windowDays","required":false,"in":"query","deprecated":true,"description":"Deprecated: rolling analysis window in days, kept for existing SDK/MCP callers. Ignored when preset or fromIso/toIso is supplied.","schema":{"minimum":1,"maximum":365,"type":"number"}},{"name":"campaignId","required":false,"in":"query","description":"Limit metrics to a single campaign.","schema":{"format":"uuid","type":"string"}},{"name":"status","required":false,"in":"query","description":"Limit campaign rollups by status.","schema":{"enum":["draft","pending_approval","active","paused","ended","completed","archived"],"type":"string"}},{"name":"currency","required":false,"in":"query","description":"Restrict donation metrics to one currency.","schema":{"example":"USD","type":"string"}},{"name":"compareMode","required":false,"in":"query","description":"Comparison mode for campaign-day and baseline analytics.","schema":{"default":"all","enum":["all","campaign_day","baseline"],"type":"string"}},{"name":"locale","required":false,"in":"query","description":"Locale used to localize task-derived workflow action copy.","schema":{"default":"en","enum":["en","he"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardOverviewResponseDto"}}}},"400":{"description":"Missing tenant context or invalid dashboard query."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.dashboard"],"security":[{"bearer":[]}]}},"/api/v1/core/dashboard/campaign-performance":{"get":{"operationId":"getOrgCampaignPerformance","x-charidy-permissions":["campaigns.read","transactions.read"],"summary":"Get campaign status and performance rollups.","description":"Groups campaigns by lifecycle status and returns per-campaign raised, donor, page-publish, and task-readiness metrics.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"preset","required":false,"in":"query","description":"Named analysis window. Use `custom` together with fromIso/toIso for an explicit range.","schema":{"default":"last_30_days","enum":["today","last_7_days","this_month","last_month","last_30_days","this_year","custom"],"type":"string"}},{"name":"fromIso","required":false,"in":"query","description":"Inclusive lower bound of a custom analysis window. Requires toIso.","schema":{"format":"date-time","type":"string"}},{"name":"toIso","required":false,"in":"query","description":"Exclusive upper bound of a custom analysis window. Requires fromIso.","schema":{"format":"date-time","type":"string"}},{"name":"windowDays","required":false,"in":"query","deprecated":true,"description":"Deprecated: rolling analysis window in days, kept for existing SDK/MCP callers. Ignored when preset or fromIso/toIso is supplied.","schema":{"minimum":1,"maximum":365,"type":"number"}},{"name":"campaignId","required":false,"in":"query","description":"Limit metrics to a single campaign.","schema":{"format":"uuid","type":"string"}},{"name":"status","required":false,"in":"query","description":"Limit campaign rollups by status.","schema":{"enum":["draft","pending_approval","active","paused","ended","completed","archived"],"type":"string"}},{"name":"currency","required":false,"in":"query","description":"Restrict donation metrics to one currency.","schema":{"example":"USD","type":"string"}},{"name":"compareMode","required":false,"in":"query","description":"Comparison mode for campaign-day and baseline analytics.","schema":{"default":"all","enum":["all","campaign_day","baseline"],"type":"string"}},{"name":"locale","required":false,"in":"query","description":"Locale used to localize task-derived workflow action copy.","schema":{"default":"en","enum":["en","he"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardCampaignPerformanceResponseDto"}}}},"400":{"description":"Missing tenant context or invalid dashboard query."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.dashboard"],"security":[{"bearer":[]}]}},"/api/v1/core/dashboard/donation-trends":{"get":{"operationId":"getOrgDonationTrends","x-charidy-permissions":["transactions.read","reports.read"],"x-charidy-feature-flag":"dashboard.analytics.enabled","summary":"Get donation trend analytics for the CRM dashboard.","description":"Returns daily raised buckets and current-vs-baseline comparisons for normal days and campaign days. Professional plans only.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"preset","required":false,"in":"query","description":"Named analysis window. Use `custom` together with fromIso/toIso for an explicit range.","schema":{"default":"last_30_days","enum":["today","last_7_days","this_month","last_month","last_30_days","this_year","custom"],"type":"string"}},{"name":"fromIso","required":false,"in":"query","description":"Inclusive lower bound of a custom analysis window. Requires toIso.","schema":{"format":"date-time","type":"string"}},{"name":"toIso","required":false,"in":"query","description":"Exclusive upper bound of a custom analysis window. Requires fromIso.","schema":{"format":"date-time","type":"string"}},{"name":"windowDays","required":false,"in":"query","deprecated":true,"description":"Deprecated: rolling analysis window in days, kept for existing SDK/MCP callers. Ignored when preset or fromIso/toIso is supplied.","schema":{"minimum":1,"maximum":365,"type":"number"}},{"name":"campaignId","required":false,"in":"query","description":"Limit metrics to a single campaign.","schema":{"format":"uuid","type":"string"}},{"name":"status","required":false,"in":"query","description":"Limit campaign rollups by status.","schema":{"enum":["draft","pending_approval","active","paused","ended","completed","archived"],"type":"string"}},{"name":"currency","required":false,"in":"query","description":"Restrict donation metrics to one currency.","schema":{"example":"USD","type":"string"}},{"name":"compareMode","required":false,"in":"query","description":"Comparison mode for campaign-day and baseline analytics.","schema":{"default":"all","enum":["all","campaign_day","baseline"],"type":"string"}},{"name":"locale","required":false,"in":"query","description":"Locale used to localize task-derived workflow action copy.","schema":{"default":"en","enum":["en","he"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardDonationTrendsResponseDto"}}}},"400":{"description":"Missing tenant context or invalid dashboard query."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"FEATURE_DISABLED — feature is disabled for this organization."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.dashboard"],"security":[{"bearer":[]}]}},"/api/v1/core/dashboard/workflow":{"get":{"operationId":"getOrgDashboardWorkflow","x-charidy-permissions":["campaigns.read","transactions.read"],"summary":"Get prioritized CRM dashboard workflow actions.","description":"Returns blocking tasks, failed-payment attention items, and campaign page readiness actions for the active tenant.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"preset","required":false,"in":"query","description":"Named analysis window. Use `custom` together with fromIso/toIso for an explicit range.","schema":{"default":"last_30_days","enum":["today","last_7_days","this_month","last_month","last_30_days","this_year","custom"],"type":"string"}},{"name":"fromIso","required":false,"in":"query","description":"Inclusive lower bound of a custom analysis window. Requires toIso.","schema":{"format":"date-time","type":"string"}},{"name":"toIso","required":false,"in":"query","description":"Exclusive upper bound of a custom analysis window. Requires fromIso.","schema":{"format":"date-time","type":"string"}},{"name":"windowDays","required":false,"in":"query","deprecated":true,"description":"Deprecated: rolling analysis window in days, kept for existing SDK/MCP callers. Ignored when preset or fromIso/toIso is supplied.","schema":{"minimum":1,"maximum":365,"type":"number"}},{"name":"campaignId","required":false,"in":"query","description":"Limit metrics to a single campaign.","schema":{"format":"uuid","type":"string"}},{"name":"status","required":false,"in":"query","description":"Limit campaign rollups by status.","schema":{"enum":["draft","pending_approval","active","paused","ended","completed","archived"],"type":"string"}},{"name":"currency","required":false,"in":"query","description":"Restrict donation metrics to one currency.","schema":{"example":"USD","type":"string"}},{"name":"compareMode","required":false,"in":"query","description":"Comparison mode for campaign-day and baseline analytics.","schema":{"default":"all","enum":["all","campaign_day","baseline"],"type":"string"}},{"name":"locale","required":false,"in":"query","description":"Locale used to localize task-derived workflow action copy.","schema":{"default":"en","enum":["en","he"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardWorkflowResponseDto"}}}},"400":{"description":"Missing tenant context or invalid dashboard query."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.dashboard"],"security":[{"bearer":[]}]}},"/api/v1/core/search":{"get":{"operationId":"searchSystemEntities","summary":"Search tenant entities across Charidy OS.","description":"Read-only global search over user-facing tenant entities. Results are filtered by the caller permissions for each entity type.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"query","required":true,"in":"query","description":"Free-text query to search across tenant entities.","schema":{"maxLength":120,"example":"spring donor","type":"string"}},{"name":"type","required":false,"in":"query","description":"Optional entity type filter.","schema":{"enum":["campaign","contact","contribution","team","matcher","donation_level","task","media_asset","automation"],"type":"string"}},{"name":"limit","required":false,"in":"query","description":"Maximum total results to return across all entity types.","schema":{"minimum":1,"maximum":50,"default":20,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GlobalSearchResponseDto"}}}},"400":{"description":"Missing tenant context or invalid query."},"401":{"description":"JWT access token is missing or invalid."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.search"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/journey/next":{"get":{"operationId":"getOnboardingJourneyNext","summary":"Return the next quest for the authenticated organization journey.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"orgSlug","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JourneyNextResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"RESOURCE_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-journey"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/journey/{questId}/answer":{"post":{"operationId":"submitOnboardingQuestAnswer","summary":"Submit an answer for the current onboarding quest.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"orgSlug","required":true,"in":"query","schema":{"type":"string"}},{"name":"questId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JourneyAnswerBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JourneyNextResponseDto"}}}},"400":{"description":"ONBOARDING_QUEST_INVALID_PAYLOAD"},"403":{"description":"Missing required permission for this operation."},"404":{"description":"ONBOARDING_QUEST_NOT_FOUND"},"409":{"description":"ONBOARDING_QUEST_OUT_OF_ORDER"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-journey"],"security":[{"bearer":[]}]}},"/api/v1/onboarding/journey/{questId}/skip":{"post":{"operationId":"skipOnboardingQuest","summary":"Skip the current onboarding quest and continue later.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"orgSlug","required":true,"in":"query","schema":{"type":"string"}},{"name":"questId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JourneySkipBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JourneyNextResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"403":{"description":"Missing required permission for this operation."},"404":{"description":"ONBOARDING_QUEST_NOT_FOUND"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["onboarding-journey"],"security":[{"bearer":[]}]}},"/api/v1/formation/roadmap":{"get":{"operationId":"getFormationRoadmap","x-charidy-scope":"tenant","summary":"Read the latest permit/registration roadmap for a newly-forming org (advisory, not legal advice).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FormationRoadmapDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["formation"],"security":[{"bearer":[]}]},"post":{"operationId":"generateFormationRoadmap","x-charidy-scope":"tenant","summary":"Generate the permit/registration roadmap from the maintained ruleset for the org country x sector.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateFormationRoadmapBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FormationRoadmapDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"409":{"description":"FORMATION_ADVISOR_DISABLED"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["formation"],"security":[{"bearer":[]}]}},"/api/v1/formation/roadmap/steps/{stepKey}/complete":{"post":{"operationId":"completeFormationRoadmapStep","x-charidy-scope":"tenant","summary":"Mark a roadmap step complete. Steps requiring professional review need professionalReviewAck=true.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"stepKey","required":true,"in":"path","description":"Stable step key (e.g. register_entity).","schema":{"type":"string"}},{"name":"x-organization-id","in":"header","description":"Tenant scope — uuid of the organization.","required":true,"schema":{"type":"string"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteFormationStepBodyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FormationRoadmapDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"404":{"description":"FORMATION_ROADMAP_NOT_FOUND | FORMATION_STEP_NOT_FOUND"},"409":{"description":"FORMATION_STEP_REQUIRES_PROFESSIONAL_REVIEW"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["formation"],"security":[{"bearer":[]}]}},"/.well-known/oauth-authorization-server":{"get":{"operationId":"getMcpOAuthAuthorizationServerMetadata","x-charidy-human-only":true,"summary":"OAuth authorization-server metadata for MCP discovery.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}},"tags":["mcp-auth"]}},"/.well-known/oauth-protected-resource":{"get":{"operationId":"getMcpOAuthProtectedResourceMetadata","x-charidy-human-only":true,"summary":"OAuth protected-resource metadata for the Charidy MCP endpoint.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}},"tags":["mcp-auth"]}},"/.well-known/mcp.json":{"get":{"operationId":"getMcpDiscoveryManifest","x-charidy-scope":"anonymous","summary":"Public Givearoo MCP server manifest with connection and transport URLs.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}},"tags":["mcp-auth"]}},"/api/v1/mcp/oauth/register":{"post":{"operationId":"registerMcpOAuthClient","x-charidy-human-only":true,"summary":"Dynamic client registration for public MCP OAuth clients.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}},"tags":["mcp-auth"]}},"/api/v1/mcp/oauth/authorize":{"get":{"operationId":"authorizeMcpOAuthClient","x-charidy-human-only":true,"summary":"Start the MCP OAuth authorization-code flow.","description":"If the user has no Charidy dashboard cookie, this redirects to the login page with a returnTo back to this URL. Once authenticated it renders an OAuth consent screen naming the requesting client, the target organization, and the scopes; NO authorization code is issued until the user approves via POST /mcp/oauth/authorize/decision. First-time users with no organization get a default organization provisioned on approval so the flow stays in chat.","parameters":[{"name":"response_type","required":true,"in":"query","schema":{"enum":["code"],"type":"string"}},{"name":"client_id","required":true,"in":"query","schema":{"type":"string"}},{"name":"redirect_uri","required":true,"in":"query","schema":{"type":"string"}},{"name":"resource","required":false,"in":"query","schema":{}},{"name":"organization_id","required":false,"in":"query","schema":{}},{"name":"code_challenge_method","required":false,"in":"query","schema":{"enum":["plain","S256"],"type":"string"}},{"name":"code_challenge","required":false,"in":"query","schema":{}},{"name":"scope","required":false,"in":"query","schema":{}},{"name":"state","required":false,"in":"query","schema":{}}],"responses":{"200":{"description":"HTML consent screen (authenticated) or a 302 redirect to login."}},"tags":["mcp-auth"]}},"/api/v1/mcp/oauth/authorize/decision":{"post":{"operationId":"decideMcpOAuthConsent","x-charidy-human-only":true,"summary":"Record the user consent decision for the MCP OAuth flow.","description":"Consumes the signed consent ticket rendered on the authorize screen. On approval it mints the authorization code and 303-redirects to the validated client callback; on denial it redirects back to the client with error=access_denied.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["ticket","decision"],"properties":{"ticket":{"type":"string"},"decision":{"type":"string","enum":["approve","deny"]}}}}}},"responses":{"200":{"description":"303 redirect back into the connector flow."}},"tags":["mcp-auth"]}},"/api/v1/mcp/oauth/token":{"post":{"operationId":"exchangeMcpOAuthToken","x-charidy-human-only":true,"summary":"Exchange an MCP OAuth authorization code or refresh token.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"properties":{"grant_type":{"type":"string","enum":["authorization_code","refresh_token"]},"code":{"type":"string"},"refresh_token":{"type":"string"},"redirect_uri":{"type":"string"},"client_id":{"type":"string"},"code_verifier":{"type":"string"},"resource":{"type":"string"}},"required":["grant_type"]}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}},"tags":["mcp-auth"]}},"/api/v1/mcp":{"post":{"operationId":"invokeMcpRpcRoot","x-charidy-human-only":true,"summary":"OpenAI-compatible root MCP JSON-RPC endpoint.","description":"Primary Streamable HTTP endpoint for ChatGPT Apps. Accepts the same JSON-RPC payload as /api/v1/mcp/v1 and /api/v1/mcp/message.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}},"tags":["mcp"]}},"/api/v1/mcp/v1":{"post":{"operationId":"invokeMcpRpc","x-charidy-human-only":true,"x-charidy-scope":"anonymous","summary":"JSON-RPC 2.0 endpoint that implements the Model Context Protocol.","description":"Single endpoint for the MCP Streamable HTTP transport. Accepts a JSON-RPC 2.0 request and returns a JSON-RPC 2.0 response. Implemented methods: `initialize`, `tools/list`, `tools/call`, `notifications/initialized`, `ping`. Notifications return an empty 202; everything else returns a 200 with the JSON-RPC envelope.","parameters":[{"name":"X-MCP-Organization-Id","in":"header","description":"Tenant scope — UUID of the organization the agent will act on. Required for any `tools/call` against a tenant-scoped operation; safe to omit for `tools/list` (the list will be intersected with the caller permissions only).","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"description":"JSON-RPC 2.0 request envelope.","content":{"application/json":{"schema":{"type":"object","required":["jsonrpc","method"],"properties":{"jsonrpc":{"type":"string","enum":["2.0"]},"id":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"null"}]},"method":{"type":"string"},"params":{"type":"object","additionalProperties":true}}}}}},"responses":{"200":{"description":"JSON-RPC 2.0 response envelope.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}},"tags":["mcp"]}},"/api/v1/mcp/message":{"post":{"operationId":"invokeMcpRpcMessageAlias","x-charidy-human-only":true,"x-charidy-scope":"anonymous","summary":"Compatibility alias for MCP JSON-RPC messages.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}},"tags":["mcp"]}},"/api/v1/mcp/sse":{"get":{"operationId":"getMcpSseCompatibilityInfo","x-charidy-human-only":true,"x-charidy-scope":"anonymous","summary":"Compatibility endpoint for MCP clients that ask for an SSE URL.","description":"Charidy MCP uses Streamable HTTP at POST /api/v1/mcp. This endpoint returns connection metadata for clients that still ask for an SSE URL.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}},"tags":["mcp"]}},"/api/v1/agent/tools/search":{"get":{"operationId":"searchAgentTools","summary":"Find ranked agent tool descriptors.","description":"Use to find the few tools that match what the user asked for, instead of loading the whole catalog.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"q","required":true,"in":"query","description":"Natural-language description of the capability the user needs.","schema":{"minLength":1,"maxLength":300,"type":"string"}},{"name":"limit","required":false,"in":"query","description":"Maximum number of ranked tools to return.","schema":{"minimum":1,"maximum":10,"default":6,"type":"number"}},{"name":"domain","required":false,"in":"query","description":"Optional first-tag domain filter, for example `core.campaigns`.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentToolSearchResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["agent"],"security":[{"bearer":[]}]}},"/api/v1/admin/mcp-activity/logs":{"get":{"operationId":"listMcpToolCallLogs","x-charidy-permissions":["organizations.read_all"],"summary":"Paginated MCP tool-call log for the /admin/mcp-activity Logs tab.","description":"Lists captured MCP `tools/call` invocations (surface = mcp) newest-first for one organization. Filterable by tool name, status, error code, requestId (correlation id), and a rolling time window. Each row is a single tool call; payloads are redacted server-side via @charidy/shared.","parameters":[{"name":"organizationId","required":true,"in":"query","schema":{"type":"string"}},{"name":"toolName","required":false,"in":"query","schema":{"type":"string"}},{"name":"status","required":false,"in":"query","schema":{"enum":["ok","error","needs_approval"],"type":"string"}},{"name":"errorCode","required":false,"in":"query","schema":{"type":"string"}},{"name":"requestId","required":false,"in":"query","schema":{"type":"string"}},{"name":"windowDays","required":false,"in":"query","schema":{"type":"integer"}},{"name":"limit","required":false,"in":"query","schema":{"type":"integer"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/McpToolCallLogPageDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["mcp"],"security":[{"bearer":[]}]}},"/api/v1/admin/mcp-activity/summary":{"get":{"operationId":"getMcpActivitySummary","x-charidy-permissions":["organizations.read_all"],"summary":"KPIs for the /admin/mcp-activity Overview tab.","description":"Returns total / ok / error / needs-approval counts, error rate %, p50 + p95 call duration, the most-invoked tools (with failure counts), and the top error codes for the organization over the supplied rolling window (1–90 days, default 7).","parameters":[{"name":"organizationId","required":true,"in":"query","schema":{"type":"string"}},{"name":"windowDays","required":false,"in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/McpActivitySummaryDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["mcp"],"security":[{"bearer":[]}]}},"/api/v1/admin/mcp-activity/incidents":{"get":{"operationId":"listMcpIncidents","x-charidy-permissions":["organizations.read_all"],"summary":"Failed MCP calls that were given a client-quotable code, for the Incidents tab.","description":"Lists `mcp_incidents` rows newest-first for one organization. Pass `reportedOnly=true` for the queue of failures a customer actually asked to report; `expected=false` narrows to likely defects (excluding permission / plan-gate / quota answers). A row whose `reportRef` is null has no ticket.","parameters":[{"name":"organizationId","required":true,"in":"query","schema":{"type":"string"}},{"name":"reportedOnly","required":false,"in":"query","schema":{"type":"boolean"}},{"name":"expected","required":false,"in":"query","schema":{"type":"boolean"}},{"name":"toolName","required":false,"in":"query","schema":{"type":"string"}},{"name":"code","required":false,"in":"query","schema":{"type":"string"}},{"name":"windowDays","required":false,"in":"query","schema":{"type":"integer"}},{"name":"limit","required":false,"in":"query","schema":{"type":"integer"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/McpIncidentPageDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["mcp"],"security":[{"bearer":[]}]}},"/api/v1/admin/mcp-activity/logs/{id}":{"get":{"operationId":"getMcpToolCallLog","x-charidy-permissions":["organizations.read_all"],"summary":"Full detail (including redacted attributes) for a single MCP tool-call log row.","parameters":[{"name":"organizationId","required":true,"in":"query","schema":{"type":"string"}},{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/McpToolCallLogDetailDto"}}}},"401":{"description":"AUTHENTICATION_REQUIRED — missing or invalid Bearer token."},"403":{"description":"Missing required permission for this operation."}},"tags":["mcp"],"security":[{"bearer":[]}]}},"/api/v1/core/mcp-incidents/{code}/report":{"post":{"operationId":"reportMcpIssue","summary":"Report a failed MCP tool call to the Charidy team by its incident code.","description":"Call this ONLY when the user explicitly asks to report a failure, quoting the incident code from the failure message (e.g. \"report MCP-8F3K-2QD7\"). Never report on your own initiative and never invent a code. Reporting the same code twice is safe — it returns the first report instead of filing a duplicate. Tell the user the report id, and do not claim a support ticket exists unless `reference` is set.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"code","required":true,"in":"path","description":"The incident code from the failure message, e.g. MCP-8F3K-2QD7.","schema":{"example":"MCP-8F3K-2QD7","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportMcpIncidentDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/McpIncidentReportResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"404":{"description":"MCP_INCIDENT_NOT_FOUND — no incident with that code belongs to the caller. Ask the user to re-read the code instead of retrying."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.mcpIncidents"],"security":[{"bearer":[]}]}},"/api/v1/core/notifications":{"get":{"operationId":"listNotifications","summary":"List the current user’s in-app notifications (own, paginated, optional unread filter).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"unreadOnly","required":false,"in":"query","description":"Only return unread notifications.","schema":{"default":false,"type":"boolean"}},{"name":"limit","required":false,"in":"query","description":"Page size.","schema":{"minimum":1,"maximum":100,"default":50,"type":"number"}},{"name":"offset","required":false,"in":"query","description":"Offset for pagination.","schema":{"minimum":0,"default":0,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.notifications"],"security":[{"bearer":[]}]}},"/api/v1/core/notifications/unread-count":{"get":{"operationId":"getUnreadNotificationCount","summary":"Return the current user’s unread notification count (for the bell badge).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnreadNotificationCountResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.notifications"],"security":[{"bearer":[]}]}},"/api/v1/core/notifications/preferences":{"get":{"operationId":"getNotificationPreferences","summary":"Return the current user’s per-event notification channel preferences (with defaults).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationPreferencesResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.notifications"],"security":[{"bearer":[]}]},"put":{"operationId":"updateNotificationPreferences","summary":"Upsert the current user’s notification channel preferences (email / in-app per event type).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateNotificationPreferencesDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationPreferencesResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.notifications"],"security":[{"bearer":[]}]}},"/api/v1/core/notifications/push/config":{"get":{"operationId":"getPushNotificationConfig","summary":"Whether push notifications are available here, and the public VAPID key a browser subscribes with.","description":"When to use: before asking a device for notification permission. Push reaches team members on an installed dashboard (PWA); it is never sent to donors.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PushConfigResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.notifications"],"security":[{"bearer":[]}]}},"/api/v1/core/notifications/push/subscriptions":{"get":{"operationId":"listPushSubscriptions","summary":"List the current user’s devices registered for push notifications in this organization.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PushSubscriptionListResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.notifications"],"security":[{"bearer":[]}]},"put":{"operationId":"registerPushSubscription","summary":"Register (or refresh) this device for push notifications, including its quiet-on-Shabbat choice.","description":"When to use: right after the browser granted notification permission and returned a PushSubscription. Re-sending the same endpoint updates it (e.g. toggling quietOnShabbat).","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterPushSubscriptionDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PushSubscriptionResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."},"503":{"description":"PUSH_NOT_CONFIGURED — this environment has no VAPID keys."}},"tags":["core.notifications"],"security":[{"bearer":[]}]}},"/api/v1/core/notifications/push/subscriptions/remove":{"post":{"operationId":"removePushSubscription","summary":"Stop sending push notifications to one of the current user’s devices.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RemovePushSubscriptionDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RemovePushSubscriptionResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.notifications"],"security":[{"bearer":[]}]}},"/api/v1/core/notifications/{notificationId}/read":{"post":{"operationId":"markNotificationRead","summary":"Mark a single notification as read.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"notificationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"404":{"description":"Notification not found for this user."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.notifications"],"security":[{"bearer":[]}]}},"/api/v1/core/notifications/read-all":{"post":{"operationId":"markAllNotificationsRead","summary":"Mark all of the current user’s notifications as read.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","description":"Required for tenant mutations. Replay storage handled by the shared idempotency module.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarkAllNotificationsReadResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.notifications"],"security":[{"bearer":[]}]}},"/api/v1/admin/reporting/activation-funnel":{"get":{"operationId":"getActivationFunnel","x-charidy-permissions":["reports.read"],"summary":"Activation funnel, time-to-live and the abandonment anti-metrics.","description":"The customer-journey report: signup → setup (campaign created) → aha (page published + first donation) → habit (returned within 7 days), plus signup→published time-to-live against the 60-minute target, signup→first-donation, the scan-seeded vs blank-start split, and the two abandonment anti-metrics (lost while waiting for the page vs lost while refining the design). The cohort is defined by signup time inside the window.","parameters":[{"name":"fromIso","required":false,"in":"query","description":"Cohort start — only organizations that signed up on/after this timestamp are counted. Defaults to 90 days ago.","schema":{"format":"date-time","type":"string"}},{"name":"toIso","required":false,"in":"query","description":"Cohort end (exclusive). Defaults to now.","schema":{"format":"date-time","type":"string"}},{"name":"organizationId","required":false,"in":"query","description":"Restrict the report to a single organization.","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivationFunnelResponseDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.reporting"],"security":[{"bearer":[]}]}},"/api/v1/admin/reporting/provider-revenue":{"get":{"operationId":"listPlatformProviderRevenue","x-charidy-permissions":["reports.read"],"summary":"List provider revenue and Crowded source-of-truth state per customer.","description":"Cross-tenant breakdown grouped by organization (customer/chapter) + provider + currency: succeeded-donation gross, provider fees, the commission the provider pays Charidy, net to the org, and reconciliation coverage. Crowded rows additionally expose server-computed collect-payments gross and variance, released gross, fees actually taken, sync coverage, and onboarding state from the latest invitation plus gateway snapshot. Crowded accounts and assigned exceptions remain visible as zero-local rows before a local contribution exists. Supports date-range, provider and organization filters.","parameters":[{"name":"fromIso","required":false,"in":"query","description":"Only count donations created on/after this ISO timestamp.","schema":{"format":"date-time","type":"string"}},{"name":"toIso","required":false,"in":"query","description":"Only count donations created before this ISO timestamp.","schema":{"format":"date-time","type":"string"}},{"name":"provider","required":false,"in":"query","description":"Filter to a single provider.","schema":{"enum":["stripe","meshulam","wallet","crowded"],"type":"string"}},{"name":"organizationId","required":false,"in":"query","description":"Filter to a single organization (customer).","schema":{"format":"uuid","type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":500,"default":100,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListPlatformProviderRevenueResponseDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.reporting"],"security":[{"bearer":[]}]}},"/api/v1/admin/reporting/provider-revenue/summary":{"get":{"operationId":"getPlatformRevenueSummary","x-charidy-permissions":["reports.read"],"summary":"Platform totals + per-provider rollup of commission earned.","description":"Aggregates the same succeeded-donation data into a per-provider/currency rollup across all customers, plus the count of distinct customers in scope. Supports the same filters as listPlatformProviderRevenue.","parameters":[{"name":"fromIso","required":false,"in":"query","description":"Only count donations created on/after this ISO timestamp.","schema":{"format":"date-time","type":"string"}},{"name":"toIso","required":false,"in":"query","description":"Only count donations created before this ISO timestamp.","schema":{"format":"date-time","type":"string"}},{"name":"provider","required":false,"in":"query","description":"Filter to a single provider.","schema":{"enum":["stripe","meshulam","wallet","crowded"],"type":"string"}},{"name":"organizationId","required":false,"in":"query","description":"Filter to a single organization (customer).","schema":{"format":"uuid","type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":500,"default":100,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlatformRevenueSummaryResponseDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required permission for this operation."}},"tags":["admin.reporting"],"security":[{"bearer":[]}]}},"/api/v1/core/team/members":{"get":{"operationId":"listTeamMembers","x-charidy-permissions":["team.read"],"summary":"List members of the active organization","description":"Returns every active, invited or suspended membership in the caller active organization for team management.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamMembersResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required team.read permission."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.team"],"security":[{"bearer":[]}]}},"/api/v1/core/team/roles":{"get":{"operationId":"listTeamAssignableRoles","x-charidy-permissions":["team.read"],"summary":"List roles assignable to members of the active organization","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamRolesResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required team.read permission."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.team"],"security":[{"bearer":[]}]}},"/api/v1/core/team/members/{membershipId}/role":{"patch":{"operationId":"updateTeamMemberRole","x-charidy-permissions":["team.update"],"summary":"Change the organization role of a team member","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"membershipId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTeamMemberRoleDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamMemberDto"}}}},"400":{"description":"Role is not assignable or last-owner protection."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required team.update permission."},"404":{"description":"Membership was not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.team"],"security":[{"bearer":[]}]}},"/api/v1/core/team/members/{membershipId}":{"delete":{"operationId":"removeTeamMember","x-charidy-permissions":["team.remove"],"summary":"Remove a member from the active organization","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"membershipId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"204":{"description":"Member removed."},"400":{"description":"Cannot remove the last active owner."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required team.remove permission."},"404":{"description":"Membership was not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.team"],"security":[{"bearer":[]}]}},"/api/v1/core/team/invitations":{"get":{"operationId":"listTeamInvitations","x-charidy-permissions":["team.read"],"summary":"List pending invitations for the active organization","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamInvitationsResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required team.read permission."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.team"],"security":[{"bearer":[]}]},"post":{"operationId":"createTeamInvitation","x-charidy-permissions":["team.invite"],"summary":"Invite a person by email to join the active organization","description":"Creates a pending invitation, sends an email with an acceptance link, and records a team.member.invited domain event. Usable from the dashboard and from the MCP chat connector.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTeamInvitationDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTeamInvitationResponseDto"}}}},"400":{"description":"Role is not assignable for this organization."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required team.invite permission."},"409":{"description":"Email already a member or already invited."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.team"],"security":[{"bearer":[]}]}},"/api/v1/core/team/invitations/{invitationId}/resend":{"post":{"operationId":"resendTeamInvitation","x-charidy-permissions":["team.invite"],"summary":"Re-issue and re-send a pending invitation","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"invitationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTeamInvitationResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required team.invite permission."},"404":{"description":"Pending invitation was not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.team"],"security":[{"bearer":[]}]}},"/api/v1/core/team/invitations/{invitationId}":{"delete":{"operationId":"revokeTeamInvitation","x-charidy-permissions":["team.invite"],"summary":"Revoke a pending invitation","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"invitationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"204":{"description":"Invitation revoked."},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"Missing required team.invite permission."},"404":{"description":"Pending invitation was not found."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["core.team"],"security":[{"bearer":[]}]}},"/api/v1/core/invitations/{token}":{"get":{"operationId":"getInvitationByToken","summary":"Preview an organization invitation by its token","description":"Public endpoint used by the acceptance page to show the organization and role before the invitee signs in. Returns valid=false for unknown, revoked or expired tokens without leaking details.","parameters":[{"name":"token","required":true,"in":"path","description":"Raw invitation token from the email link.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvitationPreviewDto"}}}}},"tags":["core.invitations"]}},"/api/v1/core/invitations/{token}/accept":{"post":{"operationId":"acceptInvitation","summary":"Accept an organization invitation as the signed-in user","description":"Creates or re-activates the membership for the authenticated user and marks the invitation accepted. The signed-in user email must match the invited email.","parameters":[{"name":"token","required":true,"in":"path","description":"Raw invitation token from the email link.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptInvitationResponseDto"}}}},"401":{"description":"JWT access token is missing or invalid."},"403":{"description":"The invitation was issued for a different email."},"404":{"description":"Invitation token was not found."},"410":{"description":"Invitation is expired or no longer pending."}},"tags":["core.invitations"],"security":[{"bearer":[]}]}},"/api/v1/auth/signup/invite/{token}":{"post":{"operationId":"signupFromInvitation","summary":"Create an account from a team invitation and join the organization.","description":"The email address comes from the invitation, never from the request body. Signup and acceptance happen in one transaction, so the caller is never an authenticated user with zero organizations.","parameters":[{"name":"token","required":true,"in":"path","description":"Single-use invitation token from the email link.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignupFromInvitationDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignupFromInvitationResponseDto"}}}},"400":{"description":"AUTH_PASSWORD_WEAK / AUTH_TERMS_NOT_ACCEPTED / LEGAL_DOCUMENT_VERSION_UNKNOWN / ROLE_NOT_ASSIGNABLE"},"403":{"description":"ORGANIZATION_NOT_ACCEPTING_MEMBERS"},"404":{"description":"INVITATION_NOT_FOUND"},"409":{"description":"INVITE_SIGNUP_ACCOUNT_EXISTS"},"410":{"description":"INVITATION_NOT_PENDING / INVITATION_EXPIRED"}},"tags":["auth"]}},"/api/v1/users/me/organizations":{"get":{"operationId":"getMyOrganizations","summary":"List organizations where the current user is a member","description":"Returns all tenants the user has access to. Used to discover `x-organization-id` for subsequent requests.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MyOrganizationResponseDto"}}}}}},"tags":["users"],"security":[{"bearer":[]}]}},"/api/v1/users/me/invitations":{"get":{"operationId":"getMyPendingInvitations","x-charidy-scope":"portal","summary":"List pending organization invitations addressed to the current user's verified email","description":"Cross-tenant by nature: the caller is not yet a member of the inviting organization, so there is no `x-organization-id` to send. Matched on the JWT subject's verified email only — never on a caller-supplied address — and returns an opaque invitation id, never the token.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyPendingInvitationsResponseDto"}}}}},"tags":["users"],"security":[{"bearer":[]}]}},"/api/v1/users/me/invitations/{invitationId}/accept":{"post":{"operationId":"acceptMyPendingInvitation","x-charidy-scope":"portal","summary":"Accept a pending invitation addressed to the current verified email","description":"Keyed on the invitation id plus the caller's verified email rather than the token, which lives only in the email. Without this the in-app surface could show an invitation but do nothing about it.","parameters":[{"name":"invitationId","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptMyInvitationResponseDto"}}}},"403":{"description":"AUTH_EMAIL_NOT_VERIFIED / INVITATION_EMAIL_MISMATCH"},"404":{"description":"INVITATION_NOT_FOUND"}},"tags":["users"],"security":[{"bearer":[]}]}},"/api/v1/users/me/super-admin":{"get":{"operationId":"getMySuperAdminStatus","summary":"Report whether the current user holds a platform super-admin role","description":"Resolves super-admin status from platform system-role grants (`global_user_system_roles`), matching the API authorization guard. Use this to gate the admin control-plane UI; organization-membership discovery (`getMyOrganizations`) does not surface global system-role grants.","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MySuperAdminStatusResponseDto"}}}}},"tags":["users"],"security":[{"bearer":[]}]}},"/api/v1/users/me/profile":{"get":{"operationId":"getMyProfile","x-charidy-scope":"tenant","summary":"Return the current user profile and connected login providers.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyProfileResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["users"],"security":[{"bearer":[]}]},"patch":{"operationId":"updateMyProfile","x-charidy-scope":"tenant","summary":"Update the current user profile, locale, timezone, and wording preference.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateMyProfileDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyProfileResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["users"],"security":[{"bearer":[]}]}},"/api/v1/users/me/password":{"post":{"operationId":"setOrChangeMyPassword","x-charidy-scope":"tenant","summary":"Set a first password for an OAuth account or change an existing password.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetOrChangeMyPasswordDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["users"],"security":[{"bearer":[]}]}},"/api/v1/users/me/email-change/request":{"post":{"operationId":"requestMyEmailChange","x-charidy-scope":"tenant","summary":"Request a verified email change for the current user.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestMyEmailChangeDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestMyEmailChangeResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"409":{"description":"EMAIL_CHANGE_EMAIL_IN_USE"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["users"],"security":[{"bearer":[]}]}},"/api/v1/users/me/email-change/confirm":{"post":{"operationId":"confirmMyEmailChange","x-charidy-scope":"tenant","summary":"Confirm a pending email change token for the current user.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmMyEmailChangeDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyProfileResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"409":{"description":"EMAIL_CHANGE_EMAIL_IN_USE"},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["users"],"security":[{"bearer":[]}]}},"/api/v1/users/me/avatar":{"post":{"operationId":"updateMyAvatar","x-charidy-scope":"tenant","summary":"Upload or attach a profile avatar for the current user.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateMyAvatarDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyProfileResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["users"],"security":[{"bearer":[]}]}},"/api/v1/users/me/avatar/import-from-provider":{"post":{"operationId":"importMyAvatarFromProvider","x-charidy-scope":"tenant","summary":"Import the current user avatar from a connected OAuth provider.","parameters":[{"name":"x-organization-id","in":"header","description":"Tenant scope — UUID of the organization on whose behalf the request is made. Auto-injected by `@charidy/sdk` middleware for authenticated callers. Direct API consumers and AI agents MUST set this for any tenant-scoped capability.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-user-id","in":"header","description":"Authenticated user id. Sent alongside `x-organization-id` so audit and permission checks can attribute the action to a human or AI agent acting on behalf of a user.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-actor-id","in":"header","description":"Effective actor id (impersonation). When omitted, defaults to `x-user-id`. Super-admin impersonation flows MUST set this explicitly.","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportMyAvatarFromProviderDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyProfileResponseDto"}}}},"400":{"description":"TENANT_CONTEXT_MISSING — `x-organization-id` header is required."},"422":{"description":"VALIDATION_FAILED — `x-organization-id` is not a valid UUID."}},"tags":["users"],"security":[{"bearer":[]}]}}},"info":{"title":"Givearoo API","description":"HTTP API for Givearoo campaigns, donations, and nonprofit CRM. Organization operations require a Givearoo bearer token and the relevant permissions. For connections from AI assistants, use the remote MCP server and OAuth.","version":"0.0.0","contact":{}},"tags":[],"servers":[{"url":"https://www.givearoo.com"}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"HealthResponseDto":{"type":"object","properties":{"status":{"type":"string","example":"ok","enum":["ok","degraded"]},"database":{"type":"string","example":"up","enum":["up","down","unknown"]},"buildSha":{"type":"string","example":"5c1131e3f27d8a843479ff6b2a739971ae17bb74","description":"Git commit baked into the running API image. `unknown` is used only for local/non-release builds."}},"required":["status","database","buildSha"]},"CreateAccessRequestDto":{"type":"object","properties":{"resourceLabel":{"type":"string","description":"Human-readable area the caller tried to open.","example":"Campaigns"},"requiredPermissions":{"description":"Permission keys required to open the requested area.","example":["campaigns.read"],"type":"array","items":{"type":"string"}},"currentRole":{"type":"string","description":"Role label shown to the requester when the access request was created.","example":"agent"},"reason":{"type":"string","description":"Optional requester note for the organization admins."}},"required":["resourceLabel","requiredPermissions"]},"AccessRequestResponseDto":{"type":"object","properties":{"delivered":{"type":"boolean","description":"Whether at least one organization admin was notified."},"recipientCount":{"type":"number","description":"Number of organization admins notified."}},"required":["delivered","recipientCount"]},"RequestFeatureActivationDto":{"type":"object","properties":{"featureKey":{"type":"string","description":"Registered feature-flag key of the switched-off or plan-gated area the organization wants activated.","example":"nav.tasks.enabled"}},"required":["featureKey"]},"FeatureActivationResponseDto":{"type":"object","properties":{"delivered":{"type":"boolean","description":"True when the request was handed to the Givearoo team."},"alreadyRequested":{"type":"boolean","description":"True when this organization already asked for the same feature recently, so no second request was sent."}},"required":["delivered","alreadyRequested"]},"SupportContactResponseDto":{"type":"object","properties":{"supportEmail":{"type":"string","description":"Address shown to organizations when they need to reach the operator — today, the \"contact us to increase quota\" CTA on /settings/communications.","example":"support@facio.io"},"isDefault":{"type":"boolean","description":"true when no address has been configured and the compiled-in default is being served. Configure one to take ownership of it."},"updatedAt":{"type":"string","nullable":true,"format":"date-time","description":"When the address was last changed. null while the default is in effect."}},"required":["supportEmail","isDefault","updatedAt"]},"UpdateSupportContactDto":{"type":"object","properties":{"supportEmail":{"type":"string","description":"A single deliverable mailbox. Shown to every organization, so it must be one somebody actually reads — not a personal address.","example":"support@facio.io","maxLength":320}},"required":["supportEmail"]},"RegisterOrganizationOrgDto":{"type":"object","properties":{"legalName":{"type":"string","minLength":2,"maxLength":200},"region":{"type":"string","enum":["IL","US_CA","AU_NZ","FR","ZA","OTHER"],"description":"Legacy coarse activity region. Optional — prefer the explicit `country` + `defaultCurrency` pair. When supplied without country/currency it still derives both."},"country":{"type":"string","minLength":2,"maxLength":2,"description":"ISO 3166-1 alpha-2 country code (e.g. \"US\", \"IL\"). Takes precedence over `region`."},"defaultCurrency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code (e.g. \"USD\", \"ILS\"). Defaults from the country when omitted."},"websiteUrl":{"type":"string","maxLength":2048,"format":"uri"},"kind":{"type":"string","enum":["non_profit","personal_cause"],"description":"Defaults to `non_profit`."},"referredBySalesRepUserId":{"type":"string","format":"uuid","description":"GlobalUser id of the Charidy sales representative who referred this org. Must hold the active `sales_rep` system role; resolve via GET /api/v1/public/sales-representatives."},"planKey":{"type":"string","maxLength":64,"description":"Subscription package chosen on the public pricing page — a `charidy_billing_plans.key` (e.g. \"togo\", \"standard\", \"professional\"). Advisory: the org is opened on this plan only when it is published AND self-serve; otherwise it opens on the catalog default and the request is retained as a sales lead. An unknown key is ignored, never an error."}},"required":["legalName"]},"RegisterOrganizationUserDto":{"type":"object","properties":{"firstName":{"type":"string","minLength":1,"maxLength":100,"description":"Optional. When omitted the display name is derived from the email local part."},"lastName":{"type":"string","minLength":1,"maxLength":100},"email":{"type":"string","format":"email"},"phone":{"type":"string","maxLength":32},"password":{"type":"string","minLength":10,"maxLength":200,"description":"Legacy. Sign-up is passwordless: send `emailProof` instead. Only honoured while AUTH_PASSWORD_AUTH_ENABLED is on."},"emailProof":{"type":"string","description":"Single-use proof returned by POST /auth/otp/verify-signup for this email. Required unless a legacy `password` is sent."},"preferredLocale":{"type":"string","enum":["en","he"]}},"required":["email"]},"LegalConsentDto":{"type":"object","properties":{"termsVersion":{"type":"string","example":"2026-08-05","maxLength":32,"description":"Version of the Terms of Use the client displayed. Must be a version this platform still publishes (LEGAL_DOCUMENT_VERSIONS / LEGAL_DOCUMENT_VERSION_HISTORY in @charidy/shared) — an unknown value is refused with LEGAL_DOCUMENT_VERSION_UNKNOWN rather than stored."},"privacyVersion":{"type":"string","example":"2026-08-05","maxLength":32,"description":"Version of the Privacy Notice the client displayed. Same rules as termsVersion."},"documentLocale":{"type":"string","enum":["en","he"],"description":"Language of the interface the documents were presented in. The document bodies are English-only today, so this records the surrounding UI."}},"required":["termsVersion","privacyVersion"]},"RegisterOrganizationBodyDto":{"type":"object","properties":{"organization":{"$ref":"#/components/schemas/RegisterOrganizationOrgDto"},"user":{"$ref":"#/components/schemas/RegisterOrganizationUserDto"},"termsAccepted":{"type":"boolean","description":"Must be true."},"legalConsent":{"description":"CHAR-12 — which document versions the user was shown when they accepted. Optional while clients roll out; enforced when LEGAL_CONSENT_REQUIRED is on. Omitting it records NO acceptance (the server never invents a version), so `termsAccepted: true` alone leaves no evidence.","allOf":[{"$ref":"#/components/schemas/LegalConsentDto"}]}},"required":["organization","user","termsAccepted"]},"RegisteredOrganizationDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"legalName":{"type":"string"},"country":{"type":"string"},"defaultCurrency":{"type":"string"},"status":{"type":"string"}},"required":["id","slug","legalName","country","defaultCurrency","status"]},"AuthenticatedUserDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"displayName":{"type":"object","nullable":true},"emailVerifiedAt":{"type":"object","format":"date-time","nullable":true},"preferredLocale":{"type":"string","enum":["en","he"],"nullable":true}},"required":["id","email","displayName","emailVerifiedAt","preferredLocale"]},"AuthSessionDto":{"type":"object","properties":{"accessToken":{"type":"string"},"accessTokenExpiresAt":{"type":"string","format":"date-time"},"refreshToken":{"type":"string"},"refreshTokenExpiresAt":{"type":"string","format":"date-time"},"familyId":{"type":"string","format":"uuid"}},"required":["accessToken","accessTokenExpiresAt","refreshToken","refreshTokenExpiresAt","familyId"]},"RegisterOrganizationResponseDto":{"type":"object","properties":{"organization":{"$ref":"#/components/schemas/RegisteredOrganizationDto"},"user":{"$ref":"#/components/schemas/AuthenticatedUserDto"},"session":{"$ref":"#/components/schemas/AuthSessionDto"}},"required":["organization","user","session"]},"LoginBodyDto":{"type":"object","properties":{"email":{"type":"string","format":"email"},"password":{"type":"string"}},"required":["email","password"]},"LoginResponseDto":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/AuthenticatedUserDto"},"session":{"$ref":"#/components/schemas/AuthSessionDto"}},"required":["user","session"]},"OtpRequestBodyDto":{"type":"object","properties":{"email":{"type":"string","format":"email"},"purpose":{"type":"string","enum":["signup","login"]},"locale":{"type":"string","enum":["en","he"]}},"required":["email","purpose"]},"OtpStatusResponseDto":{"type":"object","properties":{"ok":{"type":"boolean"},"flow":{"type":"string","enum":["login","signup"],"description":"login when a sign-in code was emailed. signup when the address has no account and a registration code was emailed instead."}},"required":["ok","flow"]},"OtpVerifyBodyDto":{"type":"object","properties":{"email":{"type":"string","format":"email"},"code":{"type":"string","minLength":6,"maxLength":16,"description":"6-character code from the email (spaces/dashes ignored)."}},"required":["email","code"]},"OtpSignupProofResponseDto":{"type":"object","properties":{"proof":{"type":"string","description":"Single-use proof to pass as user.emailProof when registering."}},"required":["proof"]},"OauthCodeExchangeBodyDto":{"type":"object","properties":{"code":{"type":"string","minLength":8},"codeVerifier":{"type":"string","minLength":43,"maxLength":128,"description":"PKCE code verifier generated before redirecting to the provider."},"redirectUri":{"type":"string","format":"uri","description":"Must match the configured OAuth redirect URI for the provider."},"displayName":{"type":"string","maxLength":200,"description":"Display name captured on the first authorization (Apple only returns the user's name once, in the callback `user` payload)."},"legalConsent":{"description":"CHAR-12 — present only when this exchange is a SIGNUP whose consent box was ticked; the web app stamps the versions server-side into the httpOnly OAuth state cookie. Recorded only on the branch that creates a new user: this endpoint serves login and signup alike, and a returning user is not re-accepting anything.","allOf":[{"$ref":"#/components/schemas/LegalConsentDto"}]}},"required":["code","codeVerifier","redirectUri"]},"RefreshBodyDto":{"type":"object","properties":{"refreshToken":{"type":"string"}},"required":["refreshToken"]},"LogoutBodyDto":{"type":"object","properties":{"refreshToken":{"type":"string"}},"required":["refreshToken"]},"StatusResponseDto":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"]},"VerifyEmailBodyDto":{"type":"object","properties":{"token":{"type":"string"}},"required":["token"]},"ResendVerificationResponseDto":{"type":"object","properties":{"ok":{"type":"boolean"},"sent":{"type":"boolean","description":"True when a fresh verification email was queued."},"alreadyVerified":{"type":"boolean","description":"The address is already verified; nothing was sent."},"throttled":{"type":"boolean","description":"A link was issued less than a minute ago; nothing was sent."}},"required":["ok","sent","alreadyVerified","throttled"]},"ForgotPasswordBodyDto":{"type":"object","properties":{"email":{"type":"string","format":"email"}},"required":["email"]},"ResetPasswordBodyDto":{"type":"object","properties":{"token":{"type":"string"},"newPassword":{"type":"string","minLength":10}},"required":["token","newPassword"]},"WhoAmIResponseDto":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/AuthenticatedUserDto"}},"required":["user"]},"PublicSalesRepresentativeDto":{"type":"object","properties":{"globalUserId":{"type":"string","format":"uuid","description":"GlobalUser id. Submit on signup as `referredBySalesRepUserId`."},"displayName":{"type":"string","description":"Public display name shown in the signup dropdown."},"referralCode":{"type":"object","nullable":true,"description":"Optional URL-safe code used for `?ref=<code>` deep-links from rep-personalised signup URLs."}},"required":["globalUserId","displayName","referralCode"]},"PublicSalesRepresentativesListResponseDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/PublicSalesRepresentativeDto"}}},"required":["items"]},"AdminAddonPriceDto":{"type":"object","properties":{"planKey":{"type":"string"},"currency":{"type":"string"},"interval":{"type":"string","enum":["month","year","one_time"]},"amountMinor":{"type":"number"},"isActive":{"type":"boolean"}},"required":["planKey","currency","interval","amountMinor","isActive"]},"AdminBillingAddonDto":{"type":"object","properties":{"key":{"type":"string"},"prices":{"type":"array","items":{"$ref":"#/components/schemas/AdminAddonPriceDto"}},"kind":{"type":"string","enum":["quantity","capability","one_time"]},"status":{"type":"string","enum":["draft","published","archived"]},"sortOrder":{"type":"number"},"entitlementKey":{"type":"string","nullable":true},"capabilityKey":{"type":"string","nullable":true},"unitStep":{"type":"number"},"marketing":{"type":"object","additionalProperties":true}},"required":["key","prices","kind","status","sortOrder","entitlementKey","capabilityKey","unitStep","marketing"]},"SetPlanFeatureAvailabilityDto":{"type":"object","properties":{"mode":{"type":"string","enum":["included","blocked","addon"]},"addonKey":{"type":"string"}},"required":["mode"]},"SaveBillingAddonDto":{"type":"object","properties":{"kind":{"type":"string","enum":["quantity","capability","one_time"]},"status":{"type":"string","enum":["draft","published","archived"]},"entitlementKey":{"type":"string","nullable":true},"capabilityKey":{"type":"string","nullable":true},"unitStep":{"type":"number","minimum":1},"sortOrder":{"type":"number","minimum":0},"marketing":{"type":"object","additionalProperties":true},"notes":{"type":"string","maxLength":2000}},"required":["kind","status","unitStep","sortOrder","marketing"]},"SubscriptionAddonChangeDto":{"type":"object","properties":{"id":{"type":"string"},"addonKey":{"type":"string"},"quantity":{"type":"number"},"status":{"type":"string","enum":["pending_payment","scheduled","active","failed","ended"]},"paymentUrl":{"type":"string","nullable":true},"effectiveAt":{"type":"string","nullable":true},"nextAction":{"type":"string","enum":["pay_invoice","retry","wait_for_period_end","purchase_again","none"]}},"required":["id","addonKey","quantity","status","paymentUrl","effectiveAt","nextAction"]},"SubscriptionItemDto":{"type":"object","properties":{"addonKey":{"type":"string"},"quantity":{"type":"number"},"unitPriceMinor":{"type":"number","description":"Price per unit captured at purchase time."},"currency":{"type":"string","minLength":3,"maxLength":3}},"required":["addonKey","quantity","unitPriceMinor","currency"]},"AmountDueLineDto":{"type":"object","properties":{"kind":{"type":"string","enum":["plan","addon"]},"label":{"type":"string","description":"Plan key or add-on key."},"quantity":{"type":"number"},"amountMinor":{"type":"number","description":"Line total in minor units (unit price × quantity)."}},"required":["kind","label","quantity","amountMinor"]},"AmountDueDto":{"type":"object","properties":{"currency":{"type":"string","minLength":3,"maxLength":3},"interval":{"type":"string","enum":["month","year","one_time"]},"recurringTotalMinor":{"type":"number","description":"Recurring total for the current period, in minor units."},"oneTimeTotalMinor":{"type":"number","description":"One-off charges (e.g. onboarding), reported apart so the recurring figure is not inflated."},"discountMinor":{"type":"number","description":"Minor units taken off the recurring total by the organization’s active coupon. Zero when there is none."},"couponCode":{"type":"string","nullable":true,"description":"The coupon producing `discountMinor`, or null."},"netRecurringTotalMinor":{"type":"number","description":"What the organization actually owes for the period: recurringTotalMinor minus discountMinor. This is the figure to show, not the gross."},"lines":{"type":"array","items":{"$ref":"#/components/schemas/AmountDueLineDto"}}},"required":["currency","interval","recurringTotalMinor","oneTimeTotalMinor","discountMinor","couponCode","netRecurringTotalMinor","lines"]},"BillingCapabilityDto":{"type":"object","properties":{"provider":{"type":"string","description":"Active platform-billing provider (\"manual\" = none wired)."},"canCollect":{"type":"boolean","description":"Whether money can actually be collected. When false, an upgrade is a recorded commitment invoiced offline — never tell the customer they were charged."},"paymentMethodConfigured":{"type":"boolean"},"reasonCode":{"type":"string","nullable":true,"description":"Why collection is unavailable, e.g. PAYMENT_TERMINAL_NOT_CONFIGURED."}},"required":["provider","canCollect","paymentMethodConfigured"]},"SubscriptionResponseDto":{"type":"object","properties":{"fullAccessEndsAt":{"type":"string","nullable":true,"format":"date-time","description":"Exclusive end of the active full-access promotion, if any."},"registrationPaymentExempt":{"type":"boolean","description":"Pending registration has an active 100% forever coupon and needs no card. Does not prove payment or start a trial."},"registrationPaymentRequired":{"type":"boolean","description":"New registration must finish provider card setup; legacy accounts remain unchanged."},"cardConfigured":{"type":"boolean"},"paymentUrl":{"type":"string","nullable":true},"trialStartedAt":{"type":"string","nullable":true,"format":"date-time"},"firstPaidAt":{"type":"string","nullable":true,"format":"date-time"},"commitmentEndsAt":{"type":"string","nullable":true,"format":"date-time"},"graceEndsAt":{"type":"string","nullable":true,"format":"date-time"},"pendingPlanEffectiveAt":{"type":"string","nullable":true,"format":"date-time"},"pendingPlanKey":{"type":"string","nullable":true},"addonChanges":{"type":"array","items":{"$ref":"#/components/schemas/SubscriptionAddonChangeDto"}},"id":{"type":"string","format":"uuid"},"planKey":{"type":"string"},"status":{"type":"string","enum":["trialing","active","past_due","frozen","canceled","expired"],"description":"`frozen` = a trial ended without the org ever paying (account held, data kept). `past_due` = money is owed; the organization keeps its plan and every capability it grants while it settles — the debt and the entitlement are tracked separately on purpose."},"interval":{"type":"string","enum":["month","year","one_time"]},"currency":{"type":"string","minLength":3,"maxLength":3},"basePriceMinor":{"type":"number","description":"Package price captured at sale time, in minor units."},"provider":{"type":"string","description":"Who collects the money. \"manual\" means nothing is charged automatically — finance invoices offline."},"requestedPlanKey":{"type":"string","nullable":true},"trialEndsAt":{"type":"string","nullable":true,"format":"date-time"},"currentPeriodStart":{"type":"string","format":"date-time"},"currentPeriodEnd":{"type":"string","nullable":true,"format":"date-time"},"cancelAtPeriodEnd":{"type":"boolean"},"items":{"type":"array","items":{"$ref":"#/components/schemas/SubscriptionItemDto"}},"dunningReason":{"type":"string","nullable":true,"enum":["trial_ended","payment_failed"],"description":"Why the account is frozen or past due. Null while healthy."},"frozenAt":{"type":"string","nullable":true,"format":"date-time"},"dataRetentionUntil":{"type":"string","nullable":true,"format":"date-time","description":"POLICY DATE ONLY — until when the account stays live and readable. Nothing in the platform deletes data on it; the purge pipeline is not built."},"backupRetentionUntil":{"type":"string","nullable":true,"format":"date-time","description":"POLICY DATE ONLY — until when a backup is kept. No backup is written by the platform."},"downgradedFromPlanKey":{"type":"string","nullable":true,"description":"Plan to restore once a failed payment is settled."},"amountDue":{"description":"What would be invoiced — not a charge.","allOf":[{"$ref":"#/components/schemas/AmountDueDto"}]},"billing":{"$ref":"#/components/schemas/BillingCapabilityDto"}},"required":["id","planKey","status","interval","currency","basePriceMinor","provider","currentPeriodStart","cancelAtPeriodEnd","items","amountDue","billing"]},"ChangePlanDto":{"type":"object","properties":{"quoteToken":{"type":"string","description":"Signed server price preview required for paid plan changes."},"prorationDate":{"type":"number","description":"Provider preview timestamp; expires after five minutes."},"planKey":{"type":"string","maxLength":64,"description":"Target plan catalog key."},"interval":{"type":"string","enum":["month","year","one_time"],"description":"Defaults to the current billing interval."}},"required":["planKey"]},"MarkPaymentFailedDto":{"type":"object","properties":{"note":{"type":"string","maxLength":500,"description":"What the provider/finance reported — kept on the subscription row for support."}}},"EffectiveSettingsResponseDto":{"type":"object","properties":{"fullAccessEndsAt":{"type":"string","nullable":true,"format":"date-time","description":"Exclusive end of the active full-access promotion, if any."},"organizationId":{"type":"string","format":"uuid"},"planKey":{"type":"string","nullable":true,"description":"null when the organization has no subscription — then no limit is declared."},"subscriptionStatus":{"type":"string","nullable":true},"trialEndsAt":{"type":"string","nullable":true,"format":"date-time"},"currentPeriodEnd":{"type":"string","nullable":true,"format":"date-time"},"entitlements":{"type":"object","additionalProperties":true,"description":"Resolved typed limits: plan → + purchased add-ons → override. A null value means unlimited; an absent key means no limit is declared."},"flags":{"type":"object","additionalProperties":{"type":"boolean"},"description":"Resolved boolean capability gates the plan has an opinion about."},"hasOverride":{"type":"boolean","description":"True when a super-admin entitlement override is contributing."},"resolvedAt":{"type":"string","format":"date-time"}},"required":["organizationId","entitlements","flags","hasOverride","resolvedAt"]},"TenantContractResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"commissionRate":{"type":"number","description":"Decimal in [0,1]. 0.0250 = 2.5%.","example":0.025},"includedSmsQuota":{"type":"number","description":"SMS quota included before overage pricing kicks in (per period)."},"includedEmailQuota":{"type":"number","description":"Email quota included before overage pricing kicks in (per period)."},"overageSmsPrice":{"type":"number","description":"Per-message price billed once includedSmsQuota is exhausted."},"overageEmailPrice":{"type":"number","description":"Per-message price billed once includedEmailQuota is exhausted."},"currency":{"type":"string","description":"ISO 4217 currency code.","example":"USD"},"activeFrom":{"type":"string","format":"date-time"},"activeUntil":{"type":"string","nullable":true,"format":"date-time"},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","commissionRate","includedSmsQuota","includedEmailQuota","overageSmsPrice","overageEmailPrice","currency","activeFrom","activeUntil","notes","createdAt","updatedAt"]},"UpsertTenantContractDto":{"type":"object","properties":{"commissionRate":{"type":"number","description":"Decimal in [0,1]. 0.0250 = 2.5%.","minimum":0,"maximum":1},"includedSmsQuota":{"type":"number","minimum":0},"includedEmailQuota":{"type":"number","minimum":0},"overageSmsPrice":{"type":"number","minimum":0,"default":0},"overageEmailPrice":{"type":"number","minimum":0,"default":0},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"},"activeFrom":{"type":"string","format":"date-time"},"activeUntil":{"type":"string","nullable":true,"format":"date-time"},"notes":{"type":"string","nullable":true,"maxLength":1000}},"required":["commissionRate","includedSmsQuota","includedEmailQuota","activeFrom"]},"MonthlyOverageResponseDto":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"periodYyyymm":{"type":"number","description":"YYYYMM, e.g. 202605 for May 2026."},"smsOverageUnits":{"type":"number","description":"SMS messages sent above the included quota."},"emailOverageUnits":{"type":"number","description":"Email messages sent above the included quota."},"smsOverageAmount":{"type":"number","description":"SMS overage cost = smsOverageUnits * overageSmsPrice."},"emailOverageAmount":{"type":"number","description":"Email overage cost = emailOverageUnits * overageEmailPrice."},"currency":{"type":"string","description":"currency from TenantContract."},"contractMissing":{"type":"boolean","description":"true if the org has no contract (defaults: 0 quotas, 0 prices)."}},"required":["organizationId","periodYyyymm","smsOverageUnits","emailOverageUnits","smsOverageAmount","emailOverageAmount","currency","contractMissing"]},"GrantBillingCreditDto":{"type":"object","properties":{"amountMinor":{"type":"number","description":"Positive integer, minor units (e.g. cents)."},"currency":{"type":"string","description":"3-letter ISO currency code."},"reason":{"type":"string","description":"Why this credit is being granted. Required and stored for audit — this is money, treated the same as a coupon revocation reason."}},"required":["amountMinor","currency","reason"]},"BillingCreditDto":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"amountMinor":{"type":"number","description":"Positive integer, minor units."},"currency":{"type":"string"},"reason":{"type":"string"},"outcome":{"type":"string","enum":["applied","failed"],"description":"\"applied\" reached the payment provider and reduces what the organization owes on its next invoice. \"failed\" means nothing changed anywhere real — see failureCode."},"failureCode":{"type":"string","nullable":true,"description":"Set only when outcome = \"failed\", e.g. CREDIT_REQUIRES_STRIPE_PROVIDER."},"providerBalanceTransactionRef":{"type":"string","nullable":true,"description":"The Stripe customer_balance_transaction id. Set only when outcome = \"applied\"."},"actorId":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","amountMinor","currency","reason","outcome","failureCode","providerBalanceTransactionRef","actorId","createdAt"]},"AdminCouponDto":{"type":"object","properties":{"discountKind":{"type":"string","enum":["percent_off","amount_off"]},"percentOffBps":{"type":"number","nullable":true,"description":"Basis points off for a percentage coupon. 10000 = free."},"amountOffMinor":{"type":"number","nullable":true,"description":"Minor units off for a fixed coupon."},"currency":{"type":"string","nullable":true},"duration":{"type":"string","enum":["once","repeating","forever"]},"durationInMonths":{"type":"number","nullable":true},"grantsFullAccess":{"type":"boolean","description":"The code unlocks a full-access grant."},"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["draft","published","archived"]},"description":{"type":"string","description":"Human summary, e.g. \"100% off for 3 months\"."},"appliesToPlanKeys":{"description":"Empty means every plan.","type":"array","items":{"type":"string"}},"appliesToIntervals":{"description":"Empty means every billing interval.","type":"array","items":{"type":"string"}},"maxRedemptions":{"type":"number","nullable":true},"maxRedemptionsPerOrg":{"type":"number"},"newCustomersOnly":{"type":"boolean"},"redemptionCount":{"type":"number"},"redeemBy":{"type":"string","nullable":true},"providerCouponRef":{"type":"string","nullable":true,"description":"The provider coupon this row is mirrored to. Null means the discount is honoured in our amount-due figure but NOT applied at checkout."},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["discountKind","percentOffBps","amountOffMinor","currency","duration","durationInMonths","id","code","name","status","description","appliesToPlanKeys","appliesToIntervals","maxRedemptions","maxRedemptionsPerOrg","newCustomersOnly","redemptionCount","redeemBy","providerCouponRef","notes","createdAt","updatedAt"]},"CreateCouponDto":{"type":"object","properties":{"grantsFullAccess":{"type":"boolean","description":"Grant full access for five calendar months, with no total redemption cap."},"code":{"type":"string","description":"Normalized to upper case. 3–64 of A–Z, 0–9, hyphen, underscore."},"name":{"type":"string","description":"Internal label shown in the admin table."},"discountKind":{"type":"string","enum":["percent_off","amount_off"]},"percentOffBps":{"type":"number","description":"Required for percent_off. 10000 = 100% off."},"amountOffMinor":{"type":"number","description":"Required for amount_off, in minor units."},"currency":{"type":"string","description":"Required for amount_off."},"duration":{"type":"string","enum":["once","repeating","forever"],"description":"Defaults to \"once\" when omitted."},"durationInMonths":{"type":"number","description":"Required when duration is \"repeating\". 1–120."},"appliesToPlanKeys":{"description":"Omit or leave empty for every plan.","type":"array","items":{"type":"string"}},"appliesToIntervals":{"type":"array","items":{"type":"string","enum":["month","year"]}},"maxRedemptions":{"type":"number","description":"Total redemptions across all organizations."},"maxRedemptionsPerOrg":{"type":"number","description":"Redemptions allowed per organization. Defaults to 1."},"newCustomersOnly":{"type":"boolean","description":"Restrict to organizations that have never been charged. Defaults to false."},"redeemBy":{"type":"string","description":"Last moment the code may be redeemed (ISO 8601)."},"notes":{"type":"string"}},"required":["code","name","discountKind"]},"UpdateCouponDto":{"type":"object","properties":{"name":{"type":"string"},"appliesToPlanKeys":{"type":"array","items":{"type":"string"}},"appliesToIntervals":{"type":"array","items":{"type":"string","enum":["month","year"]}},"maxRedemptions":{"type":"object","description":"Send null to remove the cap.","nullable":true},"maxRedemptionsPerOrg":{"type":"number"},"newCustomersOnly":{"type":"boolean"},"redeemBy":{"type":"object","nullable":true,"description":"Send null to remove the deadline."},"notes":{"type":"object","nullable":true}}},"AdminCouponRedemptionDto":{"type":"object","properties":{"grantsFullAccess":{"type":"boolean"},"fullAccessEndsAt":{"type":"string","nullable":true,"format":"date-time"},"id":{"type":"string"},"code":{"type":"string"},"status":{"type":"string","enum":["active","completed","revoked"]},"description":{"type":"string","description":"Human summary of the snapshotted terms."},"periodsRemaining":{"type":"number","nullable":true},"appliedAt":{"type":"string"},"endedAt":{"type":"string","nullable":true},"endedReason":{"type":"string","nullable":true},"organizationId":{"type":"string"},"organizationName":{"type":"string","nullable":true}},"required":["id","code","status","description","periodsRemaining","appliedAt","endedAt","endedReason","organizationId","organizationName"]},"ApplyCouponDto":{"type":"object","properties":{"code":{"type":"string","description":"The code as the customer typed it; case is normalized."}},"required":["code"]},"RevokeCouponRedemptionDto":{"type":"object","properties":{"reason":{"type":"string","description":"Why the discount is being withdrawn — kept on the row."}},"required":["reason"]},"AdminBillingPriceDto":{"type":"object","properties":{"addonId":{"type":"string","nullable":true,"format":"uuid","description":"null = plan base price."},"currency":{"type":"string","minLength":3,"maxLength":3},"interval":{"type":"string","enum":["month","year","one_time"]},"amountMinor":{"type":"number"}},"required":["currency","interval","amountMinor"]},"AdminBillingPlanDto":{"type":"object","properties":{"key":{"type":"string"},"status":{"type":"string","enum":["draft","published","archived"]},"sortOrder":{"type":"number"},"isDefaultSignup":{"type":"boolean"},"isSelfServe":{"type":"boolean"},"trialDays":{"type":"number"},"defaultPlatformFeeBps":{"type":"number","description":"Platform fee in basis points (400 = 4%)."},"entitlements":{"type":"object","additionalProperties":true,"description":"Typed limits. A null value means unlimited."},"booleanFlagDefaults":{"type":"object","additionalProperties":{"type":"boolean"},"description":"Sparse { flagKey: boolean } capability defaults."},"marketing":{"type":"object","additionalProperties":true,"description":"Pricing-page presentation (i18n key names)."},"notes":{"type":"string","nullable":true},"prices":{"type":"array","items":{"$ref":"#/components/schemas/AdminBillingPriceDto"}}},"required":["key","status","sortOrder","isDefaultSignup","isSelfServe","trialDays","defaultPlatformFeeBps","entitlements","booleanFlagDefaults","marketing","prices"]},"AdminBillingPlanStatusCountDto":{"type":"object","properties":{"planKey":{"type":"string"},"status":{"type":"string","enum":["trialing","active","past_due","frozen","canceled","expired"]},"organizationCount":{"type":"number","description":"Organizations currently on this (plan, status) pair. Live snapshot, not scoped to fromIso/toIso."}},"required":["planKey","status","organizationCount"]},"AdminBillingSaasMrrDto":{"type":"object","properties":{"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO-4217, e.g. ILS or USD."},"saasMrrMinor":{"type":"number","description":"Minor units (agorot/cents). Sum of the monthly-equivalent PLAN base price (annual /12, rounded) for every currently active/trialing subscription in this currency. Excludes add-on lines (v1 scope). This is SaaS subscription revenue — distinct from donor recurring-donation MRR. Live snapshot, not scoped to fromIso/toIso."}},"required":["currency","saasMrrMinor"]},"AdminBillingPlanStatsDto":{"type":"object","properties":{"generatedAt":{"type":"string","format":"date-time"},"fromIso":{"type":"string","format":"date-time"},"toIso":{"type":"string","format":"date-time"},"byPlanStatus":{"description":"One row per (plan, status) combination that currently has at least one organization on it.","type":"array","items":{"$ref":"#/components/schemas/AdminBillingPlanStatusCountDto"}},"saasMrrByCurrency":{"type":"array","items":{"$ref":"#/components/schemas/AdminBillingSaasMrrDto"}},"planChangeCount":{"type":"number","description":"Subscriptions whose successor row (an upgrade or a downgrade) opened within [fromIso, toIso)."},"downgradeCount":{"type":"number","description":"Subset of planChangeCount specifically flagged as a non-payment downgrade within [fromIso, toIso) (downgraded_from_plan_id set on the row). Legacy marker — the live payment-failure path no longer sets it, so this commonly reads 0."},"cancellationCount":{"type":"number","description":"Subscriptions explicitly canceled (canceled_at set) within [fromIso, toIso)."}},"required":["generatedAt","fromIso","toIso","byPlanStatus","saasMrrByCurrency","planChangeCount","downgradeCount","cancellationCount"]},"AdminPlanOverrideDto":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"entitlements":{"type":"object","additionalProperties":true,"description":"Sparse entitlement exception currently in force."},"effectiveFrom":{"type":"string","format":"date-time"},"effectiveTo":{"type":"string","nullable":true,"format":"date-time"},"reason":{"type":"string","nullable":true}},"required":["organizationId","entitlements","effectiveFrom"]},"CreateBillingPlanDto":{"type":"object","properties":{"key":{"type":"string","description":"Stable key: 2–64 chars of a-z, 0-9, underscore.","maxLength":64},"entitlements":{"type":"object","additionalProperties":true,"description":"Typed limits, validated against the entitlements schema. Use null for unlimited; omit a key to declare no limit."},"booleanFlagDefaults":{"type":"object","additionalProperties":{"type":"boolean"},"description":"Sparse { flagKey: boolean }."},"marketing":{"type":"object","additionalProperties":true,"description":"i18n key names for the pricing page."},"sortOrder":{"type":"number","minimum":0},"isSelfServe":{"type":"boolean","description":"false = quote-only; no tenant can self-assign it."},"trialDays":{"type":"number","minimum":0,"maximum":365},"defaultPlatformFeeBps":{"type":"number","minimum":0,"maximum":10000,"description":"400 = 4%."},"notes":{"type":"string","maxLength":2000}},"required":["key"]},"UpdateBillingPlanCatalogDto":{"type":"object","properties":{"entitlements":{"type":"object","additionalProperties":true,"description":"REPLACES the entire bundle — it is not deep-merged. Send every limit the plan should have, not just the one you are changing, or the omitted ones become undeclared (= unlimited). Replace rather than merge is deliberate: with merge there is no way to express \"remove this cap\", since an omitted key would mean \"keep it\". Applies to every organization already on this plan immediately, because entitlements are read live rather than snapshotted."},"booleanFlagDefaults":{"type":"object","additionalProperties":{"type":"boolean"},"description":"REPLACES the whole map, same rule as `entitlements`."},"marketing":{"type":"object","additionalProperties":true,"description":"REPLACES the whole object, same rule as `entitlements`."},"sortOrder":{"type":"number","minimum":0},"isSelfServe":{"type":"boolean"},"trialDays":{"type":"number","minimum":0,"maximum":365},"defaultPlatformFeeBps":{"type":"number","minimum":0,"maximum":10000},"notes":{"type":"string","maxLength":2000}}},"SetBillingPriceDto":{"type":"object","properties":{"addonKey":{"type":"string","maxLength":64,"description":"Omit for the plan base price; supply to price an add-on on this plan."},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO-4217, e.g. ILS or USD."},"interval":{"type":"string","enum":["month","year","one_time"]},"amountMinor":{"type":"number","minimum":0,"description":"Minor units (agorot / cents)."}},"required":["currency","interval","amountMinor"]},"UpsertPlanOverrideDto":{"type":"object","properties":{"entitlements":{"type":"object","additionalProperties":true,"description":"Sparse entitlement bundle — only the keys you send change. Validated against the schema; an unknown path is rejected rather than silently stored."},"effectiveTo":{"type":"string","format":"date-time","description":"Time-box the grant (e.g. the end of a campaign weekend). Must be in the future."},"reason":{"type":"string","maxLength":500,"description":"Why it was granted — for audit."}},"required":["entitlements"]},"StartCheckoutDto":{"type":"object","properties":{"purpose":{"type":"string","enum":["trial","activate"],"description":"Trial collects a card and starts the one-time 7-day evaluation. Activate ends an existing trial and requests immediate payment."},"planKey":{"type":"string","description":"Package to buy. Defaults to the one the organization is already on."},"interval":{"type":"string","enum":["month","year","one_time"]},"returnUrl":{"type":"string","description":"Where the provider returns the customer after paying. Must be on a configured app origin; a foreign URL is refused rather than followed."},"uiMode":{"type":"string","enum":["hosted","embedded"],"description":"hosted (default) returns a provider page URL to redirect to. embedded returns clientSecret + publishableKey so the provider’s own card form is mounted inside our page (used by the signup payment step); card data still never reaches our servers."}}},"CheckoutSessionDto":{"type":"object","properties":{"url":{"type":"string","nullable":true,"description":"Hosted page to redirect the customer to. Null for an embedded session."},"sessionRef":{"type":"string","nullable":true},"clientSecret":{"type":"string","nullable":true,"description":"Embedded session only: the secret Stripe.js mounts the in-page form with."},"publishableKey":{"type":"string","nullable":true,"description":"Embedded session only: the platform publishable key for Stripe.js."}},"required":["url","sessionRef","clientSecret","publishableKey"]},"ConfirmCheckoutDto":{"type":"object","properties":{"sessionRef":{"type":"string","description":"The checkout session id returned by startMyBillingCheckout."}},"required":["sessionRef"]},"ConfirmCheckoutResultDto":{"type":"object","properties":{"confirmed":{"type":"boolean","description":"True when the provider reports the checkout complete and it has been applied. False while it is still open."}},"required":["confirmed"]},"StartBillingPortalDto":{"type":"object","properties":{"returnUrl":{"type":"string","description":"Where to send the customer when they close the portal."}}},"BillingPortalSessionDto":{"type":"object","properties":{"url":{"type":"string","description":"The provider’s self-service page for cards and invoices."}},"required":["url"]},"BillingInvoiceDto":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["draft","open","paid","uncollectible","void"]},"currency":{"type":"string"},"subtotalMinor":{"type":"number"},"discountMinor":{"type":"number"},"taxMinor":{"type":"number"},"totalMinor":{"type":"number"},"amountPaidMinor":{"type":"number"},"periodStart":{"type":"string","nullable":true},"periodEnd":{"type":"string","nullable":true},"paidAt":{"type":"string","nullable":true},"couponCode":{"type":"string","nullable":true},"hostedInvoiceUrl":{"type":"string","nullable":true,"description":"Provider-hosted invoice page. We do not render invoices ourselves."},"invoicePdfUrl":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","status","currency","subtotalMinor","discountMinor","taxMinor","totalMinor","amountPaidMinor","periodStart","periodEnd","paidAt","couponCode","hostedInvoiceUrl","invoicePdfUrl","createdAt"]},"CouponPreviewDto":{"type":"object","properties":{"grantsFullAccess":{"type":"boolean"},"fullAccessEndsAt":{"type":"string","nullable":true,"format":"date-time"},"code":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"discountMinor":{"type":"number","description":"Minor units taken off the current recurring price."},"netMinor":{"type":"number","description":"Minor units left to pay after the discount."},"duration":{"type":"string","enum":["once","repeating","forever"]},"durationInMonths":{"type":"number","nullable":true}},"required":["code","name","description","discountMinor","netMinor","duration","durationInMonths"]},"CouponRedemptionDto":{"type":"object","properties":{"grantsFullAccess":{"type":"boolean"},"fullAccessEndsAt":{"type":"string","nullable":true,"format":"date-time"},"id":{"type":"string"},"code":{"type":"string"},"status":{"type":"string","enum":["active","completed","revoked"]},"description":{"type":"string","description":"Human summary of the snapshotted terms."},"periodsRemaining":{"type":"number","nullable":true},"appliedAt":{"type":"string"},"endedAt":{"type":"string","nullable":true},"endedReason":{"type":"string","nullable":true}},"required":["id","code","status","description","periodsRemaining","appliedAt","endedAt","endedReason"]},"PublicBillingPriceDto":{"type":"object","properties":{"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO-4217, e.g. ILS or USD."},"interval":{"type":"string","enum":["month","year","one_time"]},"amountMinor":{"type":"number","description":"Minor units (agorot / cents)."}},"required":["currency","interval","amountMinor"]},"PublicBillingPlanLimitsDto":{"type":"object","properties":{"activeCampaigns":{"type":"number","nullable":true},"activeDonationPages":{"type":"number","nullable":true},"contacts":{"type":"number","nullable":true},"editorSeats":{"type":"number","nullable":true}},"required":["activeCampaigns","activeDonationPages","contacts","editorSeats"]},"PublicBillingPlanDto":{"type":"object","properties":{"key":{"type":"string","description":"Stable plan key, e.g. \"togo\" / \"standard\" / \"professional\". Pass through as ?plan=<key> to /signup."},"sortOrder":{"type":"number","description":"Display order, ascending."},"trialDays":{"type":"number","description":"Trial length in days before the first charge."},"prices":{"description":"Active base prices for this plan, one row per (currency, interval).","type":"array","items":{"$ref":"#/components/schemas/PublicBillingPriceDto"}},"limits":{"description":"Advertised plan quotas. Null means unlimited.","allOf":[{"$ref":"#/components/schemas/PublicBillingPlanLimitsDto"}]},"marketing":{"type":"object","additionalProperties":true,"description":"i18n KEY NAMES for the pricing page (nameKey/ctaKey/whoKey/priceKey/annualPriceKey/bulletKeys/featured/zeroFee) — never literal copy. See `packages/db/prisma/seed-billing-plans.ts` for the shape."}},"required":["key","sortOrder","trialDays","prices","limits","marketing"]},"PlanUsageEntryDto":{"type":"object","properties":{"entitlement":{"type":"string","enum":["campaigns.maxActive","donationPages.maxActive","crm.maxContacts","team.maxEditorSeats","comms.email.monthlyQuota","comms.email.sharedMarketingMonthlyQuota","comms.sms.monthlyQuota","comms.whatsapp.monthlyQuota","ai.monthlyPageGenerations","media.monthlyUploadQuotaMb","reports.monthlyLimit","transactions.platformFeeBpsMax","matchers.maxCoefficient"],"description":"Numeric entitlement path. `comms.sms.allowedCountries` is intentionally absent: it is a country allowlist, not a quantity that can be consumed."},"limit":{"type":"number","nullable":true,"description":"Resolved numeric cap. Null means unlimited or undeclared, preserving the billing module fail-open contract."},"used":{"type":"number","description":"Live COUNT/SUM/MAX measurement for this entitlement. Monthly metrics use the current UTC calendar month."}},"required":["entitlement","limit","used"]},"MyPlanUsageResponseDto":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid","description":"Calling tenant, derived from the authenticated context."},"planKey":{"type":"string","nullable":true,"description":"Resolved plan key, or null when the organization has no subscription."},"rows":{"description":"One row for every numeric entitlement path, in the canonical entitlement-path order.","type":"array","items":{"$ref":"#/components/schemas/PlanUsageEntryDto"}}},"required":["organizationId","planKey","rows"]},"BillingPriceDto":{"type":"object","properties":{"interval":{"type":"string","enum":["month","year","one_time"]},"currency":{"type":"string","minLength":3,"maxLength":3},"amountMinor":{"type":"number","description":"Minor units (agorot / cents)."}},"required":["interval","currency","amountMinor"]},"BillingPlanAddonOptionDto":{"type":"object","properties":{"key":{"type":"string"},"kind":{"type":"string","enum":["quantity","one_time","capability"]},"canIncrease":{"type":"boolean","description":"False for an owned add-on no longer offered; cancellation remains available."},"entitlementKey":{"type":"string","nullable":true,"description":"Entitlement path this add-on raises; null for one-off charges."},"capabilityKey":{"type":"string","nullable":true,"description":"Registered capability unlocked by this add-on."},"unitStep":{"type":"number","description":"How much one unit adds (+1 seat, +5000 contacts)."},"prices":{"description":"Prices on THIS plan only.","type":"array","items":{"$ref":"#/components/schemas/BillingPriceDto"}},"marketing":{"type":"object","additionalProperties":true,"description":"Presentation metadata (i18n keys)."}},"required":["key","kind","unitStep","prices","marketing"]},"BillingPlanDto":{"type":"object","properties":{"key":{"type":"string","description":"Stable catalog key — the value to send when changing plan."},"isSelfServe":{"type":"boolean","description":"False for quote-only packages; a tenant cannot self-assign those."},"isCurrent":{"type":"boolean"},"trialDays":{"type":"number","description":"Free evaluation days granted on first purchase (0 = none)."},"platformFeeBps":{"type":"number","description":"Platform fee on donations, in basis points (400 = 4%)."},"prices":{"type":"array","items":{"$ref":"#/components/schemas/BillingPriceDto"}},"entitlements":{"type":"object","additionalProperties":true,"description":"Typed limits this package declares. A null value means unlimited."},"addons":{"type":"array","items":{"$ref":"#/components/schemas/BillingPlanAddonOptionDto"}},"marketing":{"type":"object","additionalProperties":true,"description":"Presentation metadata (i18n keys, badge, bullets)."}},"required":["key","isSelfServe","isCurrent","trialDays","platformFeeBps","prices","entitlements","addons","marketing"]},"SubscriptionPlanPreviewDto":{"type":"object","properties":{"quoteToken":{"type":"string"},"amountDueMinor":{"type":"number"},"currency":{"type":"string"},"effectiveAt":{"type":"string","nullable":true},"kind":{"type":"string","enum":["trial_selection","upgrade","downgrade"]},"commitmentEndsAt":{"type":"string","nullable":true},"prorationDate":{"type":"number"}},"required":["amountDueMinor","currency","effectiveAt","kind","commitmentEndsAt"]},"SetAddonQuantityDto":{"type":"object","properties":{"addonKey":{"type":"string","maxLength":64,"description":"Add-on catalog key (e.g. \"extra_seat\")."},"quantity":{"type":"number","minimum":0,"description":"Units purchased. 0 removes the add-on."}},"required":["addonKey","quantity"]},"CancelSubscriptionDto":{"type":"object","properties":{"atPeriodEnd":{"type":"boolean","default":true,"description":"Cancel at period end (default) rather than immediately. Immediate cancellation drops entitlements straight away."}}},"CommunicationChannelUsageDto":{"type":"object","properties":{"channel":{"type":"string","description":"Channel the counters belong to.","enum":["email","sms","whatsapp"]},"sentCount":{"type":"number","description":"Messages actually handed to the provider in this period."},"queuedCount":{"type":"number","description":"Messages queued but not yet sent in this period."},"suppressedCount":{"type":"number","description":"Messages dropped because the recipient is suppressed."},"includedQuota":{"type":"number","nullable":true,"description":"Included quota for this channel from the TenantContract. null means no quota is defined — either the org has no contract, or the channel has no contracted quota (WhatsApp today). null is NOT the same as 0."},"remainingQuota":{"type":"number","nullable":true,"description":"max(0, includedQuota - sentCount). null whenever includedQuota is null."},"overageUnits":{"type":"number","description":"max(0, sentCount - includedQuota), or 0 when no quota is defined. Priced by overage*Price."}},"required":["channel","sentCount","queuedCount","suppressedCount","includedQuota","remainingQuota","overageUnits"]},"CommunicationUsageResponseDto":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"periodYyyymm":{"type":"number","description":"Resolved period — the requested one, or the current UTC month."},"contractMissing":{"type":"boolean","description":"true if the org has no TenantContract, so no channel has an included quota."},"quotaIncreaseSelfServe":{"type":"boolean","description":"false in every deployment today: buying extra quota is a support conversation, not an API call. Agents must not promise a self-serve upgrade."},"quotaIncreaseContactEmail":{"type":"string","description":"Where to ask for more quota, since it cannot be bought here. Configured by the operator in super-admin platform settings, so clients must render THIS value and never a compiled-in address.","example":"support@facio.io"},"rows":{"description":"One row per channel, always email + sms + whatsapp.","type":"array","items":{"$ref":"#/components/schemas/CommunicationChannelUsageDto"}}},"required":["organizationId","periodYyyymm","contractMissing","quotaIncreaseSelfServe","quotaIncreaseContactEmail","rows"]},"AdminFeatureFlagDto":{"type":"object","properties":{"flagKey":{"type":"string"},"value":{"type":"boolean"},"effectiveFrom":{"type":"object","nullable":true,"format":"date-time"},"effectiveTo":{"type":"object","nullable":true,"format":"date-time"}},"required":["flagKey","value"]},"AdminOrganizationSettingsResponseDto":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"slug":{"type":"string"},"legalName":{"type":"string"},"country":{"type":"string","minLength":2,"maxLength":2},"defaultCurrency":{"type":"string","minLength":3,"maxLength":3},"status":{"type":"string","enum":["pending_approval","active","suspended","pending_deletion","disabled"]},"billingPlanId":{"type":"object","nullable":true,"format":"uuid"},"featureFlags":{"type":"array","items":{"$ref":"#/components/schemas/AdminFeatureFlagDto"}}},"required":["organizationId","slug","legalName","country","defaultCurrency","status","billingPlanId","featureFlags"]},"AdminGatewayFailureDto":{"type":"object","properties":{"at":{"type":"string","description":"When the failure happened.","format":"date-time"},"code":{"type":"string","description":"Provider/platform failure code, when one was recorded.","nullable":true},"message":{"type":"string","description":"Human-readable failure message as recorded by the platform. Never contains card data or secrets.","nullable":true}},"required":["at"]},"AdminPaymentGatewayStatusDto":{"type":"object","properties":{"provider":{"type":"string","enum":["stripe","meshulam","wallet","crowded"],"description":"Payment provider. `meshulam`/`wallet` are the Grow surfaces."},"health":{"type":"string","enum":["not_configured","disabled","incomplete","error","ready"]},"configured":{"type":"boolean","description":"True when a credentials row exists for this organization + provider."},"mode":{"type":"string","enum":["sandbox","production","unknown"]},"accountStatus":{"type":"string","description":"Row status (`active` / `disabled`), null when never configured.","nullable":true},"displayName":{"type":"string","nullable":true},"maskedCredentialSuffix":{"type":"string","description":"Last 4 characters of the stored credential, for identification only.","nullable":true},"providerAccountRef":{"type":"string","description":"Provider-side account identifier (Stripe account, Grow userId, Crowded chapter).","nullable":true},"chargesEnabled":{"type":"boolean","description":"True once the provider confirmed the connection can accept charges.","nullable":true},"payoutsEnabled":{"type":"boolean","nullable":true},"requirementsCurrentlyDue":{"description":"Outstanding provider onboarding requirements mirrored from the last probe.","type":"array","items":{"type":"string"}},"lastCheckedAt":{"type":"string","description":"When the connection snapshot was last reconciled with the provider.","format":"date-time","nullable":true},"updatedAt":{"type":"string","format":"date-time","nullable":true},"lastCheckoutFailure":{"description":"Most recent failed checkout session for this provider in this organization.","nullable":true,"allOf":[{"$ref":"#/components/schemas/AdminGatewayFailureDto"}]},"lastWebhookError":{"description":"Most recent webhook this provider failed to process for this organization.","nullable":true,"allOf":[{"$ref":"#/components/schemas/AdminGatewayFailureDto"}]},"succeededCheckouts30d":{"type":"number","description":"Successful checkout sessions for this provider in the last 30 days."},"failedCheckouts30d":{"type":"number","description":"Failed checkout sessions for this provider in the last 30 days."}},"required":["provider","health","configured","mode","requirementsCurrentlyDue","succeededCheckouts30d","failedCheckouts30d"]},"AdminPaymentGatewayStatusResponseDto":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"gateways":{"description":"One entry per supported provider, including providers that were never configured.","type":"array","items":{"$ref":"#/components/schemas/AdminPaymentGatewayStatusDto"}},"canAcceptDonations":{"type":"boolean","description":"True when at least one provider is `ready` — i.e. the organization can currently take a donation."},"secretsUnavailable":{"type":"boolean","description":"True when the API is missing CHARIDY_INTEGRATION_SECRET_KEY, so stored credentials cannot be inspected at all."}},"required":["organizationId","gateways","canAcceptDonations","secretsUnavailable"]},"UpdateOrganizationProfileDto":{"type":"object","properties":{"slug":{"type":"string","description":"Organization URL slug. Lowercase letters, numbers, and hyphens only.","pattern":"^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$"},"legalName":{"type":"string","maxLength":200},"country":{"type":"string","minLength":2,"maxLength":2,"description":"ISO 3166-1 alpha-2 country code."},"defaultCurrency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code."},"reason":{"type":"string","maxLength":500}}},"UpdateOrganizationStatusDto":{"type":"object","properties":{"status":{"type":"string","enum":["pending_approval","active","suspended","pending_deletion","disabled"],"description":"New lifecycle status for the organization."},"reason":{"type":"string","maxLength":500}},"required":["status"]},"AdminOrganizationSummaryDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"legalName":{"type":"string"},"status":{"type":"string","enum":["pending_approval","active","suspended","pending_deletion","disabled"]},"billingPlanId":{"type":"object","nullable":true,"format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","slug","legalName","status","billingPlanId","createdAt","updatedAt"]},"AdminOrganizationListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/AdminOrganizationSummaryDto"}},"totalCount":{"type":"number"}},"required":["rows","totalCount"]},"UpsertFeatureFlagDto":{"type":"object","properties":{"value":{"type":"boolean"},"effectiveFrom":{"type":"string","nullable":true,"format":"date-time"},"effectiveTo":{"type":"string","nullable":true,"format":"date-time"},"reason":{"type":"string","maxLength":500}},"required":["value"]},"UpdateBillingPlanDto":{"type":"object","properties":{"billingPlanId":{"type":"string","format":"uuid","description":"Sets the current organization billing plan reference."}}},"TwilioSubaccountProvisionResponseDto":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"providerAccountId":{"type":"string","format":"uuid"},"subAccountSid":{"type":"string","description":"Mocked Twilio Subaccount SID (`AC_MOCK_<orgId>` while WABA_MOCK_MODE=true)."},"status":{"type":"string","enum":["active","provisioning","suspended","disabled"]},"provisioningRequestId":{"type":"string","description":"Idempotent request id stored on communication_provider_accounts.provisioning_request_id."},"isMock":{"type":"boolean","description":"true while the integration is in mock mode (no real Twilio call performed)."}},"required":["organizationId","providerAccountId","subAccountSid","status","provisioningRequestId","isMock"]},"AdminSoftDeleteDto":{"type":"object","properties":{"reason":{"type":"string","maxLength":500}}},"AdminMutationResultDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"action":{"type":"string"},"status":{"type":"string","description":"Resulting lifecycle status after mutation."}},"required":["id","action","status"]},"AdminHardDeleteDto":{"type":"object","properties":{"confirmHardDelete":{"type":"boolean","description":"Must be true to execute a hard delete when safety checks pass.","default":false},"reason":{"type":"string","maxLength":500,"description":"Operator justification for the hard-delete action."},"mfaCode":{"type":"string","minLength":6,"maxLength":6,"description":"MFA re-check code for sensitive admin mutations."},"note":{"type":"string","maxLength":500,"deprecated":true}},"required":["confirmHardDelete","reason","mfaCode"]},"AdminSendgridIntegrationSliceDto":{"type":"object","properties":{"status":{"type":"object","nullable":true,"description":"Row status when a provider account exists."},"configured":{"type":"boolean","description":"Whether encrypted credentials are stored for SendGrid."},"maskedApiKeySuffix":{"type":"object","nullable":true,"description":"Last 4 characters of the API key when decryption is possible (never the full key)."}},"required":["status","configured"]},"AdminTwilioIntegrationSliceDto":{"type":"object","properties":{"status":{"type":"object","nullable":true},"accountRowPresent":{"type":"boolean","description":"Whether a Twilio SMS provider account row exists."},"subAccountExternalId":{"type":"object","nullable":true},"hasEncryptedAuth":{"type":"boolean","description":"Whether encrypted auth token + SID bundle is stored."}},"required":["status","accountRowPresent","hasEncryptedAuth"]},"AdminCommsIntegrationsResponseDto":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"sendgrid":{"$ref":"#/components/schemas/AdminSendgridIntegrationSliceDto"},"twilioSms":{"$ref":"#/components/schemas/AdminTwilioIntegrationSliceDto"}},"required":["organizationId","sendgrid","twilioSms"]},"AdminTwilioIntegrationDto":{"type":"object","properties":{"accountSid":{"type":"string"},"authToken":{"type":"string"}},"required":["accountSid","authToken"]},"AdminIntegrationTestResultDto":{"type":"object","properties":{"ok":{"type":"boolean"},"httpStatus":{"type":"number","description":"Upstream HTTP status from the provider self-test call."},"errorCode":{"type":"string","description":"Stable machine code when ok=false."},"message":{"type":"string","description":"Safe operator-facing detail (no secrets)."}},"required":["ok"]},"MarketingBreakerStatusDto":{"type":"object","properties":{"state":{"type":"string","enum":["ok","warn","paused","stopped"]},"windowSends":{"type":"number","description":"Marketing emails sent in the rolling 7-day window."},"bounceRate":{"type":"number","description":"Bounce rate over the window, as a fraction (0.03 = 3%)."},"complaintRate":{"type":"number","description":"Spam-complaint rate over the window, as a fraction (0.001 = 0.1%)."},"stateChangedAt":{"type":"string","nullable":true},"minSends":{"type":"number","description":"Marketing sends are only judged from this many in the window; below it the state is always `ok`."}},"required":["state","windowSends","bounceRate","complaintRate","stateChangedAt","minSends"]},"AdminDeliverabilityResponseDto":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"breaker":{"$ref":"#/components/schemas/MarketingBreakerStatusDto"},"clearedAt":{"type":"string","nullable":true},"clearNote":{"type":"string","nullable":true},"sharedLaneCapOverride":{"type":"number","nullable":true,"description":"Per-organization override of the shared-lane monthly cap."}},"required":["organizationId","breaker","clearedAt","clearNote","sharedLaneCapOverride"]},"ClearMarketingBreakerDto":{"type":"object","properties":{"note":{"type":"string","description":"Why the stop is being lifted (kept on the record)."}}},"SetSharedLaneCapDto":{"type":"object","properties":{"monthlyCap":{"type":"number","nullable":true,"minimum":0,"description":"Monthly cap of marketing emails on the shared lane for this organization. `null` removes the override (platform default applies)."}},"required":["monthlyCap"]},"AdminUserSummaryDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string"},"displayName":{"type":"object","nullable":true},"status":{"type":"string","enum":["active","disabled","locked"]},"lastLoginAt":{"type":"object","nullable":true,"format":"date-time"},"organizationMemberships":{"type":"number"}},"required":["id","email","displayName","status","lastLoginAt","organizationMemberships"]},"AdminUserListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/AdminUserSummaryDto"}},"totalCount":{"type":"number"}},"required":["rows","totalCount"]},"AdminUserSystemRoleDto":{"type":"object","properties":{"roleId":{"type":"string","format":"uuid"},"roleKey":{"type":"string"},"roleName":{"type":"string"},"description":{"type":"object","nullable":true},"active":{"type":"boolean"},"permissionKeys":{"type":"array","items":{"type":"string"}}},"required":["roleId","roleKey","roleName","active","permissionKeys"]},"AdminSystemRoleListResponseDto":{"type":"object","properties":{"roles":{"type":"array","items":{"$ref":"#/components/schemas/AdminUserSystemRoleDto"}}},"required":["roles"]},"AdminUserMembershipDto":{"type":"object","properties":{"membershipId":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"organizationSlug":{"type":"string"},"roleId":{"type":"string","format":"uuid"},"roleKey":{"type":"string","description":"Tenant role key from `roles.key`."},"roleName":{"type":"string","description":"Human-readable tenant role name."},"membershipStatus":{"type":"string"},"joinedAt":{"type":"object","nullable":true,"format":"date-time"}},"required":["membershipId","organizationId","organizationSlug","roleId","roleKey","roleName","membershipStatus"]},"AdminUserDetailResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string"},"displayName":{"type":"object","nullable":true},"status":{"type":"string"},"mfaEnabled":{"type":"boolean"},"lastLoginAt":{"type":"object","nullable":true,"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"memberships":{"type":"array","items":{"$ref":"#/components/schemas/AdminUserMembershipDto"}},"systemRoles":{"type":"array","items":{"$ref":"#/components/schemas/AdminUserSystemRoleDto"}}},"required":["id","email","displayName","status","mfaEnabled","createdAt","memberships","systemRoles"]},"UpdateAdminUserSystemRolesDto":{"type":"object","properties":{"roleIds":{"description":"Complete replacement list of active platform system role ids for this user.","type":"array","items":{"type":"string"}}},"required":["roleIds"]},"AdminCampaignSummaryDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"organizationSlug":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"status":{"type":"string"},"kind":{"type":"string"},"deletedAt":{"type":"object","nullable":true,"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","organizationSlug","name","slug","status","kind","createdAt","updatedAt"]},"AdminCampaignListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/AdminCampaignSummaryDto"}},"totalCount":{"type":"number"}},"required":["rows","totalCount"]},"AdminCampaignDetailResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"organizationSlug":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"status":{"type":"string"},"kind":{"type":"string"},"goalAmount":{"type":"string","nullable":true,"description":"Decimal goal amount as string. Null for donation_page campaigns."},"currency":{"type":"string"},"deletedAt":{"type":"object","nullable":true,"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","organizationSlug","name","slug","status","kind","currency","createdAt","updatedAt"]},"AdminPatchCampaignDto":{"type":"object","properties":{"status":{"type":"string","enum":["draft","pending_approval","active","paused","ended","completed","archived"],"description":"Super-admin lifecycle override for the campaign."}}},"StartImpersonationDto":{"type":"object","properties":{"targetGlobalUserId":{"type":"string","format":"uuid"},"targetOrganizationId":{"type":"string","format":"uuid"}},"required":["targetGlobalUserId","targetOrganizationId"]},"ImpersonationTokenResponseDto":{"type":"object","properties":{"accessToken":{"type":"string","description":"JWT access token with impersonation claims."},"tokenType":{"type":"string","example":"Bearer"},"expiresInSeconds":{"type":"number","description":"Token lifetime in seconds.","example":1800},"expiresAt":{"type":"string","description":"Absolute expiry (ISO timestamp) of the support session."},"impersonationSessionId":{"type":"string","format":"uuid"},"targetGlobalUserId":{"type":"string","format":"uuid"},"targetOrganizationId":{"type":"string","format":"uuid"},"targetLabel":{"type":"string","description":"Display name or email of the impersonated user, for the session banner."},"targetOrganizationSlug":{"type":"string","nullable":true,"description":"Slug of the target organization, so the caller can land on that tenant."}},"required":["accessToken","tokenType","expiresInSeconds","expiresAt","impersonationSessionId","targetGlobalUserId","targetOrganizationId","targetLabel"]},"ExitImpersonationDto":{"type":"object","properties":{"sessionId":{"type":"string","format":"uuid","description":"Session to end. Omit when calling with the impersonation token itself — the session is then read from the token claims."}}},"AdminPermissionDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"module":{"type":"string"},"scopeType":{"type":"string","enum":["organization","campaign","ambassador","global"]},"description":{"type":"object","nullable":true},"isSensitive":{"type":"boolean"}},"required":["id","key","module","scopeType","isSensitive"]},"AdminPermissionCatalogResponseDto":{"type":"object","properties":{"permissions":{"type":"array","items":{"$ref":"#/components/schemas/AdminPermissionDto"}}},"required":["permissions"]},"AdminOrganizationMemberDto":{"type":"object","properties":{"membershipId":{"type":"string","format":"uuid"},"globalUserId":{"type":"string","format":"uuid"},"email":{"type":"string"},"displayName":{"type":"object","nullable":true},"status":{"type":"string","enum":["invited","active","suspended","removed"]},"roleId":{"type":"string","format":"uuid"},"roleKey":{"type":"string"},"roleName":{"type":"string"},"joinedAt":{"type":"object","nullable":true,"format":"date-time"},"createdAt":{"type":"string","format":"date-time"}},"required":["membershipId","globalUserId","email","status","roleId","roleKey","roleName","createdAt"]},"AdminOrganizationMembersResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/AdminOrganizationMemberDto"}},"totalCount":{"type":"number"}},"required":["rows","totalCount"]},"UpdateAdminMemberRoleDto":{"type":"object","properties":{"roleId":{"type":"string","format":"uuid"},"reason":{"type":"string","maxLength":500}},"required":["roleId"]},"AdminRoleDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"object","nullable":true,"format":"uuid"},"key":{"type":"string"},"name":{"type":"string"},"description":{"type":"object","nullable":true},"isSystem":{"type":"boolean"},"isAssignable":{"type":"boolean"},"scopeTypesAllowed":{"type":"array","items":{"type":"string","enum":["organization","campaign","ambassador"]}},"permissionKeys":{"type":"array","items":{"type":"string"}}},"required":["id","organizationId","key","name","isSystem","isAssignable","scopeTypesAllowed","permissionKeys"]},"AdminRoleListResponseDto":{"type":"object","properties":{"roles":{"type":"array","items":{"$ref":"#/components/schemas/AdminRoleDto"}}},"required":["roles"]},"CreateAdminRoleDto":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]*(?:\\.[a-z0-9_]+)*$","description":"Stable tenant role key. System role keys are migration-owned."},"name":{"type":"string","maxLength":120},"description":{"type":"object","maxLength":500,"nullable":true},"scopeTypesAllowed":{"type":"array","items":{"type":"string","enum":["organization","campaign","ambassador"]}}},"required":["key","name"]},"UpdateAdminRoleDto":{"type":"object","properties":{"name":{"type":"string","maxLength":120},"description":{"type":"object","maxLength":500,"nullable":true},"scopeTypesAllowed":{"type":"array","items":{"type":"string","enum":["organization","campaign","ambassador"]}},"isAssignable":{"type":"boolean"}}},"AdminRolePermissionDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"module":{"type":"string"},"scopeType":{"type":"string","enum":["organization","campaign","ambassador","global"]},"description":{"type":"object","nullable":true},"isSensitive":{"type":"boolean"},"granted":{"type":"boolean"}},"required":["id","key","module","scopeType","isSensitive","granted"]},"AdminRolePermissionMatrixResponseDto":{"type":"object","properties":{"role":{"$ref":"#/components/schemas/AdminRoleDto"},"permissions":{"type":"array","items":{"$ref":"#/components/schemas/AdminRolePermissionDto"}}},"required":["role","permissions"]},"UpdateAdminRolePermissionsDto":{"type":"object","properties":{"permissionKeys":{"description":"Complete replacement list of permission keys for this custom role.","type":"array","items":{"type":"string"}},"reason":{"type":"string","maxLength":500}},"required":["permissionKeys"]},"PagePolicyResponseDto":{"type":"object","properties":{"key":{"type":"string","description":"Policy key (e.g. \"default\")."},"requiredCapabilities":{"description":"Capabilities every freeform page must include.","type":"array","items":{"type":"string"}},"sanitizeAllowlist":{"type":"object","additionalProperties":true,"nullable":true,"description":"Optional sanitize allowlist override."},"injectedConcerns":{"type":"object","additionalProperties":true,"nullable":true,"description":"Optional injected-concerns configuration."},"status":{"type":"string","description":"Policy status (draft | published | archived)."},"updatedAt":{"type":"string","format":"date-time"}},"required":["key","requiredCapabilities","status","updatedAt"]},"UpsertPagePolicyDto":{"type":"object","properties":{"requiredCapabilities":{"description":"Required capabilities (e.g. [\"donate\",\"progress\"]).","type":"array","items":{"type":"string"}},"sanitizeAllowlist":{"type":"object","additionalProperties":true},"injectedConcerns":{"type":"object","additionalProperties":true},"status":{"type":"string","description":"Policy status.","enum":["draft","published","archived"]}},"required":["requiredCapabilities"]},"CommunicationTemplateResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"key":{"type":"string"},"channel":{"type":"string","enum":["email","sms","whatsapp"]},"locale":{"type":"string","enum":["en","he"]},"category":{"type":"string","enum":["transactional","marketing","ambassador","system"]},"name":{"type":"string"},"description":{"type":"object","nullable":true},"subject":{"type":"object","nullable":true},"body":{"type":"string"},"bodyEngine":{"type":"string","enum":["handlebars_plain","mjml_handlebars"]},"providerTemplateRef":{"type":"object","additionalProperties":true,"nullable":true},"mergeTagsSchema":{"type":"object","additionalProperties":true,"nullable":true},"defaultSenderIdentityId":{"type":"object","format":"uuid","nullable":true},"isActive":{"type":"boolean"},"version":{"type":"number"},"metaStatus":{"type":"string","enum":["pending","approved","rejected"],"nullable":true,"description":"WhatsApp Business (WABA) Meta approval state. Null for non-WhatsApp templates and templates that have never been submitted."},"metaTemplateId":{"type":"object","nullable":true,"description":"Twilio Content SID / Meta template id once submitted."},"metaSubmittedAt":{"type":"object","nullable":true},"metaReviewedAt":{"type":"object","nullable":true},"metaRejectionReason":{"type":"object","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","key","channel","locale","category","name","description","subject","body","bodyEngine","providerTemplateRef","mergeTagsSchema","defaultSenderIdentityId","isActive","version","metaStatus","metaTemplateId","metaSubmittedAt","metaReviewedAt","metaRejectionReason","createdAt","updatedAt"]},"CommunicationTemplatesListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/CommunicationTemplateResponseDto"}},"totalCount":{"type":"number"}},"required":["rows","totalCount"]},"CreateCommunicationTemplateDto":{"type":"object","properties":{"key":{"type":"string","description":"Stable handle used by automations (e.g. `donation.thanks`).","maxLength":80},"channel":{"type":"string","enum":["email","sms","whatsapp"]},"locale":{"type":"string","enum":["en","he"]},"category":{"type":"string","enum":["transactional","marketing","ambassador","system"]},"name":{"type":"string","maxLength":200},"description":{"type":"string","maxLength":1000},"subject":{"type":"string","description":"Required for `channel=email`.","maxLength":998},"body":{"type":"string","description":"Handlebars source (HTML for email, plain for sms/whatsapp)."},"bodyEngine":{"type":"string","enum":["handlebars_plain","mjml_handlebars"],"default":"handlebars_plain"},"providerTemplateRef":{"type":"object","additionalProperties":true,"nullable":true},"mergeTagsSchema":{"type":"object","additionalProperties":true,"nullable":true},"defaultSenderIdentityId":{"type":"object","format":"uuid","nullable":true},"isActive":{"type":"boolean","default":true,"description":"Set false to create the template as an inactive DRAFT (e.g. AI-generated copy awaiting human review) — it is excluded from `isActive=true` listings until an operator activates it."}},"required":["key","channel","locale","category","name","body"]},"UpdateCommunicationTemplateDto":{"type":"object","properties":{"name":{"type":"string","maxLength":200},"description":{"type":"string","maxLength":1000},"subject":{"type":"string","maxLength":998},"body":{"type":"string"},"category":{"type":"string","enum":["transactional","marketing","ambassador","system"]},"isActive":{"type":"boolean"},"defaultSenderIdentityId":{"type":"object","format":"uuid","nullable":true},"mergeTagsSchema":{"type":"object","additionalProperties":true,"nullable":true}}},"PreviewCommunicationTemplateDto":{"type":"object","properties":{"mergeContext":{"type":"object","description":"Sample merge context to render against. Defaults to a minimal sample if omitted.","additionalProperties":true}}},"PreviewCommunicationTemplateResponseDto":{"type":"object","properties":{"renderedSubject":{"type":"object","nullable":true},"renderedBody":{"type":"string"},"bodyEngine":{"type":"string","enum":["handlebars_plain","mjml_handlebars"]}},"required":["renderedSubject","renderedBody","bodyEngine"]},"WabaSubmitResponseDto":{"type":"object","properties":{"templateId":{"type":"string","format":"uuid"},"metaTemplateId":{"type":"string"},"metaStatus":{"type":"string","enum":["pending","approved","rejected"]},"metaSubmittedAt":{"type":"string"},"isMock":{"type":"boolean","description":"true while the integration is in mock mode (no real Meta call performed)."}},"required":["templateId","metaTemplateId","metaStatus","metaSubmittedAt","isMock"]},"SeedDefaultCommsResponseDto":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"templatesCreated":{"type":"number","description":"Default email templates created (en + he)."},"rulesCreated":{"type":"number","description":"Default automation rules created."},"senderIdentityCreated":{"type":"boolean"},"providerAccountCreated":{"type":"boolean"}},"required":["organizationId","templatesCreated","rulesCreated","senderIdentityCreated","providerAccountCreated"]},"SendTestEmailDto":{"type":"object","properties":{"toAddress":{"type":"string","description":"Recipient address for the live test send."},"locale":{"type":"string","enum":["en","he"],"description":"Locale override for the test render."},"mergeContext":{"type":"object","description":"Sample merge context. Defaults to a minimal sample if omitted.","additionalProperties":true}},"required":["toAddress"]},"SendTestEmailResponseDto":{"type":"object","properties":{"logId":{"type":"string","format":"uuid","description":"The communication log id to poll for status."},"status":{"type":"string","example":"queued"}},"required":["logId","status"]},"CommunicationSenderIdentityResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"providerAccountId":{"type":"string","format":"uuid"},"channel":{"type":"string","enum":["email","sms","whatsapp"]},"identityType":{"type":"string","enum":["email_address","email_domain","phone_number","whatsapp_sender"]},"value":{"type":"string"},"displayName":{"type":"object","nullable":true},"isDefaultForChannel":{"type":"boolean"},"domainVerified":{"type":"boolean"},"verificationStatus":{"type":"string","enum":["pending","verified","failed"]},"createdAt":{"type":"string"},"verifiedAt":{"type":"object","nullable":true}},"required":["id","organizationId","providerAccountId","channel","identityType","value","displayName","isDefaultForChannel","domainVerified","verificationStatus","createdAt","verifiedAt"]},"CommunicationSenderIdentitiesListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/CommunicationSenderIdentityResponseDto"}},"totalCount":{"type":"number"}},"required":["rows","totalCount"]},"SendingDomainDnsRecordDto":{"type":"object","properties":{"type":{"type":"string","enum":["CNAME","TXT","MX"]},"host":{"type":"string","description":"Fully-qualified host to create the record at."},"value":{"type":"string","description":"Value the record must hold."},"purpose":{"type":"string","enum":["mail_cname","dkim","spf","mail_from","dmarc","other"]}},"required":["type","host","value","purpose"]},"SendingDomainRecordCheckDto":{"type":"object","properties":{"type":{"type":"string","enum":["CNAME","TXT","MX"]},"host":{"type":"string"},"purpose":{"type":"string","enum":["mail_cname","dkim","spf","mail_from","dmarc","other"]},"providerValid":{"type":"boolean","nullable":true,"description":"The email provider's verdict for this record. Null when the provider has no per-record answer."},"providerReason":{"type":"string","nullable":true,"description":"Provider's reason when invalid."},"dnsFound":{"type":"boolean","description":"Our own DNS lookup found a record of this type at the host."},"dnsMatches":{"type":"boolean","description":"Our own DNS lookup resolved exactly the expected value."}},"required":["type","host","purpose","providerValid","providerReason","dnsFound","dnsMatches"]},"SendingDomainValidationDto":{"type":"object","properties":{"checkedAt":{"type":"string","description":"ISO timestamp of the check."},"providerValid":{"type":"boolean","description":"True only when the PROVIDER confirmed every record."},"records":{"type":"array","items":{"$ref":"#/components/schemas/SendingDomainRecordCheckDto"}}},"required":["checkedAt","providerValid","records"]},"SendingDomainResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"provider":{"type":"string","description":"Email provider that holds the domain authentication."},"domain":{"type":"string","description":"The organization domain as entered."},"subdomain":{"type":"string","nullable":true,"description":"Subdomain label, or null when sending from the root."},"sendingDomain":{"type":"string","description":"The host being authenticated, e.g. `news.example.org`."},"verificationStatus":{"type":"string","enum":["pending","verified","failed"]},"dnsRecords":{"description":"Records to publish at the DNS host.","type":"array","items":{"$ref":"#/components/schemas/SendingDomainDnsRecordDto"}},"detectedDnsHost":{"type":"string","enum":["godaddy","cloudflare","namecheap","google_squarespace","wix","route53","other"],"nullable":true,"description":"DNS host detected from the nameservers. Use it to pick short instructions; `other` shows generic ones."},"lastValidation":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/SendingDomainValidationDto"}]},"checkingStopped":{"type":"boolean","description":"True when background re-checking stopped (7 days or the attempt cap). `verify` resumes it."},"senderAddress":{"type":"string","nullable":true,"description":"Sender address created at this domain; usable for sending once the domain is verified."},"lastCheckedAt":{"type":"string","nullable":true},"verifiedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","provider","domain","subdomain","sendingDomain","verificationStatus","dnsRecords","detectedDnsHost","lastValidation","checkingStopped","senderAddress","lastCheckedAt","verifiedAt","createdAt"]},"SendingDomainsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/SendingDomainResponseDto"}},"totalCount":{"type":"number"}},"required":["rows","totalCount"]},"CreateSendingDomainDto":{"type":"object","properties":{"domain":{"type":"string","description":"The organization's own domain, e.g. `example.org` (a scheme, `www.` or an email address is cleaned up).","example":"example.org"},"mode":{"type":"string","enum":["subdomain","root"],"default":"subdomain","description":"`subdomain` (default, recommended) authenticates `<subdomainLabel>.<domain>`; `root` authenticates the domain itself."},"subdomainLabel":{"type":"string","default":"news","description":"Subdomain label used when `mode` is `subdomain`.","example":"news"},"senderLocalPart":{"type":"string","default":"hello","description":"Part before the @ of the sender address created at this domain (e.g. `hello` gives `hello@news.example.org`). It becomes usable once the domain is verified."},"senderDisplayName":{"type":"string","description":"Display name for the sender address. Defaults to the organization name."}},"required":["domain"]},"SendSendingDomainInstructionsDto":{"type":"object","properties":{"toEmail":{"type":"string","description":"Where to send the DNS instructions, e.g. the IT person or domain registrar contact."},"locale":{"type":"string","enum":["en","he"],"default":"en"},"note":{"type":"string","description":"Optional short personal note shown above the records (plain text)."}},"required":["toEmail"]},"SendSendingDomainInstructionsResponseDto":{"type":"object","properties":{"logId":{"type":"string","nullable":true,"format":"uuid","description":"Null when the same instructions were already queued for this recipient within the hour."},"status":{"type":"string","example":"queued","description":"`queued` or `already_queued`."}},"required":["logId","status"]},"SharedLaneStatusDto":{"type":"object","properties":{"configured":{"type":"boolean","description":"Whether the platform shared marketing sender (COMMS_SHARED_MARKETING_FROM) is configured on this environment. When false, marketing for an organization without a verified domain is skipped."},"monthlyCap":{"type":"number","nullable":true,"description":"Shared marketing monthly cap from the effective plan, with an optional organization override; null means unlimited."},"sentThisMonth":{"type":"number","description":"Marketing emails sent on the shared lane in the current UTC calendar month."},"remaining":{"type":"number","nullable":true,"description":"Remaining monthly messages; null when unlimited."},"capIsOverridden":{"type":"boolean","description":"True when the cap was set for this organization by a platform admin."}},"required":["configured","monthlyCap","sentThisMonth","remaining","capIsOverridden"]},"WarmupStatusDto":{"type":"object","properties":{"sendingDomain":{"type":"string","example":"news.example.org"},"dayNumber":{"type":"number","description":"Whole days since the domain was verified."},"dailyLimit":{"type":"number","description":"Marketing emails allowed today on this domain while it warms up."},"sentToday":{"type":"number","description":"Marketing emails already sent today (UTC) on this domain."}},"required":["sendingDomain","dayNumber","dailyLimit","sentToday"]},"MarketingSenderOptionDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"address":{"type":"string","example":"hello@news.example.org"},"displayName":{"type":"string","nullable":true},"sendingDomain":{"type":"string","example":"news.example.org"}},"required":["id","address","displayName","sendingDomain"]},"CommunicationSettingsResponseDto":{"type":"object","properties":{"replyToEmail":{"type":"string","nullable":true},"defaultMarketingSenderIdentityId":{"type":"string","format":"uuid","nullable":true},"marketingLane":{"type":"string","enum":["org_domain","shared_marketing","unavailable"],"description":"The lane marketing email would use right now: `org_domain` (verified domain), `shared_marketing` (platform shared sender, capped), or `unavailable` (no verified domain and the shared lane is unconfigured, capped out, or the breaker is blocking marketing)."},"marketingLaneBlockedReason":{"type":"string","nullable":true,"description":"Machine-readable reason when `marketingLane` is `unavailable`: shared_lane_cap | shared_lane_unconfigured | marketing_paused | marketing_stopped."},"transactionalLane":{"type":"string","description":"System notifications use a verified organization sender when the domain capability is active; otherwise they use the co-branded platform sender."},"sharedLane":{"$ref":"#/components/schemas/SharedLaneStatusDto"},"breaker":{"$ref":"#/components/schemas/MarketingBreakerStatusDto"},"warmup":{"nullable":true,"description":"Present while a newly verified domain is still ramping up (first ~3 weeks).","allOf":[{"$ref":"#/components/schemas/WarmupStatusDto"}]},"marketingSenderOptions":{"description":"Senders on verified domains that can be chosen as the default marketing sender.","type":"array","items":{"$ref":"#/components/schemas/MarketingSenderOptionDto"}}},"required":["replyToEmail","defaultMarketingSenderIdentityId","marketingLane","marketingLaneBlockedReason","transactionalLane","sharedLane","breaker","warmup","marketingSenderOptions"]},"UpdateCommunicationSettingsDto":{"type":"object","properties":{"replyToEmail":{"type":"string","nullable":true,"description":"Reply-To address for co-branded platform email and the shared marketing lane (donors reply to this inbox). A single mailbox, no display name. `null` clears it.","example":"info@example.org"},"defaultMarketingSenderIdentityId":{"type":"string","format":"uuid","nullable":true,"description":"Default sender for marketing email: must be an email sender identity on one of this organization's VERIFIED sending domains. `null` clears it (the first verified-domain sender is used)."}}},"CommunicationProviderAccountResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"provider":{"type":"string"},"subAccountExternalIdMasked":{"type":"string","description":"Masked external sub-account id (last 4 chars only)."},"status":{"type":"string"},"configJson":{"type":"object","additionalProperties":true},"createdAt":{"type":"string"},"activatedAt":{"type":"object","nullable":true}},"required":["id","organizationId","provider","subAccountExternalIdMasked","status","configJson","createdAt","activatedAt"]},"CommunicationProviderAccountsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/CommunicationProviderAccountResponseDto"}},"totalCount":{"type":"number"}},"required":["rows","totalCount"]},"CommunicationChannelReadinessDto":{"type":"object","properties":{"channel":{"type":"string","enum":["email","sms","whatsapp"]},"status":{"type":"string","enum":["not_configured","configured","active","degraded","error"]},"provider":{"type":"object","nullable":true},"configured":{"type":"boolean","description":"Whether an encrypted provider credential is stored."},"maskedApiKeySuffix":{"type":"object","nullable":true,"description":"Last 4 characters of the SendGrid key when decryption is possible."},"providerAccountStatus":{"type":"object","nullable":true},"lastTestedAt":{"type":"object","nullable":true},"lastTestOk":{"type":"object","nullable":true},"senderIdentityCount":{"type":"number"},"verifiedSenderIdentityCount":{"type":"number"},"webhookConfigured":{"type":"boolean"},"blockingReasons":{"type":"array","items":{"type":"string"}},"warnings":{"type":"array","items":{"type":"string"}}},"required":["channel","status","provider","configured","providerAccountStatus","lastTestedAt","lastTestOk","senderIdentityCount","verifiedSenderIdentityCount","webhookConfigured","blockingReasons","warnings"]},"CommunicationReadinessResponseDto":{"type":"object","properties":{"channels":{"type":"array","items":{"$ref":"#/components/schemas/CommunicationChannelReadinessDto"}}},"required":["channels"]},"PutOrganizationTwilioSmsIntegrationDto":{"type":"object","properties":{"accountSid":{"type":"string","description":"Twilio Account SID. Stored encrypted server-side and never returned."},"authToken":{"type":"string","description":"Twilio Auth Token. Stored encrypted server-side and never returned."}},"required":["accountSid","authToken"]},"CommunicationIntegrationTestResultDto":{"type":"object","properties":{"ok":{"type":"boolean"},"httpStatus":{"type":"number","description":"Upstream HTTP status from the provider self-test call."},"errorCode":{"type":"string","description":"Stable machine-readable code when ok=false."},"message":{"type":"string","description":"Safe operator-facing detail. Never includes secrets."}},"required":["ok"]},"PutOrganizationTwilioWhatsappIntegrationDto":{"type":"object","properties":{"accountSid":{"type":"string","description":"Twilio Account SID. Stored encrypted server-side and never returned."},"authToken":{"type":"string","description":"Twilio Auth Token. Stored encrypted server-side and never returned."},"messagingServiceSid":{"type":"string","description":"Optional Twilio Messaging Service SID or WhatsApp sender reference for WABA routing."}},"required":["accountSid","authToken"]},"CommunicationSuppressionResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"channel":{"type":"string","enum":["email","sms","whatsapp"]},"addressMasked":{"type":"string","description":"Masked address (first 2 chars + domain, or first 4 phone digits)."},"addressHash":{"type":"string"},"reason":{"type":"string","enum":["hard_bounce","spam_complaint","user_unsubscribe_global","invalid_address","manual_block"]},"source":{"type":"string","enum":["sendgrid_webhook","twilio_webhook","user_action","admin_action","migration"]},"suppressedAt":{"type":"string"},"liftedAt":{"type":"object","nullable":true}},"required":["id","organizationId","channel","addressMasked","addressHash","reason","source","suppressedAt","liftedAt"]},"CommunicationSuppressionsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/CommunicationSuppressionResponseDto"}},"totalCount":{"type":"number"}},"required":["rows","totalCount"]},"CreateCommunicationSuppressionDto":{"type":"object","properties":{"channel":{"type":"string","enum":["email","sms","whatsapp"]},"address":{"type":"string","description":"Email or E.164 phone — lowercased / normalized server-side.","maxLength":320},"reason":{"type":"string","enum":["hard_bounce","spam_complaint","user_unsubscribe_global","invalid_address","manual_block"]},"source":{"type":"string","enum":["sendgrid_webhook","twilio_webhook","user_action","admin_action","migration"],"default":"admin_action"}},"required":["channel","address","reason"]},"UnsubscribePreviewResponseDto":{"type":"object","properties":{"contactId":{"type":"string"},"organizationId":{"type":"string"},"contactInitials":{"type":"string","description":"A coarse handle for the contact (\"J. D.\")."},"optedOutFrom":{"type":"array","items":{"type":"string","enum":["email","sms","whatsapp"]}}},"required":["contactId","organizationId","contactInitials","optedOutFrom"]},"UnsubscribeRequestDto":{"type":"object","properties":{"List-Unsubscribe":{"type":"string","enum":["One-Click"],"description":"RFC 8058 mailbox-provider form field."},"channels":{"type":"array","description":"Optional list of channel keys to opt-out from. Defaults to [\"email\"] for an email-link click, [\"sms\"] for STOP from SMS, etc.","items":{"type":"string","enum":["email","sms","whatsapp"]}}}},"BroadcastResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"name":{"type":"string"},"channel":{"type":"string","enum":["email","sms","whatsapp"]},"templateId":{"type":"string","format":"uuid"},"localeStrategy":{"type":"string","enum":["template_locale","contact_preferred","fallback_en"]},"senderIdentityId":{"type":"string","format":"uuid"},"targetKind":{"type":"string","enum":["segment","contact_list"]},"scheduledAt":{"type":"object","nullable":true},"status":{"type":"string","enum":["draft","scheduled","sending","completed","canceled","failed"]},"expectedRecipientsCount":{"type":"number"},"actualEnqueuedCount":{"type":"number"},"sentCount":{"type":"number"},"deliveredCount":{"type":"number"},"failedCount":{"type":"number"},"bouncedCount":{"type":"number"},"openedCount":{"type":"number"},"clickedCount":{"type":"number"},"unsubscribedCount":{"type":"number"},"skippedNoConsentCount":{"type":"number"},"skippedSuppressedCount":{"type":"number"},"createdAt":{"type":"string"},"startedAt":{"type":"object","nullable":true},"completedAt":{"type":"object","nullable":true},"canceledAt":{"type":"object","nullable":true},"holdReason":{"type":"string","nullable":true,"description":"Why the broadcast did not go out: `list_quality_hold:<bad>/<total>` when more than 2% of the audience are invalid or suppressed addresses (clean the list and send again), `plan_limit_exceeded`, or the cancellation reason."}},"required":["id","organizationId","name","channel","templateId","localeStrategy","senderIdentityId","targetKind","scheduledAt","status","expectedRecipientsCount","actualEnqueuedCount","sentCount","deliveredCount","failedCount","bouncedCount","openedCount","clickedCount","unsubscribedCount","skippedNoConsentCount","skippedSuppressedCount","createdAt","startedAt","completedAt","canceledAt","holdReason"]},"BroadcastsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/BroadcastResponseDto"}},"totalCount":{"type":"number"}},"required":["rows","totalCount"]},"CreateBroadcastDto":{"type":"object","properties":{"name":{"type":"string","maxLength":200},"channel":{"type":"string","enum":["email","sms","whatsapp"]},"templateId":{"type":"string","format":"uuid"},"localeStrategy":{"type":"string","enum":["template_locale","contact_preferred","fallback_en"],"default":"template_locale"},"senderIdentityId":{"type":"string","format":"uuid"},"targetKind":{"type":"string","enum":["segment","contact_list"]},"segmentId":{"type":"string","format":"uuid"},"contactIds":{"description":"Required when target_kind=contact_list. Max 5000 uuid strings.","maxItems":5000,"type":"array","items":{"type":"string","format":"uuid"}},"scheduledAt":{"type":"string","description":"ISO-8601 UTC. Omit for send_now."},"startMode":{"type":"string","enum":["send_now","schedule","draft"],"description":"send_now delivers immediately, schedule delivers at scheduledAt, draft saves the broadcast and does not send."},"mergeContextStatic":{"type":"object","additionalProperties":true},"idempotencyKey":{"type":"string","description":"Client-supplied idempotency key.","maxLength":200}},"required":["name","channel","templateId","senderIdentityId","targetKind","startMode","idempotencyKey"]},"CancelBroadcastDto":{"type":"object","properties":{"reason":{"type":"string","maxLength":500}}},"BroadcastRecipientResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contactId":{"type":"object","format":"uuid","nullable":true},"resolvedToAddressMasked":{"type":"string","description":"Masked recipient address."},"resolvedLocale":{"type":"string","enum":["en","he"]},"status":{"type":"string","enum":["pending","queued","skipped_no_consent","skipped_suppressed","skipped_invalid","sent","delivered","failed","bounced","opened","clicked","unsubscribed"]},"skipReason":{"type":"object","nullable":true},"logId":{"type":"object","format":"uuid","nullable":true},"createdAt":{"type":"string"},"queuedAt":{"type":"object","nullable":true}},"required":["id","contactId","resolvedToAddressMasked","resolvedLocale","status","skipReason","logId","createdAt","queuedAt"]},"BroadcastRecipientsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/BroadcastRecipientResponseDto"}},"totalCount":{"type":"number"}},"required":["rows","totalCount"]},"CommunicationLogResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"channel":{"type":"string","enum":["email","sms","whatsapp"]},"sourceKind":{"type":"string"},"templateId":{"type":"string","format":"uuid"},"templateVersion":{"type":"number"},"contactId":{"type":"object","format":"uuid","nullable":true},"toAddressMasked":{"type":"string","description":"Masked recipient (PII redacted)."},"status":{"type":"string","enum":["queued","sent","delivered","failed","bounced","complained","opened","clicked","unsubscribed","skipped_no_consent","skipped_suppressed"]},"sentAt":{"type":"object","nullable":true},"deliveredAt":{"type":"object","nullable":true},"failedAt":{"type":"object","nullable":true},"lastErrorCode":{"type":"object","nullable":true},"lastErrorMessage":{"type":"object","nullable":true},"category":{"type":"string","enum":["transactional","marketing","ambassador","system"],"nullable":true},"receiptAttachmentUrl":{"type":"object","nullable":true,"description":"Receipt attachment URL passed through to the email provider (we never store the binary)."},"receiptAttachmentMime":{"type":"object","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","channel","sourceKind","templateId","templateVersion","contactId","toAddressMasked","status","sentAt","deliveredAt","failedAt","lastErrorCode","lastErrorMessage","category","receiptAttachmentUrl","receiptAttachmentMime","createdAt"]},"CommunicationLogsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/CommunicationLogResponseDto"}},"totalCount":{"type":"number"}},"required":["rows","totalCount"]},"CopyPerformanceEntryDto":{"type":"object","properties":{"templateId":{"type":"string","format":"uuid","description":"The communication template the broadcasts used."},"subject":{"type":"object","nullable":true,"description":"Template-level subject with merge tags UN-rendered (email only; null for sms/whatsapp)."},"channel":{"type":"string","enum":["email","sms","whatsapp"]},"locale":{"type":"string","enum":["en","he"]},"category":{"type":"string","enum":["transactional","marketing","ambassador","system"]},"sends":{"type":"number","description":"Total messages sent across all broadcasts of this template."},"openRate":{"type":"number","description":"Opened ÷ sent across all broadcasts of this template (0..1, 4 decimal places)."},"clickRate":{"type":"number","description":"Clicked ÷ sent across all broadcasts of this template (0..1, 4 decimal places)."},"unsubscribeRate":{"type":"number","description":"Unsubscribed ÷ sent across all broadcasts of this template (0..1, 4 decimal places) — the honest cost signal next to the open/click wins."},"lastSentAt":{"type":"object","format":"date-time","nullable":true,"description":"When the most recent broadcast of this template finished (or started) sending."}},"required":["templateId","subject","channel","locale","category","sends","openRate","clickRate","unsubscribeRate"]},"CopyPerformanceResponseDto":{"type":"object","properties":{"entries":{"description":"Best-performing template-level copy, sorted by openRate then clickRate.","type":"array","items":{"$ref":"#/components/schemas/CopyPerformanceEntryDto"}},"dataThin":{"type":"boolean","description":"True when NO template passed the k-anonymity sends floor — an honest \"not enough data yet\", never invented baselines."},"minSends":{"type":"number","description":"The k-anonymity floor applied: entries need at least this many sends to appear."},"computedAt":{"type":"string","format":"date-time"}},"required":["entries","dataThin","minSends","computedAt"]},"PerformanceRangeDto":{"type":"object","properties":{"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"}},"required":["from","to"]},"PerformanceRevenueDto":{"type":"object","properties":{"currency":{"type":"string","example":"ILS","description":"ISO 4217 currency of the donations."},"amountMinor":{"type":"number","description":"Sum of attributed, still-succeeded donations, in minor units (agorot/cents)."}},"required":["currency","amountMinor"]},"PerformanceMetricsDto":{"type":"object","properties":{"sent":{"type":"number","description":"Emails handed to the provider in the range (cohort = send time)."},"delivered":{"type":"number","description":"Emails the provider reported as delivered."},"bounced":{"type":"number","description":"Emails that bounced."},"unsubscribed":{"type":"number","description":"Emails whose recipient unsubscribed from them."},"complained":{"type":"number","description":"Emails the recipient marked as spam."},"opensUnique":{"type":"number","description":"Emails opened at least once, counting automatic opens. APPROXIMATE: some mail apps (Apple Mail Privacy Protection, Gmail/Yahoo proxies) open emails on their own."},"opensHumanUnique":{"type":"number","description":"Emails opened at least once by what looks like a person (automatic/proxy opens excluded). Only emails sent with our own tracking can count here."},"opensTotal":{"type":"number","description":"Open events including automatic ones (one per email per hour at most)."},"opensHumanTotal":{"type":"number","description":"Open events from what looks like a person."},"clicksUnique":{"type":"number","description":"Emails where at least one link was clicked by what looks like a person."},"clicksTotal":{"type":"number","description":"Click events by what looks like a person (one per email per link per day at most)."},"donationsCount":{"type":"number","description":"Donations attributed to these emails (last click within 7 days)."},"donationsRevenue":{"type":"array","items":{"$ref":"#/components/schemas/PerformanceRevenueDto"}}},"required":["sent","delivered","bounced","unsubscribed","complained","opensUnique","opensHumanUnique","opensTotal","opensHumanTotal","clicksUnique","clicksTotal","donationsCount","donationsRevenue"]},"PerformanceRowDto":{"type":"object","properties":{"key":{"type":"string","description":"Id of the broadcast / automation / template / campaign, or the step id for `automation_step`."},"label":{"type":"string","nullable":true,"description":"Human-readable name of the key when known."},"metrics":{"$ref":"#/components/schemas/PerformanceMetricsDto"}},"required":["key","label","metrics"]},"CommunicationPerformanceResponseDto":{"type":"object","properties":{"dimension":{"type":"string","enum":["broadcast","automation","automation_step","template","campaign"]},"range":{"$ref":"#/components/schemas/PerformanceRangeDto"},"rows":{"type":"array","items":{"$ref":"#/components/schemas/PerformanceRowDto"}},"totals":{"description":"Totals across `rows`.","allOf":[{"$ref":"#/components/schemas/PerformanceMetricsDto"}]},"opensNote":{"type":"string","description":"Reminder to show next to open numbers: opens are approximate because some mail apps open emails automatically."}},"required":["dimension","range","rows","totals","opensNote"]},"PerformanceTopLinkDto":{"type":"object","properties":{"url":{"type":"string","description":"The original destination URL (no recipient data)."},"uniqueClicks":{"type":"number","description":"Emails in which this link was clicked by what looks like a person."}},"required":["url","uniqueClicks"]},"BroadcastPerformanceResponseDto":{"type":"object","properties":{"broadcastId":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true},"metrics":{"$ref":"#/components/schemas/PerformanceMetricsDto"},"topLinks":{"description":"Most-clicked links, best first (max 10).","type":"array","items":{"$ref":"#/components/schemas/PerformanceTopLinkDto"}},"opensNote":{"type":"string"}},"required":["broadcastId","name","metrics","topLinks","opensNote"]},"AutomationPerformanceResponseDto":{"type":"object","properties":{"automationId":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true},"metrics":{"$ref":"#/components/schemas/PerformanceMetricsDto"},"steps":{"description":"One row per email step, keyed by the step id.","type":"array","items":{"$ref":"#/components/schemas/PerformanceRowDto"}},"opensNote":{"type":"string"}},"required":["automationId","name","metrics","steps","opensNote"]},"ContactEmailActivityItemDto":{"type":"object","properties":{"logId":{"type":"string","format":"uuid"},"subject":{"type":"string","nullable":true,"description":"Template-level subject (merge tags un-rendered)."},"sourceLabel":{"type":"string","nullable":true,"description":"Broadcast / automation the email belonged to, when known."},"sourceKind":{"type":"string","nullable":true,"description":"How the email was created: `personal` (sent one-to-one from the contact card), `broadcast`, `automation_rule`, `system`, ... Null when unknown."},"sentAt":{"type":"string","format":"date-time","nullable":true},"deliveredAt":{"type":"string","format":"date-time","nullable":true},"openedAt":{"type":"string","format":"date-time","nullable":true,"description":"First open (approximate; may be automatic)."},"openLooksAutomatic":{"type":"boolean","description":"True when at least one open looks automatic (mail privacy proxy / scanner)."},"clickedAt":{"type":"string","format":"date-time","nullable":true},"linksClicked":{"type":"number","description":"Distinct links this person clicked."},"donations":{"description":"Donations by this person attributed to this email.","type":"array","items":{"$ref":"#/components/schemas/PerformanceRevenueDto"}},"donationsCount":{"type":"number","description":"Number of attributed donations."}},"required":["logId","subject","sourceLabel","sourceKind","sentAt","deliveredAt","openedAt","openLooksAutomatic","clickedAt","linksClicked","donations","donationsCount"]},"ContactEmailActivityResponseDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/ContactEmailActivityItemDto"}},"opensNote":{"type":"string"}},"required":["items","opensNote"]},"SendContactEmailDto":{"type":"object","properties":{"templateId":{"type":"string","format":"uuid","description":"Send a marketing email template. Mutually exclusive with `subject` / `body`. Only active EMAIL templates in the marketing category can be sent one-to-one."},"locale":{"type":"string","enum":["en","he"],"description":"Locale to send in. With a template: picks that template key in this locale when it exists. Defaults to the contact preferred locale, else the template locale. For free text it sets the text direction of the layout."},"subject":{"type":"string","minLength":1,"maxLength":200,"description":"Free-text mode: the subject line (plain text; control characters are removed)."},"body":{"type":"string","minLength":1,"maxLength":20000,"description":"Free-text mode: the message. With `bodyFormat=text` (default) it is escaped and line breaks are kept. With `bodyFormat=html` it is sanitized to a minimal allowlist (p, br, strong, em, u, a[href], lists, blockquote)."},"bodyFormat":{"type":"string","enum":["text","html"],"default":"text","description":"Free-text mode only. Default `text`."},"senderIdentityId":{"type":"string","format":"uuid","description":"Preferred sender identity (email channel). Defaults to the organization default marketing sender. The lane (verified domain vs shared marketing lane) is still decided at send time."}}},"SendContactEmailResponseDto":{"type":"object","properties":{"logId":{"type":"string","format":"uuid","description":"The communication log id. Poll `getCommunicationLog` or `getContactEmailActivity` for status."},"status":{"type":"string","example":"queued"},"lane":{"type":"string","enum":["org_domain","shared_marketing"],"description":"The marketing lane this email will go out on if nothing changes before the worker runs."},"source":{"type":"string","example":"personal","description":"Always `personal`: the log source for one-to-one emails."},"replayed":{"type":"boolean","description":"True when an earlier request with the same Idempotency-Key already created this log."}},"required":["logId","status","lane","source","replayed"]},"TaskResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["call","email","meeting","whatsapp","sms","todo","donation_chase","custom"]},"source":{"type":"string","enum":["manual","system","automation","ai_advisor","reminder"]},"status":{"type":"string","enum":["open","in_progress","completed","snoozed","skipped","canceled","expired","blocked"]},"priority":{"type":"string","enum":["low","normal","high","urgent"]},"title":{"type":"string"},"description":{"type":"string","nullable":true},"assignedToGlobalUserId":{"type":"string","format":"uuid","nullable":true},"coAssigneeGlobalUserIds":{"type":"array","items":{"type":"string"}},"createdById":{"type":"string","format":"uuid","nullable":true},"completedByUserId":{"type":"string","format":"uuid","nullable":true},"contactId":{"type":"string","format":"uuid","nullable":true},"additionalContactIds":{"type":"array","items":{"type":"string"}},"contributionId":{"type":"string","format":"uuid","nullable":true},"campaignId":{"type":"string","format":"uuid","nullable":true},"campaignName":{"type":"string","nullable":true,"description":"Display name of the linked campaign, when the row was loaded from a cross-campaign surface (e.g. the copilot feed). Lets identical system templates from different campaigns stay distinguishable."},"teamId":{"type":"string","format":"uuid","nullable":true},"relatedEntityType":{"type":"string","nullable":true},"relatedEntityId":{"type":"string","format":"uuid","nullable":true},"dueAt":{"type":"string","format":"date-time","nullable":true},"remindAt":{"type":"string","format":"date-time","nullable":true},"startedAt":{"type":"string","format":"date-time","nullable":true},"completedAt":{"type":"string","format":"date-time","nullable":true},"canceledAt":{"type":"string","format":"date-time","nullable":true},"snoozedUntil":{"type":"string","format":"date-time","nullable":true},"outcomeText":{"type":"string","nullable":true},"customProperties":{"type":"object","additionalProperties":true},"lifecyclePhase":{"type":"string","enum":["pre_campaign","soft_launch","live_campaign","post_campaign"],"nullable":true},"triggerEvent":{"type":"string","enum":["contacts_imported","core_circle_defined","launch_window_opened","campaign_published","campaign_live_hour_1","campaign_live_last_6h","ambassador_below_threshold","donation_rate_drop","campaign_ended","failed_clearing_detected"],"nullable":true},"templateKey":{"type":"string","nullable":true},"isBlocking":{"type":"boolean"},"actionKind":{"type":"string","enum":["open_whatsapp_prefill","open_sms_prefill","trigger_matcher","start_clearing_test","open_settings","mark_done_with_proof"],"nullable":true},"actionPayload":{"type":"object","additionalProperties":true,"nullable":true},"triggerContext":{"type":"object","additionalProperties":true,"nullable":true},"dedupeKey":{"type":"string","nullable":true},"lastAiSummary":{"type":"string","nullable":true},"overdue":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","type","source","status","priority","title","description","assignedToGlobalUserId","coAssigneeGlobalUserIds","createdById","completedByUserId","contactId","additionalContactIds","contributionId","campaignId","campaignName","teamId","relatedEntityType","relatedEntityId","dueAt","remindAt","startedAt","completedAt","canceledAt","snoozedUntil","outcomeText","customProperties","lifecyclePhase","triggerEvent","templateKey","isBlocking","actionKind","actionPayload","triggerContext","dedupeKey","lastAiSummary","overdue","createdAt","updatedAt"]},"TaskListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/TaskResponseDto"}},"totalCount":{"type":"number"},"canManageTasks":{"type":"boolean","description":"True when the caller holds \"tasks.manage\" (can create/edit/delete any task and list org-wide). Lets the UI gate management affordances without inferring from role keys."},"canAssignTasks":{"type":"boolean","description":"True when the caller holds \"tasks.assign\" (can (re)assign task owners and co-assignees)."}},"required":["rows","totalCount","canManageTasks","canAssignTasks"]},"CreateTaskDto":{"type":"object","properties":{"type":{"type":"string","enum":["call","email","meeting","whatsapp","sms","todo","donation_chase","custom"]},"title":{"type":"string","maxLength":240},"description":{"type":"string","maxLength":4000},"priority":{"type":"string","enum":["low","normal","high","urgent"],"default":"normal"},"assignedToGlobalUserId":{"type":"string","format":"uuid","nullable":true,"description":"Owner of the task. Omit to assign the person creating it. Null leaves the task unassigned."},"coAssigneeGlobalUserIds":{"maxItems":25,"type":"array","items":{"type":"string","format":"uuid"}},"contactId":{"type":"string","format":"uuid"},"contributionId":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"teamId":{"type":"string","format":"uuid","description":"Campaign team node this task hangs off."},"dueAt":{"type":"string","format":"date-time"},"remindAt":{"type":"string","format":"date-time"},"customProperties":{"type":"object","additionalProperties":true},"isBlocking":{"type":"boolean","description":"Marks the task as blocking a campaign lifecycle phase gate."},"lifecyclePhase":{"type":"string","enum":["pre_campaign","soft_launch","live_campaign","post_campaign"],"description":"Optional campaign lifecycle phase for campaign-scoped tasks."}},"required":["type","title"]},"TasksInsightResponseDto":{"type":"object","properties":{"summary":{"type":"string","description":"Natural-language summary + prioritization of the caller’s open tasks."},"focusTaskIds":{"description":"Ordered task ids the caller should focus on next (highest impact first).","type":"array","items":{"type":"string"}},"openTaskCount":{"type":"number","description":"Total open tasks considered for this insight."},"overdueTaskCount":{"type":"number","description":"How many of the open tasks are overdue."},"generatedByAi":{"type":"boolean","description":"True when the summary came from the LLM; false when the deterministic fallback was used (LLM disabled or failed)."}},"required":["summary","focusTaskIds","openTaskCount","overdueTaskCount","generatedByAi"]},"UpdateTaskDto":{"type":"object","properties":{"status":{"type":"string","enum":["open","in_progress","completed","snoozed","skipped","canceled","expired","blocked"]},"type":{"type":"string","enum":["call","email","meeting","whatsapp","sms","todo","donation_chase","custom"]},"priority":{"type":"string","enum":["low","normal","high","urgent"]},"title":{"type":"string","maxLength":240},"description":{"type":"string","maxLength":4000,"nullable":true},"dueAt":{"type":"string","format":"date-time","nullable":true},"remindAt":{"type":"string","format":"date-time","nullable":true},"outcomeText":{"type":"string","maxLength":4000,"nullable":true},"assignedToGlobalUserId":{"type":"string","format":"uuid","nullable":true}}},"AssignTaskDto":{"type":"object","properties":{"assignedToGlobalUserId":{"type":"string","format":"uuid","nullable":true,"description":"Global user id to own the task. Pass null to unassign."},"coAssigneeGlobalUserIds":{"maxItems":25,"type":"array","items":{"type":"string","format":"uuid"}}},"required":["assignedToGlobalUserId"]},"TaskCommentResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"taskId":{"type":"string","format":"uuid"},"bodyText":{"type":"string"},"authorGlobalUserId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","taskId","bodyText","authorGlobalUserId","createdAt","updatedAt"]},"TaskCommentsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/TaskCommentResponseDto"}},"totalCount":{"type":"number"}},"required":["rows","totalCount"]},"CreateTaskCommentDto":{"type":"object","properties":{"bodyText":{"type":"string","maxLength":8000}},"required":["bodyText"]},"TaskFeedResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/TaskResponseDto"}},"totalCount":{"type":"number"},"blockingCount":{"type":"number"},"executionMode":{"type":"string","enum":["prefill_only","draft_then_confirm","one_click_auto"]},"copilotEnabled":{"type":"boolean","description":"Whether the Campaign Copilot feed tab is enabled for this organization (feature flag tasks.copilot_feed.enabled; default off for the pilot)."}},"required":["rows","totalCount","blockingCount","executionMode","copilotEnabled"]},"CreateManualTaskDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"lifecyclePhase":{"type":"string","enum":["pre_campaign","soft_launch","live_campaign","post_campaign"]},"title":{"type":"string","maxLength":200},"description":{"type":"string","maxLength":1000},"priority":{"type":"string","enum":["low","normal","high","urgent"],"default":"normal"},"isBlocking":{"type":"boolean"},"dueAt":{"type":"string","nullable":true},"actionKind":{"type":"string","enum":["open_whatsapp_prefill","open_sms_prefill","trigger_matcher","start_clearing_test","open_settings","mark_done_with_proof"],"nullable":true},"actionPayload":{"type":"object","additionalProperties":true,"nullable":true}},"required":["campaignId","lifecyclePhase","title"]},"ExecuteTaskActionDto":{"type":"object","properties":{"overrideMode":{"type":"string","enum":["prefill_only","draft_then_confirm","one_click_auto"]},"input":{"type":"object","additionalProperties":true}}},"ExecuteTaskActionResponseDto":{"type":"object","properties":{"mode":{"type":"string","enum":["prefill_only","draft_then_confirm","one_click_auto"]},"executionState":{"type":"string"},"payload":{"type":"object","additionalProperties":true},"task":{"$ref":"#/components/schemas/TaskResponseDto"}},"required":["mode","executionState","payload","task"]},"CompleteTaskDto":{"type":"object","properties":{"proof":{"type":"object","additionalProperties":true}}},"SnoozeTaskDto":{"type":"object","properties":{"dueAt":{"type":"string"},"reason":{"type":"string","maxLength":500}},"required":["dueAt"]},"CampaignPhaseGateRowDto":{"type":"object","properties":{"lifecyclePhase":{"type":"string","enum":["pre_campaign","soft_launch","live_campaign","post_campaign"]},"isLocked":{"type":"boolean"},"lockedReasonCode":{"type":"string","nullable":true},"lockedByTaskIds":{"type":"array","items":{"type":"string"}}},"required":["lifecyclePhase","isLocked","lockedReasonCode","lockedByTaskIds"]},"CampaignPhaseGatesResponseDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"rows":{"type":"array","items":{"$ref":"#/components/schemas/CampaignPhaseGateRowDto"}}},"required":["campaignId","rows"]},"CopilotTasksPreferenceResponseDto":{"type":"object","properties":{"enabled":{"type":"boolean","description":"The organization's own preference after the write."},"effectiveCopilotEnabled":{"type":"boolean","description":"Whether the Campaign Copilot tab is actually shown: the tenant preference AND the tasks.copilot_feed.enabled capability flag."}},"required":["enabled","effectiveCopilotEnabled"]},"UpdateCopilotTasksPreferenceDto":{"type":"object","properties":{"enabled":{"type":"boolean","description":"False switches Campaign Copilot off for this organization (CHAR-49). Already-created tasks are left in place - dismiss them individually."}},"required":["enabled"]},"TaskExecutionPolicyResponseDto":{"type":"object","properties":{"executionMode":{"type":"string","enum":["prefill_only","draft_then_confirm","one_click_auto"]},"allowManualTasks":{"type":"boolean"},"copilotTasksEnabled":{"type":"boolean","description":"Tenant preference (CHAR-49). When false the organization has switched Campaign Copilot off: no new system tasks are generated, the copilot tab is hidden, and existing blocking tasks stop gating publish. Composes with the tasks.copilot_feed.enabled capability flag - both must allow it for the tab to show."}},"required":["executionMode","allowManualTasks","copilotTasksEnabled"]},"UpdateTaskExecutionPolicyDto":{"type":"object","properties":{"executionMode":{"type":"string","enum":["prefill_only","draft_then_confirm","one_click_auto"]},"allowManualTasks":{"type":"boolean","default":true}},"required":["executionMode"]},"SegmentResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"object","nullable":true},"definition":{"type":"object","additionalProperties":true,"description":"Versioned AND/OR tree of typed filter leaves. Leaf types: `donation_total` ({ op, amountMinor, currency?, campaignId?, teamId?, from?, to? }), `donation_count` ({ op, count, ...scope }), `contact_source` ({ source }), `tag` ({ tagKey }), `campaign_participation` ({ op, count }), `consent` ({ channel: email|sms|whatsapp, optedIn }), `last_interaction` ({ op, date }), `contact_score` ({ op, value: 0-100 }), `contact_text` ({ query } — matches display name or email), `recurring_plan` ({ status: active|past_due|canceled }), `ambassador` ({ campaignId? }). Dates (`from`, `to`, `date`) are ISO-8601 or relative to the moment the segment is evaluated: { relative: \"P12M\" } means \"12 months ago\" (years, months, weeks, days: P1Y, P6M, P2W, P90D). Combine with { all: [...] } / { any: [...] }. Comparators: gte | lte | gt | lt | eq. Amounts are in minor units."},"isActive":{"type":"boolean"},"lastEvaluatedCount":{"type":"object","nullable":true,"description":"Contact count from the last preview/evaluation."},"lastEvaluatedAt":{"type":"object","nullable":true,"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","name","description","definition","isActive","lastEvaluatedCount","lastEvaluatedAt","createdAt","updatedAt"]},"SegmentsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/SegmentResponseDto"}},"totalCount":{"type":"number"}},"required":["rows","totalCount"]},"LocalizedTextDto":{"type":"object","properties":{"en":{"type":"string"},"he":{"type":"string"}},"required":["en","he"]},"SegmentPresetParamDto":{"type":"object","properties":{"key":{"type":"string","enum":["campaignId","minTotalMinor"]},"type":{"type":"string","enum":["campaign","amount_minor"],"description":"`campaign`: a campaign id. `amount_minor`: a whole number of minor units."},"required":{"type":"boolean"},"defaultValue":{"type":"number","description":"Used when the parameter is left out (amount parameters only)."}},"required":["key","type","required"]},"SegmentPresetResponseDto":{"type":"object","properties":{"key":{"type":"string","description":"Stable key, pass it to createSegmentFromPreset."},"group":{"type":"string","enum":["donors","campaign","supporters"]},"name":{"$ref":"#/components/schemas/LocalizedTextDto"},"description":{"$ref":"#/components/schemas/LocalizedTextDto"},"params":{"description":"What the preset needs from the caller (a campaign, an amount).","type":"array","items":{"$ref":"#/components/schemas/SegmentPresetParamDto"}}},"required":["key","group","name","description","params"]},"SegmentPresetsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/SegmentPresetResponseDto"}}},"required":["rows"]},"CreateSegmentFromPresetDto":{"type":"object","properties":{"preset":{"type":"string","description":"A key from listSegmentPresets, e.g. `lapsed_donors`.","maxLength":60},"campaignId":{"type":"string","format":"uuid","description":"Required by the campaign presets."},"minTotalMinor":{"type":"number","minimum":1,"description":"Major donors only: the lifetime total, in minor units, a donor must reach."},"name":{"type":"string","maxLength":200,"description":"Your own name for the segment (default: the preset name)."},"locale":{"type":"string","enum":["en","he"],"default":"en","description":"Language of the generated name and description."}},"required":["preset"]},"CreateSegmentDto":{"type":"object","properties":{"name":{"type":"string","maxLength":200,"description":"Human-friendly segment name."},"description":{"type":"string","maxLength":1000,"nullable":true},"definition":{"type":"object","additionalProperties":true,"description":"Versioned AND/OR tree of typed filter leaves. Leaf types: `donation_total` ({ op, amountMinor, currency?, campaignId?, teamId?, from?, to? }), `donation_count` ({ op, count, ...scope }), `contact_source` ({ source }), `tag` ({ tagKey }), `campaign_participation` ({ op, count }), `consent` ({ channel: email|sms|whatsapp, optedIn }), `last_interaction` ({ op, date }), `contact_score` ({ op, value: 0-100 }), `contact_text` ({ query } — matches display name or email), `recurring_plan` ({ status: active|past_due|canceled }), `ambassador` ({ campaignId? }). Dates (`from`, `to`, `date`) are ISO-8601 or relative to the moment the segment is evaluated: { relative: \"P12M\" } means \"12 months ago\" (years, months, weeks, days: P1Y, P6M, P2W, P90D). Combine with { all: [...] } / { any: [...] }. Comparators: gte | lte | gt | lt | eq. Amounts are in minor units.","example":{"version":1,"root":{"all":[{"type":"donation_total","op":"gte","amountMinor":50000,"currency":"USD"},{"type":"donation_count","op":"gte","count":1,"campaignId":"00000000-0000-0000-0000-000000000000"}]}}},"isActive":{"type":"boolean","default":true,"description":"Inactive segments are hidden from pickers."}},"required":["name","definition"]},"PreviewSegmentDto":{"type":"object","properties":{"definition":{"type":"object","additionalProperties":true,"description":"Versioned AND/OR tree of typed filter leaves. Leaf types: `donation_total` ({ op, amountMinor, currency?, campaignId?, teamId?, from?, to? }), `donation_count` ({ op, count, ...scope }), `contact_source` ({ source }), `tag` ({ tagKey }), `campaign_participation` ({ op, count }), `consent` ({ channel: email|sms|whatsapp, optedIn }), `last_interaction` ({ op, date }), `contact_score` ({ op, value: 0-100 }), `contact_text` ({ query } — matches display name or email), `recurring_plan` ({ status: active|past_due|canceled }), `ambassador` ({ campaignId? }). Dates (`from`, `to`, `date`) are ISO-8601 or relative to the moment the segment is evaluated: { relative: \"P12M\" } means \"12 months ago\" (years, months, weeks, days: P1Y, P6M, P2W, P90D). Combine with { all: [...] } / { any: [...] }. Comparators: gte | lte | gt | lt | eq. Amounts are in minor units.","example":{"version":1,"root":{"all":[{"type":"donation_total","op":"gte","amountMinor":50000,"currency":"USD"},{"type":"donation_count","op":"gte","count":1,"campaignId":"00000000-0000-0000-0000-000000000000"}]}}},"sampleSize":{"type":"number","minimum":1,"maximum":50,"default":10,"description":"How many sample contacts to return alongside the count."}},"required":["definition"]},"SegmentPreviewContactDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"email":{"type":"object","nullable":true},"preferredLocale":{"type":"object","nullable":true},"emailOptIn":{"type":"boolean","description":"Whether the contact may receive marketing email."}},"required":["id","displayName","email","preferredLocale","emailOptIn"]},"SegmentPreviewResponseDto":{"type":"object","properties":{"count":{"type":"number","description":"Total contacts matching the definition."},"sample":{"description":"A small sample of matched contacts.","type":"array","items":{"$ref":"#/components/schemas/SegmentPreviewContactDto"}}},"required":["count","sample"]},"UpdateSegmentDto":{"type":"object","properties":{"name":{"type":"string","maxLength":200},"description":{"type":"string","maxLength":1000,"nullable":true},"definition":{"type":"object","additionalProperties":true,"description":"Versioned AND/OR tree of typed filter leaves. Leaf types: `donation_total` ({ op, amountMinor, currency?, campaignId?, teamId?, from?, to? }), `donation_count` ({ op, count, ...scope }), `contact_source` ({ source }), `tag` ({ tagKey }), `campaign_participation` ({ op, count }), `consent` ({ channel: email|sms|whatsapp, optedIn }), `last_interaction` ({ op, date }), `contact_score` ({ op, value: 0-100 }), `contact_text` ({ query } — matches display name or email), `recurring_plan` ({ status: active|past_due|canceled }), `ambassador` ({ campaignId? }). Dates (`from`, `to`, `date`) are ISO-8601 or relative to the moment the segment is evaluated: { relative: \"P12M\" } means \"12 months ago\" (years, months, weeks, days: P1Y, P6M, P2W, P90D). Combine with { all: [...] } / { any: [...] }. Comparators: gte | lte | gt | lt | eq. Amounts are in minor units.","example":{"version":1,"root":{"all":[{"type":"donation_total","op":"gte","amountMinor":50000,"currency":"USD"},{"type":"donation_count","op":"gte","count":1,"campaignId":"00000000-0000-0000-0000-000000000000"}]}}},"isActive":{"type":"boolean"}}},"ContactSegmentDto":{"type":"object","properties":{"segmentId":{"type":"string","format":"uuid","nullable":false},"name":{"type":"string","nullable":false},"kind":{"type":"string","enum":["dynamic","static"],"nullable":false},"ruleSummary":{"type":"string","nullable":true}},"required":["segmentId","name","kind","ruleSummary"]},"ContactSegmentsResponseDto":{"type":"object","properties":{"items":{"nullable":false,"type":"array","items":{"$ref":"#/components/schemas/ContactSegmentDto"}}},"required":["items"]},"AdvisorStateDto":{"type":"object","properties":{"organizationId":{"type":"string","description":"Tenant scope; mirrors x-organization-id."},"stage":{"type":"string","enum":["dna_scan","diagnostic","foundation_track","strategic_tailoring","matcher_pitch","network_import","campaign_in_a_box","compliance_ocr","hatrama","daily_copilot","live","post_campaign"],"description":"Current stage the advisor wants the user to act on."},"stageSummary":{"type":"string","description":"One-sentence semantic summary of the stage in business language. Safe to inline in a chat system prompt without further transformation."},"nextActionHint":{"type":"string","description":"Short canonical hint token (e.g. \"generate_matcher_pitch_deck\"). The UI maps this to a CTA; the LLM treats it as the next move."},"reason":{"type":"string","description":"Coach-language explanation of why this stage was chosen. Goes into the chat system prompt so the LLM can quote it back to the user."},"evidence":{"type":"object","additionalProperties":true,"description":"Soft-typed evidence the resolver used. Useful for debugging the stage decision; never displayed verbatim to end users."},"lastAdvisorTurnAt":{"type":"string","nullable":true,"description":"ISO timestamp of the last time the advisor opened a turn."},"updatedAt":{"type":"string","description":"ISO timestamp of the last stage write."}},"required":["organizationId","stage","stageSummary","nextActionHint","reason","evidence","updatedAt"]},"AdvisorOpenerDto":{"type":"object","properties":{"opener":{"type":"string","description":"Localized opener line the chat should display when it first opens. Already personalised with stage hints and (when available) the org sector + currency. Safe to render as-is."},"locale":{"type":"string","enum":["he","en"],"description":"Locale used for the opener, stage summary, and suggested action label."},"suggestedActionLabel":{"type":"string","description":"Localized label for the single next action. Matches the opener locale so a Hebrew session does not show an English button."},"state":{"$ref":"#/components/schemas/AdvisorStateDto"}},"required":["opener","state"]},"GenerateMatcherPitchDeckRequestDto":{"type":"object","properties":{"campaignId":{"type":"string","description":"Campaign to anchor the pitch deck on. Omit for the most-recent draft."},"locale":{"type":"string","description":"Output locale (`he` or `en`). Defaults to the org locale.","enum":["he","en"]}}},"MatcherCandidateDto":{"type":"object","properties":{"contactId":{"type":"string"},"fullName":{"type":"string"},"reason":{"type":"string","nullable":true},"suggestedAskMinor":{"type":"string","nullable":true}},"required":["contactId","fullName"]},"GenerateMatcherPitchDeckResponseDto":{"type":"object","properties":{"markdown":{"type":"string","description":"Markdown body of the one-pager pitch deck. Rendered as Markdown in the UI; the API also returns the same content as an HTML document so the front end can offer a \"Download PDF\" button via `window.print`."},"html":{"type":"string","description":"Standalone HTML document (full <html>) ready for print-to-PDF."},"candidates":{"type":"array","items":{"$ref":"#/components/schemas/MatcherCandidateDto"}},"totalAskMinor":{"type":"number","description":"Total ask (sum of suggestedAskMinor) in minor units."},"currency":{"type":"string","description":"Currency code (3-letter ISO)."},"generatedAt":{"type":"string"},"aiAssisted":{"type":"boolean"},"aiGenerationVersion":{"type":"string"}},"required":["markdown","html","candidates","totalAskMinor","currency","generatedAt","aiAssisted","aiGenerationVersion"]},"GenerateCampaignBoxRequestDto":{"type":"object","properties":{"campaignId":{"type":"string","description":"Target campaign (draft or active)."},"locale":{"type":"string","enum":["he","en"]}},"required":["campaignId"]},"CampaignBoxEmailDto":{"type":"object","properties":{"moment":{"type":"string","enum":["save_the_date","live_now","final_hours"]},"subject":{"type":"string"},"body":{"type":"string"}},"required":["moment","subject","body"]},"CampaignBoxSocialPostDto":{"type":"object","properties":{"channel":{"type":"string","enum":["facebook","instagram","linkedin","twitter","whatsapp_status"]},"body":{"type":"string"}},"required":["channel","body"]},"CampaignBoxSmsDto":{"type":"object","properties":{"moment":{"type":"string","enum":["t_minus_24h","go_live","final_3h"]},"body":{"type":"string"}},"required":["moment","body"]},"CampaignBoxVideoScriptDto":{"type":"object","properties":{"voiceover":{"type":"string","description":"Narrator voice-over track."},"onScreen":{"type":"string","description":"On-screen direction / b-roll cues."}},"required":["voiceover","onScreen"]},"GenerateCampaignBoxResponseDto":{"type":"object","properties":{"emails":{"type":"array","items":{"$ref":"#/components/schemas/CampaignBoxEmailDto"}},"socialPosts":{"type":"array","items":{"$ref":"#/components/schemas/CampaignBoxSocialPostDto"}},"smsTemplates":{"type":"array","items":{"$ref":"#/components/schemas/CampaignBoxSmsDto"}},"videoScript":{"$ref":"#/components/schemas/CampaignBoxVideoScriptDto"},"layout":{"type":"object","description":"A canonical page-builder LayoutConfig seeded for this campaign. The front end can hand this straight to `builderSetLayout` to publish.","additionalProperties":true},"publicUrl":{"type":"string","format":"uri","description":"Canonical absolute public campaign URL including domain."},"generatedAt":{"type":"string"},"aiAssisted":{"type":"boolean"},"aiGenerationVersion":{"type":"string"}},"required":["emails","socialPosts","smsTemplates","videoScript","layout","publicUrl","generatedAt","aiAssisted","aiGenerationVersion"]},"GenerateAmbassadorInvitePackRequestDto":{"type":"object","properties":{"campaignId":{"type":"string","description":"Campaign the ambassadors will join."},"contactIds":{"description":"Optional explicit list of contact ids. Omit to auto-select the top TIER_2 contacts ranked by closeness score.","type":"array","items":{"type":"string"}},"locale":{"type":"string","enum":["he","en"]},"senderName":{"type":"string","description":"CEO / campaign owner first name. Used to sign the invitation. Defaults to the requesting user."}},"required":["campaignId"]},"AmbassadorInviteDto":{"type":"object","properties":{"contactId":{"type":"string"},"fullName":{"type":"string"},"phoneE164":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"whatsappBody":{"type":"string","description":"Personalized WhatsApp body."},"whatsappUrl":{"type":"string","description":"Deep-link URL (https://wa.me/...) ready to open in a new tab. Omits the phone-number prefix when no phone is available."},"emailHtml":{"type":"string","description":"Personalized email body (HTML)."},"emailSubject":{"type":"string","description":"Personalized email subject."}},"required":["contactId","fullName","whatsappBody","whatsappUrl","emailHtml","emailSubject"]},"GenerateAmbassadorInvitePackResponseDto":{"type":"object","properties":{"invites":{"type":"array","items":{"$ref":"#/components/schemas/AmbassadorInviteDto"}},"totalCount":{"type":"number","description":"Total invites generated."},"generatedAt":{"type":"string"},"aiAssisted":{"type":"boolean"},"aiGenerationVersion":{"type":"string"}},"required":["invites","totalCount","generatedAt","aiAssisted","aiGenerationVersion"]},"DonationLadderSignalsDto":{"type":"object","properties":{"typicalGiftMinor":{"type":"number","description":"Your real typical/median online gift, in minor units. Overrides the derived anchor."},"topGiftMinor":{"type":"number","description":"Your single largest gift this year, in minor units. Sets the anchor rung."},"donorCountEstimate":{"type":"number","description":"How many donors you believe you can realistically reach this campaign."},"hasLeadMatcher":{"type":"boolean","description":"Whether a lead donor / matcher is lined up for the anchor rung."}}},"ProposeDonationLadderRequestDto":{"type":"object","properties":{"campaignId":{"type":"string","description":"Campaign to anchor the ladder on. Omit for the most-recent campaign.","format":"uuid"},"locale":{"type":"string","description":"Output locale. Defaults to the org locale.","enum":["he","en"]},"tierCount":{"type":"number","description":"Number of rungs to produce. Clamped to [3, 8]. Defaults to 5.","minimum":3,"maximum":8},"currency":{"type":"string","description":"Override currency (3-letter ISO). Defaults to the campaign currency."},"signals":{"$ref":"#/components/schemas/DonationLadderSignalsDto"}}},"DonationLadderTierDto":{"type":"object","properties":{"position":{"type":"number","description":"1-based position; entry rung first."},"amountMinor":{"type":"number","description":"Rung amount in minor units."},"currency":{"type":"string"},"role":{"type":"string","enum":["entry","core","ambassador","anchor"]},"title":{"type":"string"},"subtitle":{"type":"string"},"rationale":{"type":"string","description":"Short business-language reason this rung exists."},"recommended":{"type":"boolean","description":"Exactly one tier is true — the UI default to pre-highlight."}},"required":["position","amountMinor","currency","role","title","subtitle","rationale","recommended"]},"DonationLadderQuestionDto":{"type":"object","properties":{"id":{"type":"string"},"prompt":{"type":"string","description":"The question to put to the client (localized)."},"answerField":{"type":"string","enum":["typicalGiftMinor","topGiftMinor","donorCountEstimate","hasLeadMatcher"],"description":"Which `signals` field the answer feeds when re-calling propose."},"why":{"type":"string","description":"Why the brain is asking — grounds it in the profile."}},"required":["id","prompt","answerField","why"]},"DonationLadderGoalCheckDto":{"type":"object","properties":{"goalMinor":{"type":"number","nullable":true},"impliedDonorsNeeded":{"type":"number","nullable":true},"reachableDonors":{"type":"number","nullable":true},"feasibility":{"type":"string","enum":["comfortable","ambitious","stretch","unknown"]},"note":{"type":"string"}},"required":["feasibility","note"]},"DonationLadderProfileBasisDto":{"type":"object","properties":{"field":{"type":"string"},"value":{"type":"string"}},"required":["field","value"]},"ProposeDonationLadderResponseDto":{"type":"object","properties":{"tiers":{"type":"array","items":{"$ref":"#/components/schemas/DonationLadderTierDto"}},"currency":{"type":"string"},"anchorGiftMinor":{"type":"number","description":"The derived (or client-supplied) typical gift, minor units."},"recommendedTierPosition":{"type":"number","description":"1-based position of the recommended default rung."},"rationale":{"type":"string","description":"Business-language explanation of how the ladder was built."},"questions":{"description":"Targeted questions the brain should ask to refine the ladder.","type":"array","items":{"$ref":"#/components/schemas/DonationLadderQuestionDto"}},"goalCheck":{"$ref":"#/components/schemas/DonationLadderGoalCheckDto"},"profileBasis":{"description":"Which persona fields drove the numbers, for transparency.","type":"array","items":{"$ref":"#/components/schemas/DonationLadderProfileBasisDto"}},"campaignId":{"type":"string","description":"Campaign the ladder is anchored on."},"draft":{"type":"boolean","description":"True when this ladder has NOT been committed to real donation levels yet — the client should confirm/refine before calling commit."},"generatedAt":{"type":"string"},"aiAssisted":{"type":"boolean"},"aiGenerationVersion":{"type":"string"}},"required":["tiers","currency","anchorGiftMinor","recommendedTierPosition","rationale","questions","goalCheck","profileBasis","campaignId","draft","generatedAt","aiAssisted","aiGenerationVersion"]},"CommitDonationLadderTierDto":{"type":"object","properties":{"amountMinor":{"type":"number","description":"Rung amount in minor units."},"title":{"type":"string","description":"Rung title shown to donors."},"subtitle":{"type":"string"},"isRecurring":{"type":"boolean","description":"Recurring rung (e.g. monthly sustainer)."}},"required":["amountMinor","title"]},"CommitDonationLadderRequestDto":{"type":"object","properties":{"campaignId":{"type":"string","description":"Campaign whose donation levels will be created.","format":"uuid"},"currency":{"type":"string","description":"Currency for the created levels (3-letter ISO)."},"tiers":{"description":"The confirmed rungs to create.","type":"array","items":{"$ref":"#/components/schemas/CommitDonationLadderTierDto"}}},"required":["campaignId","currency","tiers"]},"CommittedDonationLevelDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"amountMinor":{"type":"number"},"currency":{"type":"string"},"title":{"type":"string"},"displayOrder":{"type":"number"}},"required":["id","amountMinor","currency","title","displayOrder"]},"CommitDonationLadderResponseDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"createdLevels":{"description":"The donation levels created.","type":"array","items":{"$ref":"#/components/schemas/CommittedDonationLevelDto"}},"count":{"type":"number"},"generatedAt":{"type":"string"}},"required":["campaignId","createdLevels","count","generatedAt"]},"ListCampaignsQueryDto":{"type":"object","properties":{"limit":{"type":"number","maximum":100,"minimum":1},"cursor":{"type":"string","description":"Opaque page token taken from a previous response's `pagination.cursor`. Returns the rows immediately AFTER that position in the same `createdAt DESC, id DESC` order, so paging stays stable when campaigns are created between two fetches. Omit for the first page. Composes with every filter below — but the filters must not change between pages, or the cursor describes a position in a different result set. A cursor that is not one we issued is rejected with `INVALID_CURSOR`.","maxLength":512},"search":{"type":"string","description":"Case-insensitive search over campaign name.","maxLength":120},"status":{"type":"string","enum":["draft","pending_approval","active","paused","ended","completed","archived"]},"kind":{"type":"string","enum":["classic_blast","year_round","donation_page"]},"excludeKind":{"type":"string","enum":["classic_blast","year_round","donation_page"],"description":"Leave out one kind. `excludeKind=donation_page` lists campaigns only (the dashboard Campaigns tab); `kind=donation_page` lists donation pages only."},"parentCampaignId":{"type":"string","description":"Filter campaigns by parent (umbrella) id.","format":"uuid"},"includeDeleted":{"type":"boolean","description":"When true, includes soft-deleted campaigns. Requires campaigns.manage."}}},"PublicDonationCurrencyDto":{"type":"object","properties":{"currency":{"type":"string","description":"ISO-4217 code.","example":"USD"},"provider":{"type":"string","description":"Provider value to send in the checkout body for this currency: crowded | stripe | wallet | meshulam.","example":"crowded"},"providerCandidates":{"description":"Ordered checkout providers eligible for this currency and campaign. Includes alternatives; billing type and level contract are independently enforced at checkout.","type":"array","items":{"type":"string"}},"minorDigits":{"type":"number","description":"Number of decimal digits in this currency's minor unit (0 for JPY, 2 for most, 3 for KWD). Sent so the form never assumes 100.","example":2},"rateToBase":{"type":"string","nullable":true,"description":"CHAR-55: conversion rate from THIS currency to the campaign's own currency, as a decimal string — MAJOR unit to MAJOR unit (\"3.65\" means 1 of this currency buys 3.65 of the campaign currency). Always \"1\" for the campaign currency itself. Published because it IS the price quoted to the donor, not a secret: the form shows the converted amount from this value instead of deriving a conversion the server would then disagree with. Null only on a currency offered without a configured rate, which the checkout will refuse with FX_RATE_MISSING.","example":"3.65"}},"required":["currency","provider","minorDigits"]},"CampaignNotificationSettingsDto":{"type":"object","properties":{"campaign_published":{"type":"boolean","description":"Omitted defaults to enabled. Email active team members when the campaign is published."},"campaign_paused":{"type":"boolean","description":"Omitted defaults to enabled. Email active team members when the campaign is paused."},"campaign_resumed":{"type":"boolean","description":"Omitted defaults to enabled. Email active team members when the campaign resumes."},"campaign_ended":{"type":"boolean","description":"Omitted defaults to enabled. Email active team members when the campaign ends."},"campaign_page_ready":{"type":"boolean","description":"Omitted defaults to enabled. Email the acting team member when their campaign page is ready. Personal opt-out wins."},"donation_received":{"type":"boolean","description":"Omitted defaults to enabled. Email active organization members about a donation. Never emails donors. Personal opt-out wins."},"campaign_goal_reached":{"type":"boolean","description":"Omitted defaults to enabled. Email active organization members once when the campaign reaches its goal."},"recurring_payment_failed":{"type":"boolean","description":"Omitted defaults to enabled. Email active organization members when a recurring campaign gift fails."}}},"CampaignPaymentSettingsDto":{"type":"object","properties":{"enabledAcquirers":{"description":"Acquirer switches are NOT flag-gated; MULTI_CURRENCY_DONATIONS_ENABLED governs conversion rates only. Which of the organization's connected acquirers are switched on for THIS campaign, by provider key (e.g. [\"crowded\",\"meshulam\"]). OMITTING the field means every connected acquirer is on — that is the default, and it is what makes a newly connected acquirer light up automatically instead of needing a backfill. An empty array switches them all OFF, which makes the campaign stop accepting donations.","type":"array","items":{"type":"string"}},"fxRates":{"type":"object","additionalProperties":{"type":"string"},"description":"Manual conversion rates keyed by the CHARGED currency, as decimal strings: {\"USD\":\"3.65\"} on an ILS campaign means 1 USD = 3.65 ILS. Rates are MAJOR-unit to MAJOR-unit, which is what keeps 0-decimal (JPY) and 3-decimal (KWD) currencies correct. The campaign currency itself must NOT appear here (it is always 1) — including it is rejected with FX_RATE_BASE_CURRENCY_NOT_ALLOWED. A currency an acquirer could settle but which has no rate here is simply not offered to donors.","example":{"USD":"3.65"}},"fxRateSource":{"type":"string","description":"How the rates were obtained. Currently always \"manual\"; reserved for a future automated rate provider (\"api:<name>\"), at which point these fields become read-only-with-override rather than free entry."},"fxRatesUpdatedAt":{"type":"string","format":"date-time","description":"When the rates were last edited. Stamped by the server, not by the caller — a hand-typed rate goes stale silently, so the dashboard shows its age."}}},"CampaignUiOverridesDto":{"type":"object","properties":{"hideTemplateStep":{"type":"boolean","nullable":true,"deprecated":true,"description":"Legacy, no effect. Inherited from the Charidy admin panel, where the donation widget had a design/template selection step. This donation form has no such step (amount → details → summary), so nothing reads this flag. Retained for legacy import compatibility only."},"hideSocialShare":{"type":"boolean","nullable":true,"description":"Hide the share affordances a donor sees — the share section and share CTAs on the public campaign page, and the share button on the thank-you screen."},"hideProgress":{"type":"boolean","nullable":true,"description":"Hide the goal meter and progress chart on the public campaign page. The donation levels stay visible — hiding those would remove the ask itself."},"hideLiveFeed":{"type":"boolean","nullable":true,"description":"Hide the live \"someone just donated\" activity feed on the public campaign page."},"hideLevelsStreams":{"type":"boolean","nullable":true,"deprecated":true,"description":"Deprecated — use `hideProgress` and `hideLiveFeed`. Kept as the fallback for both so campaigns that set it keep the behaviour they were promised. Read-only consumers still receive it."},"allowAmbassadorSignup":{"type":"boolean","nullable":true},"hideAbout":{"type":"boolean","nullable":true,"description":"Hide the about section (Bright Futures story, and an about block) on the public campaign page. Unset means shown."},"hideCountdown":{"type":"boolean","nullable":true,"description":"Hide the countdown clock on the public campaign page. The goal and progress meter stay. Unset means shown."},"hideTitle":{"type":"boolean","nullable":true,"description":"Hide the campaign title the page paints (CHAR-350), for when the title is already part of the cover image. The page keeps an accessible heading. Unset means shown."}}},"CampaignSharingSettingsDto":{"type":"object","properties":{"shareMessage":{"type":"string","nullable":true,"maxLength":500,"description":"Default campaign share message. The web app appends the canonical campaign publicUrl at action time; do not put a fabricated or environment-specific URL here."},"emailSubject":{"type":"string","nullable":true,"maxLength":120,"description":"Default subject for the campaign email share action. The email body uses shareMessage plus the canonical campaign publicUrl."},"seoTitle":{"type":"string","nullable":true,"maxLength":120},"seoDescription":{"type":"string","nullable":true,"maxLength":300},"seoImageAssetKey":{"type":"string","nullable":true,"maxLength":512},"seoImageAlt":{"type":"string","nullable":true,"maxLength":280},"isUnlisted":{"type":"boolean","nullable":true,"description":"When true, keep the campaign accessible by URL but hide it from directory/listing surfaces."}}},"CampaignCheckoutCustomFieldDto":{"type":"object","properties":{"key":{"type":"string","maxLength":80},"label":{"type":"string","maxLength":120},"type":{"type":"string","enum":["text","textarea","checkbox","select"]},"required":{"type":"boolean"},"options":{"maxItems":20,"type":"array","items":{"type":"string"}}},"required":["key","label","type"]},"CampaignCheckoutSettingsDto":{"type":"object","properties":{"showPhone":{"type":"boolean","nullable":true,"description":"Show the donor phone field. Unset means shown; false ignores submitted phone values."},"showBillingAddress":{"type":"boolean","nullable":true,"description":"Show the billing address. Unset means shown; false ignores submitted addresses."},"maxInstallments":{"type":"number","nullable":true,"minimum":2,"maximum":36,"description":"Maximum installments per donation. Defaults to 12 when unset. 24 and 36 are organization opt-ins. Grow (card and wallet) still rejects counts above 12."},"acceptingPayments":{"type":"boolean","nullable":true,"description":"Whether the public checkout accepts money at all. `false` renders the campaign page with an explanatory unavailable state and makes POST /checkout reject with CAMPAIGN_NOT_ACCEPTING_DONATIONS. Defaults to accepting when unset."},"requirePhone":{"type":"boolean","nullable":true,"description":"Require a phone number from the donor before the donation can be submitted."},"requireBillingAddress":{"type":"boolean","nullable":true,"description":"Require a full billing address. When false the address block still exists as an optional collapsed disclosure (CHAR-58) — this flag controls whether it is mandatory, not whether it is shown."},"enabledBillingTypes":{"type":"array","description":"The billing types the donor may choose from. Must list at least one — an empty array is rejected with NO_BILLING_TYPE_ENABLED. Omitting the field leaves the current value untouched; when it has never been set, all three are offered. What the donor actually sees is this list INTERSECTED with what the campaign currency's acquirer can charge (see `donationCurrencies` on the campaign response: the Grow wallet cannot charge `recurring`), so enabling a type is necessary but not sufficient.","items":{"type":"string","enum":["one_time","installments","recurring"]}},"defaultBillingType":{"type":"string","enum":["one_time","installments","recurring"],"nullable":true,"description":"Which billing type is pre-selected for the donor. Must be one of `enabledBillingTypes` — validated against the MERGED result, so patching this alone to a type that is not currently enabled is rejected with DEFAULT_BILLING_TYPE_NOT_ENABLED. Send both fields in one call to switch the default to a newly enabled type."},"allowCustomAmount":{"type":"boolean","nullable":true,"description":"Whether the donor may type an amount of their own instead of picking a donation level. Turning this off on a campaign with no donation levels leaves the donor with nothing to select."},"showDonationLevels":{"type":"boolean","nullable":true,"description":"Whether the payment form repeats the campaign's donation levels as pickable tiles. Opt-IN: unset means HIDDEN (CHAR-54) — the tiers already appear on the campaign page, and repeating them inside the form pushes the donor's own amount below the fold. This is purely about the checkout surface: it does not affect the campaign page's levels widget, nor a level's own `isVisible`. Ignored (treated as on) when `allowCustomAmount` is false, since levels would then be the only way to give anything at all."},"minimumDonationAmountMinor":{"type":"number","format":"int64","nullable":true,"minimum":1,"description":"Smallest accepted donation in MINOR units of the campaign currency (agorot/cents) — 1800 means ₪18.00. Defaults to 100 minor units when unset."},"customFields":{"maxItems":20,"description":"Extra questions asked of the DONOR inside this campaign's checkout, stored on the contribution as `extraMetadata.checkoutFields`. Unrelated to organization-level CRM custom fields (`/core/crm/custom-fields`), which describe contacts. Send `[]` to remove all of them.","type":"array","items":{"$ref":"#/components/schemas/CampaignCheckoutCustomFieldDto"}}}},"CampaignGeneralSettingsDto":{"type":"object","properties":{"donateButtonText":{"type":"string","nullable":true,"maxLength":80},"enableDedications":{"type":"boolean","nullable":true},"thankYouMessage":{"type":"string","nullable":true,"maxLength":2000},"publicContactEmail":{"type":"string","nullable":true,"maxLength":320,"description":"Optional PUBLIC contact email shown on this campaign page instead of the organization profile contact. Empty or null clears the override so the page falls back to the organization profile. Shown publicly: never the login email."},"publicContactPhone":{"type":"string","nullable":true,"maxLength":40,"description":"Optional PUBLIC contact phone shown on this campaign page instead of the organization profile contact. Empty or null clears the override."},"story":{"type":"string","nullable":true,"maxLength":6000,"description":"Campaign story in the organizer’s words. Stored on settings.general.story and returned with the campaign. Omit to leave it unchanged."}}},"CampaignSimplePageSettingsDto":{"type":"object","properties":{"description":{"type":"string","nullable":true,"maxLength":2000,"description":"Short donor-facing text shown above the checkout form."},"imageAssetKey":{"type":"string","nullable":true,"maxLength":500,"description":"Media-library asset key for the hero image."},"logoAssetKey":{"type":"string","nullable":true,"maxLength":500,"description":"Media-library asset key for the organization/logo mark."},"accentColorHex":{"type":"string","nullable":true,"example":"#3C368C","description":"Accent color for the hero band, as #RRGGBB."}}},"CampaignAboutLanguageDto":{"type":"object","properties":{"code":{"type":"string","maxLength":16,"example":"es","description":"BCP 47 language tag of this About text (e.g. en, he, es, ar, pt-BR)."},"label":{"type":"string","maxLength":40,"example":"Español","description":"Native name shown on the language pill."},"body":{"type":"string","maxLength":20000,"description":"About copy in this language, in a safe markdown subset: \"## heading\", \"**bold**\", \"_italic_\", \"- bullets\", blank line = new paragraph. Raw HTML is escaped, never rendered."}},"required":["code","label","body"]},"CampaignAboutSettingsDto":{"type":"object","properties":{"title":{"type":"string","maxLength":140,"description":"Optional title shown large on the About card; defaults to the campaign name."},"languages":{"maxItems":12,"description":"Per-language About content. The campaign default language is the fallback when a viewer language has no entry. Order is the pill order.","type":"array","items":{"$ref":"#/components/schemas/CampaignAboutLanguageDto"}}},"required":["languages"]},"CampaignSettingsDto":{"type":"object","properties":{"notifications":{"description":"Operational team email switches. Omitted keys default on. Does not change in-app/push, donor consent, security or billing mail. Read/write through getCampaign/updateCampaign.","allOf":[{"$ref":"#/components/schemas/CampaignNotificationSettingsDto"}]},"locale":{"type":"string","enum":["en","he"],"description":"Persisted language of the campaign page. Page copy and locale-aware live data resolve from this same value."},"preferredLocale":{"type":"string","maxLength":16,"description":"Legacy preferred page locale, used only when locale has not yet been persisted."},"payments":{"$ref":"#/components/schemas/CampaignPaymentSettingsDto"},"campaignUi":{"$ref":"#/components/schemas/CampaignUiOverridesDto"},"sharing":{"$ref":"#/components/schemas/CampaignSharingSettingsDto"},"checkout":{"$ref":"#/components/schemas/CampaignCheckoutSettingsDto"},"general":{"$ref":"#/components/schemas/CampaignGeneralSettingsDto"},"simplePage":{"$ref":"#/components/schemas/CampaignSimplePageSettingsDto"},"about":{"description":"Campaign-owned About content per language (no migration: stored in settings_json.about).","allOf":[{"$ref":"#/components/schemas/CampaignAboutSettingsDto"}]},"managerGlobalUserId":{"type":"string","format":"uuid","nullable":true,"description":"Active organization member who owns this campaign. Tasks the system or an automation creates for the campaign are assigned to them. Null clears the setting. A task a person creates still defaults to that person."},"yearRoundCadence":{"type":"string","enum":["annual","quarterly","on_demand"],"description":"Year-round goal/matcher reset cadence (only meaningful when kind=year_round)."}}},"CampaignTrackingDto":{"type":"object","properties":{"gaId":{"type":"string","description":"Google Analytics measurement ID (e.g. G-XXXXXXX)."},"fbPixelId":{"type":"string","description":"Facebook Pixel ID."},"gtmId":{"type":"string","description":"Google Tag Manager container ID (GTM-XXXXXX)."},"googleAdsConversionId":{"type":"string","description":"Google Ads conversion ID."},"googleAdsConversionLabel":{"type":"string","description":"Google Ads conversion label."}}},"EffectiveCampaignUiDto":{"type":"object","properties":{"hideTemplateStep":{"type":"boolean","deprecated":true,"description":"Legacy, no effect. Inherited from the Charidy admin panel, where the donation widget had a design/template selection step. This donation form has no such step (amount → details → summary), so nothing reads this flag. Retained for legacy import compatibility only."},"hideSocialShare":{"type":"boolean","description":"When true, the public campaign page hides its share section and share CTAs, and the thank-you screen hides its share button."},"hideProgress":{"type":"boolean","description":"When true, the public campaign page hides the goal meter and progress chart. Donation levels are unaffected."},"hideLiveFeed":{"type":"boolean","description":"When true, the public campaign page hides the live donation activity feed."},"hideLevelsStreams":{"type":"boolean","deprecated":true,"description":"Deprecated — use `hideProgress` and `hideLiveFeed`. Kept as the fallback for both so campaigns that set it keep the behaviour they were promised. Read-only consumers still receive it."},"hideAbout":{"type":"boolean","description":"When true, the public campaign page hides the about section. Unset means the section is shown."},"hideCountdown":{"type":"boolean","description":"When true, the public campaign page hides the countdown clock. The goal and progress meter stay."},"hideTitle":{"type":"boolean","description":"When true, the public campaign page does not paint its visible title (it stays available to assistive technology)."},"allowAmbassadorSignup":{"type":"boolean","description":"Whether public self-serve ambassador registration is enabled."}},"required":["hideTemplateStep","hideSocialShare","hideProgress","hideLiveFeed","hideLevelsStreams","hideAbout","hideCountdown","hideTitle"]},"CampaignResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"name":{"type":"string","example":"Spring Giving Day 2026","maxLength":280},"slug":{"type":"string","example":"spring-giving-2026"},"publicUrl":{"type":"string","format":"uri","nullable":true,"description":"Canonical absolute public URL, including domain, for AI/MCP clients and share flows."},"status":{"type":"string","enum":["draft","pending_approval","active","paused","ended","completed","archived"]},"effectiveStatus":{"type":"string","enum":["draft","pending_approval","pending","active","paused","ended","completed","success","failed","archived"],"description":"Status as exposed to the public (includes derived states: pending, success, failed) — computed at read time."},"publicationStatus":{"type":"string","enum":["draft","page_not_published","scheduled","live","paused","ended","completed","archived"],"description":"TRUE combined publication status (page publish state + campaign lifecycle), derived at read time. Use this — not `status` — to decide whether the public link is actually reachable/live, scheduled with a countdown, or still a draft."},"raisedAmountMinor":{"type":"number","format":"int64","minimum":0,"description":"Raised so far, in minor units of the campaign's own currency (succeeded donations; a gift in another currency counts at its converted base amount). Returned by GET /core/campaigns only; absent on single-campaign reads, where GET /core/campaigns/{campaignId}/summary carries it."},"acceptingDonations":{"type":"boolean","description":"CHAR-34 — whether this campaign can take money RIGHT NOW, from the same rule the donor page and the checkout enforce. Deliberately independent of `status`: pausing stops donations immediately, while an `acceptDonationsUntil` reaching past the end date keeps an ended campaign collecting late donations. Reaching the goal never closes it."},"notAcceptingReason":{"type":"string","enum":["payments_disabled","campaign_not_public","campaign_paused","window_closed","campaign_ended"],"nullable":true,"description":"Why `acceptingDonations` is false, or null when it is true. Says nothing about acquirer coverage — that is `donationCurrencies` being empty."},"donationCurrencies":{"description":"What this campaign can ACTUALLY be charged in, derived from the organization's connected acquirer accounts — not from anything declared on the campaign. Empty means no connected acquirer can settle the campaign currency, so the campaign cannot take money no matter what its settings say. CHAR-20: combine with `settings.checkout.enabledBillingTypes` to know what a donor will really be offered — the acquirer's own limits win (the Grow `wallet` cannot charge `recurring`, so a recurring level or default is unreachable on an ILS wallet campaign however the checkout policy is configured).","type":"array","items":{"$ref":"#/components/schemas/PublicDonationCurrencyDto"}},"currencyLocked":{"type":"boolean","description":"True once this campaign has started settling (a checkout the acquirer is clearing, or a contribution in `pending`, `succeeded` or `refunded`), which fixes `currency`. Attempting to change the currency of a locked campaign is rejected with CAMPAIGN_CURRENCY_LOCKED (409) — read this BEFORE offering a currency change, rather than discovering the lock from the error. A checkout still in `created`, or one that failed without a contribution, does not lock it. While it is false, changing `currency` also re-labels the campaign's donation levels into the new currency WITHOUT converting their amounts (a level priced at 100 becomes 100 of the new currency), so warn the operator before saving."},"pagePublishedAt":{"type":"string","format":"date-time","nullable":true,"description":"When the campaign page (design draft) was last published live. Null if the page has never been published, in which case the public link is not reachable regardless of lifecycle status."},"kind":{"type":"string","enum":["classic_blast","year_round","donation_page"]},"parentCampaignId":{"type":"string","format":"uuid","nullable":true},"goalAmount":{"type":"string","nullable":true,"example":"500000.00","description":"Decimal goal amount serialized as a string to preserve precision. Null for donation_page campaigns, which carry no goal."},"bonusGoalAmount":{"type":"string","nullable":true,"example":"750000.00"},"currency":{"type":"string","example":"USD"},"timezone":{"type":"string","nullable":true,"example":"Asia/Jerusalem"},"startDate":{"type":"string","format":"date-time","nullable":true,"example":"2026-08-05T17:00:00.000Z","description":"The instant the campaign opens — a date AND a time of day, not just a calendar day. Accepts a full ISO 8601 instant (`2026-08-05T20:00:00+03:00`), a local date-time with no offset (`2026-08-05T20:00`, read in the campaign timezone), or a bare calendar date (`2026-08-05`). A bare date opens at 00:00:00 campaign-local. Always returned as a UTC ISO instant."},"endDate":{"type":"string","format":"date-time","nullable":true,"example":"2026-08-07T05:00:00.000Z","description":"The instant the campaign closes — a date AND a time of day. Accepts a full ISO 8601 instant (`2026-08-05T20:00:00+03:00`), a local date-time with no offset (`2026-08-05T20:00`, read in the campaign timezone), or a bare calendar date (`2026-08-05`). A bare date closes at 23:59:59.999 campaign-local (the end of that day, so the day stays inclusive). Must not precede startDate. Always returned as a UTC ISO instant."},"acceptDonationsUntil":{"type":"string","format":"date-time","nullable":true},"publishedAt":{"type":"string","format":"date-time","nullable":true},"endedAt":{"type":"string","format":"date-time","nullable":true},"archivedAt":{"type":"string","format":"date-time","nullable":true},"deletedAt":{"type":"string","format":"date-time","nullable":true},"submittedForApprovalAt":{"type":"string","format":"date-time","nullable":true},"approvedAt":{"type":"string","format":"date-time","nullable":true},"approvedBySuperAdminId":{"type":"string","format":"uuid","nullable":true},"rejectedAt":{"type":"string","format":"date-time","nullable":true},"rejectionReason":{"type":"string","nullable":true},"settings":{"$ref":"#/components/schemas/CampaignSettingsDto"},"contentOverrides":{"type":"object","additionalProperties":true,"description":"Per-state, per-locale copy overrides."},"layoutConfig":{"type":"object","additionalProperties":true,"description":"Page builder layout config (opaque to backend)."},"tracking":{"$ref":"#/components/schemas/CampaignTrackingDto"},"effectiveUi":{"$ref":"#/components/schemas/EffectiveCampaignUiDto"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","name","slug","status","effectiveStatus","publicationStatus","acceptingDonations","notAcceptingReason","donationCurrencies","currencyLocked","kind","currency","effectiveUi","createdAt","updatedAt"]},"CampaignsListPaginationDto":{"type":"object","properties":{"cursor":{"type":"string","nullable":true,"description":"Opaque cursor for the next page. Pass it back as `cursor` on the next request. `null` when there are no more pages."},"hasMore":{"type":"boolean","description":"True when there is at least one more page after this one."},"pageSize":{"type":"number","minimum":1,"maximum":100,"description":"Effective page size used for this response."}},"required":["hasMore","pageSize"]},"CampaignsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/CampaignResponseDto"}},"totalCount":{"type":"number","minimum":0},"pagination":{"$ref":"#/components/schemas/CampaignsListPaginationDto"}},"required":["rows","totalCount","pagination"]},"CampaignContributionTotalDto":{"type":"object","properties":{"currency":{"type":"string","example":"USD"},"totalAmountMinor":{"type":"number","format":"int64"},"contributionCount":{"type":"number","minimum":0}},"required":["currency","totalAmountMinor","contributionCount"]},"CampaignRaisedSummaryDto":{"type":"object","properties":{"totals":{"type":"array","items":{"$ref":"#/components/schemas/CampaignContributionTotalDto"}},"contributionCount":{"type":"number","minimum":0}},"required":["totals","contributionCount"]},"CampaignCalendarNoteDto":{"type":"object","properties":{"code":{"type":"string","description":"Stable language-neutral event code. The API returns no display copy."},"packKey":{"type":"string","description":"The explicit organization calendar pack that produced this occurrence."},"severity":{"type":"string","enum":["caution","info"]},"blocking":{"type":"number","enum":[false],"description":"Always false: the check is advisory and never blocks."},"from":{"type":"string","example":"2027-05-25","description":"First day of the note inside the range."},"to":{"type":"string","example":"2027-05-25","description":"Last day of the note inside the range."},"params":{"type":"object","additionalProperties":true,"description":"Language-neutral parameters whose shape depends on the selected calendar pack."}},"required":["code","packKey","severity","blocking","from","to","params"]},"CampaignCalendarCheckResponseDto":{"type":"object","properties":{"start":{"type":"string","example":"2027-05-20"},"end":{"type":"string","example":"2027-06-10"},"notes":{"type":"array","items":{"$ref":"#/components/schemas/CampaignCalendarNoteDto"}}},"required":["start","end","notes"]},"CampaignSlugConflictDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid","description":"The campaign currently holding the slug."},"name":{"type":"string","description":"Its name, so the caller can name it to the user."},"status":{"type":"string","enum":["draft","pending_approval","active","paused","ended","completed","archived"]},"suggestedRetirementSlug":{"type":"string","nullable":true,"example":"elul-2025","description":"A SUGGESTED new slug for this campaign, derived from its own edition year, offered only as a prefill. The caller decides the actual value and passes it as retirementSlug — this is not what will be used unless they keep it. Null when no year could be derived, which is not a blocker: the caller simply types their own."},"requiresAcknowledgement":{"type":"boolean","description":"True when this campaign is still active or paused, i.e. still able to take donations. A takeover then re-points links that donors may be following RIGHT NOW at a different campaign, so it requires explicit acknowledgement."}},"required":["campaignId","name","status","requiresAcknowledgement"]},"CampaignSlugAvailabilityResponseDto":{"type":"object","properties":{"slug":{"type":"string","description":"The candidate slug as tested (trimmed)."},"available":{"type":"boolean","description":"True when this slug can be saved for this campaign."},"reason":{"type":"string","enum":["available","unchanged","invalid_format","taken","taken_other_organization","reserved","in_cooldown"]},"suggestion":{"type":"string","nullable":true,"example":"spring-giving-2026-2","description":"A free, valid slug close to the requested one. Null when the input carries nothing usable to build a suggestion from."},"publicUrl":{"type":"string","nullable":true,"description":"The public campaign URL the requested slug would produce. Null when the slug is malformed."},"conflict":{"nullable":true,"description":"Present only when reason is 'taken' — that is, the holder is one of YOUR campaigns. Describes it and what taking the slug over would look like: for an annual campaign, retiring last year's edition to a dated slug and handing the evergreen one to this year's is usually what the organization wants. Deliberately absent for 'taken_other_organization', where naming the holder would leak another tenant's campaign.","allOf":[{"$ref":"#/components/schemas/CampaignSlugConflictDto"}]},"reusableAfter":{"type":"string","nullable":true,"description":"Present only when reason is 'in_cooldown': the instant the slug becomes claimable by anyone. Until then it belongs to the organization that released it."}},"required":["slug","available","reason"]},"CampaignPreviewSettingsResponseDto":{"type":"object","properties":{"demoOverlayEnabled":{"type":"boolean","description":"When true, campaign preview pages show synthetic demo donors, ambassadors, visit counts and raised totals instead of the real ones."}},"required":["demoOverlayEnabled"]},"UpdateCampaignPreviewSettingsDto":{"type":"object","properties":{"demoOverlayEnabled":{"type":"boolean","description":"When true, campaign preview pages show synthetic demo donors, ambassadors, visit counts and raised totals instead of the real ones."}},"required":["demoOverlayEnabled"]},"CreateCampaignDto":{"type":"object","properties":{"name":{"type":"string","example":"Spring Giving Day 2026","maxLength":280},"slug":{"type":"string","example":"spring-giving-2026","description":"Lowercase URL slug. Auto-derived from name when omitted.","maxLength":80},"goalAmount":{"type":"string","example":"500000.00","maxLength":21,"description":"Decimal goal amount serialized as a string to preserve precision. Required for classic_blast and year_round; forbidden for donation_page — a donation page has no goal, and an absent goal is stored as absent, never as 0."},"currency":{"type":"string","enum":["USD","ILS","CAD","GBP","EUR","AUD","NZD","CHF","SEK","NOK","DKK","ZAR","BRL","MXN","ARS","UAH","RUB","INR","SGD","HKD"],"example":"USD","description":"Supported two-decimal campaign currency."},"kind":{"type":"string","enum":["classic_blast","year_round","donation_page"]},"parentCampaignId":{"type":"string","format":"uuid","nullable":true},"startDate":{"type":"string","format":"date-time","nullable":true,"example":"2026-08-05T20:00:00+03:00","description":"The instant the campaign opens — a date AND a time of day, not just a calendar day. Accepts a full ISO 8601 instant (`2026-08-05T20:00:00+03:00`), a local date-time with no offset (`2026-08-05T20:00`, read in the campaign timezone), or a bare calendar date (`2026-08-05`). A bare date opens at 00:00:00 campaign-local. Always returned as a UTC ISO instant."},"endDate":{"type":"string","format":"date-time","nullable":true,"example":"2026-08-07T08:00:00+03:00","description":"The instant the campaign closes — a date AND a time of day. Accepts a full ISO 8601 instant (`2026-08-05T20:00:00+03:00`), a local date-time with no offset (`2026-08-05T20:00`, read in the campaign timezone), or a bare calendar date (`2026-08-05`). A bare date closes at 23:59:59.999 campaign-local (the end of that day, so the day stays inclusive). Must not precede startDate. Always returned as a UTC ISO instant."},"acceptDonationsUntil":{"type":"string","format":"date-time","nullable":true},"timezone":{"type":"string","description":"IANA timezone (e.g. Asia/Jerusalem). Also the zone any offset-less startDate/endDate is read in. Falls back to UTC when null."},"bonusGoalAmount":{"type":"string","description":"Optional bonus / stretch goal (must be >= goalAmount).","example":"750000.00"},"settings":{"$ref":"#/components/schemas/CampaignSettingsDto"},"story":{"type":"string","nullable":true,"maxLength":6000,"description":"Campaign story in the organizer’s words. Stored on settings.general.story and returned with the campaign."}},"required":["name","currency"]},"CampaignAttentionTaskPreviewDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"templateKey":{"type":"string","nullable":true},"source":{"type":"string","nullable":true},"isBlocking":{"type":"boolean"}},"required":["id","title"]},"CampaignAttentionItemDto":{"type":"object","properties":{"kind":{"type":"string","enum":["failed_donations","pending_receipts","matcher_ending","idle_teams","open_tasks","readiness_gap"]},"severity":{"type":"string","enum":["danger","warning","info"]},"count":{"type":"number","minimum":0},"amountMinor":{"type":"number","nullable":true,"minimum":0},"currency":{"type":"string","nullable":true,"example":"USD"},"dueAt":{"type":"string","nullable":true,"format":"date-time"},"targetSection":{"type":"string","enum":["donations","matchers","teams","tasks","design"]},"previewTasks":{"type":"array","items":{"$ref":"#/components/schemas/CampaignAttentionTaskPreviewDto"}}},"required":["kind","severity","count","targetSection"]},"CampaignAttentionDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/CampaignAttentionItemDto"}}},"required":["items"]},"CampaignCountsDto":{"type":"object","properties":{"donations":{"type":"number","minimum":0},"donors":{"type":"number","minimum":0},"teams":{"type":"number","minimum":0},"openTasks":{"type":"number","minimum":0},"levels":{"type":"number","minimum":0},"matchers":{"type":"number","minimum":0},"hasCampaignPage":{"type":"boolean"}},"required":["donations","donors","teams","openTasks","levels","matchers","hasCampaignPage"]},"UpdateCampaignDto":{"type":"object","properties":{"name":{"type":"string","maxLength":280},"slug":{"type":"string","maxLength":80},"goalAmount":{"type":"string","nullable":true,"example":"750000.00","description":"Decimal goal. Null clears a goal that was previously set."},"currency":{"type":"string","enum":["USD","ILS","CAD","GBP","EUR","AUD","NZD","CHF","SEK","NOK","DKK","ZAR","BRL","MXN","ARS","UAH","RUB","INR","SGD","HKD"],"description":"Supported two-decimal campaign currency."},"kind":{"type":"string","enum":["classic_blast","year_round","donation_page"]},"parentCampaignId":{"type":"string","format":"uuid","nullable":true},"startDate":{"type":"string","format":"date-time","nullable":true,"example":"2026-08-05T20:00:00+03:00","description":"The instant the campaign opens — a date AND a time of day, not just a calendar day. Accepts a full ISO 8601 instant (`2026-08-05T20:00:00+03:00`), a local date-time with no offset (`2026-08-05T20:00`, read in the campaign timezone), or a bare calendar date (`2026-08-05`). A bare date opens at 00:00:00 campaign-local. Always returned as a UTC ISO instant."},"endDate":{"type":"string","format":"date-time","nullable":true,"example":"2026-08-07T08:00:00+03:00","description":"The instant the campaign closes — a date AND a time of day. Accepts a full ISO 8601 instant (`2026-08-05T20:00:00+03:00`), a local date-time with no offset (`2026-08-05T20:00`, read in the campaign timezone), or a bare calendar date (`2026-08-05`). A bare date closes at 23:59:59.999 campaign-local (the end of that day, so the day stays inclusive). Must not precede startDate. Always returned as a UTC ISO instant."},"acceptDonationsUntil":{"type":"string","format":"date-time","nullable":true},"timezone":{"type":"string","nullable":true,"maxLength":64,"description":"IANA timezone (e.g. Asia/Jerusalem). Also the zone any offset-less startDate/endDate is read in. Falls back to UTC when null."},"bonusGoalAmount":{"type":"string","nullable":true,"example":"750000.00"},"settings":{"$ref":"#/components/schemas/CampaignSettingsDto"}}},"CampaignSlugResponseDto":{"type":"object","properties":{"slug":{"type":"string","description":"The campaign's current public slug."},"publicUrl":{"type":"string","description":"The address that slug produces, with nothing in front of it."},"releasedSlugs":{"description":"Slugs this campaign used to answer on, newest release first. Each still redirects here — they are listed so an organization can see which printed links remain live, and so it knows what it would be giving up by renaming again.","type":"array","items":{"type":"string"}}},"required":["slug","publicUrl","releasedSlugs"]},"TakeOverCampaignSlugDto":{"type":"object","properties":{"slug":{"type":"string","example":"elul","maxLength":80,"description":"The slug to take. Must currently be held by another live campaign in this tenant."},"retirementSlug":{"type":"string","example":"elulold","maxLength":80,"description":"The new slug for the campaign giving this one up — the CALLER's decision, not derived. Required, because releasing a slug means choosing where that campaign lives afterwards, and picking on the caller's behalf would rename their page to something they never asked for. Must be free and different from `slug`. checkCampaignSlugAvailability offers a dated suggestion to prefill, which the caller is free to replace."},"acknowledgeActiveCampaign":{"type":"boolean","description":"Required to be true when the holding campaign is still active or paused. Asserts the caller has been told that links already circulating for that campaign will now lead here."}},"required":["slug","retirementSlug"]},"CampaignSlugTakeoverResponseDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"slug":{"type":"string","example":"purim","description":"The slug this campaign now answers on."},"publicUrl":{"type":"string","nullable":true},"retiredCampaignId":{"type":"string","format":"uuid","description":"The campaign that gave the slug up."},"retiredCampaignSlug":{"type":"string","example":"purim-2025","description":"The slug it moved to."},"previousLinksNowPointHere":{"type":"boolean","description":"True — links already carrying the taken slug now lead to this campaign, not to the one that gave it up. Returned explicitly so an agent relays the consequence rather than reporting a plain rename."}},"required":["campaignId","slug","publicUrl","retiredCampaignId","retiredCampaignSlug","previousLinksNowPointHere"]},"UpdateCampaignSharingSettingsDto":{"type":"object","properties":{"sharing":{"$ref":"#/components/schemas/CampaignSharingSettingsDto"}},"required":["sharing"]},"UpdateCampaignCheckoutSettingsDto":{"type":"object","properties":{"checkout":{"$ref":"#/components/schemas/CampaignCheckoutSettingsDto"}},"required":["checkout"]},"UpdateCampaignPaymentSettingsDto":{"type":"object","properties":{"payments":{"$ref":"#/components/schemas/CampaignPaymentSettingsDto"}},"required":["payments"]},"UpdateCampaignGeneralSettingsDto":{"type":"object","properties":{"general":{"$ref":"#/components/schemas/CampaignGeneralSettingsDto"},"story":{"type":"string","nullable":true,"maxLength":6000,"description":"Same story as settings.general.story. Accepted here because callers send it beside general; it is stored on settings.general.story."}},"required":["general"]},"UpdateCampaignAboutSettingsDto":{"type":"object","properties":{"about":{"$ref":"#/components/schemas/CampaignAboutSettingsDto"}},"required":["about"]},"CampaignLifecycleActionDto":{"type":"object","properties":{"reason":{"type":"string","description":"Optional human-readable reason for the lifecycle change."},"acknowledgeWarnings":{"type":"array","description":"CHAR-34 — publish only. The readiness warning keys you have SHOWN a human and had them approve. A publish with outstanding warnings is refused with `CAMPAIGN_PUBLISH_REQUIRES_ACK` and a `details.warnings` list; present that list to the person publishing, get their explicit confirmation, then call again with those keys here. Never acknowledge on their behalf — this is the review step before a page goes out to donors. Blockers can never be acknowledged; they must be fixed. Warnings that appear after you looked produce a fresh 409 rather than being silently approved.","items":{"type":"string","enum":["payment_acquirer_missing","publishable_page_missing","existing_organization_not_public","existing_plan_active_campaign_limit","existing_blocking_tasks","start_date_missing","end_date_missing","start_date_in_past","goal_missing","no_visible_levels","page_content_missing","page_untouched_default","media_missing","mobile_not_optimized","donation_window_already_closed","blocking_tasks_open","org_readiness_steps_incomplete"]}},"locale":{"type":"string","enum":["en","he"],"description":"Publish only (CHAR-48). Locale used to localize the blocking-task titles returned in a TASK_BLOCKING_PHASE error, so the caller can name what is missing in the user's language. Defaults to English server-side when omitted. Ignored by pause/resume/end/archive."}}},"UpdateCampaignLayoutDto":{"type":"object","properties":{"layoutConfig":{"type":"object","additionalProperties":true,"description":"Page builder layout JSON ({ version: 1, blocks: BuilderBlock[], meta? }). The backend validates against the canonical Zod registry shared with the web app via @charidy/shared/page-builder. Unknown block types are rejected with `LAYOUT_BLOCK_TYPE_UNKNOWN`; malformed props are rejected with `LAYOUT_VALIDATION_FAILED`."}},"required":["layoutConfig"]},"CampaignDesignResponseDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"draftSettings":{"type":"object","additionalProperties":true,"description":"Current editor draft settings."},"liveSettings":{"type":"object","additionalProperties":true,"nullable":true,"description":"Currently published public settings. Null until first publish."},"publishedVersion":{"type":"number","minimum":0},"draftUpdatedAt":{"type":"string","format":"date-time"},"livePublishedAt":{"type":"object","format":"date-time","nullable":true},"publicUrl":{"type":"string","format":"uri","nullable":true,"description":"Canonical absolute public URL after publish. Null until campaign slugs can be resolved."},"textOverrides":{"type":"object","additionalProperties":{"type":"string"},"description":"Client manual-edit TEXT overrides, keyed by `data-charidy-node` address (PAGE_DESIGN_OVERHAUL §5א). Set via setCampaignNodeOverride; merged onto `document.textOverrides` on the public/preview read. Empty object when none."},"imageOverrides":{"type":"object","additionalProperties":{"type":"string"},"description":"Client manual-edit IMAGE overrides, keyed by `data-charidy-node` address; each value is an allowlisted media URL. Merged onto `document.imageOverrides` on the public/preview read. Empty object when none."},"styleOverrides":{"type":"object","additionalProperties":{"type":"object","additionalProperties":true},"description":"Client manual-edit STYLE overrides from the closed design catalog, keyed TWO levels deep: `data-charidy-node` address → property id → payload. A continuous control stores `{ value, mobile? }` in the unit the catalog publishes for it (px for most, but also deg, ch, svh, em or unitless — read `unit` from the style-catalog endpoint rather than assuming px); a discrete one stores `{ option }`; a colour stores `{ color }`; a layered one stores `{ layers, params? }`. These are never CSS — the renderer composes the declarations from them at read time using the same closed catalog the write path validated against. Empty object when none."},"repeatSettingsOverrides":{"type":"object","additionalProperties":{"type":"object","additionalProperties":true},"description":"Repeat-container component settings keyed by data-charidy-node. Each entry may contain sort, limit, and teams-only level overrides. Applied over authored data-charidy-* attributes at read/render time."},"gallerySettingsOverrides":{"type":"object","additionalProperties":{"type":"object","additionalProperties":true},"description":"Gallery settings keyed by the frame data-charidy-node, applied over authored slides at render time."},"liveTextOverrides":{"type":"object","additionalProperties":{"type":"string"},"description":"Published snapshot of the matching override map (G1). The studio diffs the draft against this to count unpublished changes; empty object when none."},"liveImageOverrides":{"type":"object","additionalProperties":{"type":"string"},"description":"Published snapshot of the matching override map (G1). The studio diffs the draft against this to count unpublished changes; empty object when none."},"liveStyleOverrides":{"type":"object","additionalProperties":{"type":"object","additionalProperties":true},"description":"Published snapshot of the matching override map (G1). The studio diffs the draft against this to count unpublished changes; empty object when none."},"liveRepeatSettingsOverrides":{"type":"object","additionalProperties":{"type":"object","additionalProperties":true},"description":"Published snapshot of the matching override map (G1). The studio diffs the draft against this to count unpublished changes; empty object when none."},"liveGallerySettingsOverrides":{"type":"object","additionalProperties":{"type":"object","additionalProperties":true},"description":"Published snapshot of the matching override map (G1). The studio diffs the draft against this to count unpublished changes; empty object when none."},"restoreRepairs":{"description":"Only on the restoreCampaignPageVersion response, and only when the restored content had to be CHANGED to satisfy the current enforcement rules (a rule can be newer than the snapshot). One plain-language line per repair, e.g. \"Relaxed 1 fixed element width so it fits a phone screen (width → max-width).\" Absent when nothing was repaired. The same list is recorded on the page version the restore creates, so it stays visible afterwards.","type":"array","items":{"type":"string"}}},"required":["campaignId","draftSettings","publishedVersion","draftUpdatedAt","textOverrides","imageOverrides","styleOverrides","repeatSettingsOverrides","gallerySettingsOverrides","liveTextOverrides","liveImageOverrides","liveStyleOverrides","liveRepeatSettingsOverrides","liveGallerySettingsOverrides"]},"CampaignDesignNodeDto":{"type":"object","properties":{"address":{"type":"string"},"sectionEditId":{"type":"string"},"pathWithinSection":{"type":"string"},"tag":{"type":"string"},"kind":{"type":"string","enum":["text","image","button","container"]},"label":{"type":"string"},"text":{"type":"string"}},"required":["address","sectionEditId","pathWithinSection","tag","kind","label"]},"CampaignDesignNodesResponseDto":{"type":"object","properties":{"nodes":{"type":"array","items":{"$ref":"#/components/schemas/CampaignDesignNodeDto"}}},"required":["nodes"]},"CampaignDesignPreviewLinkResponseDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"previewUrl":{"type":"string","format":"uri","description":"Externally viewable draft preview URL. It is not a donor-facing share link."},"token":{"type":"string","description":"Signed preview token embedded in previewUrl. The token is bound to org + campaign, and to the campaign’s current preview-link generation."},"expiresAt":{"type":"string","format":"date-time","nullable":true,"description":"Always null: preview links no longer expire on a clock. A link stops working only when revokeCampaignDesignPreviewLinks is called. Kept on the response for contract stability."}},"required":["campaignId","previewUrl","token","expiresAt"]},"CampaignDesignPreviewLinksRevokedResponseDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"previewLinkEpoch":{"type":"number","description":"The campaign’s new preview-link generation. Every link issued before this number is refused."},"revokedAt":{"type":"string","format":"date-time"}},"required":["campaignId","previewLinkEpoch","revokedAt"]},"SaveCampaignDesignDraftDto":{"type":"object","properties":{"draftSettings":{"type":"object","additionalProperties":true,"description":"Page builder draft JSON ({ version: 1, blocks: BuilderBlock[], meta? }). Validated by the same `LayoutConfigSchema` as the public renderer — unknown block types yield `LAYOUT_BLOCK_TYPE_UNKNOWN` and bad props yield `LAYOUT_VALIDATION_FAILED`. Donors do not see this until publishCampaignDesign is called."}},"required":["draftSettings"]},"CampaignNodeStyleValueDto":{"type":"object","properties":{"value":{"type":"number","description":"Required for a CONTINUOUS control. The desktop value, in pixels — the UI speaks pixels because that is what a nonprofit understands; the emitted stylesheet may use rem, which is the server's business. Outside the property's range this is REJECTED, not clamped. Omit it and send `option` instead for a discrete control."},"option":{"type":"string","maxLength":64,"description":"Required for a DISCRETE control (`kind: \"enum\"` in the catalog), and rejected on a continuous one. The chosen option id — call getCampaignStyleCatalog for the options each property offers. Some intents have no continuum (text alignment is start/center/end), so they are a choice rather than a slider."},"color":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","description":"Required for a template-palette colour control. The server derives a black/white companion ink with the stronger WCAG contrast; callers never choose the ink independently."},"layers":{"type":"array","items":{"type":"object","additionalProperties":true},"description":"Required for a LAYERED control (`kind: \"layered\"` in the catalog). The ordered layers, each an object whose fields the catalog publishes — a gradient stop is `{ color, position }`. A colour field accepts ONLY the platform token names the catalog lists, never a raw colour: a stop naming its own colour would survive until the next brand retune and then be the one thing on the page that did not move. The layer count is bounded by `minLayers`/`maxLayers`."},"params":{"type":"object","additionalProperties":{"type":"number"},"description":"Layered controls only. Scalar knobs belonging to the value as a whole rather than to any one layer — a gradient's angle. Each is bounded by the catalog and REJECTED outside its range rather than clamped; a missing one is refused too, since composing `NaN` into a declaration makes it silently vanish."},"mobile":{"type":"number","nullable":true,"description":"Optional phone value from the \"mobile adjustment\" toggle, in pixels. Omit it and the server derives the phone value from the desktop one by the property's class ratio — no breakpoint jump, a single fluid clamp() between a 390px phone and a 1280px desktop. Supplying it is capped by the property's mobile ceiling."}},"required":["value"]},"CampaignRepeatSettingsDto":{"type":"object","properties":{"sort":{"type":"string","enum":["recent","top","count","lowest","oldest"],"nullable":true},"limit":{"type":"number","minimum":1,"maximum":9999,"nullable":true},"level":{"type":"number","minimum":1,"maximum":10,"nullable":true}}},"CampaignGallerySettingsDto":{"type":"object","properties":{"autoplayMs":{"type":"number","minimum":0,"maximum":60000,"nullable":true,"description":"0 disables autoplay; otherwise an integer 3000..60000 milliseconds."},"slideOrder":{"nullable":true,"description":"Unique zero-based authored indices; unnamed slides follow in authored order.","type":"array","items":{"type":"number"}},"hiddenSlides":{"nullable":true,"description":"Unique zero-based authored indices to hide. At least one slide must remain visible.","type":"array","items":{"type":"number"}}}},"SetCampaignNodeOverrideDto":{"type":"object","properties":{"sectionEditId":{"type":"string","maxLength":256,"description":"The target node's stable identity WITHIN its section (from describeNodeAddresses). Sent WITH `node` so a stale address (the page shifted since selection) is silently re-resolved to the current node on write. Ignored on removal. Both sectionEditId and pathWithinSection must be present to enable recovery."},"pathWithinSection":{"type":"string","maxLength":512,"description":"The target node's section-relative path (from describeNodeAddresses), e.g. `section.0>h1.0` or a `…#t2` text run. Paired with sectionEditId for silent stale-address recovery."},"kind":{"type":"string","enum":["text","image","style","repeatSettings","gallerySettings"],"description":"Which override map to write. `text` replaces a text leaf (stored + rendered as escaped text, never markup); `image` replaces an `<img src>` and MUST resolve to an allowlisted media host; `style` sets ONE design-catalog property on the node — the client sends a property id and a number, NEVER CSS, and the server composes the responsive declaration."},"node":{"type":"string","maxLength":256,"description":"The target node's `data-charidy-node` address (the platform-stamped structural hash). Node addresses change when a page is regenerated, so an override may stop matching after a rebuild — that is expected (§5א)."},"value":{"type":"string","maxLength":10000,"default":"","description":"The replacement value. Ignored (send `\"\"`) when `kind=style` — a style edit carries its payload in `styleValue`. For `kind=text`: the plain-text replacement (max 5000 chars; stored and rendered as escaped text). For `kind=image`: an absolute media URL on the allowlist, or a relative/`data:image` URL. Rejected with `CAMPAIGN_NODE_OVERRIDE_INVALID` (empty/oversized text), `CAMPAIGN_NODE_OVERRIDE_MEDIA_HOST_DISALLOWED` (off-allowlist image host) or `CAMPAIGN_NODE_OVERRIDE_NODE_NOT_FOUND` (no such node on the current page) — nothing is stored on rejection. Ignored when `remove` is true."},"property":{"type":"string","maxLength":64,"description":"Required when `kind=style`, ignored otherwise. The design-catalog property id, e.g. `paddingBlock`. The catalog is CLOSED — an unknown id is rejected with `CAMPAIGN_NODE_STYLE_UNKNOWN` and the error names what is available. Call getCampaignStyleCatalog to discover the current list with its enforced ranges. Also required when removing a style override, so resetting one slider cannot clear the node's other properties."},"styleValue":{"description":"Required when `kind=style`. The desktop value in pixels, plus the optional phone value from the \"mobile adjustment\" toggle. Both are bounded by the server (`CAMPAIGN_NODE_STYLE_INVALID` names the range); the phone value is additionally capped at the property's mobile ceiling, so opening the toggle can move the value inside the phone budget but never past it. The server derives the phone value automatically when it is omitted.","allOf":[{"$ref":"#/components/schemas/CampaignNodeStyleValueDto"}]},"repeatSettings":{"description":"Required when kind=repeatSettings. Patches the selected live collection container: sort is recent|top|count|lowest|oldest, limit is 1..9999, and level is 1..10 only for a teams source. A null value clears that one key and falls back to the authored data-charidy-* attribute; omitted keys are unchanged.","allOf":[{"$ref":"#/components/schemas/CampaignRepeatSettingsDto"}]},"gallerySettings":{"description":"Required for kind=gallerySettings. Patch autoplayMs, slideOrder, or hiddenSlides on a gallery frame. Null clears one key, omitted keys stay unchanged, remove:true clears the entry. Adding a slide waits on the editor-insert capability.","allOf":[{"$ref":"#/components/schemas/CampaignGallerySettingsDto"}]},"remove":{"type":"boolean","description":"Set true to REMOVE this override instead of writing one (per-edit undo — the node returns to what the page itself says). `value` is ignored. Removing a key that is not stored succeeds and changes nothing, and — unlike a write — removal does NOT require the node to still exist, so a stale override left behind by a regeneration can always be cleaned up. This is separate from restoreCampaignPageVersion, which rewinds the whole page."}},"required":["kind","value"]},"CampaignTokenOverridesResponseDto":{"type":"object","properties":{"tokenOverrides":{"type":"object","additionalProperties":{"type":"string"},"description":"CSS custom properties retuned from the design studio, e.g. `{ \"--cg-ink\": \"#FF6494\" }`. Empty when none have been set."}},"required":["tokenOverrides"]},"SetCampaignTokenOverridesDto":{"type":"object","properties":{"tokenOverrides":{"type":"object","additionalProperties":{"type":"string","nullable":true},"description":"Palette token overrides keyed by CSS custom-property name. Merged into the draft; a `null` value clears one key."}},"required":["tokenOverrides"]},"CampaignPageVersionDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"version":{"type":"number","minimum":1,"description":"Monotonic per-campaign version number. Restore targets this."},"publishedVersion":{"type":"number","minimum":0,"description":"campaign_design.published_version at snapshot time (0 before first publish)."},"source":{"type":"string","enum":["ai-generate","ai-refine","manual-save","agent-submit","template-apply","kit-apply","section-edit","publish","restore","duplicate"],"description":"The write path that produced this version."},"restoredFromVersion":{"type":"number","nullable":true,"description":"When source = \"restore\", the version this content was restored from."},"actorGlobalUserId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","campaignId","version","publishedVersion","source","createdAt"]},"CampaignPageVersionListDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/CampaignPageVersionDto"}}},"required":["items"]},"CampaignPublishResultDto":{"type":"object","properties":{"campaign":{"description":"The campaign after publish, including its derived `publicationStatus`.","allOf":[{"$ref":"#/components/schemas/CampaignResponseDto"}]},"design":{"description":"The published page/design state (live version + public URL).","allOf":[{"$ref":"#/components/schemas/CampaignDesignResponseDto"}]},"activated":{"type":"boolean","description":"True when this call transitioned a draft campaign to active (the lifecycle side of the one-click publish actually flipped)."},"publicationStatus":{"type":"string","enum":["draft","page_not_published","scheduled","live","paused","ended","completed","archived"],"description":"The true combined status after publish (mirror of `campaign.publicationStatus`)."},"publicUrl":{"type":"string","format":"uri","nullable":true,"description":"Canonical absolute public URL of the now-live campaign page."}},"required":["campaign","design","activated","publicationStatus"]},"ValidateCampaignDesignResponseDto":{"type":"object","properties":{"valid":{"type":"boolean","description":"True when the document passed the enforcement gate."},"renderMode":{"type":"string","enum":["blocks","freeform"],"description":"Detected render mode."},"version":{"type":"number","description":"Document schema version (1 = blocks, 2 = freeform)."},"itemCount":{"type":"number","description":"Number of blocks (v1) or functional islands (v2)."},"capabilities":{"description":"Logical capabilities the page provides (freeform only; empty for blocks).","type":"array","items":{"type":"string"}}},"required":["valid","renderMode","version","itemCount","capabilities"]},"GeneratePageBrandPaletteDto":{"type":"object","properties":{"primary":{"type":"string","description":"Primary brand color (CSS color)."},"secondary":{"type":"string","description":"Secondary/accent brand color (CSS color)."},"background":{"type":"string","description":"Page background color (CSS color)."},"surface":{"type":"string","description":"Surface/card color (CSS color)."},"text":{"type":"string","description":"Body text color (CSS color)."}}},"GeneratePageBrandAssetsDto":{"type":"object","properties":{"logoUrl":{"type":"string","description":"Platform-hosted (media library) logo URL. Only allowlisted media hosts pass the enforcement gate + CSP."},"heroUrl":{"type":"string","description":"Platform-hosted (media library) hero image URL."},"galleryUrls":{"description":"Additional platform-hosted (media library) image URLs for story/gallery sections.","type":"array","items":{"type":"string"}},"palette":{"$ref":"#/components/schemas/GeneratePageBrandPaletteDto"}}},"GenerateCampaignPageReferenceTemplateSectionDto":{"type":"object","properties":{"key":{"type":"string","description":"Stable key for this section, e.g. \"hero\", \"top_gallery\", \"donation_levels\"."},"description":{"type":"string","description":"One-line description of what this section is / does."},"mediaType":{"type":"string","enum":["video","image","slider","none"],"description":"What media the REFERENCE carries in this section, if any."},"capability":{"type":"string","enum":["content","donate","progress","donation_levels","donor_wall","live_donations","teams","ambassadors","matchers","media","share","media_gallery"],"description":"The engine capability this section maps onto. When set and `required` is not false, it is merged into the enforcement gate's required capabilities."},"styleNotes":{"type":"string","description":"Free-text styling notes to preserve exactly, e.g. \"circular image, amount printed below it\"."},"required":{"type":"boolean","description":"Whether this section (or its mapped counterpart) is mandatory. Defaults true."}},"required":["key","description"]},"GenerateCampaignPageReferenceTemplateDto":{"type":"object","properties":{"name":{"type":"string","description":"Human label, e.g. \"Shneor reference template (CHAR-158)\"."},"sections":{"description":"Ordered section list — the rhythm/order the output must preserve.","type":"array","items":{"$ref":"#/components/schemas/GenerateCampaignPageReferenceTemplateSectionDto"}},"teamFilterOptions":{"description":"The team-filter dropdown's fixed option set, when the reference shows one, reproduced verbatim.","type":"array","items":{"type":"string"}},"shareIconStyle":{"type":"string","description":"Share-icon style note, e.g. \"outline duotone icon set — never emoji\"."},"donationLevelCardStyle":{"type":"string","description":"Donation-level card style note, e.g. \"circular image, amount below it\"."}},"required":["name","sections"]},"GenerateCampaignPageDto":{"type":"object","properties":{"brief":{"type":"string","description":"Natural-language brief describing the desired campaign page."},"tone":{"type":"string","description":"Optional tone/style hint (e.g. \"warm\", \"bold\", \"minimal\")."},"locale":{"type":"string","description":"Optional primary locale (e.g. \"en\", \"he\")."},"brandAssets":{"description":"Real, platform-hosted brand imagery + palette for the AI to build the page around. Use only media-library URLs (they must survive the enforcement gate + CSP).","allOf":[{"$ref":"#/components/schemas/GeneratePageBrandAssetsDto"}]},"templateId":{"type":"string","enum":["general","bold","subtle","network","donation"],"description":"Optional deterministic template skeleton. The model starts from the composed, live-bound structure and fills it instead of authoring a page from scratch."},"referenceTemplate":{"description":"CHAR-158: a STRUCTURED description of an approved reference template (e.g. a client-built exemplar page) the generated page must match section-for-section — per-section media type, donation-level card style, team-filter shape, share-icon style. Optional; absent behaves exactly as before.","allOf":[{"$ref":"#/components/schemas/GenerateCampaignPageReferenceTemplateDto"}]}},"required":["brief"]},"CampaignPublishReadinessItemDto":{"type":"object","properties":{"key":{"type":"string","enum":["payment_acquirer_missing","publishable_page_missing","existing_organization_not_public","existing_plan_active_campaign_limit","existing_blocking_tasks","start_date_missing","end_date_missing","start_date_in_past","goal_missing","no_visible_levels","page_content_missing","page_untouched_default","media_missing","mobile_not_optimized","donation_window_already_closed","blocking_tasks_open","org_readiness_steps_incomplete"],"description":"Stable machine key. Callers localize from this, never from a message string."},"severity":{"type":"string","enum":["blocker","warning"]},"message":{"type":"string","description":"English explanation for logs and for agents with no localization table. NOT for display in a localized UI."},"context":{"type":"object","additionalProperties":true,"description":"Item-specific facts — e.g. the open task titles for `blocking_tasks_open`, the currency for `payment_acquirer_missing`, the step keys for `org_readiness_steps_incomplete`."}},"required":["key","severity","message"]},"CampaignPublishReadinessSummaryDto":{"type":"object","properties":{"startDate":{"type":"string","nullable":true},"endDate":{"type":"string","nullable":true},"acceptDonationsUntil":{"type":"string","nullable":true,"description":"The money cutoff. Later than `endDate` means late donations are accepted."},"timezone":{"type":"string","nullable":true},"goalAmount":{"type":"string","nullable":true},"currency":{"type":"string"},"visibleLevelCount":{"type":"number","description":"Visible donation levels. Zero is a warning, not a blocker — donors can still enter a free amount."},"chargingAcquirer":{"type":"string","nullable":true,"description":"The acquirer that will charge this campaign, or null when none can."},"publicUrl":{"type":"string","nullable":true}},"required":["startDate","endDate","acceptDonationsUntil","timezone","goalAmount","currency","visibleLevelCount","chargingAcquirer","publicUrl"]},"CampaignPublishReadinessDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"canPublish":{"type":"boolean","description":"True when nothing BLOCKS publishing. Warnings may still be present — those need `acknowledgeWarnings`, not a fix."},"blockers":{"description":"Hard failures. Publishing is refused while any of these stand; they cannot be acknowledged away.","type":"array","items":{"$ref":"#/components/schemas/CampaignPublishReadinessItemDto"}},"warnings":{"description":"Things a human should see before donors do. Publishing proceeds once every key here is passed back in `acknowledgeWarnings`.","type":"array","items":{"$ref":"#/components/schemas/CampaignPublishReadinessItemDto"}},"passed":{"type":"array","description":"Checks that passed, so the UI can show a complete checklist rather than only the bad news.","items":{"type":"string","enum":["payment_acquirer_missing","publishable_page_missing","existing_organization_not_public","existing_plan_active_campaign_limit","existing_blocking_tasks","start_date_missing","end_date_missing","start_date_in_past","goal_missing","no_visible_levels","page_content_missing","page_untouched_default","media_missing","mobile_not_optimized","donation_window_already_closed","blocking_tasks_open","org_readiness_steps_incomplete"]}},"summary":{"$ref":"#/components/schemas/CampaignPublishReadinessSummaryDto"}},"required":["campaignId","canPublish","blockers","warnings","passed","summary"]},"CampaignPublishGateMissingStepDto":{"type":"object","properties":{"stepKey":{"type":"string","description":"Onboarding setup-hub step key still incomplete."},"reasonCode":{"type":"string","enum":["step_incomplete"]}},"required":["stepKey","reasonCode"]},"CampaignGenerationPipelineStatusDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"campaignSlug":{"type":"string"},"campaignStatus":{"type":"string","enum":["draft","pending_approval","active","paused","ended","completed","archived"]},"pageGenerationStatus":{"type":"string","enum":["pending","ready","failed","skipped_llm_disabled"]},"pageGenerationSource":{"type":"object","nullable":true,"description":"Source recorded in draft_settings.meta.source."},"draftUpdatedAt":{"type":"string","format":"date-time"},"levelsSeeded":{"type":"boolean"},"previewAvailable":{"type":"boolean"},"designPublished":{"type":"boolean"},"publishGateUnlocked":{"type":"boolean","description":"Org-level onboarding publish gate: true when the org may publish its first campaign."},"missingPublishSteps":{"type":"array","items":{"$ref":"#/components/schemas/CampaignPublishGateMissingStepDto"}},"requiredCapabilitiesSatisfied":{"type":"boolean","description":"True when the generated freeform draft has non-empty html/css and passes the required page-engine capabilities."},"contentGenerated":{"type":"boolean","description":"True when generated draft content is present; false while the placeholder is still pending."},"mediaPresent":{"type":"boolean","description":"True when the generated draft includes media capability or image markup."},"mobileOptimized":{"type":"boolean","description":"True when the page is generated and passed the page-engine validation gate."},"progressPercent":{"type":"number","minimum":0,"maximum":100,"description":"Completion of real pipeline milestones; never elapsed-time based."}},"required":["campaignId","campaignSlug","campaignStatus","pageGenerationStatus","draftUpdatedAt","levelsSeeded","previewAvailable","designPublished","publishGateUnlocked","missingPublishSteps","requiredCapabilitiesSatisfied","contentGenerated","mediaPresent","mobileOptimized","progressPercent"]},"EnqueueCampaignPageGenerationDto":{"type":"object","properties":{"brief":{"type":"string","description":"Natural-language brief for the AI page author. When omitted, the platform builds one from the organization's stored website intelligence + brand settings (the same inputs onboarding uses) and the campaign's own name/goal/kind."},"tone":{"type":"string","description":"Optional tone/style hint (e.g. \"warm\", \"bold\", \"minimal\")."},"locale":{"type":"string","description":"Optional primary locale (e.g. \"en\", \"he\")."},"templateId":{"type":"string","enum":["general","bold","subtle","network","donation"],"description":"Optional deterministic template skeleton used as the worker model's starting structure."},"rebuild":{"type":"boolean","description":"Stated intent to overwrite a page that already exists. Generation replaces `campaign_design.draft_settings` WHOLESALE, so re-running it discards every refine edit made since (and on a published campaign, replaces what was approved). Without this flag a campaign that already has a generated draft or a published design is refused with `CAMPAIGN_PAGE_ALREADY_BUILT`; a failed or LLM-disabled attempt has nothing to lose and is always retryable."}}},"EnqueueCampaignPageGenerationResponseDto":{"type":"object","properties":{"accepted":{"type":"boolean","description":"True when the approved kit was composed or the generation job was enqueued. False when the enqueue failed (logged server-side); safe to retry."},"campaignId":{"type":"string","format":"uuid"},"pageGenerationStatus":{"type":"string","enum":["pending","ready"]},"donationTiersSource":{"type":"string","enum":["spec","automatic"],"description":"Where the campaign’s giving ladder came from: `spec` when a plan’s own tiers were written (Campaign Journey build-page), `automatic` when the goal-derived ladder was seeded (or already existed)."},"donationTiersApplied":{"type":"number","description":"How many donation levels this call wrote. 0 when the campaign already had tiers and no plan overrode them."}},"required":["accepted","campaignId","pageGenerationStatus","donationTiersSource","donationTiersApplied"]},"RefineCampaignPageDto":{"type":"object","properties":{"instruction":{"type":"string","description":"Natural-language instruction for a targeted change to the current freeform draft."},"selectedEditId":{"type":"string","description":"When the user clicked a region in the design studio, the data-charidy-edit-id of that region."},"locale":{"type":"string","description":"Optional primary locale (e.g. \"en\", \"he\")."}},"required":["instruction"]},"SubmitCampaignPageDesignDto":{"type":"object","properties":{"design":{"type":"object","additionalProperties":true,"description":"A complete Design Engine v2 freeform document that the calling agent authored itself: `{ version: 2, renderMode: \"freeform\", document: { html: string, css: string }, islands: Array<{ ref, type, props }>, capabilities?: string[], meta? }`. The HTML may use only allowlisted tags plus `<charidy-island data-type=\"...\" data-ref=\"...\">` functional islands (donate_button, goal_progress, donor_wall, ambassadors, etc.) and declarative `data-charidy-action=\"donate\"` elements — no `<script>`/`<style>`/`<iframe>` or inline event handlers. The CSS supports `@keyframes`/`@media`/`@font-face`, transitions, and animations; `@import`/`expression()`/`behavior:` are rejected. Every `islands[]` ref must match a `<charidy-island>` in the HTML and its props must satisfy that island’s schema (see getPageEngineCapabilities). Only freeform documents are accepted — block layouts are rejected with `FREEFORM_DOCUMENT_INVALID`."}},"required":["design"]},"SubmitCampaignPageDesignResponseDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"renderMode":{"type":"string","enum":["freeform"],"description":"Always \"freeform\" — this tool only accepts Design Engine v2 documents."},"islandCount":{"type":"number","minimum":0,"description":"Number of functional islands wired into the saved design."},"capabilities":{"description":"Logical capabilities the page provides (derived from islands + declarative donate actions).","type":"array","items":{"type":"string"}},"draftUpdatedAt":{"type":"string","format":"date-time","description":"When the draft was last updated."},"previewUrl":{"type":"string","format":"uri","description":"Signed external preview URL for the saved draft. Not a donor-facing share link."},"previewToken":{"type":"string","description":"Signed preview token embedded in previewUrl (bound to org + campaign)."},"previewExpiresAt":{"type":"string","format":"date-time","nullable":true,"description":"Always null: preview links no longer expire on a clock, they are stopped on request via revokeCampaignDesignPreviewLinks."}},"required":["campaignId","renderMode","islandCount","capabilities","draftUpdatedAt","previewUrl","previewToken","previewExpiresAt"]},"GenerateCampaignConceptDto":{"type":"object","properties":{"locale":{"type":"string","enum":["he","en"],"description":"Language the concept prose is composed in (not translated into). Defaults to the acting user’s preferred locale, else the organization’s country (`IL` → `he`), else `en`."},"inheritFromPreviousCampaign":{"type":"boolean","description":"When true, reuse the palette + typography of the organization’s most recently APPROVED concept (so an org’s 5th campaign looks like the same organization) while writing fresh beats, headline and pull quotes for this campaign. When false/omitted the visual identity is composed fresh. No previous approved concept simply means nothing is inherited.","default":false}}},"ConceptHeadlineDto":{"type":"object","properties":{"text":{"type":"string","description":"The page H1."},"emphasis":{"description":"Words/phrases inside `text` to visually accent. Each is an exact substring of `text`.","type":"array","items":{"type":"string"}}},"required":["text","emphasis"]},"ConceptEvidenceDto":{"type":"object","properties":{"kind":{"type":"string","description":"Where the fact came from: `scan_finding` (website scan), `client_answer` (the team’s own words or their chosen strategy), `media_asset` (an approved media-library image), `stat` (a computed campaign number), `document`, `testimonial`, `prior_campaign`. Open vocabulary by design.","example":"client_answer"},"ref":{"type":"string","description":"Locator for the source — e.g. `onboarding.campaignPurpose`, `website_scan.storySignals[1]`, `media_asset.<uuid>`, `campaign.goal`, `journey.strategy.chosen`."},"quote":{"type":"string","description":"The verbatim snippet from that source which supports the beat. Server-validated against the real input: a citation whose quote is not a span of the source is stripped, and a beat left with no citations is deleted."}},"required":["kind","ref","quote"]},"ConceptBeatDto":{"type":"object","properties":{"id":{"type":"string","description":"Stable slug for the beat; `textOverrides` keys reference it."},"role":{"type":"string","description":"Narrative function of the beat, e.g. `problem`, `stakes`, `proof`, `ask`. Open vocabulary."},"headline":{"type":"string","description":"Short section headline for this beat."},"body":{"type":"string","description":"The beat copy — one to three sentences of grounded prose."},"evidence":{"description":"Citations grounding this beat. ALWAYS non-empty in a persisted concept: unevidenced beats are deleted, never back-filled.","type":"array","items":{"$ref":"#/components/schemas/ConceptEvidenceDto"}},"capabilities":{"description":"Platform capabilities this beat wants rendered inside its section (closed vocabulary — the page-engine capability registry).","example":["donate","progress"],"type":"array","items":{"type":"string"}}},"required":["id","role","headline","body","evidence","capabilities"]},"ConceptPaletteTokenLabelDto":{"type":"object","properties":{"he":{"type":"string","description":"Hebrew label shown in the client-facing concept review."},"en":{"type":"string","description":"English label shown in the client-facing concept review."}},"required":["he","en"]},"ConceptPaletteTokenDto":{"type":"object","properties":{"name":{"type":"string","description":"CSS custom-property name (open set), e.g. `--ember`.","example":"--ember"},"value":{"type":"string","description":"The token’s colour value.","example":"#B3311C"},"role":{"type":"string","description":"What the token is for, e.g. `surface`, `ink`, `accent`, `hero-overlay`."},"label":{"description":"Bilingual label — the palette is reviewed by the client, never shown as raw hex.","allOf":[{"$ref":"#/components/schemas/ConceptPaletteTokenLabelDto"}]}},"required":["name","value","role","label"]},"ConceptBrandAnchorDto":{"type":"object","properties":{"tokenName":{"type":"string","description":"Which token carries the organization’s real brand colour. Always one of `tokens[].name` (enforced by the schema)."},"brandColor":{"type":"string","description":"The organization’s actual brand colour, as scanned or supplied."},"placement":{"type":"string","description":"Where the brand colour must be visible, e.g. `hero-cta`, `progress-fill`."}},"required":["tokenName","brandColor","placement"]},"ConceptPaletteDto":{"type":"object","properties":{"tokens":{"description":"The page’s colour tokens, emitted as CSS custom properties. OPEN set — a concept declares as many as its art direction needs, named after the story.","type":"array","items":{"$ref":"#/components/schemas/ConceptPaletteTokenDto"}},"brandAnchor":{"description":"The one guaranteed tie to the real brand. A campaign palette may move the brand palette aside (dark mode, an emotional accent) — story fidelity may outrank brand dominance — but the brand colour must survive in a declared token.","allOf":[{"$ref":"#/components/schemas/ConceptBrandAnchorDto"}]}},"required":["tokens","brandAnchor"]},"ConceptTypographyDto":{"type":"object","properties":{"displayFamily":{"type":"string","description":"Family for headlines/display text. One of the platform font families — the page CSP blocks external fonts.","example":"Charidy Frank"},"bodyFamily":{"type":"string","description":"Family for body copy (platform families only).","example":"Charidy Assistant"},"mood":{"type":"string","description":"Why this pairing fits, e.g. `warm editorial`, `civic and plain`."}},"required":["displayFamily","bodyFamily","mood"]},"ConceptMoodDto":{"type":"object","properties":{"mode":{"type":"string","enum":["light","dark","auto"],"description":"Overall light/dark treatment of the page."},"density":{"type":"string","description":"Spatial feel, e.g. `airy`, `balanced`, `dense`."}},"required":["mode","density"]},"ConceptProvenanceDto":{"type":"object","properties":{"promptVersion":{"type":"string","description":"Version of the concept prompt that produced this, so regressions are attributable."},"source":{"type":"string","enum":["llm","deterministic"],"description":"`deterministic` = built from the real inputs with no model (the honest fallback used when the LLM is off, fails, or its output cannot be grounded). Never a fabricated story."},"inputSummary":{"type":"string","description":"Short description of the inputs the concept was derived from."}},"required":["promptVersion","source","inputSummary"]},"CampaignConceptDto":{"type":"object","properties":{"headline":{"$ref":"#/components/schemas/ConceptHeadlineDto"},"beats":{"description":"The surviving evidenced beats, in page order. MAY be fewer than five — or empty: unevidenced beats are deleted rather than invented.","type":"array","items":{"$ref":"#/components/schemas/ConceptBeatDto"}},"pullQuotes":{"description":"Two to three short quotes to break up the page.","type":"array","items":{"type":"string"}},"palette":{"$ref":"#/components/schemas/ConceptPaletteDto"},"typography":{"$ref":"#/components/schemas/ConceptTypographyDto"},"mood":{"$ref":"#/components/schemas/ConceptMoodDto"},"groundedBeatCount":{"type":"number","description":"Number of beats actually backed by evidence, recomputed server-side after pruning (never the model’s self-report)."},"route":{"type":"string","enum":["story_first","hybrid","warm_generic"],"description":"How much story the page is entitled to tell, derived from `groundedBeatCount`: >=5 → `story_first`, 2-4 → `hybrid`, 0-1 → `warm_generic`. `warm_generic` on a thin-data organization is the correct, honest outcome."},"provenance":{"$ref":"#/components/schemas/ConceptProvenanceDto"}},"required":["headline","beats","pullQuotes","palette","typography","mood","groundedBeatCount","route","provenance"]},"CampaignConceptResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The concept row id."},"campaignId":{"type":"string","format":"uuid"},"concept":{"$ref":"#/components/schemas/CampaignConceptDto"},"tokenOverrides":{"type":"object","additionalProperties":{"type":"string"},"description":"Client edits to palette tokens, keyed by CSS custom-property name (`{\"--ember\":\"#123456\"}`). Layered OVER `concept.palette` at render time so an approved concept is never mutated in place."},"textOverrides":{"type":"object","additionalProperties":true,"description":"Client edits to concept copy, keyed by `headline` or `beat.<beatId>.headline` / `beat.<beatId>.body`. Same layering contract as `tokenOverrides`."},"approvedAt":{"type":"object","nullable":true,"format":"date-time","description":"Set when the client approved the concept; null while it is still a proposal."},"approvedByUserId":{"type":"object","nullable":true,"format":"uuid"},"version":{"type":"number","description":"Bumped on each re-generation, so page authoring can record which concept version it rendered from. A re-generation also clears the approval and the override maps."},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","campaignId","concept","tokenOverrides","textOverrides","version","createdAt","updatedAt"]},"PatchConceptHeadlineDto":{"type":"object","properties":{"text":{"type":"string","description":"The page H1."},"emphasis":{"description":"Words/phrases inside `text` to accent. Each must be an exact substring of `text`.","type":"array","items":{"type":"string"}}},"required":["text"]},"PatchCampaignConceptDto":{"type":"object","properties":{"headline":{"$ref":"#/components/schemas/PatchConceptHeadlineDto"},"pullQuotes":{"minItems":2,"maxItems":3,"description":"Replacement pull quotes.","type":"array","items":{"type":"string"}},"beats":{"description":"Replacement beats, in page order (max 7). Each beat must carry `evidence` that resolves against this campaign’s real inputs; beats whose citations do not resolve are DELETED and `route` degrades accordingly.","type":"array","items":{"$ref":"#/components/schemas/ConceptBeatDto"}},"palette":{"description":"Replacement palette. `brandAnchor.tokenName` must be one of `tokens[].name` — the brand may be de-emphasized, not removed.","allOf":[{"$ref":"#/components/schemas/ConceptPaletteDto"}]},"typography":{"description":"Replacement type pairing. Families must be platform families (the CSP blocks external fonts).","allOf":[{"$ref":"#/components/schemas/ConceptTypographyDto"}]},"mood":{"description":"Replacement global mood.","allOf":[{"$ref":"#/components/schemas/ConceptMoodDto"}]},"tokenOverrides":{"type":"object","additionalProperties":{"type":"string"},"description":"Palette token overrides keyed by CSS custom-property name (`{\"--ember\":\"#123456\"}`). Merged into the stored map; a `null` value clears one key. Allowed even after approval."},"textOverrides":{"type":"object","additionalProperties":true,"description":"Copy overrides keyed by `headline` or `beat.<beatId>.headline` / `beat.<beatId>.body`. Merged into the stored map; a `null` value clears one key. Allowed even after approval."}}},"UpdateCampaignContentOverridesDto":{"type":"object","properties":{"contentOverrides":{"type":"object","additionalProperties":true,"description":"State -> locale -> override entry. States: default | countdown | primary_goal_reached | bonus_goal_reached | completed."}},"required":["contentOverrides"]},"UpdateCampaignTrackingDto":{"type":"object","properties":{"tracking":{"$ref":"#/components/schemas/CampaignTrackingDto"}},"required":["tracking"]},"SubmitForApprovalDto":{"type":"object","properties":{"note":{"type":"string","description":"Optional submission note for the reviewer."}}},"RejectCampaignDto":{"type":"object","properties":{"reason":{"type":"string","description":"Reason for rejection (visible to org admin).","maxLength":2000}},"required":["reason"]},"DuplicateCampaignDto":{"type":"object","properties":{"name":{"type":"string","maxLength":280,"description":"Display name of the new (duplicated) campaign."},"slug":{"type":"string","maxLength":80,"description":"URL slug for the new campaign. Auto-derived from `name` when omitted; must be lowercase, hyphen-separated, and unique per organization."},"includeLevels":{"type":"boolean","description":"Copy ALL donation levels (hidden ones too, each keeping its visibility, translations, cap setting and order; sold-out counters restart at zero). Defaults to true."},"includeDesign":{"type":"boolean","description":"Copy the page design and its content as a DRAFT (editor draft, text/image/style/repeat/gallery overrides, art-direction concept). The live published page is never copied: the new campaign shows nothing until it is published. Defaults to true (it used to default to false and, when set, copied nothing)."},"includeMatchers":{"type":"boolean","description":"Copy every matcher with all its fields (name, description, logos, type, order, featured/host flags, coefficients, pool cap). The consumed pool restarts at zero and each copy is `scheduled` (not active) until a person activates it; a window already in the past is not copied. Defaults to true (it used to default to false and dropped most fields)."},"includeDetails":{"type":"boolean","description":"Copy the campaign details: goal, bonus goal, timezone, purpose answer, one-time/monthly answer, language, donate-button/thank-you/contact/dedication settings, UI overrides, manager. Schedule dates are copied only while still in the future (a past date is not copied: set new dates). Defaults to true. Currency and kind are always copied."},"includeStory":{"type":"boolean","description":"Copy the story, the per-language About content and the sharing/SEO settings (share message, email subject, SEO title and description). Defaults to true."},"includePaymentSettings":{"type":"boolean","description":"Copy payment settings: the list of enabled acquirers (provider keys only, never credentials or connection config), manual FX rates, and the donor-form switches (phone/address/installments/billing types/accepting payments). Whether each listed acquirer is actually connected is NOT re-checked here. Defaults to true."},"includeCustomFields":{"type":"boolean","description":"Copy the custom donor-form fields (checkout.customFields). Defaults to true."},"includeTeamSettings":{"type":"boolean","description":"Copy the per-campaign team settings (multi-team donation, auto-approve signup). The teams/fundraisers themselves are never copied. Defaults to true."},"includeComms":{"type":"boolean","description":"Copy the per-campaign email template overrides. Automation journeys are not cloned: the new campaign gets its own default journeys as drafts (never active). Sent messages are never copied. Defaults to true."},"includeTasks":{"type":"boolean","description":"Copy pending campaign-level manual to-dos as fresh open tasks (no due dates). Donor-linked and system tasks are not copied; the new campaign gets its own system tasks. Defaults to true."}},"required":["name"]},"DuplicateCampaignResponseDto":{"type":"object","properties":{"campaign":{"$ref":"#/components/schemas/CampaignResponseDto"},"copiedLevelsCount":{"type":"number"},"copiedMatchersCount":{"type":"number"},"copiedTemplatesCount":{"type":"number","description":"Email template overrides copied."},"copiedTasksCount":{"type":"number","description":"Pending manual tasks copied as fresh open tasks."},"copiedItems":{"type":"array","description":"The checklist items that were copied (the ones asked for).","items":{"type":"string","enum":["details","design","story","levels","matchers","payments","customFields","teamSettings","comms","tasks"]}},"datesNotCopied":{"type":"boolean","description":"True when the source had start/end/accept-until dates that are already past and so were NOT copied; the caller must set new dates."}},"required":["campaign","copiedLevelsCount","copiedMatchersCount","copiedTemplatesCount","copiedTasksCount","copiedItems","datesNotCopied"]},"UmbrellaChildSummaryDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"status":{"type":"string","enum":["draft","pending_approval","active","paused","ended","completed","archived"]},"goalAmount":{"type":"string","nullable":true},"currency":{"type":"string"},"raisedAmountMinor":{"type":"number","format":"int64"},"contributionCount":{"type":"number"}},"required":["campaignId","name","slug","status","currency","raisedAmountMinor","contributionCount"]},"UmbrellaLeaderboardResponseDto":{"type":"object","properties":{"children":{"type":"array","items":{"$ref":"#/components/schemas/UmbrellaChildSummaryDto"}},"totalRaisedAmountMinor":{"type":"number","format":"int64"},"totalCurrency":{"type":"string"}},"required":["children","totalRaisedAmountMinor","totalCurrency"]},"AddChildCampaignDto":{"type":"object","properties":{"childCampaignId":{"type":"string","format":"uuid"}},"required":["childCampaignId"]},"CampaignSummaryDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"totals":{"type":"array","items":{"$ref":"#/components/schemas/CampaignContributionTotalDto"}},"contributionCount":{"type":"number","minimum":0},"raisedAmountMinor":{"type":"number","format":"int64"},"currency":{"type":"string"}},"required":["campaignId","totals","contributionCount","raisedAmountMinor","currency"]},"SeedCampaignDemoDataDto":{"type":"object","properties":{"includeAmbassadors":{"type":"boolean","description":"Include an ambassador leaderboard. Defaults to the campaign recommendation (on when peer fundraising is part of the strategy)."},"ambassadorCount":{"type":"number","minimum":1,"maximum":4,"description":"How many demo ambassadors to seed when ambassadors are included. Defaults to 2."},"includeMatcher":{"type":"boolean","description":"Feature a matching-gift (\"every gift matched\"). Defaults to false."},"coveragePercent":{"type":"number","minimum":5,"maximum":90,"description":"Percentage of the goal the demo should appear to have raised. Defaults to 30."},"locale":{"type":"string","description":"Locale for demo donor/ambassador names (\"he\" or \"en\"). Defaults to English.","maxLength":10}}},"CampaignDemoDataResponseDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"seeded":{"type":"boolean","description":"True when a demo overlay is present after the operation."},"currency":{"type":"string"},"raisedAmountMinor":{"type":"number","format":"int64","description":"Synthetic raised amount (minor units)."},"contributionCount":{"type":"number"},"percent":{"type":"number","description":"Synthetic percentage of goal raised."},"ambassadorCount":{"type":"number"},"matcherCount":{"type":"number"},"liveVisitorCount":{"type":"number","description":"Recent-visitor count shown in the preview banner."},"strategyNotes":{"description":"Campaign-brain rationale: what the page should lean on to convert.","type":"array","items":{"type":"string"}}},"required":["campaignId","seeded","currency","raisedAmountMinor","contributionCount","percent","ambassadorCount","matcherCount","liveVisitorCount","strategyNotes"]},"ApplyCampaignPageTemplateDto":{"type":"object","properties":{"templateId":{"type":"string","enum":["general","bold","subtle","network","donation"]},"locale":{"type":"string","maxLength":16,"description":"Primary locale; Hebrew produces an RTL document."},"mode":{"type":"string","enum":["replace","keep-overrides"]}},"required":["templateId","mode"]},"DroppedCampaignPageOverrideDto":{"type":"object","properties":{"kind":{"type":"string","enum":["text","image","style","repeatSettings","gallerySettings"]},"node":{"type":"string","description":"The old data-charidy-node override key that had no equivalent node."}},"required":["kind","node"]},"ApplyCampaignPageTemplateResponseDto":{"type":"object","properties":{"design":{"$ref":"#/components/schemas/CampaignDesignResponseDto"},"previewUrl":{"type":"string","format":"uri"},"previewToken":{"type":"string","description":"Signed token embedded in previewUrl."},"previewExpiresAt":{"type":"string","format":"date-time","nullable":true,"description":"Always null: preview links are stopped on request, not on a clock."},"droppedOverrides":{"type":"array","items":{"$ref":"#/components/schemas/DroppedCampaignPageOverrideDto"}}},"required":["design","previewUrl","previewToken","previewExpiresAt","droppedOverrides"]},"ApplyCampaignPersonaKitDto":{"type":"object","properties":{"kitId":{"type":"string","enum":["giving-day-urgent","school-giving-day","personal-rescue","emergency-relief","bright-futures"]},"locale":{"type":"string","maxLength":16,"description":"Optional page-locale override (the gallery sends its en/he switch value). Resolution order is requested, campaign settings locale, campaign preferredLocale, organization default locale, then Hebrew."},"mode":{"type":"string","enum":["replace","keep-overrides"]},"seed":{"type":"boolean","description":"When true, missing levels, teams, matcher, deadline, and recurring policy are seeded without overwriting existing campaign data."}},"required":["kitId","mode","seed"]},"CampaignPersonaKitSeedResultDto":{"type":"object","properties":{"status":{"type":"string","enum":["seeded","skipped-existing","not-applicable","not-requested"]},"count":{"type":"number","minimum":0}},"required":["status","count"]},"CampaignPersonaKitSeedSummaryDto":{"type":"object","properties":{"levels":{"$ref":"#/components/schemas/CampaignPersonaKitSeedResultDto"},"teams":{"$ref":"#/components/schemas/CampaignPersonaKitSeedResultDto"},"matcher":{"$ref":"#/components/schemas/CampaignPersonaKitSeedResultDto"},"endDate":{"$ref":"#/components/schemas/CampaignPersonaKitSeedResultDto"},"recurring":{"$ref":"#/components/schemas/CampaignPersonaKitSeedResultDto"}},"required":["levels","teams","matcher","endDate","recurring"]},"ApplyCampaignPersonaKitResponseDto":{"type":"object","properties":{"design":{"$ref":"#/components/schemas/CampaignDesignResponseDto"},"previewUrl":{"type":"string","format":"uri"},"previewToken":{"type":"string","description":"Signed token embedded in previewUrl."},"previewExpiresAt":{"type":"string","format":"date-time","nullable":true,"description":"Always null: preview links are stopped on request, not on a clock."},"droppedOverrides":{"type":"array","items":{"$ref":"#/components/schemas/DroppedCampaignPageOverrideDto"}},"seeded":{"$ref":"#/components/schemas/CampaignPersonaKitSeedSummaryDto"}},"required":["design","previewUrl","previewToken","previewExpiresAt","droppedOverrides","seeded"]},"SeedCampaignPersonaKitDto":{"type":"object","properties":{"kitId":{"type":"string","enum":["giving-day-urgent","school-giving-day","personal-rescue","emergency-relief","bright-futures"]}},"required":["kitId"]},"SeedCampaignPersonaKitResponseDto":{"type":"object","properties":{"seeded":{"$ref":"#/components/schemas/CampaignPersonaKitSeedSummaryDto"}},"required":["seeded"]},"ApplyCampaignSectionActionDto":{"type":"object","properties":{"action":{"type":"string","enum":["move-up","move-down","hide","show","duplicate","remove","swap-variant","reset","insert-section","duplicate-node","remove-node"]},"section":{"type":"string","maxLength":160,"description":"Stable target/anchor data-charidy-edit-id. Required except for insert-section; omitted inserts default before the footer (recipe first/last placement takes precedence)."},"variant":{"type":"string","maxLength":160,"description":"For swap-variant only: a component-library recipe id from the same block."},"recipe":{"type":"string","maxLength":160,"description":"insert-section only: a component-library recipe id to insert."},"position":{"type":"string","enum":["before","after"],"description":"insert-section only: placement relative to the anchor section; default after."},"node":{"type":"string","maxLength":160,"description":"duplicate-node/remove-node only: the data-charidy-node address of the node inside `section` to duplicate or remove."},"slotValues":{"type":"object","additionalProperties":{"type":"string"},"description":"insert-section only: caller-supplied content for the recipe's slots (e.g. FAQ_Q1/FAQ_A1/FAQ_Q2/… for close.faq), keyed by the slot name from the component-library catalog. Keys the chosen recipe does not declare are ignored; values are HTML-escaped and length-capped server-side before being rendered into the section."}},"required":["action"]},"ApplyCampaignSectionActionResponseDto":{"type":"object","properties":{"design":{"$ref":"#/components/schemas/CampaignDesignResponseDto"},"insertedSection":{"type":"string","maxLength":160,"description":"insert-section only: the data-charidy-edit-id of the section the insert created — pass it back as `section` with action \"remove\" to undo the insert."},"remapped":{"type":"number","minimum":0},"dropped":{"type":"array","items":{"$ref":"#/components/schemas/DroppedCampaignPageOverrideDto"}}},"required":["design","remapped","dropped"]},"AccessibilityFindingDto":{"type":"object","properties":{"code":{"type":"string","enum":["image-missing-alt","image-empty-alt","heading-level-skipped","control-name-review"]},"element":{"type":"string"},"index":{"type":"number"}},"required":["code","element","index"]},"AccessibilityImageSuggestionDto":{"type":"object","properties":{"section":{"type":"string","enum":["heroImages","gallery","storyImage","sponsorLogos"]},"itemId":{"type":"string"},"assetId":{"type":"string","format":"uuid"},"suggestion":{"type":"string","nullable":true},"previewUrl":{"type":"string","nullable":true}},"required":["section","itemId","assetId","suggestion","previewUrl"]},"AccessibilityDraftImageDto":{"type":"object","properties":{"index":{"type":"number"},"src":{"type":"string"},"effectiveSrc":{"type":"string"},"suggestion":{"type":"string","nullable":true},"previewUrl":{"type":"string","nullable":true}},"required":["index","src","effectiveSrc","suggestion","previewUrl"]},"CampaignAccessibilityReviewDto":{"type":"object","properties":{"draftUpdatedAt":{"type":"string"},"findings":{"type":"array","items":{"$ref":"#/components/schemas/AccessibilityFindingDto"}},"images":{"type":"array","items":{"$ref":"#/components/schemas/AccessibilityImageSuggestionDto"}},"draftImages":{"type":"array","items":{"$ref":"#/components/schemas/AccessibilityDraftImageDto"}}},"required":["draftUpdatedAt","findings","images","draftImages"]},"UpdateAccessibilityDraftImageDto":{"type":"object","properties":{"expectedDraftUpdatedAt":{"type":"string","format":"date-time"},"index":{"type":"number","minimum":0},"expectedSrc":{"type":"string","maxLength":4096},"expectedEffectiveSrc":{"type":"string","maxLength":4096},"alt":{"type":"string","maxLength":500},"decorative":{"type":"boolean"}},"required":["expectedDraftUpdatedAt","index","expectedSrc","expectedEffectiveSrc","alt","decorative"]},"PageContentAboutLanguageDto":{"type":"object","properties":{"code":{"type":"string","description":"BCP 47 visitor language code, for example he or en-GB."},"label":{"type":"string","description":"Native language name shown on the About switcher.","maxLength":40},"title":{"type":"string","description":"About heading in this language.","maxLength":300},"body":{"type":"string","description":"TipTap rich-text HTML with allowlisted formatting. Inline images use <img data-asset-key=\"campaign-media/ORG/PATH\" alt=\"description\">; src is derived by the server. Only public raster assets in this organization/campaign are accepted.","maxLength":20000}},"required":["code","label","title","body"]},"PageContentParagraphDto":{"type":"object","properties":{"id":{"type":"string","description":"Stable item ID. Array order determines display order."},"visible":{"type":"boolean"},"text":{"type":"string","maxLength":6000}},"required":["id","visible","text"]},"PageContentStatisticDto":{"type":"object","properties":{"id":{"type":"string","description":"Stable item ID. Array order determines display order."},"visible":{"type":"boolean"},"value":{"type":"string","maxLength":100},"label":{"type":"string","maxLength":300}},"required":["id","visible","value","label"]},"PageContentFaqDto":{"type":"object","properties":{"id":{"type":"string","description":"Stable item ID. Array order determines display order."},"visible":{"type":"boolean"},"question":{"type":"string","maxLength":500},"answer":{"type":"string","maxLength":6000}},"required":["id","visible","question","answer"]},"PageContentImageDto":{"type":"object","properties":{"id":{"type":"string","description":"Stable item ID. Array order determines display order."},"visible":{"type":"boolean"},"assetId":{"type":"string","format":"uuid","description":"An approved, non-internal image in this organization media library."},"alt":{"type":"string","maxLength":500},"decorative":{"type":"boolean","description":"The image is intentionally decorative when its alternative is empty."},"caption":{"type":"string","maxLength":1000}},"required":["id","visible","assetId","alt","caption"]},"PageContentGalleryItemDto":{"type":"object","properties":{"id":{"type":"string","description":"Stable item ID. Array order determines display order."},"visible":{"type":"boolean"},"kind":{"type":"string","enum":["image","video"]},"assetId":{"type":"string","format":"uuid","description":"Required for image items; tenant-owned media ID."},"alt":{"type":"string","maxLength":500,"description":"Alternative text or accessible video title."},"caption":{"type":"string","maxLength":1000},"decorative":{"type":"boolean"},"provider":{"type":"string","enum":["youtube","vimeo","file"],"description":"Required for video items."},"url":{"type":"string","maxLength":500,"description":"Secure playable video URL matching provider; required for video."}},"required":["id","visible","kind","alt","caption"]},"PageContentHeroImageDto":{"type":"object","properties":{"id":{"type":"string","description":"Stable item ID. Array order determines display order."},"visible":{"type":"boolean"},"assetId":{"type":"string","format":"uuid","description":"An approved, non-internal image in this organization media library."},"alt":{"type":"string","maxLength":500},"decorative":{"type":"boolean","description":"The image is intentionally decorative when its alternative is empty."},"caption":{"type":"string","maxLength":1000},"locale":{"type":"string","description":"Optional BCP 47 page language for this media variant. Omitted is the fallback.","maxLength":16},"device":{"type":"string","enum":["desktop","mobile"],"description":"Target viewport. Mobile is emitted as a responsive picture source."}},"required":["id","visible","assetId","alt","caption"]},"PageContentVideoDto":{"type":"object","properties":{"provider":{"type":"string","enum":["youtube","vimeo","file"]},"url":{"type":"string","maxLength":500,"description":"https YouTube or Vimeo URL matching provider, or the public URL of an uploaded MP4/WebM file when provider is \"file\"."}},"required":["provider","url"]},"CampaignPageContentDto":{"type":"object","properties":{"headline":{"type":"string","minLength":8,"maxLength":160},"subhead":{"type":"string","maxLength":2000},"storyHeadline":{"type":"string","maxLength":300},"about":{"maxItems":12,"type":"array","items":{"$ref":"#/components/schemas/PageContentAboutLanguageDto"}},"paragraphs":{"maxItems":30,"type":"array","items":{"$ref":"#/components/schemas/PageContentParagraphDto"}},"statistics":{"maxItems":12,"type":"array","items":{"$ref":"#/components/schemas/PageContentStatisticDto"}},"faq":{"maxItems":30,"type":"array","items":{"$ref":"#/components/schemas/PageContentFaqDto"}},"gallery":{"maxItems":12,"type":"array","items":{"$ref":"#/components/schemas/PageContentImageDto"}},"galleryItems":{"maxItems":12,"description":"Version 1 mixed image/video gallery in display order. Omitted preserves legacy gallery/video; [] clears. When present this owns gallery placement and suppresses the separate campaign video.","type":"array","items":{"$ref":"#/components/schemas/PageContentGalleryItemDto"}},"heroImages":{"maxItems":12,"type":"array","items":{"$ref":"#/components/schemas/PageContentHeroImageDto"}},"storyImage":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/PageContentImageDto"}]},"sponsorLogos":{"maxItems":12,"description":"Partner/sponsor logo cards, in display order (network pages). Omitted keeps the saved list; [] clears it.","type":"array","items":{"$ref":"#/components/schemas/PageContentImageDto"}},"video":{"nullable":true,"description":"The campaign's one cover video, shown as a play icon on the cover image (and under the Bright Futures headline). YouTube uses the privacy-enhanced player; Vimeo is requested with do-not-track; provider \"file\" is an uploaded MP4/WebM. Null removes it.","allOf":[{"$ref":"#/components/schemas/PageContentVideoDto"}]}}},"CampaignPageContentCapabilitiesDto":{"type":"object","properties":{"about":{"type":"boolean","description":"The applied template has a public About surface."},"statistics":{"type":"boolean","description":"The applied template renders campaign-authored fact cards."},"coverVideo":{"type":"boolean","description":"The applied template renders the campaign cover video."}},"required":["about","statistics","coverVideo"]},"CampaignPageContentResponseDto":{"type":"object","properties":{"content":{"$ref":"#/components/schemas/CampaignPageContentDto"},"draftUpdatedAt":{"type":"string","format":"date-time"},"capabilities":{"$ref":"#/components/schemas/CampaignPageContentCapabilitiesDto"}},"required":["content","draftUpdatedAt","capabilities"]},"UpdateCampaignPageContentDto":{"type":"object","properties":{"expectedDraftUpdatedAt":{"type":"string","format":"date-time","description":"draftUpdatedAt returned by getCampaignPageContent; stale drafts are rejected."},"content":{"$ref":"#/components/schemas/CampaignPageContentDto"},"deferHeroProjection":{"type":"boolean","description":"On a page without a supported template, save only hero-image selections for a later template without changing its current HTML."},"locale":{"type":"string","enum":["en","he"],"description":"Page language this edit is for. Omitted means the campaign page language. A different language is rejected until the campaign has more than one language."}},"required":["expectedDraftUpdatedAt","content"]},"UpdateCampaignPageContentResponseDto":{"type":"object","properties":{"content":{"$ref":"#/components/schemas/CampaignPageContentDto"},"draftUpdatedAt":{"type":"string","format":"date-time"},"capabilities":{"$ref":"#/components/schemas/CampaignPageContentCapabilitiesDto"},"design":{"$ref":"#/components/schemas/CampaignDesignResponseDto"}},"required":["content","draftUpdatedAt","capabilities","design"]},"CreateAboutTranslationDto":{"type":"object","properties":{"title":{"type":"string","maxLength":300},"body":{"type":"string","maxLength":20000,"description":"Explicit source About document, including unsaved edits. Never saved automatically."},"sourceLanguage":{"type":"string","example":"he"},"targetLanguage":{"type":"string","example":"en"}},"required":["title","body","sourceLanguage","targetLanguage"]},"AboutTranslationResponseDto":{"type":"object","properties":{"jobId":{"type":"string"},"status":{"type":"string","enum":["pending","completed","failed","cancelled","disabled"]},"title":{"type":"string"},"body":{"type":"string"},"reason":{"type":"string","enum":["llm_disabled","rate_limited","failed","unsafe"]}},"required":["jobId","status"]},"InsightsFundraisingCurrencyDto":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency code.","example":"ILS"},"totalRaisedMinor":{"type":"number","description":"Succeeded contributions in the last 12 months, minor units."},"donationCount":{"type":"number","description":"Number of succeeded contributions in the last 12 months."},"medianGiftMinor":{"type":"object","nullable":true,"description":"Median succeeded gift in the last 12 months (minor units). Null when no gifts."}},"required":["currency","totalRaisedMinor","donationCount"]},"InsightsDonorsDto":{"type":"object","properties":{"activeDonorCount":{"type":"number","description":"Donors whose last gift is within the last 12 months."},"lapsedDonorCount":{"type":"number","description":"Donors with at least one gift, none in the last 12 months."},"recurringDonorCount":{"type":"number","description":"Contacts with an active recurring plan."}},"required":["activeDonorCount","lapsedDonorCount","recurringDonorCount"]},"InsightsLastCampaignDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"name":{"type":"string"},"currency":{"type":"string","description":"ISO 4217 currency of the campaign goal."},"goalMinor":{"type":"object","nullable":true,"description":"The campaign goal in minor units (null when no goal was set)."},"raisedMinor":{"type":"number","description":"Succeeded contributions attributed to the campaign, minor units."},"donorCount":{"type":"number","description":"Distinct contributing contacts."},"startDate":{"type":"object","nullable":true,"format":"date"},"endDate":{"type":"object","nullable":true,"format":"date"}},"required":["campaignId","name","currency","raisedMinor","donorCount"]},"InsightsPresenceDto":{"type":"object","properties":{"hasApprovedMedia":{"type":"boolean","description":"Approved media-library assets exist."},"approvedMediaCount":{"type":"number","description":"Count of approved media-library assets."},"hasLogo":{"type":"boolean","description":"An approved logo asset or brand-settings logo URL exists."},"hasHeroImage":{"type":"boolean","description":"At least one approved hero image exists."},"hasBrandColors":{"type":"boolean","description":"Brand colors are configured in organization brand settings."},"hasWebsite":{"type":"boolean","description":"A website URL is configured in organization brand settings."}},"required":["hasApprovedMedia","approvedMediaCount","hasLogo","hasHeroImage","hasBrandColors","hasWebsite"]},"NextCampaignInsightsResponseDto":{"type":"object","properties":{"fundraisingLast12Months":{"description":"Succeeded contributions of the last 12 months grouped per currency (largest total first). Empty when the org has no donation history.","type":"array","items":{"$ref":"#/components/schemas/InsightsFundraisingCurrencyDto"}},"totalDonationCountLast12Months":{"type":"number","description":"Total succeeded contributions across all currencies, last 12 months."},"donors":{"$ref":"#/components/schemas/InsightsDonorsDto"},"lastCampaign":{"nullable":true,"description":"Top-line of the most recent campaign, or null when the org never ran one.","allOf":[{"$ref":"#/components/schemas/InsightsLastCampaignDto"}]},"presence":{"$ref":"#/components/schemas/InsightsPresenceDto"},"computedAt":{"type":"string","format":"date-time"}},"required":["fundraisingLast12Months","totalDonationCountLast12Months","donors","presence","computedAt"]},"LocalizedQuestionDto":{"type":"object","properties":{"he":{"type":"string","description":"Hebrew question text (deterministic template, slots filled)."},"en":{"type":"string","description":"English question text (deterministic template, slots filled)."}},"required":["he","en"]},"DirectionGoalSeedDto":{"type":"object","properties":{"suggestedMinor":{"type":"number","description":"Suggested campaign goal in minor units — always server-derived from real numbers."},"currency":{"type":"string","description":"ISO 4217 currency."},"rationale":{"type":"string","description":"Which computed facts produced this number (honest, human-readable)."}},"required":["suggestedMinor","currency","rationale"]},"CampaignDirectionDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable id used by the strategy-choice endpoint."},"rank":{"type":"number","minimum":1,"maximum":3,"description":"1 = the recommended direction (auto-picked when the client does not choose)."},"label":{"description":"Short direction name, he+en.","allOf":[{"$ref":"#/components/schemas/LocalizedQuestionDto"}]},"narrativeAngle":{"type":"string","description":"The story/framing of the campaign under this direction — free strategic text."},"reason":{"type":"string","description":"Why this direction, grounded in the org's own numbers (facts digest / Discovery Brief). Knowledge tips may be cited as inspiration; numbers are never invented."},"goalSeed":{"nullable":true,"description":"Data-derived goal seed. Null when the org data is too thin to ground a number honestly.","allOf":[{"$ref":"#/components/schemas/DirectionGoalSeedDto"}]},"capabilityPlan":{"description":"Page/platform capabilities this direction relies on — keys validated against the closed capability registry (packages/shared page-engine).","example":["donate","progress","donation_levels","matchers"],"type":"array","items":{"type":"string"}},"timingHint":{"type":"object","nullable":true,"description":"Timing suggestion grounded in the org’s own campaign history, if any."},"audienceFocus":{"type":"object","nullable":true,"description":"Which audience segment this direction leads with."}},"required":["id","rank","label","narrativeAngle","reason","capabilityPlan"]},"GoalOptionDto":{"type":"object","properties":{"key":{"type":"string","enum":["lower","fits","higher"]},"amountMinor":{"type":"number","description":"Goal amount in minor units."},"currency":{"type":"string","description":"ISO 4217 currency."},"rationale":{"type":"string","description":"The deterministic derivation, quoting the real inputs."}},"required":["key","amountMinor","currency","rationale"]},"GenerateDirectionsResponseDto":{"type":"object","properties":{"directions":{"minItems":3,"maxItems":3,"type":"array","items":{"$ref":"#/components/schemas/CampaignDirectionDto"}},"goalOptions":{"description":"Server-derived goal options (lower / fits / higher) from last-campaign performance bounded by donor capacity. Empty when the data cannot ground a number.","type":"array","items":{"$ref":"#/components/schemas/GoalOptionDto"}},"source":{"type":"string","enum":["llm","deterministic"],"description":"`llm` — the strategy brain composed these directions for this organization, reasoning from fundraising practice at large. `deterministic` — the brain was unavailable and the server fell back to five generic archetypes it can compute without an LLM; that set is an emergency path, NOT the space of campaigns this org could run, and `fallbackNotice` says so in the reader’s language."},"fallbackNotice":{"type":"string","nullable":true,"description":"Localized disclosure to show above the directions when `source` is `deterministic` — states that the strategy advisor was unavailable and that these are generic patterns rather than a plan built for this org. Always null when `source` is `llm`."},"knowledgeReferencesUsed":{"description":"Knowledge document ids that inspired the directions (trusted server-side selection only).","type":"array","items":{"type":"string"}},"generatedAt":{"type":"string","format":"date-time"},"journeyId":{"type":"string","format":"uuid"}},"required":["directions","goalOptions","source","knowledgeReferencesUsed","generatedAt","journeyId"]},"ChooseDirectionDto":{"type":"object","properties":{"directionId":{"type":"string","format":"uuid","description":"The chosen direction id from the generated set. OMIT to auto-pick rank #1 (the locked product shape: the brain’s top direction stands when the client does not choose)."},"goalMinor":{"type":"number","description":"Override goal in minor units. Defaults to the chosen direction’s goalSeed.","minimum":1},"currency":{"type":"string","description":"ISO 4217 currency for the override goal.","example":"ILS"}}},"ChosenDirectionDto":{"type":"object","properties":{"directionId":{"type":"string","format":"uuid"},"goalMinor":{"type":"object","nullable":true,"description":"The decided goal (minor units). Null when neither an override nor a goal seed existed."},"currency":{"type":"object","nullable":true},"decidedAt":{"type":"string","format":"date-time"},"auto":{"type":"boolean","description":"True when rank #1 was auto-picked because the client did not choose."}},"required":["directionId","decidedAt","auto"]},"ChooseDirectionResponseDto":{"type":"object","properties":{"journeyId":{"type":"string","format":"uuid"},"chosen":{"$ref":"#/components/schemas/ChosenDirectionDto"},"direction":{"description":"The full chosen direction (the contract for later production stages).","allOf":[{"$ref":"#/components/schemas/CampaignDirectionDto"}]},"decisionId":{"type":"string","format":"uuid","description":"The StrategyDecision ledger row recorded for this choice."},"phase":{"type":"string","description":"Journey phase after the choice (advanced discovery→strategy when needed)."}},"required":["journeyId","chosen","direction","decisionId","phase"]},"CapabilityConfigurationItemDto":{"type":"object","properties":{"key":{"type":"string","description":"Stable snake_case key for this decision — safe to plan and reason against.","example":"pool_ceiling"},"required":{"type":"boolean","description":"True when the capability cannot be rendered or bound to data without it. False items change how well it works, not whether it works."},"guidance":{"description":"What has to be decided or provided, and why it matters — he + en.","allOf":[{"$ref":"#/components/schemas/LocalizedTextDto"}]}},"required":["key","required","guidance"]},"CapabilityCatalogEntryDto":{"type":"object","properties":{"capability":{"type":"string","description":"Capability id from the shared page-engine registry.","example":"matchers"},"islandTypes":{"description":"The island types that provide this capability (the page-engine building blocks behind it).","example":["matchers_strip"],"type":"array","items":{"type":"string"}},"name":{"description":"Short name a fundraiser would use for it.","allOf":[{"$ref":"#/components/schemas/LocalizedTextDto"}]},"explanation":{"description":"Plain-language explanation a nonprofit manager understands without platform vocabulary — this is the text to teach the concept from.","allOf":[{"$ref":"#/components/schemas/LocalizedTextDto"}]},"configuration":{"description":"What must be decided or provided for this capability to work, required items first. Empty only for capabilities that need no input at all.","type":"array","items":{"$ref":"#/components/schemas/CapabilityConfigurationItemDto"}},"requiresConfiguration":{"type":"boolean","description":"True when at least one configuration item is required — i.e. this capability cannot just be switched on."},"orgSignal":{"nullable":true,"description":"A FACT from this organization’s own data that makes the capability concretely available (e.g. matchers it has already run, approved media it already holds). Every number in it is computed tenant-scoped. Null when the org’s data says nothing — the catalog never argues that a capability is unsuitable, only points at what is already there.","allOf":[{"$ref":"#/components/schemas/LocalizedTextDto"}]}},"required":["capability","islandTypes","name","explanation","configuration","requiresConfiguration"]},"CampaignJourneyCapabilityCatalogResponseDto":{"type":"object","properties":{"capabilities":{"description":"Every capability the page engine can render live, in registry order.","type":"array","items":{"$ref":"#/components/schemas/CapabilityCatalogEntryDto"}},"totalCount":{"type":"number","description":"Count of capabilities returned — always the full registry; the catalog is never filtered down for an organization."}},"required":["capabilities","totalCount"]},"CampaignJourneyPhaseHistoryEntryDto":{"type":"object","properties":{"phase":{"type":"string","enum":["discovery","strategy","blueprint","production","readiness","live","retro"]},"enteredAt":{"type":"string","format":"date-time"},"byUserId":{"type":"object","format":"uuid","nullable":true}},"required":["phase","enteredAt"]},"CreateCampaignJourneyResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"campaignId":{"type":"object","format":"uuid","nullable":true,"description":"The campaign this journey produced. Null while discovery/strategy run before the campaign exists; linked once via PATCH."},"createdByUserId":{"type":"string","format":"uuid"},"phase":{"type":"string","enum":["discovery","strategy","blueprint","production","readiness","live","retro"]},"status":{"type":"string","enum":["active","completed","abandoned"]},"artifacts":{"type":"object","additionalProperties":true,"description":"Per-phase artifacts keyed by phase output (discoveryBrief, directions, chosenDirectionId, strategySummary, blueprint, ...). Patched by shallow merge per top-level key."},"phaseHistory":{"description":"Append-only log of every phase entered, in order.","type":"array","items":{"$ref":"#/components/schemas/CampaignJourneyPhaseHistoryEntryDto"}},"lastInteractionAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"reused":{"type":"boolean","description":"True when an existing active, not-yet-linked journey was returned instead of creating a duplicate."}},"required":["id","organizationId","createdByUserId","phase","status","artifacts","phaseHistory","lastInteractionAt","createdAt","updatedAt","reused"]},"CampaignJourneyResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"campaignId":{"type":"object","format":"uuid","nullable":true,"description":"The campaign this journey produced. Null while discovery/strategy run before the campaign exists; linked once via PATCH."},"createdByUserId":{"type":"string","format":"uuid"},"phase":{"type":"string","enum":["discovery","strategy","blueprint","production","readiness","live","retro"]},"status":{"type":"string","enum":["active","completed","abandoned"]},"artifacts":{"type":"object","additionalProperties":true,"description":"Per-phase artifacts keyed by phase output (discoveryBrief, directions, chosenDirectionId, strategySummary, blueprint, ...). Patched by shallow merge per top-level key."},"phaseHistory":{"description":"Append-only log of every phase entered, in order.","type":"array","items":{"$ref":"#/components/schemas/CampaignJourneyPhaseHistoryEntryDto"}},"lastInteractionAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","createdByUserId","phase","status","artifacts","phaseHistory","lastInteractionAt","createdAt","updatedAt"]},"CampaignJourneysListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/CampaignJourneyResponseDto"}},"totalCount":{"type":"number"}},"required":["rows","totalCount"]},"UpdateCampaignJourneyDto":{"type":"object","properties":{"phase":{"type":"string","enum":["discovery","strategy","blueprint","production","readiness","live","retro"],"description":"Move the journey to this phase. Forward moves advance exactly one step along the ordered phases; backward moves may jump to ANY earlier phase (revisits). Anything else is rejected with `CAMPAIGN_JOURNEY_PHASE_INVALID`."},"status":{"type":"string","enum":["active","completed","abandoned"],"description":"Close the journey: only `active → completed` and `active → abandoned` are allowed (`CAMPAIGN_JOURNEY_STATUS_INVALID` otherwise)."},"campaignId":{"type":"string","format":"uuid","description":"Link the campaign created mid-journey. Settable once: re-linking a different campaign fails with `CAMPAIGN_JOURNEY_ALREADY_LINKED`; the campaign must belong to the active tenant and not already have a journey."},"artifacts":{"type":"object","additionalProperties":true,"description":"Shallow-merged into the stored artifacts per TOP-LEVEL key (never a wholesale replace). Set a key to null to remove it. `blueprint.onboardingProposal` is reserved: use get/save/approveCampaignOnboardingGenerationProposal instead. Patches over 64KB serialized are rejected with `CAMPAIGN_JOURNEY_ARTIFACTS_TOO_LARGE`."}}},"DiscoveryEvidenceFactDto":{"type":"object","properties":{"key":{"type":"string","description":"Stable fact key (e.g. `activeDonorCount`)."},"value":{"description":"The computed value (number, string, or boolean) — straight from tenant data.","oneOf":[{"type":"number"},{"type":"string"},{"type":"boolean"}]},"source":{"type":"string","description":"Which data source produced the fact (table / service)."}},"required":["key","value","source"]},"DiscoveryRecordedAnswerDto":{"type":"object","properties":{"kind":{"type":"string","enum":["confirm","edit","answer"]},"value":{"type":"object","nullable":true,"description":"The verbatim user value. Optional for `confirm` (confirming the inference as-is); required for `edit`/`answer`."},"at":{"type":"string","format":"date-time"}},"required":["kind","at"]},"DiscoveryPlanTopicDto":{"type":"object","properties":{"key":{"type":"string","enum":["purpose_why_now","audience_relationships","anchors_matchers","team_capacity","timing_window","assets_media","constraints_special_needs"]},"order":{"type":"number","description":"Interview order (ascending)."},"required":{"type":"boolean","description":"Whether the Discovery Brief needs this topic resolved."},"status":{"type":"string","enum":["inferred","confirmed","answered","unknown"]},"question":{"description":"The question to put to the user: the filled confirm template when inferred, the open ask template when unknown.","allOf":[{"$ref":"#/components/schemas/LocalizedQuestionDto"}]},"evidence":{"description":"The structured facts the inference is built on (empty when the topic is unknown). NOT persisted into journey artifacts.","type":"array","items":{"$ref":"#/components/schemas/DiscoveryEvidenceFactDto"}},"answer":{"nullable":true,"description":"The answer already recorded in journey artifacts, if any.","allOf":[{"$ref":"#/components/schemas/DiscoveryRecordedAnswerDto"}]},"briefEffect":{"description":"Which Discovery Brief field(s) this topic feeds.","type":"array","items":{"type":"string"}}},"required":["key","order","required","status","question","evidence","briefEffect"]},"DiscoveryPlanResponseDto":{"type":"object","properties":{"journeyId":{"type":"string","format":"uuid"},"topics":{"description":"All topics in interview order.","type":"array","items":{"$ref":"#/components/schemas/DiscoveryPlanTopicDto"}},"inferredCount":{"type":"number","description":"Topics the data answered (awaiting confirmation)."},"resolvedCount":{"type":"number","description":"Topics confirmed or answered by the user."},"unknownCount":{"type":"number","description":"Topics the data could NOT answer and no answer was recorded."}},"required":["journeyId","topics","inferredCount","resolvedCount","unknownCount"]},"RecordDiscoveryAnswerDto":{"type":"object","properties":{"topicKey":{"type":"string","enum":["purpose_why_now","audience_relationships","anchors_matchers","team_capacity","timing_window","assets_media","constraints_special_needs"],"description":"Which topic this answer resolves."},"kind":{"type":"string","enum":["confirm","edit","answer"],"description":"`confirm` accepts the inference as-is (value optional); `edit` corrects it; `answer` answers an open question. `edit`/`answer` require a non-empty value."},"value":{"type":"string","maxLength":4000,"description":"The user value, recorded verbatim (required for `edit`/`answer`)."}},"required":["topicKey","kind"]},"RecordDiscoveryAnswerResponseDto":{"type":"object","properties":{"journeyId":{"type":"string","format":"uuid"},"topicKey":{"type":"string","enum":["purpose_why_now","audience_relationships","anchors_matchers","team_capacity","timing_window","assets_media","constraints_special_needs"]},"answer":{"$ref":"#/components/schemas/DiscoveryRecordedAnswerDto"}},"required":["journeyId","topicKey","answer"]},"RecordDiscoveryFindingInputDto":{"type":"object","properties":{"key":{"type":"string","maxLength":80,"example":"chinese_auction_request"},"label":{"type":"string","maxLength":200},"value":{"type":"string","maxLength":4000}},"required":["key","label","value"]},"CampaignJourneySeedDto":{"type":"object","properties":{"title":{"type":"string","maxLength":280,"description":"Working campaign title / message headline, in the client’s words."},"goalMinor":{"type":"number","minimum":1,"maximum":1000000000000,"description":"Fundraising goal in MINOR units (same convention as `artifacts.strategy.chosen.goalMinor`)."},"currency":{"type":"string","enum":["USD","ILS","CAD","GBP","EUR","AUD","NZD","CHF","SEK","NOK","DKK","ZAR","BRL","MXN","ARS","UAH","RUB","INR","SGD","HKD"],"description":"Supported two-decimal campaign currency."},"timezone":{"type":"string","maxLength":64,"example":"Asia/Jerusalem","description":"The IANA timezone in which the supplied campaign schedule was resolved."},"startDate":{"type":"string","description":"Campaign start as an ISO instant, local date-time, or calendar day."},"endDate":{"type":"string","nullable":true,"description":"Campaign end as an ISO instant, local date-time, or calendar day. Null for an open-ended campaign."}}},"RecordDiscoveryFindingsDto":{"type":"object","properties":{"findings":{"maxItems":20,"description":"Free-form findings to APPEND (never replace) to `artifacts.discovery.findings`.","type":"array","items":{"$ref":"#/components/schemas/RecordDiscoveryFindingInputDto"}},"answers":{"maxItems":7,"description":"Legacy topic-keyed answers written in the SAME batch, so the closed-enum canvas and the free conversation can never race each other.","type":"array","items":{"$ref":"#/components/schemas/RecordDiscoveryAnswerDto"}},"campaignSeed":{"description":"Mechanical-floor fields learned this turn (title / goal / currency / dates), merged into `artifacts.campaignSeed`. Once the floor is complete the campaign is auto-created as a draft and linked.","allOf":[{"$ref":"#/components/schemas/CampaignJourneySeedDto"}]}}},"DiscoveryFindingDto":{"type":"object","properties":{"key":{"type":"string","maxLength":80,"description":"Brain-chosen slug (e.g. `chinese_auction_request`). NOT constrained to a closed enum."},"label":{"type":"string","maxLength":200,"description":"Short human title for the finding, for display on the canvas."},"value":{"type":"string","maxLength":4000,"description":"The client’s words, VERBATIM. Never a paraphrase."},"at":{"type":"string","format":"date-time"}},"required":["key","label","value","at"]},"CampaignJourneyAutosaveDto":{"type":"object","properties":{"campaignId":{"type":"object","format":"uuid","nullable":true,"description":"The linked campaign — freshly created, already linked, or null while the floor is incomplete."},"campaignCreated":{"type":"boolean","description":"True only when THIS request created the campaign."},"floorMet":{"type":"boolean","description":"True when the mechanical floor (title + goal + currency + start date) is satisfied."},"missingFloorFields":{"type":"array","description":"Floor fields still missing. Empty once `floorMet` is true.","items":{"type":"string","enum":["title","goalMinor","currency","startDate"]}}},"required":["campaignCreated","floorMet","missingFloorFields"]},"RecordDiscoveryFindingsResponseDto":{"type":"object","properties":{"journeyId":{"type":"string","format":"uuid"},"recordedFindings":{"description":"The findings appended by THIS request, with their server timestamps.","type":"array","items":{"$ref":"#/components/schemas/DiscoveryFindingDto"}},"findingsCount":{"type":"number","description":"Total findings on the journey after this write."},"recordedAnswerTopicKeys":{"type":"array","description":"Topic keys whose answers were written in the same batch.","items":{"type":"string","enum":["purpose_why_now","audience_relationships","anchors_matchers","team_capacity","timing_window","assets_media","constraints_special_needs"]}},"autosave":{"description":"Whether the mechanical floor is met and what happened to the campaign row.","allOf":[{"$ref":"#/components/schemas/CampaignJourneyAutosaveDto"}]}},"required":["journeyId","recordedFindings","findingsCount","recordedAnswerTopicKeys","autosave"]},"DiscoveryBriefTextDto":{"type":"object","properties":{"text":{"type":"string"},"source":{"type":"string","enum":["answer","confirmed_inference","unconfirmed_inference"]}},"required":["text","source"]},"DiscoveryBriefAudienceDto":{"type":"object","properties":{"activeDonorCount":{"type":"number"},"lapsedDonorCount":{"type":"number","description":"Donors whose last gift is older than 12 months."},"recurringDonorCount":{"type":"number"},"innerCircleCount":{"type":"number"},"activeCommunityCount":{"type":"number"},"knownPeopleCount":{"type":"number"},"note":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/DiscoveryBriefTextDto"}]}},"required":["activeDonorCount","lapsedDonorCount","recurringDonorCount","innerCircleCount","activeCommunityCount","knownPeopleCount"]},"DiscoveryBriefAnchorsDto":{"type":"object","properties":{"pastMatcherCount":{"type":"number","description":"Matcher rows on the org’s past campaigns."},"campaignsWithMatchers":{"type":"number"},"avgCoefficient":{"type":"object","nullable":true,"description":"Average matcher coefficient across past campaigns."},"plan":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/DiscoveryBriefTextDto"}]}},"required":["pastMatcherCount","campaignsWithMatchers"]},"DiscoveryBriefTeamDto":{"type":"object","properties":{"pastAmbassadorCount":{"type":"number","description":"Distinct ambassadors across the org’s past campaigns."},"campaignsWithAmbassadors":{"type":"number"},"note":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/DiscoveryBriefTextDto"}]}},"required":["pastAmbassadorCount","campaignsWithAmbassadors"]},"DiscoveryBriefTimingDto":{"type":"object","properties":{"typicalDurationDays":{"type":"object","nullable":true,"description":"Typical past campaign duration (days)."},"lastCampaignStartDate":{"type":"object","nullable":true,"format":"date"},"preference":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/DiscoveryBriefTextDto"}]}}},"DiscoveryBriefAssetsDto":{"type":"object","properties":{"logoCount":{"type":"number"},"heroCount":{"type":"number"},"galleryCount":{"type":"number"},"approvedCount":{"type":"number"},"note":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/DiscoveryBriefTextDto"}]}},"required":["logoCount","heroCount","galleryCount","approvedCount"]},"StoryProfileFieldDto":{"type":"object","properties":{"value":{"type":"string"},"status":{"type":"string","enum":["inferred","confirmed"]},"source":{"type":"string","enum":["extraction","math","derived","user"]}},"required":["value","status","source"]},"CampaignStoryProfileDto":{"type":"object","properties":{"crowdShape":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/StoryProfileFieldDto"}]},"whyNow":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/StoryProfileFieldDto"}]},"protagonist":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/StoryProfileFieldDto"}]},"audienceWarmth":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/StoryProfileFieldDto"}]},"donorExchange":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/StoryProfileFieldDto"}]},"emotionalRegister":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/StoryProfileFieldDto"}]},"gapFields":{"type":"array","items":{"type":"string","enum":["audienceWarmth","donorExchange"]}},"confirmedAt":{"type":"string","format":"date-time","nullable":true}},"required":["gapFields"]},"DiscoveryBriefDto":{"type":"object","properties":{"purpose":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/DiscoveryBriefTextDto"}]},"whyNow":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/DiscoveryBriefTextDto"}]},"audienceSummary":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/DiscoveryBriefAudienceDto"}]},"anchorsPlan":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/DiscoveryBriefAnchorsDto"}]},"teamCapacity":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/DiscoveryBriefTeamDto"}]},"timingWindow":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/DiscoveryBriefTimingDto"}]},"assetsSummary":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/DiscoveryBriefAssetsDto"}]},"storyProfile":{"nullable":true,"description":"The story profile shared verbatim with self-serve campaign onboarding.","allOf":[{"$ref":"#/components/schemas/CampaignStoryProfileDto"}]},"specialNeeds":{"description":"Special requests / constraints, recorded VERBATIM for the capability-mapping stage.","type":"array","items":{"type":"string"}},"findings":{"description":"Every free-form finding the brain recorded, in the order recorded, VERBATIM. These do NOT map onto the 7 legacy topics — a request like \"we want a Chinese auction\" reaches the brief through here instead of vanishing.","type":"array","items":{"$ref":"#/components/schemas/DiscoveryFindingDto"}},"dataGaps":{"description":"Topics still unknown — honest gaps, never papered over.","type":"array","items":{"type":"string"}},"compiledAt":{"type":"string","format":"date-time"}},"required":["specialNeeds","findings","dataGaps","compiledAt"]},"CompileDiscoveryBriefResponseDto":{"type":"object","properties":{"journeyId":{"type":"string","format":"uuid"},"brief":{"$ref":"#/components/schemas/DiscoveryBriefDto"}},"required":["journeyId","brief"]},"CampaignJourneyOutlineGoalInputDto":{"type":"object","properties":{"key":{"type":"string","maxLength":80,"example":"anchor_matcher_plan"},"label":{"type":"string","maxLength":200,"description":"Required when declaring a new goal."},"why":{"type":"string","maxLength":1000,"description":"Required when declaring a new goal."},"content":{"type":"string","maxLength":4000,"description":"The plan for this component. Supplying non-empty content flips `status` to `filled` unless `status` is given explicitly."},"status":{"type":"string","enum":["open","filled"],"description":"Override the derived status (e.g. re-open a goal the brain wants to revisit)."}},"required":["key"]},"UpdateCampaignJourneyOutlineDto":{"type":"object","properties":{"goals":{"maxItems":20,"description":"Goals to declare or update, upserted by `key`. Unmentioned goals are preserved.","type":"array","items":{"$ref":"#/components/schemas/CampaignJourneyOutlineGoalInputDto"}}},"required":["goals"]},"CampaignJourneyOutlineGoalDto":{"type":"object","properties":{"key":{"type":"string","maxLength":80,"example":"anchor_matcher_plan","description":"Brain-chosen slug. NOT constrained to a closed enum — it is the brain’s own component."},"label":{"type":"string","maxLength":200,"description":"Short human title for the canvas."},"why":{"type":"string","maxLength":1000,"description":"Why the brain decided this campaign needs this component."},"status":{"type":"string","enum":["open","filled"]},"content":{"type":"string","maxLength":4000,"nullable":true,"description":"The filled-in plan for this component, in the brain’s words. Absent while `status` is `open`."},"declaredAt":{"type":"string","format":"date-time","description":"When this goal was first declared."},"updatedAt":{"type":"string","format":"date-time","description":"When this goal was last changed."}},"required":["key","label","why","status","declaredAt","updatedAt"]},"CampaignJourneyOutlineSelfCritiqueDto":{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"missing":{"description":"What the brain itself judged is still missing from the plan. May be empty.","type":"array","items":{"type":"string"}},"rationale":{"type":"string","maxLength":2000}},"required":["at","missing","rationale"]},"CampaignJourneyOutlineDto":{"type":"object","properties":{"goals":{"type":"array","items":{"$ref":"#/components/schemas/CampaignJourneyOutlineGoalDto"}},"selfCritique":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/CampaignJourneyOutlineSelfCritiqueDto"}]},"declaredReadyAt":{"type":"string","format":"date-time","nullable":true,"description":"When the brain declared the outline ready (only ever set once the mechanical floor was met)."}},"required":["goals"]},"CampaignJourneyOutlineResponseDto":{"type":"object","properties":{"journeyId":{"type":"string","format":"uuid"},"outline":{"$ref":"#/components/schemas/CampaignJourneyOutlineDto"},"declaredGoalKeys":{"description":"Keys declared for the first time by THIS request.","type":"array","items":{"type":"string"}},"updatedGoalKeys":{"description":"Keys of existing goals updated by THIS request.","type":"array","items":{"type":"string"}}},"required":["journeyId","outline","declaredGoalKeys","updatedGoalKeys"]},"AssessCampaignJourneyOutlineReadinessDto":{"type":"object","properties":{"missing":{"maxItems":20,"description":"The brain’s OWN answer to \"what is missing from this plan for me to stand behind it?\". Empty means it found nothing missing.","type":"array","items":{"type":"string"}},"rationale":{"type":"string","maxLength":2000,"description":"Why the brain reached that verdict. Recorded verbatim and shown to the client."},"declareReady":{"type":"boolean","description":"True when the brain declares the outline ready. Refused with `CAMPAIGN_JOURNEY_OUTLINE_FLOOR_INCOMPLETE` if the mechanical floor is not satisfied; ALLOWED (and reported) when the brain’s own goals are still open."}},"required":["missing","rationale","declareReady"]},"CampaignJourneyOutlineOpenGoalDto":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"why":{"type":"string"}},"required":["key","label","why"]},"CampaignJourneyOutlineReadinessResponseDto":{"type":"object","properties":{"journeyId":{"type":"string","format":"uuid"},"floorMet":{"type":"boolean","description":"The MECHANICAL floor only — title/message, goal, currency, start date. The server checks nothing else."},"missingFloorFields":{"type":"array","description":"Exactly which mechanical fields are still missing. Empty when `floorMet`.","items":{"type":"string","enum":["title","goalMinor","currency","startDate"]}},"openGoals":{"description":"The brain’s OWN goals still marked `open`. Never a blocker — reported so the client can see what was never covered.","type":"array","items":{"$ref":"#/components/schemas/CampaignJourneyOutlineOpenGoalDto"}},"selfCritique":{"description":"The self-critique recorded by this call.","allOf":[{"$ref":"#/components/schemas/CampaignJourneyOutlineSelfCritiqueDto"}]},"declaredReady":{"type":"boolean","description":"True when this call declared the outline ready and the declaration was accepted."},"declaredReadyAt":{"type":"object","format":"date-time","nullable":true,"description":"When readiness was declared (persisted on the artifact). Null while never declared."},"mayProceed":{"type":"boolean","description":"Whether the journey may move on to the blueprint phase: the floor is met AND the brain declared ready."}},"required":["journeyId","floorMet","missingFloorFields","openGoals","selfCritique","declaredReady","mayProceed"]},"CampaignWizardBillingDto":{"type":"object","properties":{"enabledBillingTypes":{"type":"array","description":"Billing modes the donation page offers (`one_time`, `recurring` = monthly, `installments`). An empty list is a blocker (BILLING_TYPES_REQUIRED).","items":{"type":"string","enum":["one_time","installments","recurring"]}},"defaultBillingType":{"type":"string","enum":["one_time","installments","recurring"],"description":"The pre-selected billing mode. Must be one of the offered modes (BILLING_DEFAULT_NOT_ENABLED otherwise)."}}},"CampaignWizardNameDto":{"type":"object","properties":{"value":{"type":"string","maxLength":280,"description":"The campaign name (not the organization name)."}}},"CampaignWizardGoalDto":{"type":"object","properties":{"amountMinor":{"type":"number","minimum":0,"maximum":1000000000000,"description":"Goal in MINOR units. No currency conversion is ever applied."},"currency":{"type":"string","enum":["USD","ILS","CAD","GBP","EUR","AUD","NZD","CHF","SEK","NOK","DKK","ZAR","BRL","MXN","ARS","UAH","RUB","INR","SGD","HKD"]}}},"CampaignWizardDatesDto":{"type":"object","properties":{"startDate":{"type":"string","description":"Start as an ISO instant, local date-time or calendar day."},"endDate":{"type":"string","description":"End as an ISO instant, local date-time or calendar day."},"noEndDate":{"type":"boolean","description":"The user explicitly chose \"no end date\". `endDate` is then ignored."},"acceptDonationsUntil":{"type":"string","description":"Last moment donations are accepted (ISO)."}}},"CampaignWizardDonationButtonDetailDto":{"type":"object","properties":{"title":{"type":"string","maxLength":120,"description":"Optional title shown on this donation button."},"imageAssetKey":{"type":"string","maxLength":512,"description":"Media library asset key of the image shown on this donation button."},"imagePublicUrl":{"type":"string","maxLength":2048,"description":"Preview URL of the image (display only)."}}},"CampaignWizardDonationButtonsDto":{"type":"object","properties":{"amountsMinor":{"description":"Donation button amounts in MINOR units. Replaces the previous list.","type":"array","items":{"type":"number"}},"details":{"description":"Optional title and image per button, aligned by index with `amountsMinor`. Replacing `amountsMinor` without `details` clears the old details.","type":"array","items":{"$ref":"#/components/schemas/CampaignWizardDonationButtonDetailDto"}},"skipped":{"type":"boolean","description":"The user explicitly chose to set the donation buttons up later (no buttons yet)."}}},"CampaignWizardAboutDto":{"type":"object","properties":{"text":{"type":"string","maxLength":4000},"html":{"type":"string","maxLength":20000,"description":"The rich About document (HTML from the editor). Sanitized on the server; Finish publishes it as the campaign About copy."},"skipped":{"type":"boolean","description":"The user explicitly chose to skip the about text for now."}}},"CampaignWizardBannersDto":{"type":"object","properties":{"decided":{"type":"boolean","description":"The user made an explicit banners decision (including \"none\")."},"heroAssetId":{"type":"string","nullable":true,"format":"uuid","maxLength":80,"description":"Selected hero/cover media asset id. The server approves it when attached to page content."},"heroAssetKey":{"type":"string","nullable":true,"maxLength":512},"heroPublicUrl":{"type":"string","nullable":true,"maxLength":2048},"videoUrl":{"type":"string","maxLength":2048,"description":"Optional campaign video (https YouTube/Vimeo link). Empty string clears it."},"shareAssetId":{"type":"string","nullable":true,"format":"uuid","maxLength":80,"description":"Selected share/OG media asset id."},"shareAssetKey":{"type":"string","nullable":true,"maxLength":512},"sharePublicUrl":{"type":"string","nullable":true,"maxLength":2048},"placements":{"maxItems":8,"description":"Chosen banner placements. Replaces the previous list.","type":"array","items":{"type":"string"}}}},"CampaignWizardGroupsDto":{"type":"object","properties":{"decided":{"type":"boolean","description":"The user made an explicit groups decision (including \"no groups\")."},"enabled":{"type":"boolean"},"names":{"maxItems":8,"description":"Fundraising group names. Replaces the previous list.","type":"array","items":{"type":"string"}}}},"CampaignWizardBlockerDto":{"type":"object","properties":{"step":{"type":"string","enum":["name","dates","about","banners","donation_buttons","groups","summary"]},"code":{"type":"string","enum":["NAME_REQUIRED","NAME_TOO_LONG","GOAL_AMOUNT_REQUIRED","GOAL_CURRENCY_REQUIRED","START_DATE_REQUIRED","START_DATE_INVALID","END_DATE_REQUIRED","END_DATE_INVALID","END_BEFORE_START","DONATION_WINDOW_INVALID","DONATION_WINDOW_BEFORE_END","DONATION_BUTTONS_REQUIRED","DONATION_BUTTONS_DUPLICATE","ABOUT_REQUIRED","ABOUT_TOO_LONG","BANNERS_UNDECIDED","BANNERS_VIDEO_INVALID","GROUPS_UNDECIDED","BILLING_TYPES_REQUIRED","BILLING_DEFAULT_NOT_ENABLED","SUMMARY_STEP_INCOMPLETE"]},"ref":{"type":"string","enum":["name","dates","about","banners","donation_buttons","groups","summary"],"description":"For SUMMARY_STEP_INCOMPLETE: the earlier step that still blocks the summary."}},"required":["step","code"]},"CampaignWizardStepProgressDto":{"type":"object","properties":{"step":{"type":"string","enum":["name","dates","about","banners","donation_buttons","groups","summary"]},"complete":{"type":"boolean"},"blockers":{"type":"array","items":{"$ref":"#/components/schemas/CampaignWizardBlockerDto"}}},"required":["step","complete","blockers"]},"CampaignWizardProgressDto":{"type":"object","properties":{"steps":{"type":"array","items":{"$ref":"#/components/schemas/CampaignWizardStepProgressDto"}},"firstIncompleteStep":{"type":"string","enum":["name","dates","about","banners","donation_buttons","groups","summary"],"nullable":true,"description":"First step that still has blockers; null when every step is complete."},"canFinish":{"type":"boolean","description":"True when the summary has no blockers."}},"required":["steps","firstIncompleteStep","canFinish"]},"CampaignWizardStateResponseDto":{"type":"object","properties":{"journeyId":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid","nullable":true,"description":"The draft campaign this wizard belongs to, when already linked."},"version":{"type":"number","example":1},"currentStep":{"type":"string","enum":["name","dates","about","banners","donation_buttons","groups","summary"]},"variant":{"type":"string","enum":["campaign","donation_page"],"description":"What this wizard builds. Absent = `campaign`. `donation_page` runs only the steps name > banners > summary (see progress.steps)."},"billing":{"$ref":"#/components/schemas/CampaignWizardBillingDto"},"pageBuildRequested":{"type":"boolean","description":"A plan-approved campaign page build has been queued."},"name":{"$ref":"#/components/schemas/CampaignWizardNameDto"},"goal":{"$ref":"#/components/schemas/CampaignWizardGoalDto"},"dates":{"$ref":"#/components/schemas/CampaignWizardDatesDto"},"donationButtons":{"$ref":"#/components/schemas/CampaignWizardDonationButtonsDto"},"about":{"$ref":"#/components/schemas/CampaignWizardAboutDto"},"banners":{"$ref":"#/components/schemas/CampaignWizardBannersDto"},"groups":{"$ref":"#/components/schemas/CampaignWizardGroupsDto"},"progress":{"description":"Computed server-side from the shared step registry.","allOf":[{"$ref":"#/components/schemas/CampaignWizardProgressDto"}]}},"required":["journeyId","version","currentStep","progress"]},"UpdateCampaignWizardStateDto":{"type":"object","properties":{"currentStep":{"type":"string","enum":["name","dates","about","banners","donation_buttons","groups","summary"],"description":"The step the user is currently on. The name and goal share the single `name` step; the legacy value `goal` is still accepted and read as `name`."},"name":{"$ref":"#/components/schemas/CampaignWizardNameDto"},"goal":{"$ref":"#/components/schemas/CampaignWizardGoalDto"},"dates":{"$ref":"#/components/schemas/CampaignWizardDatesDto"},"donationButtons":{"$ref":"#/components/schemas/CampaignWizardDonationButtonsDto"},"about":{"$ref":"#/components/schemas/CampaignWizardAboutDto"},"banners":{"$ref":"#/components/schemas/CampaignWizardBannersDto"},"groups":{"$ref":"#/components/schemas/CampaignWizardGroupsDto"},"billing":{"description":"Donation-page wizard only; rejected (CAMPAIGN_WIZARD_FIELD_NOT_IN_VARIANT) on a campaign wizard.","allOf":[{"$ref":"#/components/schemas/CampaignWizardBillingDto"}]}}},"FinishCampaignWizardDto":{"type":"object","properties":{"timezone":{"type":"string","example":"Asia/Jerusalem","maxLength":64},"locale":{"type":"string","example":"he","maxLength":16}},"required":["timezone"]},"FinishCampaignWizardResponseDto":{"type":"object","properties":{"state":{"$ref":"#/components/schemas/CampaignWizardStateResponseDto"},"pageGenerationStatus":{"type":"string","enum":["pending","ready"]},"accepted":{"type":"boolean","description":"True only when the approved page build was accepted by the server."}},"required":["state","pageGenerationStatus","accepted"]},"PageSpecCapabilityInputDto":{"type":"object","properties":{"capability":{"type":"string","description":"Capability id from the page-engine registry.","example":"matchers"},"configuration":{"type":"object","additionalProperties":true,"description":"Configuration decisions for this capability, merged key-by-key into whatever was already decided. Keys must be the capability’s catalog configuration keys; a key set to `null` deletes that decision. After the merge every REQUIRED key must be present, else `CAMPAIGN_JOURNEY_PAGE_SPEC_CONFIG_INCOMPLETE` names the capability and the missing keys."},"note":{"type":"string","maxLength":1000},"remove":{"type":"boolean","description":"Explicitly drop this capability from the spec. Required to remove one: a PATCH that simply omits a capability NEVER drops it."}},"required":["capability"]},"PageSpecMessageInputDto":{"type":"object","properties":{"clientWords":{"type":"string","maxLength":4000,"description":"The client’s own words. Stored verbatim (trimmed of surrounding whitespace only)."},"headline":{"type":"string","maxLength":280}}},"PageSpecDonationTierInputDto":{"type":"object","properties":{"amountMinor":{"type":"number","minimum":1,"maximum":1000000000000},"currency":{"type":"string"},"title":{"type":"string","maxLength":200},"subtitle":{"type":"object","maxLength":400,"nullable":true},"recurring":{"type":"boolean"},"recurringMonths":{"type":"number","minimum":1,"maximum":120},"stockQuantity":{"type":"number","minimum":1,"maximum":1000000},"colorHex":{"type":"string","description":"Accent colour `#rrggbb`."}},"required":["amountMinor","title"]},"UpdateCampaignJourneyPageSpecDto":{"type":"object","properties":{"capabilities":{"maxItems":20,"description":"Capabilities to choose or re-configure, upserted by `capability`. Capabilities NOT mentioned are preserved untouched; removing one requires `remove: true`.","type":"array","items":{"$ref":"#/components/schemas/PageSpecCapabilityInputDto"}},"message":{"$ref":"#/components/schemas/PageSpecMessageInputDto"},"specialRequests":{"maxItems":10,"description":"Special requests to APPEND, stored verbatim. Existing entries are never rewritten or removed.","type":"array","items":{"type":"string"}},"donationTiers":{"description":"The giving ladder, as an ORDERED whole: supplying it replaces any previously specified ladder (a ladder is one decision, not a set of independent rows). Omit to leave the current ladder alone; an empty array explicitly chooses no donation buttons; use `clearDonationTiers` to go back to the automatic ladder.","type":"array","items":{"$ref":"#/components/schemas/PageSpecDonationTierInputDto"}},"clearDonationTiers":{"type":"boolean","description":"Explicitly drop the spec’s ladder and go back to the automatic goal-derived one. Cannot be combined with `donationTiers`."}}},"PageSpecCapabilityDto":{"type":"object","properties":{"capability":{"type":"string","description":"Capability id from the shared page-engine registry (as returned by getCampaignJourneyCapabilityCatalog).","example":"matchers"},"configuration":{"type":"object","additionalProperties":{"type":"string"},"description":"The configuration decided for this capability, keyed by the catalog’s configuration keys. Every REQUIRED key of the capability is present — the spec cannot store a capability that could not be wired to real data.","example":{"coefficient":"2 (allowed 1.5–3)","pool_ceiling":"5000000","label":"משפחה מירושלים","currency":"ILS"}},"note":{"type":"string","maxLength":1000,"nullable":true,"description":"Free-text note about this choice, in the brain’s words (why it is here, how it should feel)."},"chosenAt":{"type":"string","format":"date-time","description":"When this capability was first chosen."},"updatedAt":{"type":"string","format":"date-time"}},"required":["capability","configuration","chosenAt","updatedAt"]},"PageSpecMessageDto":{"type":"object","properties":{"clientWords":{"type":"string","maxLength":4000,"description":"The campaign’s message in the CLIENT’s own words, stored verbatim. Never authored server-side."},"headline":{"type":"string","maxLength":280,"nullable":true,"description":"A headline the brain proposed for the page. Optional — the client’s words are what the page must carry."},"recordedAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["clientWords","recordedAt","updatedAt"]},"PageSpecSpecialRequestDto":{"type":"object","properties":{"text":{"type":"string","maxLength":1000},"at":{"type":"string","format":"date-time"}},"required":["text","at"]},"PageSpecDonationTierDto":{"type":"object","properties":{"amountMinor":{"type":"number","minimum":1,"maximum":1000000000000,"description":"Tier amount in MINOR units (₪180 is 18000)."},"currency":{"type":"string","nullable":true,"description":"ISO-4217 alpha-3 code. Defaults to the campaign’s currency when omitted."},"title":{"type":"string","maxLength":200,"description":"Tier title, stored verbatim."},"subtitle":{"type":"object","maxLength":400,"nullable":true},"recurring":{"type":"boolean","description":"True for a recurring commitment tier."},"recurringMonths":{"type":"number","minimum":1,"maximum":120,"nullable":true,"description":"Months of a recurring commitment (defaults to 12 when `recurring` is set without it)."},"stockQuantity":{"type":"number","minimum":1,"maximum":1000000,"nullable":true,"description":"Real stock for this tier. When set, the tier is capped HARD: once consumed it renders sold out and cannot be given through."},"colorHex":{"type":"string","nullable":true,"description":"Accent colour `#rrggbb`. Falls back to the brand-derived palette."}},"required":["amountMinor","title"]},"CampaignJourneyPageSpecDto":{"type":"object","properties":{"capabilities":{"description":"The live capabilities agreed for this page, in the order they were chosen.","type":"array","items":{"$ref":"#/components/schemas/PageSpecCapabilityDto"}},"message":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/PageSpecMessageDto"}]},"specialRequests":{"description":"Append-only, verbatim.","type":"array","items":{"$ref":"#/components/schemas/PageSpecSpecialRequestDto"}},"donationTiers":{"nullable":true,"description":"The giving ladder the plan defined. When present it WINS over the automatic goal-derived ladder; when absent the automatic ladder is seeded as before.","type":"array","items":{"$ref":"#/components/schemas/PageSpecDonationTierDto"}},"updatedAt":{"type":"string","format":"date-time"}},"required":["capabilities","specialRequests","updatedAt"]},"PageSpecGapDto":{"type":"object","properties":{"kind":{"type":"string","enum":["message","capability_configuration"]},"capability":{"type":"string","nullable":true,"description":"The capability at fault, for `capability_configuration`."},"missingKeys":{"description":"The REQUIRED configuration keys still missing for that capability.","type":"array","items":{"type":"string"}}},"required":["kind"]},"CampaignJourneyPageSpecResponseDto":{"type":"object","properties":{"journeyId":{"type":"string","format":"uuid"},"pageSpec":{"$ref":"#/components/schemas/CampaignJourneyPageSpecDto"},"chosenCapabilities":{"description":"Capabilities chosen for the first time by THIS request.","type":"array","items":{"type":"string"}},"updatedCapabilities":{"description":"Already-chosen capabilities re-configured by THIS request.","type":"array","items":{"type":"string"}},"removedCapabilities":{"description":"Capabilities dropped by THIS request — only ever via an explicit `remove: true`.","type":"array","items":{"type":"string"}},"appendedSpecialRequests":{"type":"number","description":"How many special requests this request appended."},"donationTiersSource":{"type":"string","enum":["spec","automatic"],"description":"`spec` when the plan’s own ladder will be used, `automatic` when the goal-derived ladder still applies."},"phase":{"type":"string","enum":["discovery","strategy","blueprint","production","readiness","live","retro"],"description":"The journey phase after this write."},"readyToBuild":{"type":"boolean","description":"True when buildCampaignJourneyPage would accept this spec as it stands."},"gaps":{"description":"Exactly what still blocks a build. Empty when `readyToBuild`.","type":"array","items":{"$ref":"#/components/schemas/PageSpecGapDto"}}},"required":["journeyId","pageSpec","chosenCapabilities","updatedCapabilities","removedCapabilities","appendedSpecialRequests","donationTiersSource","phase","readyToBuild","gaps"]},"BuildCampaignJourneyPageDto":{"type":"object","properties":{"rebuild":{"type":"boolean","description":"Stated intent to overwrite a page that already exists. Without it, a second build over a ready or published design is REFUSED with `CAMPAIGN_PAGE_ALREADY_BUILT` — generation overwrites `draft_settings` wholesale and would destroy refine edits."},"tone":{"type":"string","description":"Optional tone/style hint. Defaults to the platform tone for the locale."},"locale":{"type":"string","description":"Optional primary locale (\"he\", \"en\"). Defaults to the organization’s locale."}}},"BuildCampaignJourneyPageResponseDto":{"type":"object","properties":{"journeyId":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid","description":"The campaign the page is being built for (linked to the journey)."},"accepted":{"type":"boolean","description":"True when the generation job was enqueued. False means the enqueue failed; safe to retry."},"pageGenerationStatus":{"type":"string","enum":["pending","ready"]},"requiredCapabilities":{"description":"The capability set carried to the worker as `requiredCapabilities` — the spec’s chosen capabilities, plus the `donate` floor a campaign page cannot exist without.","type":"array","items":{"type":"string"}},"donationTiersSource":{"type":"string","enum":["spec","automatic"],"description":"`spec` when the plan’s ladder was written to the campaign, `automatic` when the goal-derived ladder was seeded."},"donationTiersApplied":{"type":"number","description":"How many donation levels this build wrote (0 when tiers already existed and the spec defined none)."},"rebuild":{"type":"boolean","description":"True when this build overwrote an existing page under an explicit `rebuild`."},"phase":{"type":"string","enum":["discovery","strategy","blueprint","production","readiness","live","retro"],"description":"The journey phase after the build (advanced to `production` on success)."}},"required":["journeyId","campaignId","accepted","pageGenerationStatus","requiredCapabilities","donationTiersSource","donationTiersApplied","rebuild","phase"]},"CopyPackArtifactDto":{"type":"object","properties":{"templateIds":{"description":"Draft CommunicationTemplate ids, in piece order.","type":"array","items":{"type":"string"}},"generatedAt":{"type":"string","format":"date-time"},"source":{"type":"string","enum":["llm"],"description":"Always `llm` — there is deliberately NO deterministic fallback that fakes creativity; a failed run errors honestly instead."},"locale":{"type":"string","enum":["en","he"]},"promptVersion":{"type":"string","description":"Prompt version used (provenance for the learning loop)."}},"required":["templateIds","generatedAt","source","locale","promptVersion"]},"CopyPackPieceDto":{"type":"object","properties":{"pieceKey":{"type":"string","enum":["email_announcement","email_reminder","email_thank_you","whatsapp_short","sms_short"]},"templateId":{"type":"string","format":"uuid","description":"The draft CommunicationTemplate holding this piece."},"channel":{"type":"string","enum":["email","sms","whatsapp"]},"locale":{"type":"string","enum":["en","he"]},"category":{"type":"string","enum":["transactional","marketing","ambassador","system"]},"subject":{"type":"object","nullable":true,"description":"Subject with merge tags un-rendered (email pieces only; null for sms/whatsapp)."},"body":{"type":"string","description":"Body with merge tags un-rendered (Handlebars)."}},"required":["pieceKey","templateId","channel","locale","category","subject","body"]},"GenerateCopyPackResponseDto":{"type":"object","properties":{"journeyId":{"type":"string","format":"uuid"},"copyPack":{"$ref":"#/components/schemas/CopyPackArtifactDto"},"pieces":{"description":"The 5 generated pieces, saved as inactive draft templates.","type":"array","items":{"$ref":"#/components/schemas/CopyPackPieceDto"}}},"required":["journeyId","copyPack","pieces"]},"PageEngineCapabilitiesResponseDto":{"type":"object","properties":{"islandTag":{"type":"string","description":"The custom element tag used for functional islands."},"requiredCapabilities":{"description":"Capabilities every published page must include.","type":"array","items":{"type":"string"}},"islands":{"type":"array","items":{"type":"object","additionalProperties":true},"description":"One entry per island type: type, capability, DOM contract, and props JSON Schema."},"binding":{"type":"object","additionalProperties":true,"description":"The declarative data-binding contract (Design Engine v2.2): the vocabulary an agent uses to author its OWN markup/CSS for the donate button, progress bar, donor wall, levels and ambassadors and bind live values into it, instead of a platform-styled <charidy-island>. Includes `attrs` (data-charidy-* names), `formats`, `scalars[]` (bindable campaign values + the capability each satisfies), `repeatSources[]` (live lists + their item fields), `examples`, and authoring `guidance`."},"componentLibrary":{"type":"object","additionalProperties":true,"description":"The campaign component library: platform-styled `cl-*`/`clb-*` building blocks whose CSS is injected at render time for any page that references a library class. Includes `components[]` (id, variant, whenToUse, a full markup `recipe` with the live data-charidy-* binds pre-wired, and the {{SLOT}} placeholders to fill), the `accentContract` and `personalityAxes` token contracts a page wrapper may re-point, and `mandatoryGroups[]` — the elements every library-built page must include."}},"required":["islandTag","requiredCapabilities","islands","binding","componentLibrary"]},"CampaignStyleCatalogOptionDto":{"type":"object","properties":{"id":{"type":"string","description":"Option id — send this as `styleValue.option`."},"labelKey":{"type":"string","description":"i18n key suffix for this option's label. Never display copy."},"declarations":{"type":"object","additionalProperties":{"type":"string"},"description":"The exact declarations this option emits, `cssProperty -> value`. More than one when the intent needs a pair (a surface role sets background and ink together)."}},"required":["id","labelKey","declarations"]},"CampaignStyleCatalogEntryDto":{"type":"object","properties":{"id":{"type":"string","description":"Catalog property id, passed as `property` on setCampaignNodeOverride."},"kind":{"type":"string","enum":["fluid","enum","layered","color"],"description":"`fluid` — a number in a range, sent as `styleValue.value`. `enum` — one choice from `options`, sent as `styleValue.option`. The fields below are populated per kind; a discrete control has no range and a continuous one has no options."},"pageLevel":{"type":"boolean","description":"True when this control belongs on the page wrapper only."},"css":{"type":"string","description":"fluid only. The CSS property the server emits. Always LOGICAL (padding-inline, never padding-left)."},"options":{"description":"enum only. The choices this control offers, each with the exact declarations it emits — published rather than hidden so an agent can reason about the page instead of guessing from an option name.","type":"array","items":{"$ref":"#/components/schemas/CampaignStyleCatalogOptionDto"}},"appliesTo":{"type":"array","description":"Which kinds of node this control can act on: `container` (anything with element children), `text` (a text-bearing leaf, including a button), `image` (an `<img>`). A control is listed only where it can genuinely DO something — typography is absent for an image because nothing there moves a pixel of a bitmap, and the child-layout controls are container-only because a leaf has no children to space. Read it before offering a control to a user or setting one as an agent: writing a control outside its surfaces is still ACCEPTED (a page may already carry such a value), it simply has no effect.","items":{"type":"string","enum":["container","text","image"]}},"group":{"type":"string","description":"Panel group this control is filed under."},"labelKey":{"type":"string","description":"i18n key suffix for the label. Never display copy — the client resolves it."},"min":{"type":"number","description":"fluid only. Smallest desktop value accepted, in px. Below this is REJECTED, not clamped."},"max":{"type":"number","description":"fluid only. Largest desktop value accepted, in px. Above this is REJECTED, not clamped."},"step":{"type":"number","description":"Suggested editor increment for a fluid control."},"mobileMax":{"type":"number","description":"fluid only. Ceiling on the phone value, in px. The server derives the phone value from the desktop one, and an explicit `mobile` is capped here — so opening the mobile toggle moves the value inside the phone budget but never past it."},"unit":{"type":"string","enum":["px","rem","%","ch","svh","em","ms","deg",""],"description":"fluid only. The unit the BOUNDS above are expressed in — what a slider should display. NOT necessarily the unit the stylesheet emits: a padding is bounded in px and emitted in rem, because the UI speaks pixels and the rem conversion is the server's business. When a control declares its own unit (a measure in `ch`, a height in `svh`, a unitless line-height) bounds and output share it."},"supportsMobileOverride":{"type":"boolean","description":"fluid only. False when this control cannot carry a separate phone value: its unit does not interpolate, so a phone value is not expressible without a media query the engine does not emit. Clients should hide the \"mobile adjustment\" affordance rather than offer a switch whose write is refused with `CAMPAIGN_NODE_STYLE_INVALID`."}},"required":["id","kind","appliesTo","group","labelKey"]},"CampaignStyleCatalogResponseDto":{"type":"object","properties":{"properties":{"type":"array","items":{"$ref":"#/components/schemas/CampaignStyleCatalogEntryDto"}}},"required":["properties"]},"CampaignPageTemplateSectionDto":{"type":"object","properties":{"key":{"type":"string"},"recipe":{"type":"string"},"modifiers":{"type":"array","items":{"type":"string"}},"required":{"type":"boolean"}},"required":["key","recipe","modifiers","required"]},"CampaignPageTemplateDto":{"type":"object","properties":{"id":{"type":"string","enum":["general","bold","subtle","network","donation"]},"title":{"type":"string"},"summary":{"type":"string"},"whenToUse":{"type":"string","description":"AI-facing guidance for choosing this composition."},"sections":{"type":"array","items":{"$ref":"#/components/schemas/CampaignPageTemplateSectionDto"}},"previewImage":{"type":"string","nullable":true,"format":"uri"}},"required":["id","title","summary","whenToUse","sections"]},"CampaignPageTemplateCatalogDto":{"type":"object","properties":{"version":{"type":"number","minimum":1},"templates":{"type":"array","items":{"$ref":"#/components/schemas/CampaignPageTemplateDto"}}},"required":["version","templates"]},"PersonaKitLocalizedTextDto":{"type":"object","properties":{"en":{"type":"string"},"he":{"type":"string"}},"required":["en","he"]},"CampaignPersonaKitPaletteDto":{"type":"object","properties":{"templateGround":{"type":"string","nullable":true},"templateInk":{"type":"string","nullable":true},"templatePrimary":{"type":"string","nullable":true},"templateHighlight":{"type":"string","nullable":true},"templateSecondary":{"type":"string","nullable":true},"templatePaper":{"type":"string","nullable":true},"templateMarquee":{"type":"string","nullable":true}}},"CampaignPersonaKitTypographyDto":{"type":"object","properties":{"fontWeight":{"type":"number","nullable":true},"letterSpacing":{"type":"number","nullable":true},"fontSize":{"type":"number","nullable":true}}},"CampaignPersonaKitSectionActionDto":{"type":"object","properties":{"key":{"type":"string"},"action":{"type":"string","enum":["hide","move-up","move-down","swap-variant"]},"variant":{"type":"string","nullable":true}},"required":["key","action"]},"CampaignPersonaKitLevelSeedDto":{"type":"object","properties":{"amountMinor":{"type":"number","format":"int64"},"currency":{"type":"string"},"title":{"$ref":"#/components/schemas/PersonaKitLocalizedTextDto"},"impact":{"$ref":"#/components/schemas/PersonaKitLocalizedTextDto"}},"required":["amountMinor","currency","title","impact"]},"CampaignPersonaKitTeamSeedDto":{"type":"object","properties":{"name":{"$ref":"#/components/schemas/PersonaKitLocalizedTextDto"},"slug":{"type":"string"},"level":{"type":"number","minimum":1}},"required":["name","slug","level"]},"CampaignPersonaKitMatcherSeedDto":{"type":"object","properties":{"label":{"$ref":"#/components/schemas/PersonaKitLocalizedTextDto"},"name":{"$ref":"#/components/schemas/PersonaKitLocalizedTextDto"},"coefficient":{"type":"string"},"maxPoolMinor":{"type":"number","format":"int64"},"currency":{"type":"string"}},"required":["label","name","coefficient","maxPoolMinor","currency"]},"CampaignPersonaKitSeedsDto":{"type":"object","properties":{"levels":{"type":"array","items":{"$ref":"#/components/schemas/CampaignPersonaKitLevelSeedDto"}},"teams":{"nullable":true,"type":"array","items":{"$ref":"#/components/schemas/CampaignPersonaKitTeamSeedDto"}},"matcher":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/CampaignPersonaKitMatcherSeedDto"}]},"endInHours":{"type":"number","nullable":true,"minimum":1},"recurring":{"type":"boolean"}},"required":["levels","recurring"]},"CampaignPersonaKitDto":{"type":"object","properties":{"id":{"type":"string","enum":["giving-day-urgent","school-giving-day","personal-rescue","emergency-relief","bright-futures"]},"version":{"type":"number","minimum":1},"title":{"$ref":"#/components/schemas/PersonaKitLocalizedTextDto"},"whenToUse":{"$ref":"#/components/schemas/PersonaKitLocalizedTextDto"},"imageryNote":{"$ref":"#/components/schemas/PersonaKitLocalizedTextDto"},"templateId":{"type":"string","enum":["general","bold","subtle","network","donation"]},"tokens":{"$ref":"#/components/schemas/CampaignPersonaKitPaletteDto"},"fallbackPrimary":{"type":"string","nullable":true},"preferKitPrimary":{"type":"boolean","default":false},"typography":{"$ref":"#/components/schemas/CampaignPersonaKitTypographyDto"},"sections":{"type":"array","items":{"$ref":"#/components/schemas/CampaignPersonaKitSectionActionDto"}},"copy":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/PersonaKitLocalizedTextDto"}},"seeds":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/CampaignPersonaKitSeedsDto"}]}},"required":["id","version","title","whenToUse","imageryNote","templateId","tokens","preferKitPrimary","typography","sections","copy"]},"CampaignPersonaKitCatalogDto":{"type":"object","properties":{"version":{"type":"number","minimum":1},"kits":{"type":"array","items":{"$ref":"#/components/schemas/CampaignPersonaKitDto"}}},"required":["version","kits"]},"DonationLevelTranslationDto":{"type":"object","properties":{"locale":{"type":"string","example":"he"},"title":{"type":"string","nullable":true},"subtitle":{"type":"string","nullable":true},"amountMinor":{"type":"number","format":"int64","nullable":true},"currency":{"type":"string","nullable":true}},"required":["locale"]},"CreateDonationLevelDto":{"type":"object","properties":{"slug":{"type":"string","description":"Auto-derived from default_title when omitted."},"displayOrder":{"type":"number","description":"Defaults to last+1 when omitted."},"isVisible":{"type":"boolean"},"defaultTitle":{"type":"string","maxLength":280},"defaultSubtitle":{"type":"string","nullable":true},"defaultAmountMinor":{"type":"number","format":"int64","description":"Amount in minor units."},"defaultCurrency":{"type":"string","description":"ISO-4217 alpha-3 (uppercase)."},"capMode":{"type":"string","enum":["unlimited","hard","soft"]},"capQuantity":{"type":"number","nullable":true},"colorHex":{"type":"string","description":"Hex color string starting with # (6 hex chars)."},"imageAssetKey":{"type":"string","description":"S3 asset key per MASTER §7."},"matchKeywords":{"type":"array","items":{"type":"string"}},"isRecurring":{"type":"boolean"},"recurringFrequency":{"type":"string","enum":["monthly","quarterly","yearly"],"nullable":true},"recurringMonths":{"type":"number","nullable":true},"translations":{"type":"array","items":{"$ref":"#/components/schemas/DonationLevelTranslationDto"}}},"required":["defaultTitle","defaultAmountMinor","defaultCurrency"]},"DonationLevelTranslationResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"locale":{"type":"string"},"title":{"type":"string","nullable":true},"subtitle":{"type":"string","nullable":true},"amountMinor":{"type":"number","format":"int64","nullable":true},"currency":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","locale","createdAt","updatedAt"]},"DonationLevelResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"slug":{"type":"string"},"displayOrder":{"type":"number"},"isVisible":{"type":"boolean"},"defaultTitle":{"type":"string"},"defaultSubtitle":{"type":"string","nullable":true},"defaultAmountMinor":{"type":"number","format":"int64"},"defaultCurrency":{"type":"string"},"capMode":{"type":"string","enum":["unlimited","hard","soft"]},"capQuantity":{"type":"number","nullable":true},"capConsumed":{"type":"number"},"colorHex":{"type":"string","nullable":true},"imageAssetKey":{"type":"string","nullable":true},"matchKeywords":{"type":"array","items":{"type":"string"}},"isRecurring":{"type":"boolean"},"recurringFrequency":{"type":"string","enum":["monthly","quarterly","yearly"],"nullable":true},"recurringMonths":{"type":"number","nullable":true},"translations":{"type":"array","items":{"$ref":"#/components/schemas/DonationLevelTranslationResponseDto"}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","campaignId","slug","displayOrder","isVisible","defaultTitle","defaultAmountMinor","defaultCurrency","capMode","capConsumed","matchKeywords","isRecurring","translations","createdAt","updatedAt"]},"DonationLevelsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/DonationLevelResponseDto"}},"totalCount":{"type":"number"}},"required":["rows","totalCount"]},"UpdateDonationLevelDto":{"type":"object","properties":{"slug":{"type":"string"},"isVisible":{"type":"boolean"},"defaultTitle":{"type":"string"},"defaultSubtitle":{"type":"string","nullable":true},"defaultAmountMinor":{"type":"number","format":"int64"},"defaultCurrency":{"type":"string"},"capMode":{"type":"string","enum":["unlimited","hard","soft"]},"capQuantity":{"type":"number","nullable":true},"colorHex":{"type":"string","nullable":true},"imageAssetKey":{"type":"string","nullable":true},"matchKeywords":{"type":"array","items":{"type":"string"}},"isRecurring":{"type":"boolean"},"recurringFrequency":{"type":"string","enum":["monthly","quarterly","yearly"],"nullable":true},"recurringMonths":{"type":"number","nullable":true}}},"BulkDeleteDonationLevelsDto":{"type":"object","properties":{"levelIds":{"minItems":1,"maxItems":100,"description":"Active donation-level ids to soft-delete atomically.","type":"array","items":{"type":"string","format":"uuid"}}},"required":["levelIds"]},"SetDonationLevelVisibilityDto":{"type":"object","properties":{"isVisible":{"type":"boolean"}},"required":["isVisible"]},"ReorderDonationLevelsDto":{"type":"object","properties":{"orderedLevelIds":{"description":"Full ordered list of level ids; partial orderings rejected.","type":"array","items":{"type":"string"}}},"required":["orderedLevelIds"]},"DonationLevelsBulkResponseDto":{"type":"object","properties":{"levels":{"type":"array","items":{"$ref":"#/components/schemas/DonationLevelResponseDto"}}},"required":["levels"]},"BulkCreateDonationLevelsDto":{"type":"object","properties":{"levels":{"type":"array","items":{"$ref":"#/components/schemas/CreateDonationLevelDto"}}},"required":["levels"]},"CopyDonationLevelsDto":{"type":"object","properties":{"sourceCampaignId":{"type":"string","format":"uuid"},"levelIds":{"type":"array","items":{"type":"string"}},"resetCaps":{"type":"boolean"},"resetVisibility":{"type":"boolean"}},"required":["sourceCampaignId"]},"DonationLevelsCopyResponseDto":{"type":"object","properties":{"levels":{"type":"array","items":{"$ref":"#/components/schemas/DonationLevelResponseDto"}},"copiedCount":{"type":"number"}},"required":["levels","copiedCount"]},"UpsertDonationLevelTranslationDto":{"type":"object","properties":{"title":{"type":"string","nullable":true},"subtitle":{"type":"string","nullable":true},"amountMinor":{"type":"number","format":"int64","nullable":true},"currency":{"type":"string","nullable":true}}},"ReserveDonationLevelSlotDto":{"type":"object","properties":{"reservationId":{"type":"string","description":"Optional client-side reservation id (UUID). Auto-generated if absent."},"ttlSeconds":{"type":"number","description":"Hold duration in seconds. Defaults to 600 (10 min)."}}},"DonationLevelHoldResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"levelId":{"type":"string","format":"uuid"},"reservationId":{"type":"string"},"expiresAt":{"type":"string","format":"date-time"}},"required":["id","levelId","reservationId","expiresAt"]},"CampaignMatcherResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"label":{"type":"string"},"name":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"avatarAssetKey":{"type":"string","nullable":true},"logoAssetKey":{"type":"string","nullable":true},"isFeatured":{"type":"boolean"},"orderSequence":{"type":"number"},"coefficient":{"type":"string"},"coefficientMin":{"type":"string"},"coefficientMax":{"type":"string"},"startsAt":{"type":"string","format":"date-time","nullable":true},"endsAt":{"type":"string","format":"date-time","nullable":true},"maxPoolMinor":{"type":"number","format":"int64","nullable":true},"consumedPoolMinor":{"type":"number","format":"int64"},"currency":{"type":"string"},"status":{"type":"string","enum":["scheduled","active","exhausted","expired"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","campaignId","label","name","description","avatarAssetKey","logoAssetKey","isFeatured","orderSequence","coefficient","coefficientMin","coefficientMax","maxPoolMinor","consumedPoolMinor","currency","status","createdAt","updatedAt"]},"CampaignMatchersListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/CampaignMatcherResponseDto"}},"totalCount":{"type":"number"}},"required":["rows","totalCount"]},"CreateCampaignMatcherDto":{"type":"object","properties":{"label":{"type":"string","maxLength":120},"name":{"type":"string","maxLength":120,"description":"Public matcher or sponsor name."},"description":{"type":"string","maxLength":2000},"coefficient":{"type":"string","example":"2.0000"},"coefficientMin":{"type":"string","example":"1.0000"},"coefficientMax":{"type":"string","example":"5.0000"},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"},"maxPoolMinor":{"type":"number","format":"int64"},"currency":{"type":"string","description":"ISO-4217 alpha-3 (uppercase)."},"logoAssetKey":{"type":"string","nullable":true,"maxLength":500,"description":"Media-library asset key for the matcher logo shown on the campaign page."}},"required":["label","coefficient","coefficientMin","coefficientMax","currency"]},"UpdateCampaignMatcherDto":{"type":"object","properties":{"label":{"type":"string","maxLength":120},"name":{"type":"object","maxLength":120,"nullable":true},"description":{"type":"object","maxLength":2000,"nullable":true},"startsAt":{"type":"string","format":"date-time","nullable":true},"endsAt":{"type":"string","format":"date-time","nullable":true},"maxPoolMinor":{"type":"number","format":"int64","nullable":true},"logoAssetKey":{"type":"string","nullable":true,"maxLength":500,"description":"Media-library asset key for the matcher logo shown on the campaign page."}}},"SetMatcherCoefficientDto":{"type":"object","properties":{"coefficient":{"type":"string"}},"required":["coefficient"]},"SetCampaignMatcherFeaturedDto":{"type":"object","properties":{"isFeatured":{"type":"boolean"}},"required":["isFeatured"]},"CampaignStreamResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"object","nullable":true},"imageAssetKey":{"type":"object","nullable":true},"goalAmountMinor":{"type":"string","nullable":true},"currency":{"type":"string"},"colorHex":{"type":"object","nullable":true},"orderSequence":{"type":"number","minimum":0},"isDefault":{"type":"boolean"},"showOnPage":{"type":"boolean"},"showOnCheckout":{"type":"boolean"},"raisedAmountMinor":{"type":"string"},"contributionCount":{"type":"number","minimum":0},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"object","format":"date-time","nullable":true}},"required":["id","organizationId","campaignId","title","currency","orderSequence","isDefault","showOnPage","showOnCheckout","raisedAmountMinor","contributionCount","createdAt","updatedAt"]},"CampaignStreamsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/CampaignStreamResponseDto"}},"totalCount":{"type":"number","minimum":0}},"required":["rows","totalCount"]},"CreateCampaignStreamDto":{"type":"object","properties":{"title":{"type":"string","maxLength":280},"description":{"type":"object","maxLength":2000},"imageAssetKey":{"type":"object","description":"S3 asset key for the stream image (200x200 recommended)."},"goalAmountMinor":{"type":"string","format":"int64","description":"Optional goal in minor units for this stream."},"currency":{"type":"string","example":"USD"},"colorHex":{"type":"object","example":"#3B82F6","description":"Hex color (e.g. #3B82F6)."},"orderSequence":{"type":"number","description":"Display order. When omitted the stream is appended."},"isDefault":{"type":"boolean","description":"Mark as the campaign default stream. At most one default per campaign."},"showOnPage":{"type":"boolean","description":"Show on the public campaign page."},"showOnCheckout":{"type":"boolean","description":"Show on the donor checkout step."}},"required":["title","currency"]},"UpdateCampaignStreamDto":{"type":"object","properties":{"title":{"type":"string","maxLength":280},"description":{"type":"object","maxLength":2000,"nullable":true},"imageAssetKey":{"type":"object","nullable":true},"goalAmountMinor":{"type":"string","nullable":true},"currency":{"type":"string"},"colorHex":{"type":"object","nullable":true},"showOnPage":{"type":"boolean"},"showOnCheckout":{"type":"boolean"}}},"ReorderCampaignStreamsDto":{"type":"object","properties":{"orderedStreamIds":{"description":"Stream IDs in the new desired order. All visible streams must appear.","type":"array","items":{"type":"string"}}},"required":["orderedStreamIds"]},"CampaignTeamAncestorDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"customSlug":{"type":"string"},"levelId":{"type":"string","format":"uuid","nullable":true}},"required":["id","name","customSlug"]},"CampaignTeamResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"parentTeamId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string"},"customSlug":{"type":"string"},"avatarAssetKey":{"type":"string","nullable":true},"goalAmountMinor":{"type":"string","nullable":true},"bonusGoalAmountMinor":{"type":"string","nullable":true},"donorGoalCount":{"type":"number","nullable":true},"internalGoalMinor":{"type":"string","nullable":true},"displayOrder":{"type":"number","nullable":true},"externalId":{"type":"string","nullable":true},"currency":{"type":"string"},"currencyRate":{"type":"string"},"donorThankYouText":{"type":"string","nullable":true},"hideGoal":{"type":"boolean"},"noGoal":{"type":"boolean"},"isFeatured":{"type":"boolean"},"pinnedDonationIds":{"type":"array","items":{"type":"string"}},"raisedAmountMinor":{"type":"string"},"contributionCount":{"type":"number","minimum":0},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"object","format":"date-time","nullable":true},"levelId":{"type":"string","format":"uuid","nullable":true,"description":"Level tag; NULL = no level. Always present so a client can group by level."},"contactId":{"type":"string","format":"uuid","nullable":true,"description":"The CRM contact behind this node (decision ה-2)."},"contactDisplayName":{"type":"string","nullable":true,"description":"The linked contact's display name, resolved server-side (`contacts.display_name`). NULL when the node has no contact, or the contact was deleted/merged away. Exists so a caller never needs a second round-trip — and never needs the legacy `leaderName` text column — just to render who is behind a node."},"globalUserId":{"type":"string","format":"uuid","nullable":true,"description":"Set when the node was created by a logged-in user (self-signup)."},"status":{"type":"string","enum":["pending","approved","suspended","archived"]},"isHidden":{"type":"boolean","description":"Decision ה-11 — hidden from public lists, still counted upward."},"shareUrl":{"type":"string","nullable":true},"locale":{"type":"string"},"ancestors":{"description":"Ancestor breadcrumb, ROOT-FIRST, excluding this node. Populated by getCampaignTeam; omitted from list rows (use parentTeamId + levelId to build the tree client-side).","type":"array","items":{"$ref":"#/components/schemas/CampaignTeamAncestorDto"}}},"required":["id","organizationId","campaignId","name","customSlug","currency","currencyRate","hideGoal","noGoal","isFeatured","pinnedDonationIds","raisedAmountMinor","contributionCount","createdAt","updatedAt","status","isHidden","locale"]},"CampaignTeamsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/CampaignTeamResponseDto"}},"totalCount":{"type":"number","minimum":0}},"required":["rows","totalCount"]},"CampaignTeamContactInputDto":{"type":"object","properties":{"contactId":{"type":"string","format":"uuid","nullable":true,"description":"Link this existing CRM contact. Mutually exclusive with email/name — when set, no dedup or create happens."},"email":{"type":"string","format":"email","nullable":true,"description":"Dedup key. An existing live contact with this email in the org is linked, not duplicated."},"name":{"type":"string","maxLength":280,"nullable":true,"description":"Full name, used only when a new contact has to be created."},"phoneE164":{"type":"string","maxLength":32,"nullable":true}}},"CreateCampaignTeamDto":{"type":"object","properties":{"name":{"type":"string","maxLength":280},"customSlug":{"type":"string","maxLength":80,"example":"class-3a","description":"URL slug (unique per campaign)."},"parentTeamId":{"type":"string","format":"uuid","nullable":true},"avatarAssetKey":{"type":"string","nullable":true},"goalAmountMinor":{"type":"string","nullable":true},"bonusGoalAmountMinor":{"type":"string","nullable":true},"donorGoalCount":{"type":"string","nullable":true,"description":"How many donors this team aims to bring. Whole number. Null clears it."},"internalGoalMinor":{"type":"string","nullable":true,"description":"Internal goal in minor units. Not shown on the public page. Null clears it."},"displayOrder":{"type":"string","nullable":true,"description":"Staff sort order. Whole number. Null clears it."},"externalId":{"type":"string","nullable":true,"maxLength":80,"description":"Identifier from another system. Null clears it."},"currency":{"type":"string","example":"USD"},"currencyRate":{"type":"string","example":"1.0","description":"Static FX rate locked at team creation (relative to the campaign currency). Defaults to 1 when omitted."},"donorThankYouText":{"type":"string","maxLength":4000,"nullable":true},"hideGoal":{"type":"boolean","description":"When true, hide absolute monetary target (show progress percentage only)."},"noGoal":{"type":"boolean","description":"When true, the team has no goal at all."},"isFeatured":{"type":"boolean"},"levelId":{"type":"string","format":"uuid","nullable":true,"description":"Level tag from this campaign's level scheme (see getCampaignTeamLevels). NULL = \"no level\" — a node may sit directly under the campaign; the level is a display/competition label, not a cage (decision ה-3)."},"isHidden":{"type":"boolean","description":"Decision ה-11: hide from every public list, leaderboard and donation picker. Reachable only by direct link. Its money STILL rolls up to ancestors — hidden never means uncounted."},"status":{"type":"string","enum":["pending","approved","suspended","archived"],"description":"Defaults to approved for a staff-created node."},"contact":{"description":"Create-or-link the CRM contact behind this node (decision ה-2, dedup by email).","allOf":[{"$ref":"#/components/schemas/CampaignTeamContactInputDto"}]}},"required":["name","customSlug","currency"]},"CampaignTeamDonorViaDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"]},"CampaignTeamDonorEntryDto":{"type":"object","properties":{"contributionId":{"type":"string","format":"uuid"},"teamId":{"type":"object","format":"uuid","nullable":true},"contactId":{"type":"string","format":"uuid"},"amountMinor":{"type":"string","description":"This team's SHARE of the contribution in minor units, not the full donation amount — the two differ when the donation was split (decision ה-5/ה-6)."},"currency":{"type":"string"},"status":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"teamName":{"type":"string","nullable":true},"via":{"description":"The \"via\" chain (decision ה-12): the path from the team being queried DOWN to the node the donation was actually attributed to, exclusive of the queried node. Empty when the donation landed on the queried node itself.","type":"array","items":{"$ref":"#/components/schemas/CampaignTeamDonorViaDto"}},"isShared":{"type":"boolean","description":"Decision ה-6: true when this ONE donation was split across several teams. The UI shows the full donation amount with a \"shared\" marker, while the amount COUNTED toward progress is this row's share."},"sharedTeamCount":{"type":"number","minimum":1,"description":"How many teams this donation was split across (1 = not shared)."},"sharedWith":{"description":"Decision ה-6: the OTHER nodes this donation was split with, so a client can name them on hover/tap instead of only showing a count. Excludes the row's own node. Admin surface — unlike the public one, this includes hidden and not-yet-approved partners, because staff are entitled to see them. Empty when the donation was not shared.","type":"array","items":{"$ref":"#/components/schemas/CampaignTeamDonorViaDto"}},"contributionAmountMinor":{"type":"string","description":"The FULL contribution amount in minor units, before the split."},"shareBps":{"type":"number","minimum":0,"maximum":10000,"description":"This team's share in basis points of 10000 (10000 = the whole donation)."}},"required":["contributionId","teamId","contactId","amountMinor","currency","status","createdAt","via","isShared","sharedTeamCount","sharedWith","contributionAmountMinor","shareBps"]},"CampaignTeamDonorsResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/CampaignTeamDonorEntryDto"}},"totalCount":{"type":"number","minimum":0}},"required":["rows","totalCount"]},"UpdateCampaignTeamDto":{"type":"object","properties":{"name":{"type":"string","maxLength":280},"customSlug":{"type":"string","maxLength":80},"parentTeamId":{"type":"string","format":"uuid","nullable":true},"avatarAssetKey":{"type":"string","nullable":true},"goalAmountMinor":{"type":"string","nullable":true},"bonusGoalAmountMinor":{"type":"string","nullable":true},"donorGoalCount":{"type":"string","nullable":true},"internalGoalMinor":{"type":"string","nullable":true},"displayOrder":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true,"maxLength":80},"donorThankYouText":{"type":"string","nullable":true},"hideGoal":{"type":"boolean"},"noGoal":{"type":"boolean"},"isFeatured":{"type":"boolean"},"levelId":{"type":"string","format":"uuid","nullable":true},"isHidden":{"type":"boolean","description":"Decision ה-11 — see CreateCampaignTeamDto.isHidden."},"status":{"type":"string","enum":["pending","approved","suspended","archived"],"description":"Approve / suspend / archive a node. This PATCH is the ONLY way to change status — there are deliberately no approve/suspend/archive sub-endpoints (§5.1). Emits team.status_changed alongside team.updated."},"contactId":{"type":"string","format":"uuid","nullable":true,"description":"Re-link (or unlink, with null) the CRM contact behind this node."}}},"PinDonationDto":{"type":"object","properties":{"donationId":{"type":"string","format":"uuid"}},"required":["donationId"]},"CampaignTeamLevelDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"rank":{"type":"number","minimum":1,"description":"1 = top of the hierarchy. The HIGHEST rank is the bottom, self-signup level (decision ה-8)."},"label":{"type":"string"},"teamCount":{"type":"number","minimum":0,"description":"How many live nodes currently sit on this level."}},"required":["id","rank","label","teamCount"]},"CampaignTeamLevelsResponseDto":{"type":"object","properties":{"levels":{"description":"Ordered by rank ascending.","type":"array","items":{"$ref":"#/components/schemas/CampaignTeamLevelDto"}}},"required":["levels"]},"SetCampaignTeamLevelInputDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Existing level to keep. When set, this row keeps its id (and the teams on it) and only its rank and label change. Omit it to add a level."},"rank":{"type":"number","minimum":1,"maximum":10},"label":{"type":"string","maxLength":120,"example":"Grade"}},"required":["rank","label"]},"SetCampaignTeamLevelsDto":{"type":"object","properties":{"levels":{"description":"The complete, ordered level scheme. Ranks must be unique. An empty array clears the scheme (allowed only when no live node references a level).","type":"array","items":{"$ref":"#/components/schemas/SetCampaignTeamLevelInputDto"}}},"required":["levels"]},"CampaignTeamSettingsResponseDto":{"type":"object","properties":{"multiTeamDonationEnabled":{"type":"boolean","description":"Decision ה-5. When on, a donor may pick several nodes at checkout and the gift is split equally between them (largest-remainder). The donor never types per-node amounts. OFF by default."},"signupAutoApprove":{"type":"boolean","description":"Decision ה-9. When on, a public self-signup node is born `approved` instead of `pending`, so a signup goes live without staff review. OFF by default."}},"required":["multiTeamDonationEnabled","signupAutoApprove"]},"UpdateCampaignTeamSettingsDto":{"type":"object","properties":{"multiTeamDonationEnabled":{"type":"boolean","description":"Decision ה-5 — allow a donor to split one gift across several nodes."},"signupAutoApprove":{"type":"boolean","description":"Decision ה-9 — public self-signups go live without staff approval."}}},"CampaignUpdateResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"title":{"type":"string"},"bodyRich":{"type":"object","additionalProperties":true},"publishedAt":{"type":"object","format":"date-time","nullable":true},"authorId":{"type":"object","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","campaignId","title","bodyRich","createdAt","updatedAt"]},"CampaignUpdatesListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/CampaignUpdateResponseDto"}},"totalCount":{"type":"number","minimum":0}},"required":["rows","totalCount"]},"CreateCampaignUpdateDto":{"type":"object","properties":{"title":{"type":"string","maxLength":280},"bodyRich":{"type":"object","additionalProperties":true,"description":"Rich text body (TipTap / ProseMirror JSON)."},"publishNow":{"type":"boolean","description":"Publish immediately if true."}},"required":["title","bodyRich"]},"UpdateCampaignUpdateDto":{"type":"object","properties":{"title":{"type":"string","maxLength":280},"bodyRich":{"type":"object","additionalProperties":true}}},"CampaignEmailTemplateResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"templateKey":{"type":"string","enum":["donation_confirmation","receipt_email","team_created","share_invite","matcher_update","team_leader_alert"]},"isEnabled":{"type":"boolean"},"subject":{"type":"object","nullable":true},"bodyHtml":{"type":"object","nullable":true},"bodyText":{"type":"object","nullable":true},"customCss":{"type":"object","nullable":true},"mergeTagsSchema":{"type":"object","additionalProperties":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","campaignId","templateKey","isEnabled","mergeTagsSchema","createdAt","updatedAt"]},"CampaignEmailTemplatesListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/CampaignEmailTemplateResponseDto"}}},"required":["rows"]},"UpsertCampaignEmailTemplateDto":{"type":"object","properties":{"templateKey":{"type":"string","enum":["donation_confirmation","receipt_email","team_created","share_invite","matcher_update","team_leader_alert"]},"isEnabled":{"type":"boolean","description":"Whether this campaign override is active."},"subject":{"type":"object","maxLength":280},"bodyHtml":{"type":"object","description":"HTML body. Variables interpolated via Handlebars-style {{var}}."},"bodyText":{"type":"object","description":"Plain-text fallback body."},"customCss":{"type":"object","description":"Optional CSS injected into the email head."},"mergeTagsSchema":{"type":"object","additionalProperties":true,"description":"Schema describing the merge tags expected by this template."}},"required":["templateKey"]},"ReceiptArchiveFilterDto":{"type":"object","properties":{"fromDate":{"type":"string","format":"date-time"},"toDate":{"type":"string","format":"date-time"},"statuses":{"description":"Filter by contribution status (defaults to succeeded only).","type":"array","items":{"type":"string"}}}},"CreateReceiptArchiveJobDto":{"type":"object","properties":{"filter":{"$ref":"#/components/schemas/ReceiptArchiveFilterDto"},"notificationEmail":{"type":"string","format":"email","description":"Email to notify when the archive is ready (signed URL)."}},"required":["notificationEmail"]},"ReceiptArchiveJobAcceptedDto":{"type":"object","properties":{"jobId":{"type":"string","format":"uuid"},"message":{"type":"string","example":"Receipts generation may take several minutes — we'll email you when it's ready."},"status":{"type":"string","enum":["queued","running","succeeded","failed","expired"]}},"required":["jobId","message","status"]},"ReceiptArchiveJobResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["queued","running","succeeded","failed","expired"]},"filter":{"type":"object","additionalProperties":true},"archiveAssetKey":{"type":"object","nullable":true},"archiveSizeBytes":{"type":"string","nullable":true},"receiptCount":{"type":"object","minimum":0,"nullable":true},"signedUrlExpiresAt":{"type":"object","format":"date-time","nullable":true},"errorMessage":{"type":"object","nullable":true},"retryCount":{"type":"number","minimum":0},"requestedById":{"type":"string","format":"uuid"},"notificationEmail":{"type":"string","format":"email"},"createdAt":{"type":"string","format":"date-time"},"startedAt":{"type":"object","format":"date-time","nullable":true},"completedAt":{"type":"object","format":"date-time","nullable":true}},"required":["id","organizationId","campaignId","status","filter","retryCount","requestedById","notificationEmail","createdAt"]},"ReceiptArchiveJobsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/ReceiptArchiveJobResponseDto"}},"totalCount":{"type":"number","minimum":0}},"required":["rows","totalCount"]},"ReceiptArchiveDownloadUrlDto":{"type":"object","properties":{"signedUrl":{"type":"string","format":"uri"},"expiresAt":{"type":"string","format":"date-time"}},"required":["signedUrl","expiresAt"]},"PublicRootSlugResolutionDto":{"type":"object","properties":{"found":{"type":"boolean","description":"False when nothing on the platform answers on this word, live or historical — render a 404."},"kind":{"type":"string","enum":["campaign","organization"],"nullable":true,"description":"What holds the word. `campaign` renders the campaign page; `organization` is the tenant's own root address and behaves as it did before. Null when `found` is false."},"campaignSlug":{"type":"string","nullable":true,"description":"The campaign's CURRENT slug — different from the one requested when the answer came from release history. Null unless kind is `campaign`."},"orgSlug":{"type":"string","nullable":true,"description":"The owning organization slug. Not part of the public address any more; returned for analytics and for building a legacy link when one is still needed."},"moved":{"type":"boolean","description":"True when the word was resolved from release history rather than a live holder. The caller should permanently redirect to the current address, so search engines consolidate on one URL."}},"required":["found","campaignSlug","orgSlug","moved"]},"PublicCampaignContactDto":{"type":"object","properties":{"email":{"type":"string","nullable":true,"description":"Public contact email from the organization profile, or null when not set."},"phone":{"type":"string","nullable":true,"description":"Public contact phone from the organization profile, or null when not set."}}},"PublicCampaignOrganizationDto":{"type":"object","properties":{"name":{"type":"string","description":"Public display name of the organization (brand name, else its legal name). Shown in the platform header chrome."},"logoUrl":{"type":"string","nullable":true,"description":"Public URL of the organization logo when it has an APPROVED logo media asset, else null (never an unapproved or external URL)."}},"required":["name"]},"PublicConnectedProviderDto":{"type":"object","properties":{"provider":{"type":"string","description":"Provider identifier: crowded | stripe | meshulam (Grow).","example":"meshulam"},"capabilities":{"description":"Donor-facing capabilities for this provider: \"card\" and/or \"wallet\".","example":["card","wallet"],"type":"array","items":{"type":"string"}},"currencies":{"description":"CHAR-70: ISO-4217 currencies this connected account can actually charge, derived from the account row (never the org default, which describes reporting rather than settlement). A currency absent from every connected provider is not offered to the donor at all.","example":["ILS"],"type":"array","items":{"type":"string"}}},"required":["provider","capabilities","currencies"]},"PublicDemoDonorDto":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"isAnonymous":{"type":"boolean"},"amountMinor":{"type":"number","format":"int64"},"createdAt":{"type":"string","format":"date-time"},"levelTitle":{"type":"string","nullable":true},"levelColorHex":{"type":"string","nullable":true}},"required":["id","name","isAnonymous","amountMinor","createdAt"]},"PublicDemoAmbassadorDto":{"type":"object","properties":{"id":{"type":"string"},"displayName":{"type":"string"},"slug":{"type":"string"},"goalAmountMinor":{"type":"number","format":"int64","nullable":true},"raisedAmountMinor":{"type":"number","format":"int64"},"contributionCount":{"type":"number"},"isFeatured":{"type":"boolean"}},"required":["id","displayName","slug","raisedAmountMinor","contributionCount","isFeatured"]},"PublicDemoMatcherDto":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"name":{"type":"string","nullable":true},"coefficient":{"type":"string"},"maxPoolMinor":{"type":"number","format":"int64","nullable":true},"consumedPoolMinor":{"type":"number","format":"int64"}},"required":["id","label","coefficient","consumedPoolMinor"]},"PublicCampaignDemoDto":{"type":"object","properties":{"isDemo":{"type":"boolean","description":"Always true — marks this data as synthetic."},"raisedAmountMinor":{"type":"number","format":"int64"},"contributionCount":{"type":"number"},"percent":{"type":"number"},"liveVisitorCount":{"type":"number","description":"Recent-visitor count for the preview banner."},"donors":{"type":"array","items":{"$ref":"#/components/schemas/PublicDemoDonorDto"}},"ambassadors":{"type":"array","items":{"$ref":"#/components/schemas/PublicDemoAmbassadorDto"}},"matchers":{"type":"array","items":{"$ref":"#/components/schemas/PublicDemoMatcherDto"}},"strategyNotes":{"type":"array","items":{"type":"string"}}},"required":["isDemo","raisedAmountMinor","contributionCount","percent","liveVisitorCount","donors","ambassadors","matchers","strategyNotes"]},"PublicDonationLevelDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"displayOrder":{"type":"number"},"title":{"type":"string","description":"Resolved title (translation OR default)."},"subtitle":{"type":"string","nullable":true},"amountMinor":{"type":"number","format":"int64"},"currency":{"type":"string"},"capStatus":{"type":"string","enum":["open","sold_out"]},"capQuantity":{"type":"number","nullable":true,"description":"Total slots for a capped tier; null when the tier is unlimited. Public because sponsorship inventory (\"12 of 20 claimed\", \"3 left\") is donor-facing copy on the campaign page — it says nothing about who claimed them."},"capConsumed":{"type":"number","nullable":true,"description":"Slots already claimed for a capped tier; null when the tier is unlimited."},"isRecurring":{"type":"boolean"},"recurringFrequency":{"type":"string","enum":["monthly","quarterly","yearly"],"nullable":true},"recurringMonths":{"type":"number","nullable":true},"multiplierLabel":{"type":"string","nullable":true,"description":"Display badge for the level (e.g. `x12`). Derived server-side from `recurringMonths` so the UI does not have to guess; null for one-time or single-installment levels."},"colorHex":{"type":"string","nullable":true},"imageAssetKey":{"type":"string","nullable":true}},"required":["id","slug","displayOrder","title","amountMinor","currency","capStatus","isRecurring"]},"PublicCampaignTeamDto":{"type":"object","properties":{"createdAt":{"type":"string","format":"date-time","description":"Team creation time for chronological sorting."},"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"customSlug":{"type":"string"},"parentTeamId":{"type":"string","format":"uuid","nullable":true},"contactDisplayName":{"type":"string","nullable":true,"description":"The linked contact's display name, resolved server-side. The public name of the person behind this node (decision ה-2), and the replacement for `leaderName`."},"avatarAssetKey":{"type":"string","nullable":true},"goalAmountMinor":{"type":"string","nullable":true},"bonusGoalAmountMinor":{"type":"string","nullable":true},"currency":{"type":"string"},"hideGoal":{"type":"boolean"},"noGoal":{"type":"boolean"},"isFeatured":{"type":"boolean"},"raisedAmountMinor":{"type":"string"},"contributionCount":{"type":"number","minimum":0},"donorThankYouText":{"type":"string","nullable":true},"levelId":{"type":"string","format":"uuid","nullable":true,"description":"Level tag, so a public page can render a per-level leaderboard tab."}},"required":["id","name","customSlug","currency","hideGoal","noGoal","isFeatured","raisedAmountMinor","contributionCount"]},"PublicDonorReactionCountsDto":{"type":"object","properties":{"clap":{"type":"number"},"confetti":{"type":"number"},"heart":{"type":"number"},"like":{"type":"number"}},"required":["clap","confetti","heart","like"]},"PublicDonorWallTeamRefDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"]},"PublicDonorWallEntryDto":{"type":"object","properties":{"contributionId":{"type":"string","format":"uuid"},"donorName":{"type":"string"},"isAnonymous":{"type":"boolean"},"amountMinor":{"type":"number","format":"int64"},"currency":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"levelId":{"type":"string","format":"uuid","nullable":true},"levelTitle":{"type":"string","nullable":true},"levelColorHex":{"type":"string","nullable":true},"message":{"type":"string","nullable":true,"description":"The donor-authored public note already stored on the contribution. Null when no note was supplied."},"reactions":{"$ref":"#/components/schemas/PublicDonorReactionCountsDto"},"via":{"description":"The \"via who\" chain (decision ה-12), root-first, ending at the node the gift was attributed to — so the wall can render a small \"via Grade 5 › Class 3B\" link. For a split gift this is the chain of the node that received the LARGEST share. Empty when the gift carried no team attribution, or when every node in the chain is hidden. Hidden and not-yet-approved nodes are omitted from the chain (decision ה-11).","type":"array","items":{"$ref":"#/components/schemas/PublicDonorWallTeamRefDto"}},"isShared":{"type":"boolean","description":"Decision ה-6 — true when this ONE gift was split across several nodes. The wall shows the full amount plus a \"shared\" marker. False for an unattributed gift, which has no nodes at all."},"sharedTeamCount":{"type":"number","minimum":0,"description":"How many nodes this gift was split across. 0 means it carried no team attribution; 1 means a single node."},"sharedWith":{"description":"The partner nodes to name when the \"shared\" marker is hovered or tapped, excluding the one already named by `via`. Hidden and not-yet-approved partners are filtered out (decision ה-11), so this can be SHORTER than `sharedTeamCount - 1`; the count stays truthful because hidden money is still counted, only the name is withheld.","type":"array","items":{"$ref":"#/components/schemas/PublicDonorWallTeamRefDto"}}},"required":["contributionId","donorName","isAnonymous","amountMinor","currency","createdAt","reactions","via","isShared","sharedTeamCount","sharedWith"]},"PublicDonorWallResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/PublicDonorWallEntryDto"}},"generatedAt":{"type":"string","format":"date-time"},"totalCount":{"type":"number","description":"Total donor wall entries matching the filters (ignoring limit/offset)."},"hasMore":{"type":"boolean","description":"True when more rows are available beyond the returned page."}},"required":["rows","generatedAt","totalCount","hasMore"]},"PublicCampaignMatcherDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"label":{"type":"string"},"name":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"avatarAssetKey":{"type":"string","nullable":true},"logoAssetKey":{"type":"string","nullable":true},"coefficient":{"type":"string"},"isFeatured":{"type":"boolean"},"orderSequence":{"type":"number"},"currency":{"type":"string"},"maxPoolMinor":{"type":"number","format":"int64","nullable":true},"consumedPoolMinor":{"type":"number","format":"int64"},"status":{"type":"string","enum":["scheduled","active","exhausted","expired"]}},"required":["id","label","name","description","avatarAssetKey","logoAssetKey","coefficient","isFeatured","orderSequence","currency","maxPoolMinor","consumedPoolMinor","status"]},"PublicCampaignTeamLevelDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"rank":{"type":"number","minimum":1,"description":"1 = top of the hierarchy. The HIGHEST rank is the bottom, self-signup level."},"label":{"type":"string","description":"The per-campaign label for this level, e.g. \"Grade\" or \"Class\"."}},"required":["id","rank","label"]},"PublicCampaignResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["draft","pending_approval","active","paused","ended","completed","archived"]},"effectiveStatus":{"type":"string","enum":["draft","pending_approval","pending","active","paused","ended","completed","success","failed","archived"]},"kind":{"type":"string","enum":["classic_blast","year_round","donation_page"]},"goalAmount":{"type":"string","nullable":true,"description":"Null for donation_page campaigns, which carry no goal."},"bonusGoalAmount":{"type":"string","nullable":true},"currency":{"type":"string"},"pageLocale":{"type":"string","enum":["en","he"],"description":"Resolved campaign-page locale used for localized page copy and live campaign data."},"timezone":{"type":"string","nullable":true},"raisedAmountMinor":{"type":"number","format":"int64"},"contributionCount":{"type":"number"},"startDate":{"type":"string","format":"date-time","nullable":true,"description":"CHAR-29: the opening instant as a UTC ISO string, time of day included — not a calendar day."},"endDate":{"type":"string","format":"date-time","nullable":true,"description":"CHAR-29: the closing instant as a UTC ISO string, time of day included. The renderer takes the donor-facing deadline as the sooner of this and acceptDonationsUntil."},"acceptDonationsUntil":{"type":"string","format":"date-time","nullable":true},"contentOverrides":{"type":"object","additionalProperties":true,"description":"Per-state, per-locale copy overrides for the public renderer."},"layoutConfig":{"type":"object","additionalProperties":true,"description":"Page builder layout config used by the public renderer."},"tracking":{"$ref":"#/components/schemas/CampaignTrackingDto"},"publicContact":{"description":"The RESOLVED public contact channel for this campaign page: the campaign override (settings.general.publicContactEmail / publicContactPhone) when set, otherwise the organization profile contact. Feeds the campaign.contactEmail / campaign.contactPhone page binds; a null field means neither is set.","allOf":[{"$ref":"#/components/schemas/PublicCampaignContactDto"}]},"organization":{"description":"Public identity of the organization that owns the campaign (name + approved logo). Feeds the Givearoo platform header chrome; never carries contact details or settings.","allOf":[{"$ref":"#/components/schemas/PublicCampaignOrganizationDto"}]},"settings":{"description":"Public-safe campaign settings that affect sharing, checkout, and donor experience.","allOf":[{"$ref":"#/components/schemas/CampaignSettingsDto"}]},"effectiveUi":{"$ref":"#/components/schemas/EffectiveCampaignUiDto"},"supportedCurrencies":{"description":"CHAR-70: the currencies a donor can actually be charged in, derived from the org's connected acquirers — NOT a wish list. Empty when the campaign cannot take money (see acceptingDonations). Previously read from a settings key nothing ever wrote, so it always collapsed to the campaign currency.","type":"array","items":{"type":"string"}},"donationCurrencies":{"description":"CHAR-70: the same currencies as supportedCurrencies, each already routed to its acquirer and carrying its minor-unit precision. The donation form renders its currency picker from this and sends the paired provider back.","type":"array","items":{"$ref":"#/components/schemas/PublicDonationCurrencyDto"}},"acceptingDonations":{"type":"boolean","description":"CHAR-70: false when this campaign cannot take a donation right now. The public page must render an explanatory state instead of the donation form — a donor should never reach a payment step that cannot succeed."},"notAcceptingReason":{"type":"string","enum":["no_acquirer","payments_disabled","campaign_paused","window_closed","campaign_ended"],"nullable":true,"description":"Why acceptingDonations is false, or null when it is true. An explicit reason rather than an empty array, so SDK/MCP callers get a diagnosis instead of a shape to interpret."},"connectedProviders":{"description":"Payment providers the org has actively connected, with donor-facing capabilities only (never account ids or secrets). The public form builds its processor picker from this list.","type":"array","items":{"$ref":"#/components/schemas/PublicConnectedProviderDto"}},"demo":{"nullable":true,"description":"Preview-only synthetic activity overlay. Only present on the signed draft-preview response; absent (undefined) on the public campaign route.","allOf":[{"$ref":"#/components/schemas/PublicCampaignDemoDto"}]},"levels":{"description":"Preview-only inline donation levels for signed draft previews. Public published pages load levels from the dedicated levels endpoint.","type":"array","items":{"$ref":"#/components/schemas/PublicDonationLevelDto"}},"teams":{"description":"Preview-only public team rows. Signed draft previews and Design Studio use these exact rows so repeats match the published landing page.","type":"array","items":{"$ref":"#/components/schemas/PublicCampaignTeamDto"}},"donorWall":{"description":"Preview-only first page of real donor-wall rows. Always the real (non-demo) rows — CHAR-138: when the org has the demo overlay switched on, the client layers the synthetic donors on top of this for display, but the API-level rows here are never fabricated.","allOf":[{"$ref":"#/components/schemas/PublicDonorWallResponseDto"}]},"matchers":{"description":"Preview-only active/scheduled matcher rows.","type":"array","items":{"$ref":"#/components/schemas/PublicCampaignMatcherDto"}},"teamLevels":{"description":"Preview-only team level scheme, ordered by rank.","type":"array","items":{"$ref":"#/components/schemas/PublicCampaignTeamLevelDto"}},"multiTeamDonationEnabled":{"type":"boolean","description":"Preview-only donor-facing multi-team donation setting."}},"required":["id","slug","name","status","effectiveStatus","kind","currency","pageLocale","raisedAmountMinor","contributionCount","effectiveUi","supportedCurrencies","donationCurrencies","acceptingDonations","notAcceptingReason","connectedProviders"]},"PublicCampaignTimelinePointDto":{"type":"object","properties":{"bucket":{"type":"string","format":"date-time","description":"Start of the bucket window in UTC (ISO-8601)."},"amountMinor":{"type":"number","format":"int64","description":"Sum of succeeded contribution amounts in this bucket, in minor units."},"cumulativeAmountMinor":{"type":"number","format":"int64","description":"Cumulative succeeded total at the END of this bucket, in minor units."},"contributionCount":{"type":"number","description":"Distinct succeeded contributions in this bucket."}},"required":["bucket","amountMinor","cumulativeAmountMinor","contributionCount"]},"PublicCampaignTimelineResponseDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"currency":{"type":"string"},"bucket":{"type":"string","enum":["day","week","month"]},"from":{"type":"string","format":"date-time","nullable":true},"to":{"type":"string","format":"date-time","nullable":true},"goalAmountMinor":{"type":"number","format":"int64","description":"Goal amount in minor units (campaign currency)."},"totalAmountMinor":{"type":"number","format":"int64","description":"Sum of succeeded contributions across the returned window."},"points":{"type":"array","items":{"$ref":"#/components/schemas/PublicCampaignTimelinePointDto"}},"generatedAt":{"type":"string","format":"date-time"}},"required":["campaignId","currency","bucket","from","to","goalAmountMinor","totalAmountMinor","points","generatedAt"]},"PublicCampaignLinkResolutionDto":{"type":"object","properties":{"found":{"type":"boolean","description":"False when neither segment resolves to anything, live or historical — the link is genuinely dead and the caller should render a 404."},"orgSlug":{"type":"string","nullable":true,"description":"The organization slug to use now. Null when `found` is false."},"campaignSlug":{"type":"string","nullable":true,"description":"The campaign slug to use now. Null when `found` is false."},"movedOrg":{"type":"boolean","description":"True when the requested organization slug was a former one."},"movedCampaign":{"type":"boolean","description":"True when the requested campaign slug was a former one."},"pendingPublication":{"type":"boolean","description":"True when the address (current or former) belongs to a real campaign that has simply never gone public yet — the organization is live and the campaign is draft/pending_approval. The caller renders a \"coming soon\" page (200) instead of a 404. False for every other reason a direct fetch can fail, including an archived campaign: that address WAS public and is not \"coming soon\"."}},"required":["found","orgSlug","campaignSlug","movedOrg","movedCampaign","pendingPublication"]},"CreatePublicDonorReactionDto":{"type":"object","properties":{"reactionType":{"type":"string","enum":["clap","confetti","heart","like"]},"clientToken":{"type":"string","minLength":16,"maxLength":128,"description":"Anonymous browser token. The API stores only a salted SHA-256 hash."}},"required":["reactionType","clientToken"]},"PublicDonorReactionResponseDto":{"type":"object","properties":{"contributionId":{"type":"string","format":"uuid"},"reactionType":{"type":"string","enum":["clap","confetti","heart","like"]},"created":{"type":"boolean"},"reactions":{"$ref":"#/components/schemas/PublicDonorReactionCountsDto"}},"required":["contributionId","reactionType","created","reactions"]},"PublicCampaignMatchersListDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/PublicCampaignMatcherDto"}},"totalCount":{"type":"number"}},"required":["rows","totalCount"]},"PublicLandingEventDto":{"type":"object","properties":{"type":{"type":"string","enum":["contribution.succeeded","contribution.created","campaign.donor_reaction.created","ambassador.created"]},"campaignId":{"type":"string","format":"uuid"},"contributionId":{"type":"object","format":"uuid","nullable":true},"ambassadorParticipationId":{"type":"object","format":"uuid","nullable":true},"occurredAt":{"type":"string","format":"date-time"}},"required":["type","campaignId","occurredAt"]},"PublicCampaignStreamDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"object","nullable":true},"imageAssetKey":{"type":"object","nullable":true},"goalAmountMinor":{"type":"string","nullable":true},"currency":{"type":"string"},"colorHex":{"type":"object","nullable":true},"orderSequence":{"type":"number"},"isDefault":{"type":"boolean"},"raisedAmountMinor":{"type":"string"},"contributionCount":{"type":"number"}},"required":["id","title","currency","orderSequence","isDefault","raisedAmountMinor","contributionCount"]},"PublicCampaignStreamsListDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/PublicCampaignStreamDto"}}},"required":["rows"]},"PublicCampaignTeamsListDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/PublicCampaignTeamDto"}}},"required":["rows"]},"PublicCampaignTeamSchemeDto":{"type":"object","properties":{"levels":{"description":"Ordered by rank ascending. Empty when this campaign defined no level scheme.","type":"array","items":{"$ref":"#/components/schemas/PublicCampaignTeamLevelDto"}},"multiTeamDonationEnabled":{"type":"boolean","description":"Decision ה-5, default false. When false the donation form must offer exactly ONE team — a multi-select picker is a contract violation, not a nicety."}},"required":["levels","multiTeamDonationEnabled"]},"PublicCampaignTeamDonorDto":{"type":"object","properties":{"donorName":{"type":"string","description":"Display name, or the anonymous placeholder."},"amountMinor":{"type":"string","description":"This team's share, in minor units."},"contributionAmountMinor":{"type":"string","description":"The full donation amount, before any split."},"currency":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"via":{"description":"The \"via\" chain — decision ה-12.","type":"array","items":{"$ref":"#/components/schemas/CampaignTeamDonorViaDto"}},"isShared":{"type":"boolean","description":"Decision ה-6 — render the full amount plus a \"shared\" marker."},"sharedTeamCount":{"type":"number","minimum":1},"sharedWith":{"description":"Decision ה-6 — the partner nodes to name on hover/tap of the \"shared\" marker, excluding this row's own node. HIDDEN and not-yet-approved partners are filtered out (decision ה-11: a hidden node must never leak into a public surface), so this list can be SHORTER than `sharedTeamCount - 1`. `sharedTeamCount` stays truthful — hidden money is still counted, it is only the name that is withheld.","type":"array","items":{"$ref":"#/components/schemas/CampaignTeamDonorViaDto"}}},"required":["donorName","amountMinor","contributionAmountMinor","currency","createdAt","via","isShared","sharedTeamCount","sharedWith"]},"PublicCampaignTeamDetailDto":{"type":"object","properties":{"team":{"$ref":"#/components/schemas/PublicCampaignTeamDto"},"ancestors":{"description":"Ancestor breadcrumb, root-first, excluding this node.","type":"array","items":{"$ref":"#/components/schemas/CampaignTeamAncestorDto"}},"children":{"description":"Visible direct children (approved and not hidden).","type":"array","items":{"$ref":"#/components/schemas/PublicCampaignTeamDto"}},"donors":{"description":"Donors of this node and its whole subtree, most recent first.","type":"array","items":{"$ref":"#/components/schemas/PublicCampaignTeamDonorDto"}}},"required":["team","ancestors","children","donors"]},"PublicCreateCampaignTeamDto":{"type":"object","properties":{"name":{"type":"string","maxLength":280,"description":"The node name (usually the person or family name)."},"email":{"type":"string","format":"email","description":"Required — it is the CRM dedup key (decision ה-2). An existing contact with this email is linked, not duplicated."},"phoneE164":{"type":"string","maxLength":32,"nullable":true},"parentId":{"type":"string","format":"uuid","nullable":true,"description":"The parent to join, chosen from the existing structure. Must be an APPROVED, non-deleted node of this campaign; a hidden node may be named explicitly (the signup link came from it) but never appears in the picker."},"customSlug":{"type":"string","maxLength":80,"nullable":true,"description":"Preferred URL slug. Taken slugs get a numeric suffix rather than an error."},"goalAmountMinor":{"type":"string","nullable":true,"description":"Personal fundraising goal, minor units."},"captchaToken":{"type":"string","nullable":true,"description":"hCaptcha response token. Verified when HCAPTCHA_SECRET is configured for the environment; see HcaptchaService for the (deliberately explicit) unconfigured behaviour."}},"required":["name","email"]},"PublicCreateCampaignTeamResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"customSlug":{"type":"string"},"status":{"type":"string","enum":["pending","approved","suspended","archived"],"description":"pending unless the campaign's signupAutoApprove toggle is on (decision ה-9). A pending node is invisible on every public surface until staff approve it."},"publicUrl":{"type":"string","description":"Relative public path of the new node page."},"isLive":{"type":"boolean","description":"True when the node is already live. False means \"submitted, awaiting approval\" — say so in the UI rather than implying it is live."}},"required":["id","customSlug","status","publicUrl","isLive"]},"PublicListDonationLevelsResponseDto":{"type":"object","properties":{"levels":{"type":"array","items":{"$ref":"#/components/schemas/PublicDonationLevelDto"}},"preselectedLevelId":{"type":"string","format":"uuid","nullable":true},"locale":{"type":"string"}},"required":["levels","locale"]},"StartOrganizationScanDto":{"type":"object","properties":{"websiteUrl":{"type":"string","description":"Public organization website URL to research.","example":"https://example.org"},"forceRefresh":{"type":"boolean","description":"Force a fresh scan even if a recent completed run exists for the same domain.","default":false}},"required":["websiteUrl"]},"StartOrganizationScanResponseDto":{"type":"object","properties":{"runId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending","running","completed","partial","failed"]},"reused":{"type":"boolean","description":"True when an existing recent run was reused instead of starting a new crawl."}},"required":["runId","status","reused"]},"OrganizationResearchRunResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"inputUrl":{"type":"string"},"normalizedDomain":{"type":"string"},"status":{"type":"string","enum":["pending","running","completed","partial","failed"]},"pagesDiscovered":{"type":"number"},"pagesScanned":{"type":"number"},"findingsCount":{"type":"number"},"assetsCount":{"type":"number"},"confidenceScore":{"type":"number","nullable":true},"limitations":{"type":"array","items":{"type":"string"}},"errorCode":{"type":"string","nullable":true},"errorMessage":{"type":"string","nullable":true},"startedAt":{"type":"string","format":"date-time","nullable":true},"completedAt":{"type":"string","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","inputUrl","normalizedDomain","status","pagesDiscovered","pagesScanned","findingsCount","assetsCount","limitations","createdAt"]},"OrganizationStorySignalsDto":{"type":"object","properties":{"pain":{"type":"array","items":{"type":"string"}},"hope":{"type":"array","items":{"type":"string"}},"whyNow":{"type":"array","items":{"type":"string"}},"proofPoints":{"type":"array","items":{"type":"string"}},"weaknesses":{"type":"array","items":{"type":"string"}}},"required":["pain","hope","whyNow","proofPoints","weaknesses"]},"OrganizationSocialProfileSummaryDto":{"type":"object","properties":{"platform":{"type":"string"},"url":{"type":"string"}},"required":["platform","url"]},"OrganizationPaymentSignalSummaryDto":{"type":"object","properties":{"provider":{"type":"string"},"donationUrl":{"type":"string","nullable":true}},"required":["provider"]},"OrganizationProfileConfirmationDto":{"type":"object","properties":{"organizationName":{"type":"string","nullable":true},"category":{"type":"string","nullable":true},"location":{"type":"string","nullable":true},"primaryLanguage":{"type":"string","nullable":true},"audienceSummary":{"type":"string","nullable":true},"missionSummary":{"type":"string","nullable":true},"storySignals":{"$ref":"#/components/schemas/OrganizationStorySignalsDto"},"logoUrl":{"type":"string","nullable":true},"palette":{"type":"array","items":{"type":"string"}},"topImages":{"type":"array","items":{"type":"string"}},"socialProfiles":{"type":"array","items":{"$ref":"#/components/schemas/OrganizationSocialProfileSummaryDto"}},"paymentSignals":{"type":"array","items":{"$ref":"#/components/schemas/OrganizationPaymentSignalSummaryDto"}},"missingCriticalInfo":{"type":"array","items":{"type":"string"}},"recommendedNextAction":{"type":"string","nullable":true},"confidenceScore":{"type":"number"}},"required":["storySignals","palette","topImages","socialProfiles","paymentSignals","missingCriticalInfo","confidenceScore"]},"OrganizationIntelligenceProfileResponseDto":{"type":"object","properties":{"hasProfile":{"type":"boolean","description":"True when a profile exists for the organization."},"latestRunId":{"type":"string","format":"uuid","nullable":true},"profileVersion":{"type":"number"},"confirmed":{"type":"boolean"},"confirmation":{"$ref":"#/components/schemas/OrganizationProfileConfirmationDto"}},"required":["hasProfile","profileVersion","confirmed","confirmation"]},"ConfirmOrganizationProfileResponseDto":{"type":"object","properties":{"confirmed":{"type":"boolean"},"confirmedAt":{"type":"string","format":"date-time"}},"required":["confirmed","confirmedAt"]},"RejectOrganizationFindingDto":{"type":"object","properties":{"findingId":{"type":"string","format":"uuid"},"reason":{"type":"string","description":"Optional reason for rejecting the finding."}},"required":["findingId"]},"RejectOrganizationFindingResponseDto":{"type":"object","properties":{"findingId":{"type":"string","format":"uuid"},"status":{"type":"string","example":"rejected"}},"required":["findingId","status"]},"GetOrganizationPersonaResponseDto":{"type":"object","properties":{"hasPersona":{"type":"boolean","description":"True when a valid persona has been synthesized for this organization.","example":true},"persona":{"type":"object","nullable":true,"description":"The synthesized persona blob (archetype, missionOneLiner, toneVoice, primaryAudience, donorProfile, financialProfile, seasonality, digitalMaturity, strategicPosture, provenance, synthesisMeta). Null when hasPersona is false."},"version":{"type":"number","description":"Monotonic persona version, bumped on every re-synthesis. 0 when never synthesized.","example":3},"synthesizedAt":{"type":"string","nullable":true,"format":"date-time","description":"ISO-8601 timestamp of the last successful synthesis, or null when never synthesized."},"stale":{"type":"boolean","description":"True when the persona is missing, or when the intelligence profile has been updated (a fresh scan / confirmation) more recently than the persona was last synthesized — i.e. a re-synthesis is due. Agents should branch on this rather than the raw timestamps.","example":false}},"required":["hasPersona","version","stale"]},"ResynthesizeOrganizationPersonaResponseDto":{"type":"object","properties":{"runId":{"type":"string","format":"uuid","description":"Correlation id for this synthesis request (also stamped on the persona_synthesized outbox event)."},"status":{"type":"string","description":"Always \"queued\" — synthesis completes asynchronously; poll the profile/persona read for the result.","example":"queued"}},"required":["runId","status"]},"CreateOrganizationDto":{"type":"object","properties":{"planKey":{"type":"string","maxLength":64,"description":"Published self-serve plan selected before OAuth or organization creation; otherwise the catalog default is used."},"legalConsent":{"description":"Terms of Use / Privacy Notice versions the caller accepted. Required when the caller has no acceptance of the current versions on record and LEGAL_CONSENT_REQUIRED is on; ignored when they already have one.","allOf":[{"$ref":"#/components/schemas/LegalConsentDto"}]},"name":{"type":"string","description":"Legal name of the organization.","example":"Charidy Inc.","maxLength":200},"slug":{"type":"string","description":"Optional URL-safe organization slug. Lowercase letters, digits and hyphens; 3–60 chars. Must be unique platform-wide. If omitted, generated from the organization name.","example":"charidy","maxLength":60},"country":{"type":"string","description":"ISO-3166-1 alpha-2 country code. Defaults to \"IL\".","example":"IL","minLength":2,"maxLength":2},"defaultCurrency":{"type":"string","description":"ISO-4217 currency code. Defaults to \"ILS\".","example":"ILS","minLength":3,"maxLength":3}},"required":["name"]},"CreatedOrganizationResponseDto":{"type":"object","properties":{"id":{"type":"string","description":"Organization UUID.","format":"uuid"},"slug":{"type":"string","example":"charidy"},"name":{"type":"string","example":"Charidy Inc."},"country":{"type":"string","example":"IL","minLength":2,"maxLength":2},"defaultCurrency":{"type":"string","example":"ILS","minLength":3,"maxLength":3},"status":{"type":"string","enum":["pending_approval","active","suspended","pending_deletion","disabled"],"description":"Initial organization status."},"ownerRoleKey":{"type":"string","description":"Membership role key assigned to the creator (always `org_owner` for self-created orgs).","example":"org_owner"}},"required":["id","slug","name","country","defaultCurrency","status","ownerRoleKey"]},"OrganizationContextResponseDto":{"type":"object","properties":{"id":{"type":"string","description":"Organization UUID.","format":"uuid"},"slug":{"type":"string","example":"charidy"},"legalName":{"type":"string","example":"Charidy Inc."},"country":{"type":"string","example":"IL","minLength":2,"maxLength":2},"defaultCurrency":{"type":"string","example":"ILS","minLength":3,"maxLength":3},"status":{"type":"string","enum":["pending_approval","active","suspended","pending_deletion","disabled"]},"roleKey":{"type":"string","example":"org_owner"}},"required":["id","slug","legalName","country","defaultCurrency","status","roleKey"]},"EffectiveFeatureFlagsResponseDto":{"type":"object","properties":{"flags":{"type":"object","additionalProperties":{"type":"boolean"},"example":{"donation_pages.enabled":false},"description":"Effective value per requested key: org override row > registered code default."}},"required":["flags"]},"OrganizationProfileEditableDto":{"type":"object","properties":{"displayName":{"type":"string","nullable":true,"description":"Display / brand name shown to donors, on receipts and in email footers."},"logoUrl":{"type":"string","nullable":true,"description":"Absolute https URL to the org logo."},"logoMediaAssetId":{"type":"string","nullable":true,"format":"uuid","description":"Media-library asset id backing the logo, when picked from the library."},"websiteUrl":{"type":"string","nullable":true},"addressLine1":{"type":"string","nullable":true},"addressLine2":{"type":"string","nullable":true},"addressCity":{"type":"string","nullable":true},"addressRegion":{"type":"string","nullable":true,"description":"State / province / region."},"addressPostalCode":{"type":"string","nullable":true},"addressCountry":{"type":"string","nullable":true,"example":"IL","description":"ISO-3166-1 alpha-2 country of the postal address."},"contactEmail":{"type":"string","nullable":true,"description":"Public contact email shown to donors."},"contactPhone":{"type":"string","nullable":true,"description":"Public contact phone shown to donors."},"registrationNumber":{"type":"string","nullable":true,"description":"SELF-DECLARED registration number as the client typed it (ע.ר. / מספר עמותה for IL, EIN for US). Not a verified fact — it is the lookup key for compliance verification. The verified equivalent is `taxStatus.registrationNumber`."},"registrationNumberDeclaredAt":{"type":"string","nullable":true,"format":"date-time","description":"When the client last stated `registrationNumber`, so \"declared but unverified\" is distinguishable from \"never stated\"."},"timezone":{"type":"string","nullable":true,"example":"Asia/Jerusalem","description":"The organization's default IANA timezone. A campaign with no `timezone` of its own inherits this one, and it is what offset-less campaign dates are read in. Null means the organization never stated one, which falls through to the caller's clock and then UTC."},"receiptStartingNumber":{"type":"number","nullable":true,"minimum":1,"description":"Israeli organizations only: the first receipt number Givearoo issues (null means 1). See `receiptNumbering` for the number the next receipt will get."}}},"OrganizationProfileReadOnlyDto":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"legalName":{"type":"string","description":"Registered legal name of the entity. Printed on donor receipts.","example":"Charidy Inc."},"slug":{"type":"string","description":"URL-safe organization slug.","example":"charidy"},"country":{"type":"string","example":"IL","minLength":2,"maxLength":2},"defaultCurrency":{"type":"string","example":"ILS","minLength":3,"maxLength":3},"status":{"type":"string","enum":["pending_approval","active","suspended","pending_deletion","disabled"]},"roleKey":{"type":"string","description":"Membership role key of the requesting user.","example":"org_owner"}},"required":["organizationId","legalName","slug","country","defaultCurrency","status","roleKey"]},"OrganizationProfileTaxStatusDto":{"type":"object","properties":{"verified":{"type":"boolean","description":"Whether any KYB verification has been run and persisted for this org."},"registrationNumber":{"type":"string","nullable":true,"description":"Registration number the verification matched on (ע.ר. for IL, EIN for US)."},"hasSection46":{"type":"boolean","nullable":true,"description":"Israel only: whether the registry reports a valid סעיף 46 tax-deduction approval. Null when unknown or not applicable."},"taxExempt501c3":{"type":"boolean","nullable":true,"description":"US only: whether the org is a recognised 501(c)(3). Null when unknown or not applicable."},"hasProperManagement":{"type":"boolean","nullable":true,"description":"Israel only: אישור ניהול תקין status as reported by the registry."},"contributionsDeductible":{"type":"boolean","nullable":true,"description":"US only: whether a donor may deduct a contribution, per the IRS deductibility code — a separate fact from 501(c)(3) status, since an exempt entity can still be non-deductible. Null when not reported. Israel reports the same idea as `hasSection46`."},"verifiedCharityBadge":{"type":"boolean","description":"Whether the org earned the verified-charity badge on its public page."},"provider":{"type":"string","nullable":true,"description":"Registry/provider the status came from, e.g. guidestar_il | us_charity | none."},"verifiedAt":{"type":"string","nullable":true,"format":"date-time"},"verificationAvailable":{"type":"boolean","description":"False when compliance verification is disabled for this environment, so the UI can say \"not checked\" rather than \"not approved\"."},"mode":{"type":"string","nullable":true,"enum":["live","stub","disabled"],"description":"How the snapshot was produced. `live` = a real registry answered. `stub` = adapter fixture data, returned when no registry credential is configured — the tri-state flags above are forced to null and the badge to false in that case, so fixture data can never read as an approved tax status. Null when no verification has run."}},"required":["verified","verifiedCharityBadge","verificationAvailable"]},"OrganizationReceiptNumberingDto":{"type":"object","properties":{"mode":{"type":"string","enum":["org_sequence","donation_number"],"description":"`org_sequence` — Israeli organization (country IL): receipts are numbered 1, 2, 3 … per organization from `startingNumber`. `donation_number` — every other country: there is no separate receipt number; the receipt shows the Givearoo donation number."},"startingNumber":{"type":"number","nullable":true,"description":"Configured starting number (org_sequence only; null means 1)."},"lastIssuedNumber":{"type":"number","nullable":true,"description":"Last receipt number issued (org_sequence only; null before the first receipt)."},"nextNumber":{"type":"number","nullable":true,"description":"Number the next receipt will get (org_sequence only)."}},"required":["mode"]},"OrganizationProfileResponseDto":{"type":"object","properties":{"editable":{"$ref":"#/components/schemas/OrganizationProfileEditableDto"},"readOnly":{"$ref":"#/components/schemas/OrganizationProfileReadOnlyDto"},"taxStatus":{"$ref":"#/components/schemas/OrganizationProfileTaxStatusDto"},"receiptNumbering":{"$ref":"#/components/schemas/OrganizationReceiptNumberingDto"},"footerAddress":{"type":"string","nullable":true,"description":"The one-line address currently rendered on receipts and email footers. Derived from the structured address fields; free text on rows that predate them."},"source":{"type":"string","nullable":true,"description":"How the identity data was derived: website_scan | org_intelligence | manual."},"updatedAt":{"type":"string","format":"date-time"}},"required":["editable","readOnly","taxStatus","receiptNumbering","updatedAt"]},"UpdateOrganizationProfileSettingsDto":{"type":"object","properties":{"displayName":{"type":"string","description":"Display / brand name shown to donors.","maxLength":200},"logoUrl":{"type":"string","description":"Absolute https URL to the org logo.","maxLength":2048},"logoMediaAssetId":{"type":"string","format":"uuid","description":"Media-library asset id for the logo."},"websiteUrl":{"type":"string","maxLength":2048},"addressLine1":{"type":"string","maxLength":200},"addressLine2":{"type":"string","maxLength":200},"addressCity":{"type":"string","maxLength":120},"addressRegion":{"type":"string","description":"State / province / region.","maxLength":120},"addressPostalCode":{"type":"string","maxLength":32},"addressCountry":{"type":"string","example":"IL","description":"ISO-3166-1 alpha-2, or empty to clear."},"contactEmail":{"type":"string","description":"Public contact email, or empty to clear.","maxLength":320},"contactPhone":{"type":"string","description":"Public contact phone, or empty to clear.","maxLength":40},"registrationNumber":{"type":"string","description":"Self-declared registration number (ע.ר. / מספר עמותה for IL, EIN for US), or empty to clear. Writing it does NOT assert a tax status — it is the key compliance verification looks up.","maxLength":40,"example":"580123456"},"timezone":{"type":"string","description":"The organization's default IANA timezone, or empty to clear. Campaigns with no timezone of their own inherit it, and offset-less campaign dates are read in it.","maxLength":64,"example":"Asia/Jerusalem"},"receiptStartingNumber":{"type":"number","nullable":true,"minimum":1,"maximum":1000000000,"example":1001,"description":"Israeli organizations only: first receipt number to issue, or null to reset to 1. Must be greater than the last receipt number already issued. Error codes: RECEIPT_NUMBERING_NOT_APPLICABLE (organization outside Israel: its receipts show the donation number), RECEIPT_STARTING_NUMBER_TOO_LOW."}}},"ComplianceCheckDto":{"type":"object","properties":{"key":{"type":"string"},"status":{"type":"string","enum":["pass","fail","unknown"]},"label":{"type":"string"},"detail":{"type":"object","nullable":true}},"required":["key","status","label"]},"ComplianceReconciliationDto":{"type":"object","properties":{"summary":{"type":"string"},"rationale":{"type":"array","items":{"type":"string"}},"nameMatch":{"type":"object","nullable":true},"confidence":{"type":"number","minimum":0,"maximum":1},"aiAssisted":{"type":"boolean"}},"required":["summary","rationale","nameMatch","confidence","aiAssisted"]},"ComplianceVerificationDto":{"type":"object","properties":{"verified":{"type":"boolean","description":"True when a verification snapshot exists for the org."},"decision":{"type":"string","enum":["eligible","needs_review","ineligible","unknown"]},"verifiedCharityBadge":{"type":"boolean","description":"Eligible for the public verified-charity badge."},"provider":{"type":"string"},"country":{"type":"object","nullable":true},"matched":{"type":"boolean"},"registrationNumber":{"type":"object","nullable":true},"legalName":{"type":"object","nullable":true},"activityStatus":{"type":"object","nullable":true},"isActive":{"type":"object","nullable":true},"hasProperManagement":{"type":"object","nullable":true},"hasSection46":{"type":"object","nullable":true},"taxExempt501c3":{"type":"object","nullable":true},"contributionsDeductible":{"type":"boolean","nullable":true,"description":"Whether a donor may deduct a contribution — a separate IRS fact from being tax-exempt (BMF DEDUCTIBILITY: 1 deductible, 2 not deductible, 4 deductible by treaty). Null when not reported. For Israel the equivalent is `hasSection46`."},"bankAccountVerified":{"type":"object","nullable":true},"checks":{"type":"array","items":{"$ref":"#/components/schemas/ComplianceCheckDto"}},"reconciliation":{"$ref":"#/components/schemas/ComplianceReconciliationDto"},"mode":{"type":"string","enum":["live","stub","disabled"]},"confidence":{"type":"number","minimum":0,"maximum":1},"verifiedAt":{"type":"object","nullable":true,"description":"ISO timestamp of the last verification run."},"changedFields":{"description":"Fields whose verification result changed compared with the snapshot immediately before this on-demand run. Empty for reads and for an unchanged re-run.","type":"array","items":{"type":"string"}}},"required":["verified","decision","verifiedCharityBadge","provider","country","matched","registrationNumber","legalName","activityStatus","isActive","hasProperManagement","hasSection46","taxExempt501c3","contributionsDeductible","bankAccountVerified","checks","reconciliation","mode","confidence","verifiedAt","changedFields"]},"TriggerVerificationBodyDto":{"type":"object","properties":{"registrationNumber":{"type":"string","maxLength":80,"description":"Registration number to verify against — Israel amuta / ע.ר., US EIN, or the org-country equivalent.","example":"580123456"},"country":{"type":"string","description":"ISO 3166-1 alpha-2 country override. Defaults to the org country.","example":"IL"}}},"CreateMediaUploadSessionDto":{"type":"object","properties":{"purpose":{"type":"string","enum":["campaign_builder","organization_branding","broadcast_media","generic_image"]},"contentType":{"type":"string","example":"image/png"},"contentLength":{"type":"number","minimum":1,"maximum":73400320},"campaignId":{"type":"string","format":"uuid"},"filename":{"type":"string","maxLength":160,"description":"Original filename for auditability and extension inference. Do not include a local path."},"assetType":{"type":"string","enum":["logo","hero_image","activity_image","event_image","staff_image","community_image","testimonial_image","gallery_image","video","youtube_video","reel","document","social_post","generated_image","generated_video"],"default":"gallery_image"},"title":{"type":"string","maxLength":160}},"required":["purpose","contentType","contentLength"]},"MediaUploadSessionResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","nullable":true,"description":"Null for pre-complete browser upload sessions; populated once persisted."},"assetKey":{"type":"string","example":"campaign-media/org/uuid/campaign/uuid/asset.webp"},"publicUrl":{"type":"string","description":"Stable Charidy URL that can be stored in layouts and rendered publicly. The endpoint mints short-lived storage URLs behind the scenes."},"signedReadUrl":{"type":"string","description":"Short-lived direct storage read URL. Agents should store publicUrl or assetKey, not this URL.","nullable":true},"readExpiresAt":{"type":"string","format":"date-time","nullable":true},"purpose":{"type":"string","enum":["campaign_builder","organization_branding","broadcast_media","generic_image"]},"contentType":{"type":"string","example":"image/png"},"assetType":{"type":"string","enum":["logo","hero_image","activity_image","event_image","staff_image","community_image","testimonial_image","gallery_image","video","youtube_video","reel","document","social_post","generated_image","generated_video"]},"assetSource":{"type":"string","enum":["website","social","chat","upload","whatsapp","email","generated","manual"]},"status":{"type":"string","enum":["pending","approved","rejected","archived"]},"campaignId":{"type":"string","format":"uuid","nullable":true},"title":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"thumbnailUrl":{"type":"string","nullable":true},"width":{"type":"number","nullable":true},"height":{"type":"number","nullable":true},"durationSeconds":{"type":"number","nullable":true},"fileSize":{"type":"string","format":"int64","nullable":true,"description":"Byte size as a decimal STRING (the column is a bigint)."},"isLogo":{"type":"boolean"},"isHero":{"type":"boolean"},"isCampaignRecommended":{"type":"boolean"},"confidenceScore":{"type":"string","nullable":true,"description":"Reserved for AI analysis of the asset. Nothing writes it yet — see apps/api/src/media/README.md."},"approvedFor":{"type":"array","items":{"type":"string","enum":["campaign_pages","social_media","email","whatsapp","ads"]}},"internalOnly":{"type":"boolean"},"originalFilename":{"type":"string","nullable":true},"analyzedAt":{"type":"string","format":"date-time","nullable":true,"description":"When AI analysis last succeeded. Null = never analysed; treat labels/scores as unknown, NOT as \"nothing there\"."},"labels":{"description":"Concrete visible subjects, e.g. [\"volunteers\",\"food_boxes\"]. Empty when unanalysed.","type":"array","items":{"type":"string"}},"emotions":{"description":"Affective read of the image, e.g. [\"hopeful\"]. Empty when unanalysed.","type":"array","items":{"type":"string"}},"fundraisingScores":{"type":"object","additionalProperties":{"type":"number"},"nullable":true,"description":"Suitability 0..1 per surface (hero, story, email, whatsapp, social, ambassador). Null when unanalysed."},"focalPoint":{"type":"object","additionalProperties":{"type":"number"},"nullable":true,"description":"Most important point in the frame, each axis 0..1 from the top-left. An automated crop keeps this in frame. Null when unanalysed."},"containsPeople":{"type":"boolean","description":"Whether identifiable people appear. Surface this before publishing an image — it is a consent question, not a design one."},"metadata":{"type":"object","additionalProperties":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"uploadUrl":{"type":"string","description":"Short-lived storage URL the browser must PUT the file to."},"requiredHeaders":{"type":"object","additionalProperties":{"type":"string"}},"uploadExpiresAt":{"type":"string","format":"date-time"}},"required":["assetKey","publicUrl","purpose","contentType","assetType","assetSource","status","isLogo","isHero","isCampaignRecommended","approvedFor","internalOnly","labels","emotions","containsPeople","metadata","createdAt","updatedAt","uploadUrl","requiredHeaders","uploadExpiresAt"]},"CompleteMediaUploadDto":{"type":"object","properties":{"assetKey":{"type":"string","example":"campaign-media/org/uuid/media/asset.png"},"purpose":{"type":"string","enum":["campaign_builder","organization_branding","broadcast_media","generic_image"]},"contentType":{"type":"string","example":"image/png"},"contentLength":{"type":"number","minimum":1,"maximum":73400320},"campaignId":{"type":"string","format":"uuid"},"filename":{"type":"string","maxLength":160},"assetType":{"type":"string","enum":["logo","hero_image","activity_image","event_image","staff_image","community_image","testimonial_image","gallery_image","video","youtube_video","reel","document","social_post","generated_image","generated_video"],"default":"gallery_image"},"assetSource":{"type":"string","enum":["website","social","chat","upload","whatsapp","email","generated","manual"],"default":"upload"},"title":{"type":"string","maxLength":160}},"required":["assetKey","purpose","contentType","contentLength"]},"MediaAssetResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","nullable":true,"description":"Null for pre-complete browser upload sessions; populated once persisted."},"assetKey":{"type":"string","example":"campaign-media/org/uuid/campaign/uuid/asset.webp"},"publicUrl":{"type":"string","description":"Stable Charidy URL that can be stored in layouts and rendered publicly. The endpoint mints short-lived storage URLs behind the scenes."},"signedReadUrl":{"type":"string","description":"Short-lived direct storage read URL. Agents should store publicUrl or assetKey, not this URL.","nullable":true},"readExpiresAt":{"type":"string","format":"date-time","nullable":true},"purpose":{"type":"string","enum":["campaign_builder","organization_branding","broadcast_media","generic_image"]},"contentType":{"type":"string","example":"image/png"},"assetType":{"type":"string","enum":["logo","hero_image","activity_image","event_image","staff_image","community_image","testimonial_image","gallery_image","video","youtube_video","reel","document","social_post","generated_image","generated_video"]},"assetSource":{"type":"string","enum":["website","social","chat","upload","whatsapp","email","generated","manual"]},"status":{"type":"string","enum":["pending","approved","rejected","archived"]},"campaignId":{"type":"string","format":"uuid","nullable":true},"title":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"thumbnailUrl":{"type":"string","nullable":true},"width":{"type":"number","nullable":true},"height":{"type":"number","nullable":true},"durationSeconds":{"type":"number","nullable":true},"fileSize":{"type":"string","format":"int64","nullable":true,"description":"Byte size as a decimal STRING (the column is a bigint)."},"isLogo":{"type":"boolean"},"isHero":{"type":"boolean"},"isCampaignRecommended":{"type":"boolean"},"confidenceScore":{"type":"string","nullable":true,"description":"Reserved for AI analysis of the asset. Nothing writes it yet — see apps/api/src/media/README.md."},"approvedFor":{"type":"array","items":{"type":"string","enum":["campaign_pages","social_media","email","whatsapp","ads"]}},"internalOnly":{"type":"boolean"},"originalFilename":{"type":"string","nullable":true},"analyzedAt":{"type":"string","format":"date-time","nullable":true,"description":"When AI analysis last succeeded. Null = never analysed; treat labels/scores as unknown, NOT as \"nothing there\"."},"labels":{"description":"Concrete visible subjects, e.g. [\"volunteers\",\"food_boxes\"]. Empty when unanalysed.","type":"array","items":{"type":"string"}},"emotions":{"description":"Affective read of the image, e.g. [\"hopeful\"]. Empty when unanalysed.","type":"array","items":{"type":"string"}},"fundraisingScores":{"type":"object","additionalProperties":{"type":"number"},"nullable":true,"description":"Suitability 0..1 per surface (hero, story, email, whatsapp, social, ambassador). Null when unanalysed."},"focalPoint":{"type":"object","additionalProperties":{"type":"number"},"nullable":true,"description":"Most important point in the frame, each axis 0..1 from the top-left. An automated crop keeps this in frame. Null when unanalysed."},"containsPeople":{"type":"boolean","description":"Whether identifiable people appear. Surface this before publishing an image — it is a consent question, not a design one."},"metadata":{"type":"object","additionalProperties":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["assetKey","publicUrl","purpose","contentType","assetType","assetSource","status","isLogo","isHero","isCampaignRecommended","approvedFor","internalOnly","labels","emotions","containsPeople","metadata","createdAt","updatedAt"]},"IngestMediaAssetDto":{"type":"object","properties":{"purpose":{"type":"string","enum":["campaign_builder","organization_branding","broadcast_media","generic_image"]},"contentType":{"type":"string","example":"image/png","description":"Required with imageBase64. Optional with sourceUrl — the server then uses the fetched response content-type."},"contentLength":{"type":"number","minimum":1,"maximum":73400320},"campaignId":{"type":"string","format":"uuid"},"filename":{"type":"string","maxLength":160,"description":"Original filename for auditability and extension inference. Do not include a local path."},"imageBase64":{"type":"string","description":"Image bytes as base64 or a data URI. Use this for MCP clients that can attach file content."},"sourceUrl":{"type":"string","description":"Remote HTTPS image URL for the API to fetch and store. Must resolve to a public host — private, loopback and link-local addresses are rejected."},"assetType":{"type":"string","enum":["logo","hero_image","activity_image","event_image","staff_image","community_image","testimonial_image","gallery_image","video","youtube_video","reel","document","social_post","generated_image","generated_video"],"default":"gallery_image"},"assetSource":{"type":"string","enum":["website","social","chat","upload","whatsapp","email","generated","manual"],"default":"chat"},"title":{"type":"string","maxLength":160},"description":{"type":"string","maxLength":1000},"isLogo":{"type":"boolean"},"isHero":{"type":"boolean"}},"required":["purpose"]},"GenerateCampaignImageDto":{"type":"object","properties":{"prompt":{"type":"string","maxLength":800,"description":"Plain-language description of what to depict. Keep it TEXT-FREE — never ask for words, letters, or numbers in the image (raster models render Hebrew/text poorly); overlay all labels/amounts as CSS on the page. The service also hard-appends a no-text rule."},"kind":{"type":"string","enum":["background","icon","pattern"],"description":"How the image will be used: background (tile/CTA band), icon (a symbolic glyph, transparent), or pattern (subtle texture)."},"palette":{"description":"Optional brand colours (hex, e.g. #1a73e8) to keep the image on-brand.","type":"array","items":{"type":"string"}},"campaignId":{"type":"string","format":"uuid","description":"Optional campaign to associate the asset with."},"title":{"type":"string","maxLength":160}},"required":["prompt","kind"]},"GeneratedImageResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Media-library asset id for page-content placements."},"assetKey":{"type":"string","example":"campaign-media/org/uuid/campaign/uuid/generated-background.png"},"publicUrl":{"type":"string","description":"Stable Charidy media URL for the AI-generated (text-free) image. Store it in a donation level `imageAssetKey`, or reference the URL from a freeform page design."}},"required":["id","assetKey","publicUrl"]},"MediaAssetsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/MediaAssetResponseDto"}}},"required":["rows"]},"UpdateMediaAssetDto":{"type":"object","properties":{"assetType":{"type":"string","enum":["logo","hero_image","activity_image","event_image","staff_image","community_image","testimonial_image","gallery_image","video","youtube_video","reel","document","social_post","generated_image","generated_video"]},"status":{"type":"string","enum":["pending","approved","rejected","archived"]},"title":{"type":"string","maxLength":160,"nullable":true},"description":{"type":"string","maxLength":1000,"nullable":true},"isLogo":{"type":"boolean"},"isHero":{"type":"boolean"},"isCampaignRecommended":{"type":"boolean"},"confidenceScore":{"type":"object","minimum":0,"maximum":100},"approvedFor":{"type":"array","items":{"type":"string","enum":["campaign_pages","social_media","email","whatsapp","ads"]}},"internalOnly":{"type":"boolean"}}},"CropRectDto":{"type":"object","properties":{"x":{"type":"number","minimum":0,"description":"Left edge in SOURCE pixels."},"y":{"type":"number","minimum":0,"description":"Top edge in SOURCE pixels."},"width":{"type":"number","minimum":1},"height":{"type":"number","minimum":1}},"required":["x","y","width","height"]},"NormalizedCropRectDto":{"type":"object","properties":{"x":{"type":"number","minimum":0,"maximum":1},"y":{"type":"number","minimum":0,"maximum":1},"width":{"type":"number","minimum":0,"maximum":1},"height":{"type":"number","minimum":0,"maximum":1}},"required":["x","y","width","height"]},"CropMediaAssetDto":{"type":"object","properties":{"rect":{"description":"Exact crop window in source pixels. Mutually exclusive with normalizedRect and aspectRatio.","allOf":[{"$ref":"#/components/schemas/CropRectDto"}]},"normalizedRect":{"description":"Crop window as fractions of the source dimensions. Mutually exclusive with rect and aspectRatio.","allOf":[{"$ref":"#/components/schemas/NormalizedCropRectDto"}]},"aspectRatio":{"type":"string","example":"16:9","description":"Target ratio as W:H. The largest window of this ratio that fits is used, so only one axis is ever trimmed and no resolution is invented. Mutually exclusive with rect and normalizedRect."},"normalizeOrientation":{"type":"boolean","description":"Interpret crop coordinates in the image as displayed after EXIF orientation. Defaults to false for existing clients."},"gravity":{"type":"string","enum":["center","north","south","east","west","auto"],"default":"auto","description":"Anchor for an aspectRatio crop. \"auto\" uses the analysed focal point and falls back to centre when the asset has not been analysed."},"title":{"type":"string","maxLength":160,"description":"Title for the new asset. Defaults from the source."}}},"MediaAlbumResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"albumType":{"type":"string","enum":["manual","event","program","story","smart"]},"assetCount":{"type":"number"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","albumType","assetCount","createdAt","updatedAt"]},"MediaAlbumsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/MediaAlbumResponseDto"}}},"required":["rows"]},"CreateMediaAlbumDto":{"type":"object","properties":{"name":{"type":"string","maxLength":160},"description":{"type":"string","maxLength":1000},"albumType":{"type":"string","enum":["manual","event","program","story","smart"],"default":"manual"}},"required":["name"]},"UpdateMediaAlbumDto":{"type":"object","properties":{"name":{"type":"string","maxLength":160},"description":{"type":"string","maxLength":1000,"nullable":true}}},"AddMediaAlbumItemDto":{"type":"object","properties":{"assetId":{"type":"string","format":"uuid"},"sortOrder":{"type":"number","default":0}},"required":["assetId"]},"MediaCompletenessResponseDto":{"type":"object","properties":{"hasLogo":{"type":"boolean"},"hasHeroImage":{"type":"boolean"},"hasCommunityPhotos":{"type":"boolean"},"hasVideos":{"type":"boolean"},"hasSuccessStories":{"type":"boolean"},"hasBrandAssets":{"type":"boolean"},"mediaCompletenessScore":{"type":"number","minimum":0,"maximum":100},"missing":{"type":"array","items":{"type":"string"}}},"required":["hasLogo","hasHeroImage","hasCommunityPhotos","hasVideos","hasSuccessStories","hasBrandAssets","mediaCompletenessScore","missing"]},"MediaRecommendationsResponseDto":{"type":"object","properties":{"heroImages":{"type":"array","items":{"$ref":"#/components/schemas/MediaAssetResponseDto"}},"gallery":{"type":"array","items":{"$ref":"#/components/schemas/MediaAssetResponseDto"}},"completeness":{"$ref":"#/components/schemas/MediaCompletenessResponseDto"}},"required":["heroImages","gallery","completeness"]},"HumanCapitalAnswersDto":{"type":"object","properties":{"employeeCount":{"type":"string","enum":["solo","2_5","6_20","21_plus"]},"beneficiaryCount":{"type":"string","enum":["0","1_50","51_500","500_plus"]},"formerBeneficiaryCount":{"type":"string","enum":["0","1_50","51_500","500_plus"]},"namedAmbassadorCount":{"type":"number","minimum":0,"description":"Number of people the org can name today as ambassador candidates."},"coreCommunitySplit":{"type":"string","enum":["mostly_core","mixed","mostly_peripheral"]}},"required":["employeeCount","beneficiaryCount","formerBeneficiaryCount","coreCommunitySplit"]},"TeamAnswersDto":{"type":"object","properties":{"dedicatedOwner":{"type":"boolean","description":"Is at least one staff member dedicated to the campaign?"},"weeklyHoursAvailable":{"type":"number","minimum":0,"maximum":168}},"required":["dedicatedOwner","weeklyHoursAvailable"]},"AnchorAnswersDto":{"type":"object","properties":{"hasCommittedDonor":{"type":"boolean"},"committedAmountUsd":{"type":"number","minimum":0},"isSigned":{"type":"boolean"}},"required":["hasCommittedDonor"]},"PartialDiagnosticAnswersDto":{"type":"object","properties":{"humanCapital":{"$ref":"#/components/schemas/HumanCapitalAnswersDto"},"team":{"$ref":"#/components/schemas/TeamAnswersDto"},"sector":{"type":"string","enum":["haredi","religious_zionist","educational","chesed_with_anchors","multi_branch","american_jewish","general_nonprofit"]},"anchor":{"$ref":"#/components/schemas/AnchorAnswersDto"},"urgency":{"type":"string","enum":["existential","strong_need","nice_to_have"]},"ambassadorCountBucket":{"type":"string","enum":["0_15","15_50","50_150","150_plus","unknown"]},"campaignPurpose":{"type":"string","maxLength":2000},"goalAmountMinor":{"type":"number","minimum":0},"goalCurrency":{"type":"string","enum":["USD","ILS","CAD","GBP","EUR","AUD","NZD","CHF","SEK","NOK","DKK","ZAR","BRL","MXN","ARS","UAH","RUB","INR","SGD","HKD"],"example":"ILS"},"targetDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-06-15"},"recurringIntent":{"type":"boolean","description":"True when the founder chose an ongoing monthly/recurring campaign (drives recurring_focus + year_round)."},"matcher":{"type":"string","enum":["yes_confirmed","yes_potential","no","what_is_that"]}}},"ReadinessAssessmentDto":{"type":"object","properties":{"score":{"type":"number","minimum":0,"maximum":100},"tier":{"type":"string","enum":["green","yellow","red"]},"blockers":{"type":"array","items":{"type":"string","enum":["no_dedicated_owner","too_few_named_ambassadors","no_urgency_no_beneficiaries"]}},"strengths":{"type":"array","items":{"type":"string","enum":["large_active_beneficiary_base","committed_signed_anchor","existential_urgency","rich_named_ambassador_list","core_centric_community","experienced_staff"]}},"components":{"type":"object","properties":{"humanCapital":{"type":"number"},"team":{"type":"number"},"urgency":{"type":"number"},"anchor":{"type":"number"},"ambassadorReadiness":{"type":"number"}},"additionalProperties":false}},"required":["score","tier","blockers","strengths","components"]},"OnboardingProfileDto":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"diagnosticAnswers":{"$ref":"#/components/schemas/PartialDiagnosticAnswersDto"},"readiness":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/ReadinessAssessmentDto"}]},"sector":{"type":"string","enum":["haredi","religious_zionist","educational","chesed_with_anchors","multi_branch","american_jewish","general_nonprofit"],"nullable":true},"recommendedCampaignType":{"type":"string","enum":["fast_24h","fast_36h","fast_48h","weekly","umbrella","ambassador_contest","recurring_focus","concrete_units","event_tickets"],"nullable":true},"wizardCompletedAt":{"type":"object","format":"date-time","nullable":true},"publishGateUnlockedAt":{"type":"object","format":"date-time","nullable":true},"publishGateOverrideAt":{"type":"object","format":"date-time","nullable":true},"intakeDecision":{"type":"object","nullable":true,"properties":{"fitDecision":{"type":"string","enum":["ready_now","needs_preparation","not_fit_now"]},"serviceRoute":{"type":"string","enum":["self_serve","internal_manager","subcontractor"]},"commercialRecommendation":{"type":"string","enum":["no_upfront","upfront_required","deposit_required"]},"confidence":{"type":"number","minimum":0,"maximum":1},"rationale":{"type":"array","items":{"type":"string"}},"recommendedActions":{"type":"array","items":{"type":"string"}},"requiredFollowupQuestions":{"type":"array","items":{"type":"string","enum":["named_ambassador_count","dedicated_owner","weekly_hours_available","urgency_reason","anchor_commitment","organization_number"]}},"derived":{"type":"object","properties":{"readinessTier":{"type":"string","nullable":true,"enum":["green","yellow","red"]},"readinessScore":{"type":"number","nullable":true},"complexityScore":{"type":"number","minimum":0,"maximum":1},"websiteOnly":{"type":"boolean"}}}}}},"required":["organizationId","diagnosticAnswers","readiness","sector","recommendedCampaignType","wizardCompletedAt","publishGateUnlockedAt","publishGateOverrideAt","intakeDecision"]},"RegistrationCandidateDto":{"type":"object","properties":{"country":{"type":"string"},"registryName":{"type":"string"},"registrationNumber":{"type":"string"},"confidence":{"type":"number"},"reason":{"type":"string"},"sourceUrl":{"type":"string"},"legalName":{"type":"string"},"address":{"type":"string"},"addressMatch":{"type":"string","enum":["matched","not_available"]}},"required":["country","registryName","registrationNumber","confidence"]},"RegistrationDiscoveryDto":{"type":"object","properties":{"status":{"type":"string","enum":["found","no_match","unavailable","ambiguous","not_applicable"]},"candidates":{"type":"array","items":{"$ref":"#/components/schemas/RegistrationCandidateDto"}}},"required":["status","candidates"]},"OnboardingStorageRefDto":{"type":"object","properties":{"table":{"type":"string"},"column":{"type":"string"},"jsonPath":{"type":"array","items":{"type":"string"}}},"required":["table","column"]},"OnboardingAskRuleDto":{"type":"object","properties":{"contexts":{"type":"array","items":{"type":"string","enum":["org","campaign"]}},"intents":{"type":"array","items":{"type":"string","enum":["campaign","donors","both"]}},"priority":{"type":"number","minimum":0},"mode":{"type":"string","enum":["ask","confirm","settings"]}},"required":["contexts","intents","priority","mode"]},"OnboardingFieldDto":{"type":"object","properties":{"key":{"type":"string","example":"org.intent"},"scope":{"type":"string","enum":["organization","campaign"]},"storage":{"$ref":"#/components/schemas/OnboardingStorageRefDto"},"sources":{"type":"array","items":{"type":"string","enum":["scan","user","derived","external"]}},"status":{"type":"string","enum":["missing","inferred","confirmed"]},"askKey":{"type":"string"},"impact":{"type":"string","description":"Concrete downstream code consumer. Fields without one are forbidden."},"askWhen":{"$ref":"#/components/schemas/OnboardingAskRuleDto"},"value":{"description":"Present for inferred or confirmed values. Never fabricated.","oneOf":[{"type":"string"},{"type":"boolean"},{"type":"number"},{"type":"object","additionalProperties":true}]}},"required":["key","scope","storage","sources","status","askKey","impact","askWhen"]},"OnboardingBrandColorsDto":{"type":"object","properties":{"primary":{"type":"object","nullable":true,"example":"#0f766e"},"secondary":{"type":"object","nullable":true,"example":"#f59e0b"}},"required":["primary","secondary"]},"OnboardingOrgProfileDto":{"type":"object","properties":{"orgName":{"type":"object","nullable":true},"logoUrl":{"type":"object","nullable":true},"brandColors":{"$ref":"#/components/schemas/OnboardingBrandColorsDto"},"description":{"type":"object","nullable":true},"contactEmail":{"type":"object","nullable":true,"example":"info@example.org"},"contactPhone":{"type":"object","nullable":true,"example":"+972 3 000 0000"},"backgroundColor":{"type":"object","nullable":true,"example":"#f8fafc"},"surfaceColor":{"type":"object","nullable":true,"example":"#ffffff"},"textColor":{"type":"object","nullable":true,"example":"#0f172a"},"fontFamily":{"type":"object","nullable":true,"example":"'Heebo', system-ui, sans-serif"},"sector":{"type":"string","enum":["haredi","religious_zionist","educational","chesed_with_anchors","multi_branch","american_jewish","general_nonprofit"],"nullable":true},"region":{"type":"string","enum":["IL","US","UK","CA","AU","EU","OTHER"]},"country":{"type":"object","nullable":true},"currency":{"type":"object","nullable":true,"example":"ILS"},"language":{"type":"string","example":"he"},"size":{"type":"string","enum":["MICRO","SMALL","MEDIUM","LARGE","UNKNOWN"]},"fundraisingExp":{"type":"string","enum":["HAS_CHARIDY","HAS_OTHER","HAS_NONE","UNKNOWN"]},"confidenceScore":{"type":"number","minimum":0,"maximum":1},"sectorConfidence":{"type":"number","minimum":0,"maximum":1},"flags":{"type":"array","items":{"type":"string"}},"storySignals":{"type":"array","items":{"type":"string"}}},"required":["orgName","logoUrl","brandColors","description","contactEmail","contactPhone","backgroundColor","surfaceColor","textColor","fontFamily","sector","region","country","currency","language","size","fundraisingExp","confidenceScore","sectorConfidence","flags","storySignals"]},"OnboardingRegistryEnrichmentDto":{"type":"object","properties":{"matched":{"type":"boolean"},"provider":{"type":"string"},"country":{"type":"object","nullable":true},"registrationNumber":{"type":"object","nullable":true},"legalName":{"type":"object","nullable":true},"confidence":{"type":"number","minimum":0,"maximum":1},"verificationStatus":{"type":"string","enum":["verified","probable","unverified"]}},"required":["matched","provider","country","registrationNumber","legalName","confidence","verificationStatus"]},"OnboardingWebsiteScanResponseDto":{"type":"object","properties":{"registrationDiscovery":{"$ref":"#/components/schemas/RegistrationDiscoveryDto"},"organizationFields":{"type":"array","items":{"$ref":"#/components/schemas/OnboardingFieldDto"}},"websiteUrl":{"type":"string","nullable":true},"matched":{"type":"boolean"},"inferredFromWebsite":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/OnboardingOrgProfileDto"}]},"registryEnrichment":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/OnboardingRegistryEnrichmentDto"}]}},"required":["matched","inferredFromWebsite","registryEnrichment"]},"OnboardingWebsiteScanBodyDto":{"type":"object","properties":{"refresh":{"type":"boolean","description":"Explicitly refresh a saved scan of the same website."},"websiteUrl":{"type":"string","example":"https://example.org"},"organizationNumber":{"type":"string","maxLength":80}},"required":["websiteUrl"]},"OnboardingRegistrationNumberBodyDto":{"type":"object","properties":{"registrationNumber":{"type":"string","maxLength":80,"example":"580123456","description":"Registration number the client confirmed or typed manually — Israel amuta / ע.ר., US EIN, or the equivalent registry id for the org country."}},"required":["registrationNumber"]},"ReadinessGateDecisionDto":{"type":"object","properties":{"route":{"type":"string","enum":["foundation_track","campaign_with_warnings","campaign_ready"]},"tone":{"type":"string","enum":["protective","coach","accelerate"]},"blocksCampaignCreation":{"type":"boolean"},"readiness":{"$ref":"#/components/schemas/ReadinessAssessmentDto"},"requiredActions":{"type":"array","items":{"type":"string","enum":["build_50_name_list","complete_10_personal_calls","assign_campaign_owner"]}},"mandatoryPrep":{"type":"array","items":{"type":"string","enum":["build_50_name_list","increase_owner_capacity","confirm_anchor_or_adjust_goal"]}}},"required":["route","tone","blocksCampaignCreation","readiness"]},"GoalRecommendationDto":{"type":"object","properties":{"currency":{"type":"string"},"publicGoalMinor":{"type":"number"},"internalGoalMinor":{"type":"number"},"bonusGoalMinor":{"type":"number"},"feasibility":{"type":"string","enum":["ok","goal_too_high","goal_too_low","insufficient_ambassador_base","needs_anchor_or_lower_goal"]},"minAmbassadorsNeeded":{"type":"number"},"maxRealisticAmbassadors":{"type":"number"},"averageAmbassadorRaiseMinor":{"type":"number"},"suggestedGoalMinor":{"type":"object","nullable":true},"flags":{"type":"array","items":{"type":"string"}}},"required":["currency","publicGoalMinor","internalGoalMinor","bonusGoalMinor","feasibility","minAmbassadorsNeeded","maxRealisticAmbassadors","averageAmbassadorRaiseMinor","suggestedGoalMinor","flags"]},"RaiseEstimateDto":{"type":"object","properties":{"lowMinor":{"type":"number"},"midMinor":{"type":"number"},"highMinor":{"type":"number"},"goalFeasibility":{"type":"string","enum":["FEASIBLE","STRETCH"]}},"required":["lowMinor","midMinor","highMinor","goalFeasibility"]},"CalendarValidationDto":{"type":"object","properties":{"hardBlocked":{"type":"boolean"},"date":{"type":"string"},"reason":{"type":"string","enum":["shabbat","rosh_hashanah","yom_kippur","sukkot_first_days","sukkot_last_days","pesach_first_days","pesach_last_days","shavuot"],"nullable":true},"eventName":{"type":"object","nullable":true},"safeAlternatives":{"type":"array","items":{"type":"string"}},"weeksOk":{"type":"boolean"},"dayScore":{"type":"number"},"softWarnings":{"type":"array","items":{"type":"string"}},"timingScore":{"type":"number"}},"required":["hardBlocked","date","reason","eventName","safeAlternatives"]},"DonationLevelSeedDto":{"type":"object","properties":{"amountMinor":{"type":"number"},"labelKey":{"type":"string"}},"required":["amountMinor","labelKey"]},"HatramaRecommendationDto":{"type":"object","properties":{"recommended":{"type":"boolean"},"inviteeTarget":{"type":"number"},"commitmentTarget":{"type":"number"}},"required":["recommended","inviteeTarget","commitmentTarget"]},"MessageKitSeedDto":{"type":"object","properties":{"moments":{"type":"array","items":{"type":"string"}},"audienceVariants":{"type":"array","items":{"type":"string"}}},"required":["moments","audienceVariants"]},"BuilderDraftSeedDto":{"type":"object","properties":{"headlineKey":{"type":"string"},"storyKey":{"type":"string"},"ctaKey":{"type":"string"}},"required":["headlineKey","storyKey","ctaKey"]},"OnboardingNextTaskDto":{"type":"object","properties":{"id":{"type":"string"},"titleKey":{"type":"string"},"priority":{"type":"number"},"dueOffsetDays":{"type":"number"},"blockedBy":{"type":"array","items":{"type":"string"}}},"required":["id","titleKey","priority","dueOffsetDays","blockedBy"]},"OnboardingRecommendationDto":{"type":"object","properties":{"readinessGate":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/ReadinessGateDecisionDto"}]},"campaignType":{"type":"string","enum":["fast_24h","fast_36h","fast_48h","weekly","umbrella","ambassador_contest","recurring_focus","concrete_units","event_tickets"],"nullable":true},"durationHours":{"type":"number"},"goal":{"$ref":"#/components/schemas/GoalRecommendationDto"},"raiseEstimate":{"$ref":"#/components/schemas/RaiseEstimateDto"},"calendar":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/CalendarValidationDto"}]},"suggestedDonationLevels":{"type":"array","items":{"$ref":"#/components/schemas/DonationLevelSeedDto"}},"hatrama":{"$ref":"#/components/schemas/HatramaRecommendationDto"},"messageKitSeed":{"$ref":"#/components/schemas/MessageKitSeedDto"},"builderDraftSeed":{"$ref":"#/components/schemas/BuilderDraftSeedDto"},"nextTasks":{"type":"array","items":{"$ref":"#/components/schemas/OnboardingNextTaskDto"}}},"required":["readinessGate","campaignType","durationHours","goal","raiseEstimate","calendar","suggestedDonationLevels","hatrama","messageKitSeed","builderDraftSeed","nextTasks"]},"OnboardingStoryDraftBodyDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid","description":"Use this campaign purpose rather than a previous organization diagnostic."},"hint":{"type":"string","description":"Optional free-text hint from the user (what the campaign is for). Blended into the draft when present.","maxLength":2000},"locale":{"type":"string","description":"Preferred draft language. Falls back to the org's inferred language, then Hebrew.","enum":["he","en"]}}},"OnboardingStoryDraftResponseDto":{"type":"object","properties":{"draft":{"type":"string","description":"A ready-to-edit, first-person campaign story draft in the requested language. Never empty.","example":"אנחנו מפעילים מחנה קיץ לילדים בסיכון, והשנה אנחנו מגייסים כדי להעניק מלגות ל-40 ילדים נוספים..."},"campaignName":{"type":"string","maxLength":70,"description":"A separate, concise, editable campaign title grounded in the same context."},"source":{"type":"string","description":"Where the draft came from: 'llm' when the model authored it, 'fallback' when a deterministic template was used (LLM disabled/unavailable).","enum":["llm","fallback"]}},"required":["draft","campaignName","source"]},"OnboardingStoryImproveBodyDto":{"type":"object","properties":{"text":{"type":"string","maxLength":20000,"description":"The About text the person wrote, as the editor holds it (HTML) or plain text. It is rewritten, never replaced by invented copy."},"tone":{"type":"string","enum":["warm","moving","formal","urgent","simple"],"description":"Writing tone. Default: warm."},"audience":{"type":"string","enum":["familiar","new","major_donors"],"description":"Who reads it. Default: new (people who do not know the organization)."},"mode":{"type":"string","enum":["improve","expand","shorten","restructure"],"description":"What to do with the text. improve (default): rewrite in the chosen tone/audience. expand: a longer, richer text that elaborates only on what is written (never adds facts; at least 1.25x, at most 2.2x the original and 400 words). shorten: at most about three quarters of the length, keeping every number, name and the request to the reader. restructure: the same content re-ordered and re-organised (subheadings, lists), with minimal rewording."},"locale":{"type":"string","enum":["he","en"],"deprecated":true,"description":"Ignored. The output is always in the language of the original text (a text is never translated)."}},"required":["text"]},"OnboardingStoryImproveResponseDto":{"type":"object","properties":{"source":{"type":"string","enum":["llm","unavailable"],"description":"\"llm\" when the model rewrote the text; \"unavailable\" when it could not (see `reason`). In that case the original text is untouched."},"improved":{"type":"string","nullable":true,"description":"The rewritten text as safe HTML (p, h1-h3, strong, em, ul, ol, li, br; text-align kept), or null when unavailable."},"reason":{"type":"string","enum":["too_short","llm_disabled","failed","unsafe","incomplete","unchanged","wrong_length","rate_limited"],"description":"Why no rewrite was returned."},"removedIdentifierKinds":{"description":"Kinds of personal identifiers removed from the text before it was sent to the model.","type":"array","items":{"type":"string"}}},"required":["source","improved"]},"CreateCampaignOnboardingDraftBodyDto":{"type":"object","properties":{"startNew":{"type":"boolean","description":"true = the person explicitly chose to start a NEW campaign instead of continuing their latest unfinished draft. Omitted/false continues that draft."}}},"CreateCampaignOnboardingDraftResponseDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"organizationCurrency":{"type":"string","enum":["USD","ILS","CAD","GBP","EUR","AUD","NZD","CHF","SEK","NOK","DKK","ZAR","BRL","MXN","ARS","UAH","RUB","INR","SGD","HKD"],"example":"USD"},"organizationFields":{"type":"array","items":{"$ref":"#/components/schemas/OnboardingFieldDto"}}},"required":["campaignId","organizationCurrency","organizationFields"]},"CampaignOnboardingCoreDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":280},"campaignPurpose":{"type":"string","nullable":true,"maxLength":4000},"goalAmountMinor":{"type":"number","nullable":true,"minimum":1},"currency":{"type":"string","enum":["USD","ILS","CAD","GBP","EUR","AUD","NZD","CHF","SEK","NOK","DKK","ZAR","BRL","MXN","ARS","UAH","RUB","INR","SGD","HKD"],"example":"USD"},"startDate":{"type":"string","format":"date-time","nullable":true},"endDate":{"type":"string","format":"date-time","nullable":true},"acceptDonationsUntil":{"type":"string","format":"date-time","nullable":true},"recurringIntent":{"type":"boolean","nullable":true},"timezone":{"type":"string","nullable":true,"example":"Asia/Jerusalem"}},"required":["campaignId","name","currency"]},"PatchCampaignOnboardingCoreDto":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":280},"campaignPurpose":{"type":"string","maxLength":4000},"goalAmountMinor":{"type":"number","minimum":1,"description":"Campaign goal in minor units."},"currency":{"type":"string","enum":["USD","ILS","CAD","GBP","EUR","AUD","NZD","CHF","SEK","NOK","DKK","ZAR","BRL","MXN","ARS","UAH","RUB","INR","SGD","HKD"],"example":"USD"},"timezone":{"type":"string","maxLength":64,"example":"Asia/Jerusalem","description":"The IANA timezone in which the supplied campaign schedule was resolved."},"startDate":{"type":"string","description":"ISO instant, local date-time, or calendar day."},"endDate":{"type":"string","description":"ISO instant, local date-time, or calendar day."},"acceptDonationsUntil":{"type":"string","description":"Must be on or after endDate. Defaults to endDate itself (donations stop at the end date); send a later value, up to one calendar month after endDate, to keep donations open."},"recurringIntent":{"type":"boolean","description":"One-time (false) or ongoing monthly support (true)."},"yearRound":{"type":"boolean","description":"Make the draft a year-round campaign (kind = year_round: no end date, no donation window), or `false` to make it a classic time-boxed campaign. Independent of `recurringIntent` (the monthly-support choice), which this never touches. `true` clears any stored end/acceptance dates and is rejected together with `endDate` or `acceptDonationsUntil`."},"allowExtendedDonationWindow":{"type":"boolean","description":"Set when the organization chose to keep donations open past one month after endDate, up to five years. Longer than five years still requires a platform admin."}}},"CampaignStoryProfileResponseDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"journeyId":{"type":"string","format":"uuid"},"profile":{"$ref":"#/components/schemas/CampaignStoryProfileDto"},"removedIdentifierKinds":{"type":"array","items":{"type":"string","enum":["email","phone","national_id","iban","bank_account","bank_branch","card_number"]}},"nextInstruction":{"type":"string","description":"Exact next MCP-safe action; proposal approval always precedes generation."}},"required":["campaignId","journeyId","profile","removedIdentifierKinds","nextInstruction"]},"ExtractCampaignStoryProfileBodyDto":{"type":"object","properties":{"text":{"type":"string","maxLength":8000,"description":"The one free-text answer, in the client’s own words."}},"required":["text"]},"ConfirmCampaignStoryProfileBodyDto":{"type":"object","properties":{"crowdShape":{"type":"string","enum":["mass","major_partners","hybrid"]},"whyNow":{"type":"string","maxLength":4000},"protagonist":{"type":"string","maxLength":4000},"audienceWarmth":{"type":"string","enum":["familiar","mixed","strangers"]},"donorExchange":{"type":"string","enum":["recognition","belonging","rewards","pure_charity"]},"emotionalRegister":{"type":"string","enum":["rescue","growth","celebration","memorial"]}}},"CampaignProposalTierDto":{"type":"object","properties":{"amountMinor":{"type":"number","minimum":1,"description":"Donation amount in campaign minor units."},"label":{"type":"string","maxLength":120},"subtitle":{"type":"string","nullable":true,"maxLength":160},"colorHex":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"imageAssetKey":{"type":"string","nullable":true,"maxLength":512,"description":"Media library asset key of the image shown on this donation button. Null clears it; omitted keeps the earlier one."},"recurringMonths":{"type":"number","nullable":true,"minimum":2,"maximum":36,"description":"When set, this button is that amount each month for this many months (shown as ×N). Null or omitted is a one-time gift."}},"required":["amountMinor","label"]},"CampaignProposalBoostersDto":{"type":"object","properties":{"matchingDonor":{"type":"boolean","description":"Is there a donor who will match every gift?"},"communityFundraising":{"type":"boolean","description":"Friends or community who will fundraise for you?"},"bannerImage":{"type":"boolean","description":"A banner image the team has to upload?"}},"required":["matchingDonor","communityFundraising","bannerImage"]},"CampaignProposalMatcherDto":{"type":"object","properties":{"name":{"type":"string","maxLength":120,"description":"The matching donor or sponsor name."},"coefficient":{"type":"string","example":"2.0000","description":"Total gift multiplier (2 = 2X)."},"maxPoolMinor":{"type":"number","format":"int64","minimum":1},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"}},"required":["name","coefficient","maxPoolMinor","startsAt","endsAt"]},"CampaignGenerationProposalDto":{"type":"object","properties":{"tiers":{"type":"array","items":{"$ref":"#/components/schemas/CampaignProposalTierDto"}},"boosters":{"$ref":"#/components/schemas/CampaignProposalBoostersDto"},"matcher":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/CampaignProposalMatcherDto"}]},"videoUrl":{"type":"string","nullable":true,"maxLength":2048,"description":"Optional HTTPS YouTube, Vimeo, or direct video-file URL for the campaign hero."},"templateKey":{"type":"string","nullable":true,"enum":["general","bold","subtle","network","donation"],"description":"Selected campaign-page template. New proposals default to network."},"templateOptions":{"type":"array","description":"Installed campaign-page template catalog ids.","items":{"type":"string","enum":["general","bold","subtle","network","donation"]}},"kitKey":{"type":"string","nullable":true,"enum":["giving-day-urgent","school-giving-day","personal-rescue","emergency-relief","bright-futures"],"description":"Optional persona kit applied when the approved campaign is built. New proposals leave this unset so the selected template is used; omitted updates preserve the saved choice."},"kitOptions":{"type":"array","description":"Installed cause-specific persona-kit catalog ids.","items":{"type":"string","enum":["giving-day-urgent","school-giving-day","personal-rescue","emergency-relief","bright-futures"]}},"status":{"type":"string","enum":["draft","approved"]},"approvedAt":{"type":"string","nullable":true,"format":"date-time"}},"required":["tiers","boosters","templateOptions","kitOptions","status"]},"CampaignGenerationProposalResponseDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"journeyId":{"type":"string","format":"uuid"},"proposal":{"$ref":"#/components/schemas/CampaignGenerationProposalDto"},"nextInstruction":{"type":"string","description":"Exact next MCP-safe action based on proposal approval status."}},"required":["campaignId","journeyId","proposal","nextInstruction"]},"SaveCampaignGenerationProposalBodyDto":{"type":"object","properties":{"tiers":{"type":"array","items":{"$ref":"#/components/schemas/CampaignProposalTierDto"}},"boosters":{"$ref":"#/components/schemas/CampaignProposalBoostersDto"},"matcher":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/CampaignProposalMatcherDto"}]},"videoUrl":{"type":"string","nullable":true,"maxLength":2048,"description":"Optional HTTPS YouTube, Vimeo, or direct video-file URL for the campaign hero."},"templateKey":{"type":"string","nullable":true,"enum":["general","bold","subtle","network","donation"]},"kitKey":{"type":"string","nullable":true,"enum":["giving-day-urgent","school-giving-day","personal-rescue","emergency-relief","bright-futures"]}},"required":["tiers","boosters"]},"ApprovedCampaignGenerationPlanResponseDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"storyProfile":{"$ref":"#/components/schemas/CampaignStoryProfileDto"},"approvedTiers":{"type":"array","items":{"$ref":"#/components/schemas/CampaignProposalTierDto"}},"boosters":{"$ref":"#/components/schemas/CampaignProposalBoostersDto"},"matcher":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/CampaignProposalMatcherDto"}]},"videoUrl":{"type":"string","nullable":true,"description":"Approved campaign hero video URL."},"goalAmountMinor":{"type":"number","nullable":true,"minimum":1},"currency":{"type":"string","example":"USD"},"nextInstruction":{"type":"string","description":"Agent instruction: the approved plan is authoritative, while page authoring may use the agent model and saveCampaignDesignDraft."}},"required":["campaignId","storyProfile","approvedTiers","boosters","currency","nextInstruction"]},"AutoCreateCampaignBodyDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid","description":"The draft created when the unified campaign-onboarding flow opened. Required because generation is proposal-gated per campaign."},"locale":{"type":"string","description":"The onboarding session's own active locale (the `/he/` vs `/en/` route the client is on). Used to name/localize the auto-generated campaign when the org has no preferredLocale/country signal yet (CHAR-101) — a resolvable org/user locale still wins.","enum":["he","en"]}},"required":["campaignId"]},"AutoCreateCampaignGuardResponseDto":{"type":"object","properties":{"accepted":{"type":"boolean"},"campaignId":{"type":"string","format":"uuid"},"campaignSlug":{"type":"string"},"recommendation":{"$ref":"#/components/schemas/OnboardingRecommendationDto"},"generationEnqueued":{"type":"boolean","description":"True when this request enqueued or re-enqueued asynchronous AI page generation."},"pageGenerationStatus":{"type":"string","enum":["pending","ready","failed","skipped_llm_disabled"],"description":"Snapshot of the draft page-generation state immediately after auto-create."},"reusedExistingDraft":{"type":"boolean","description":"True when an already-generated onboarding draft was reused instead of re-queued."},"nextInstruction":{"type":"string","description":"Exact next MCP-safe action after this generation request."}},"required":["accepted","recommendation","nextInstruction"]},"HatramaInviteeDto":{"type":"object","properties":{"name":{"type":"string","maxLength":160},"email":{"type":"string","maxLength":320},"phoneE164":{"type":"string","maxLength":32},"status":{"type":"string","enum":["draft","invited","accepted","declined","no_response"]}},"required":["name","status"]},"HatramaInvitationCountsDto":{"type":"object","properties":{"draft":{"type":"number"},"invited":{"type":"number"},"accepted":{"type":"number"},"declined":{"type":"number"},"noResponse":{"type":"number"}},"required":["draft","invited","accepted","declined","noResponse"]},"HatramaInvitationManagerDto":{"type":"object","properties":{"eventDateTime":{"type":"object","nullable":true},"location":{"type":"object","nullable":true},"zoomUrl":{"type":"object","nullable":true},"invitees":{"type":"array","items":{"$ref":"#/components/schemas/HatramaInviteeDto"}},"counts":{"$ref":"#/components/schemas/HatramaInvitationCountsDto"},"whatsappTemplate":{"type":"string"},"emailSubject":{"type":"string"},"emailBody":{"type":"string"}},"required":["eventDateTime","location","zoomUrl","invitees","counts","whatsappTemplate","emailSubject","emailBody"]},"SaveHatramaInvitationManagerDto":{"type":"object","properties":{"eventDateTime":{"type":"string","maxLength":80},"location":{"type":"string","maxLength":240},"zoomUrl":{"type":"string","maxLength":500},"invitees":{"type":"array","items":{"$ref":"#/components/schemas/HatramaInviteeDto"}}},"required":["eventDateTime","invitees"]},"PublishGateMissingItemDto":{"type":"object","properties":{"stepKey":{"type":"string","enum":["story_extraction","ambassador_list","activation_event","matcher_decision","comms_templates","gateway","pre_campaign.import_contacts","pre_campaign.contacts","pre_campaign.inner_circle","pre_campaign.activation","pre_campaign.anchor"]},"reasonCode":{"type":"string","enum":["step_incomplete"]}},"required":["stepKey","reasonCode"]},"OnboardingCampaignPipelineStatusDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"campaignSlug":{"type":"string"},"campaignStatus":{"type":"string","enum":["draft","pending_approval","active","paused","ended","completed","archived"]},"pageGenerationStatus":{"type":"string","enum":["pending","ready","failed","skipped_llm_disabled"]},"pageGenerationSource":{"type":"object","nullable":true,"description":"Source recorded in draft_settings.meta.source."},"draftUpdatedAt":{"type":"string","format":"date-time"},"levelsSeeded":{"type":"boolean"},"previewAvailable":{"type":"boolean"},"designPublished":{"type":"boolean"},"publishGateUnlocked":{"type":"boolean"},"missingPublishSteps":{"type":"array","items":{"$ref":"#/components/schemas/PublishGateMissingItemDto"}},"requiredCapabilitiesSatisfied":{"type":"boolean","description":"True when the generated freeform draft has non-empty html/css and passes the required page-engine capabilities."},"contentGenerated":{"type":"boolean","description":"True when generated draft content is present; false while the placeholder is still pending."},"mediaPresent":{"type":"boolean","description":"True when the generated draft includes media capability or image markup."},"mobileOptimized":{"type":"boolean","description":"True when the page is generated and passed the page-engine validation gate."},"progressPercent":{"type":"number","minimum":0,"maximum":100,"description":"Completion of real pipeline milestones; never elapsed-time based."},"paymentsConnected":{"type":"boolean","description":"True when the organization has at least one active payment acquirer, i.e. a published page could actually collect a donation. False means the page can still be published and shared — only real donations wait for a connected payment account."}},"required":["campaignId","campaignSlug","campaignStatus","pageGenerationStatus","draftUpdatedAt","levelsSeeded","previewAvailable","designPublished","publishGateUnlocked","missingPublishSteps","requiredCapabilitiesSatisfied","contentGenerated","mediaPresent","mobileOptimized","progressPercent","paymentsConnected"]},"ApplyContentBriefRequestDto":{"type":"object","properties":{"storyAngle":{"type":"string","description":"The core story angle the brain recommends the page lead with."},"headlineOptions":{"description":"1-3 proposed headline phrasings.","type":"array","items":{"type":"string"}},"keyMessages":{"description":"1-5 key messages the copy should carry.","type":"array","items":{"type":"string"}},"toneWords":{"description":"1-6 tone words (mapped to the page-engine tone).","type":"array","items":{"type":"string"}},"ctaText":{"type":"string"},"donorPromise":{"type":"string"},"directions":{"description":"Up to 3 ranked campaign directions.","type":"array","items":{"$ref":"#/components/schemas/CampaignDirectionDto"}},"chosenDirectionId":{"type":"string","description":"Chosen direction id (defaults to the first)."},"openQuestions":{"description":"Questions the brain still wants to ask the client.","type":"array","items":{"type":"string"}},"relatedActionKey":{"type":"string","enum":["ask_for_website","confirm_org_profile","ask_for_campaign_goal","ask_reason_why_now","collect_first_10_people","collect_50_name_list","classify_people","identify_core_team","identify_major_donor_candidates","calculate_goal_range","design_donation_ladder","recommend_campaign_type","plan_activation_event","create_ambassador_targets","generate_messaging_pack","build_campaign_page","check_payment_infrastructure","run_launch_readiness_check","start_soft_launch","monitor_live_campaign","generate_post_campaign_report","ask_human_advisor_review","start_next_campaign_journey"]},"sourceSignals":{"description":"State signals the brief was grounded in.","type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["gathering","proposed","ready"],"description":"Conversation state; only \"ready\" is safe to apply to a page."}},"required":["storyAngle","headlineOptions","keyMessages","toneWords","status"]},"ApplyContentBriefResponseDto":{"type":"object","properties":{"campaignId":{"type":"string"},"campaignSlug":{"type":"string"},"generationEnqueued":{"type":"boolean","description":"Always true — page (re)generation was enqueued from the brief."}},"required":["campaignId","campaignSlug","generationEnqueued"]},"SetupHubStepDto":{"type":"object","properties":{"stepKey":{"type":"string","enum":["story_extraction","ambassador_list","activation_event","matcher_decision","comms_templates","gateway","pre_campaign.import_contacts","pre_campaign.contacts","pre_campaign.inner_circle","pre_campaign.activation","pre_campaign.anchor"]},"titleKey":{"type":"string"},"bodyKey":{"type":"string"},"kbAnchor":{"type":"string"},"requiredForFirstCampaign":{"type":"boolean"},"track":{"type":"string","enum":["main","pre_campaign"]},"completed":{"type":"boolean"},"completedAt":{"type":"object","format":"date-time","nullable":true}},"required":["stepKey","titleKey","bodyKey","kbAnchor","requiredForFirstCampaign","track","completed","completedAt"]},"SetupHubDto":{"type":"object","properties":{"steps":{"type":"array","items":{"$ref":"#/components/schemas/SetupHubStepDto"}},"completionPercent":{"type":"number","minimum":0,"maximum":100},"track":{"type":"string","enum":["main","pre_campaign"]}},"required":["steps","completionPercent","track"]},"NextMissingFieldsResponseDto":{"type":"object","properties":{"context":{"type":"string","enum":["org","campaign"]},"fields":{"type":"array","items":{"$ref":"#/components/schemas/OnboardingFieldDto"}},"complete":{"type":"boolean"},"nextInstruction":{"type":"string","description":"Agent-grade instruction for the next safe action."}},"required":["context","fields","complete","nextInstruction"]},"AnswerOnboardingFieldBodyDto":{"type":"object","properties":{"value":{"description":"The user-provided value. The field registry applies field-specific validation.","oneOf":[{"type":"string"},{"type":"boolean"},{"type":"number"},{"type":"object","additionalProperties":true}]}},"required":["value"]},"OnboardingFieldMutationResponseDto":{"type":"object","properties":{"field":{"$ref":"#/components/schemas/OnboardingFieldDto"},"nextInstruction":{"type":"string","description":"Agent-grade instruction after the mutation."}},"required":["field","nextInstruction"]},"SetupTaskDto":{"type":"object","properties":{"key":{"type":"string","enum":["dashboard.intent","dashboard.previous_system","dashboard.learn_org","dashboard.confirm_profile","dashboard.invite_teammate","dashboard.review_data","contacts.import","contacts.segment","donations.review","donations.connect_gateway","comms.verify_sender","comms.send_first_broadcast","campaigns.create","campaigns.review_build","campaigns.publish","campaigns.share"]},"area":{"type":"string","enum":["dashboard","contacts","donations","campaigns","comms","ambassadors"]},"titleKey":{"type":"string","description":"i18n key for the task title (English is the source copy)."},"bodyKey":{"type":"string","description":"i18n key for the one-line task body."},"ctaRoute":{"type":"string","description":"Dashboard route that lets the person do this task."},"completed":{"type":"boolean"},"completionSource":{"type":"string","enum":["auto","manual","none"],"description":"How this task's truth was established: `auto` = observed from the organization's own state, `manual` = a completion the system cannot observe, `none` = still open."},"dismissed":{"type":"boolean","description":"The organization said this task is not relevant to them."},"dismissible":{"type":"boolean"},"locked":{"type":"boolean","description":"Requires a plan the organization does not have — show an upgrade prompt, don't hide it."},"checklistVisible":{"type":"boolean","description":"False for tutorial-only navigation and acknowledgement tasks."},"honestNoteKey":{"type":"string","description":"i18n key for an honest caveat about what is not live yet (e.g. Stripe is not yet available while the platform account is being opened). Present only when such a caveat exists."}},"required":["key","area","titleKey","bodyKey","ctaRoute","completed","completionSource","dismissed","dismissible","locked","checklistVisible"]},"SetupAreaSummaryDto":{"type":"object","properties":{"area":{"type":"string","enum":["dashboard","contacts","donations","campaigns","comms","ambassadors"]},"total":{"type":"number"},"completed":{"type":"number"},"completionPercent":{"type":"number","minimum":0,"maximum":100}},"required":["area","total","completed","completionPercent"]},"SetupTourStopDto":{"type":"object","properties":{"taskKey":{"type":"string","enum":["dashboard.intent","dashboard.previous_system","dashboard.learn_org","dashboard.confirm_profile","dashboard.invite_teammate","dashboard.review_data","contacts.import","contacts.segment","donations.review","donations.connect_gateway","comms.verify_sender","comms.send_first_broadcast","campaigns.create","campaigns.review_build","campaigns.publish","campaigns.share"],"description":"Setup task whose server-derived completion state closes this tour stop."},"variant":{"type":"string","enum":["crm","both","campaign"],"description":"Intent-specific tour sequence this stop belongs to."},"order":{"type":"number","minimum":0,"description":"Zero-based position of this stop within its tour variant."},"kind":{"type":"string","enum":["do","look"],"description":"`look` explains a real surface; `do` asks the person to use its real control."},"route":{"type":"string","description":"Dashboard route containing the real target control."},"targetKeys":{"description":"Ordered `data-system-tour-target` keys; later entries are fallbacks when an earlier target is absent.","type":"array","items":{"type":"string"}},"titleKey":{"type":"string","description":"i18n key for the tour-stop title."},"bodyKey":{"type":"string","description":"i18n key for the tour-stop explanation or instruction."},"actionKey":{"type":"string","description":"Optional i18n key for the action label shown by the tour."},"completed":{"type":"boolean","description":"True when the owning setup task is complete from real state."},"dismissed":{"type":"boolean","description":"True when the organization dismissed the owning setup task."},"dismissible":{"type":"boolean","description":"Whether the owning setup task may be dismissed as not applicable."}},"required":["taskKey","variant","order","kind","route","targetKeys","titleKey","bodyKey","completed","dismissed","dismissible"]},"SetupTourDto":{"type":"object","properties":{"variant":{"type":"string","enum":["crm","both","campaign"]},"stops":{"type":"array","items":{"$ref":"#/components/schemas/SetupTourStopDto"}},"activeStop":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/SetupTourStopDto"}]},"skipped":{"type":"boolean"}},"required":["variant","stops","activeStop","skipped"]},"SetupTasksResponseDto":{"type":"object","properties":{"tasks":{"description":"Tasks, filtered by `area` when one was requested.","type":"array","items":{"$ref":"#/components/schemas/SetupTaskDto"}},"globalTasks":{"description":"The rows the global dashboard card shows, ordered by intent: the already-earned item first, then the most urgent open work.","type":"array","items":{"$ref":"#/components/schemas/SetupTaskDto"}},"areaSummaries":{"description":"Whole-organization progress per area.","type":"array","items":{"$ref":"#/components/schemas/SetupAreaSummaryDto"}},"completionPercent":{"type":"number","minimum":0,"maximum":100},"intent":{"type":"string","enum":["campaign","donors","both"],"nullable":true,"description":"What the organization said brought them here; null when unanswered."},"intentSkipped":{"type":"boolean","description":"Whether the organization explicitly skipped the intent question and accepted campaign-first ordering."},"effectiveIntent":{"type":"string","enum":["campaign","donors","both"],"description":"The intent actually used for ordering (campaign-first when unanswered)."},"tour":{"$ref":"#/components/schemas/SetupTourDto"}},"required":["tasks","globalTasks","areaSummaries","completionPercent","intent","intentSkipped","effectiveIntent","tour"]},"SkipSetupTourBodyDto":{"type":"object","properties":{"variant":{"type":"string","enum":["crm","both","campaign"]}},"required":["variant"]},"SkipSetupTourResponseDto":{"type":"object","properties":{"variant":{"type":"string","enum":["crm","both","campaign"]},"skippedAt":{"type":"string","format":"date-time"}},"required":["variant","skippedAt"]},"SetupTaskCompletionResponseDto":{"type":"object","properties":{"taskKey":{"type":"string","enum":["dashboard.intent","dashboard.previous_system","dashboard.learn_org","dashboard.confirm_profile","dashboard.invite_teammate","dashboard.review_data","contacts.import","contacts.segment","donations.review","donations.connect_gateway","comms.verify_sender","comms.send_first_broadcast","campaigns.create","campaigns.review_build","campaigns.publish","campaigns.share"]},"completedAt":{"type":"string","format":"date-time"}},"required":["taskKey","completedAt"]},"SetupTaskDismissalResponseDto":{"type":"object","properties":{"taskKey":{"type":"string","enum":["dashboard.intent","dashboard.previous_system","dashboard.learn_org","dashboard.confirm_profile","dashboard.invite_teammate","dashboard.review_data","contacts.import","contacts.segment","donations.review","donations.connect_gateway","comms.verify_sender","comms.send_first_broadcast","campaigns.create","campaigns.review_build","campaigns.publish","campaigns.share"]},"dismissedAt":{"type":"string","format":"date-time"}},"required":["taskKey","dismissedAt"]},"SetupIntentResponseDto":{"type":"object","properties":{"intent":{"type":"string","enum":["campaign","donors","both"],"nullable":true}},"required":["intent"]},"SetupIntentBodyDto":{"type":"object","properties":{"intent":{"type":"string","enum":["campaign","donors","both"],"description":"What brought the organization here. Orders the checklist only — it never blocks navigation or hides a capability."}},"required":["intent"]},"SkipSetupIntentResponseDto":{"type":"object","properties":{"intentSkipped":{"type":"boolean"},"skippedAt":{"type":"string","format":"date-time"}},"required":["intentSkipped","skippedAt"]},"CompleteSetupStepBodyDto":{"type":"object","properties":{"payload":{"type":"object","description":"Step-specific payload (e.g. story-extraction text, ambassador list count).","additionalProperties":true}}},"CompleteSetupStepResponseDto":{"type":"object","properties":{"stepKey":{"type":"string","enum":["story_extraction","ambassador_list","activation_event","matcher_decision","comms_templates","gateway","pre_campaign.import_contacts","pre_campaign.contacts","pre_campaign.inner_circle","pre_campaign.activation","pre_campaign.anchor"]},"completedAt":{"type":"string","format":"date-time"},"unlockedPublishGate":{"type":"boolean","description":"True iff this completion unlocked the publish gate."}},"required":["stepKey","completedAt","unlockedPublishGate"]},"PreCampaignContactsCheckpointDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"stage":{"type":"string","enum":["inner-circle","rapid-classify","core-temporary","summary"]},"rapidIndex":{"type":"number","minimum":0},"classifiedCount":{"type":"number","minimum":0},"progressPercent":{"type":"number","minimum":0,"maximum":100},"remainingCount":{"type":"number","minimum":0},"totalCount":{"type":"number","minimum":0},"lockedInnerCircleCount":{"type":"number","minimum":0},"updatedAt":{"type":"string","format":"date-time"},"updatedByUserId":{"type":"string","format":"uuid"}},"required":["campaignId","stage","rapidIndex","classifiedCount","progressPercent","remainingCount","totalCount","lockedInnerCircleCount","updatedAt","updatedByUserId"]},"PreCampaignContactsCheckpointResponseDto":{"type":"object","properties":{"checkpoint":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/PreCampaignContactsCheckpointDto"}]}},"required":["checkpoint"]},"SavePreCampaignContactsCheckpointBodyDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"stage":{"type":"string","enum":["inner-circle","rapid-classify","core-temporary","summary"]},"rapidIndex":{"type":"number","minimum":0},"classifiedCount":{"type":"number","minimum":0},"progressPercent":{"type":"number","minimum":0,"maximum":100},"remainingCount":{"type":"number","minimum":0},"totalCount":{"type":"number","minimum":0},"lockedInnerCircleCount":{"type":"number","minimum":0}},"required":["campaignId","stage","rapidIndex","classifiedCount","progressPercent","remainingCount","totalCount","lockedInnerCircleCount"]},"WizardCheckpointDto":{"type":"object","properties":{"step":{"type":"string","enum":["welcome","understand","goal","schedule","refine","style","generating","ready"]},"websiteUrl":{"type":"string","maxLength":2048},"scanSeeded":{"type":"boolean","description":"True once the website scan produced usable signals."},"websiteScanStatus":{"type":"string","enum":["succeeded","failed","skipped"],"description":"Terminal website scan result; failed is persisted so resume never hangs on analyzing."},"goalAmountMinor":{"type":"number"},"goalCurrency":{"type":"string","minLength":3,"maxLength":3},"goalChoice":{"type":"string","maxLength":64},"styleChoice":{"type":"string","maxLength":64},"showRefine":{"type":"boolean"},"campaignId":{"type":"string","format":"uuid"},"updatedAt":{"type":"string","format":"date-time"},"updatedByUserId":{"type":"string","format":"uuid"}},"required":["step","updatedAt","updatedByUserId"]},"WizardCheckpointResponseDto":{"type":"object","properties":{"checkpoint":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/WizardCheckpointDto"}]}},"required":["checkpoint"]},"SaveWizardCheckpointBodyDto":{"type":"object","properties":{"step":{"type":"string","enum":["welcome","understand","goal","schedule","refine","style","generating","ready"]},"websiteUrl":{"type":"string","maxLength":2048},"scanSeeded":{"type":"boolean","description":"True once the website scan produced usable signals."},"websiteScanStatus":{"type":"string","enum":["succeeded","failed","skipped"],"description":"Terminal website scan result; failed is persisted so resume never hangs on analyzing."},"goalAmountMinor":{"type":"number"},"goalCurrency":{"type":"string","minLength":3,"maxLength":3},"goalChoice":{"type":"string","maxLength":64},"styleChoice":{"type":"string","maxLength":64},"showRefine":{"type":"boolean"},"campaignId":{"type":"string","format":"uuid"}},"required":["step"]},"CompleteWizardResponseDto":{"type":"object","properties":{"wizardCompletedAt":{"type":"string","format":"date-time","nullable":true,"description":"When the wizard was first completed. Unchanged on repeat calls — the earliest timestamp wins."}},"required":["wizardCompletedAt"]},"CoachTipDto":{"type":"object","properties":{"id":{"type":"string"},"screen":{"type":"string","enum":["dashboard.home","setup_hub.home","setup_hub.story_extraction","setup_hub.ambassador_list","setup_hub.activation_event","setup_hub.matcher_decision","campaigns.builder.goal","campaigns.builder.dates","campaigns.builder.ambassadors","contacts.list","pre_campaign_track.home"]},"titleKey":{"type":"string"},"bodyKey":{"type":"string"},"anchor":{"type":"string"},"priority":{"type":"number"},"kbAnchor":{"type":"string"},"audience":{"type":"object","additionalProperties":false,"properties":{"tiers":{"type":"array","items":{"type":"string","enum":["green","yellow","red"]}},"sectors":{"type":"array","items":{"type":"string","enum":["haredi","religious_zionist","educational","chesed_with_anchors","multi_branch","american_jewish","general_nonprofit"]}}}}},"required":["id","screen","titleKey","bodyKey","priority","kbAnchor"]},"CoachTipsResponseDto":{"type":"object","properties":{"tips":{"type":"array","items":{"$ref":"#/components/schemas/CoachTipDto"}}},"required":["tips"]},"DismissCoachTipResponseDto":{"type":"object","properties":{"tipId":{"type":"string"},"dismissedAt":{"type":"string","format":"date-time"}},"required":["tipId","dismissedAt"]},"PublishGateStateDto":{"type":"object","properties":{"unlocked":{"type":"boolean"},"overrideAvailable":{"type":"boolean","description":"True only when the org is in yellow tier."},"track":{"type":"string","enum":["main","pre_campaign"]},"missing":{"type":"array","items":{"$ref":"#/components/schemas/PublishGateMissingItemDto"}}},"required":["unlocked","overrideAvailable","track","missing"]},"PublishGateOverrideBodyDto":{"type":"object","properties":{"reasonText":{"type":"string","minLength":4,"description":"Free-text reason captured for audit. Required when invoking the override."}},"required":["reasonText"]},"PublishGateOverrideResponseDto":{"type":"object","properties":{"unlocked":{"type":"boolean"},"overrideAvailable":{"type":"boolean","description":"True only when the org is in yellow tier."},"track":{"type":"string","enum":["main","pre_campaign"]},"missing":{"type":"array","items":{"$ref":"#/components/schemas/PublishGateMissingItemDto"}},"overriddenAt":{"type":"string","format":"date-time"}},"required":["unlocked","overrideAvailable","track","missing","overriddenAt"]},"AdminJourneySliderSettingDto":{"type":"object","properties":{"questId":{"type":"string","enum":["inner_circle_size","weekly_hours","let_us_show_what_is_achievable"]},"min":{"type":"number"},"max":{"type":"number"},"defaultValue":{"type":"number"},"step":{"type":"number"},"isOverride":{"type":"boolean","description":"True when this value comes from the database, false for code defaults."},"updatedAt":{"type":"object","format":"date-time","nullable":true}},"required":["questId","min","max","defaultValue","step","isOverride","updatedAt"]},"AdminJourneySliderSettingsResponseDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AdminJourneySliderSettingDto"}}},"required":["items"]},"UpdateAdminJourneySliderSettingDto":{"type":"object","properties":{"min":{"type":"number"},"max":{"type":"number"},"defaultValue":{"type":"number"},"step":{"type":"number","minimum":1}},"required":["min","max","defaultValue","step"]},"InternalReadinessPillarDto":{"type":"object","properties":{"key":{"type":"string","enum":["strategy_fit","people_commitments","story_offer_content","operations_infrastructure","activation_launch"]},"status":{"type":"string","enum":["not_started","in_progress","complete"]},"completedEvidenceCount":{"type":"number","minimum":0},"totalEvidenceCount":{"type":"number","minimum":0}},"required":["key","status","completedEvidenceCount","totalEvidenceCount"]},"ReadinessSummaryDto":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"pillars":{"type":"array","items":{"$ref":"#/components/schemas/InternalReadinessPillarDto"}},"overallPercent":{"type":"number","minimum":0,"maximum":100}},"required":["organizationId","pillars","overallPercent"]},"IntakeDecisionSummaryDto":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"fitDecision":{"type":"string","enum":["ready_now","needs_preparation","not_fit_now"]},"serviceRoute":{"type":"string","enum":["self_serve","internal_manager","subcontractor"]},"commercialRecommendation":{"type":"string","enum":["no_upfront","upfront_required","deposit_required"]},"confidence":{"type":"number","minimum":0,"maximum":1},"rationale":{"type":"array","items":{"type":"string"}},"recommendedActions":{"type":"array","items":{"type":"string"}},"requiredFollowupQuestions":{"type":"array","items":{"type":"string","enum":["named_ambassador_count","dedicated_owner","weekly_hours_available","urgency_reason","anchor_commitment","organization_number"]}}},"required":["organizationId","fitDecision","serviceRoute","commercialRecommendation","confidence","rationale","recommendedActions","requiredFollowupQuestions"]},"DonationSuggestionInputDto":{"type":"object","properties":{"goalMinor":{"type":"number","minimum":1,"maximum":1000000000000},"currency":{"type":"string","minLength":3,"maxLength":3,"pattern":"^[A-Za-z]{3}$"},"story":{"type":"string","maxLength":8000},"name":{"type":"string","maxLength":280},"locale":{"type":"string","enum":["he","en"]}},"required":["goalMinor","currency"]},"DonationSuggestionDto":{"type":"object","properties":{"amountMinor":{"type":"number"},"title":{"type":"string"}},"required":["amountMinor","title"]},"DonationSuggestionsResponseDto":{"type":"object","properties":{"suggestions":{"type":"array","items":{"$ref":"#/components/schemas/DonationSuggestionDto"}},"source":{"type":"string","enum":["story","mechanism"]}},"required":["suggestions","source"]},"AdvisorNextStepRequestDto":{"type":"object","properties":{"campaignId":{"type":"string","description":"Campaign to scope the next-step decision to. Omit for org-level advising."},"lastUserMessage":{"type":"string","description":"The last message the user typed, persisted to the advisor transcript."},"userMessage":{"type":"string","description":"Alias of lastUserMessage. The latest user utterance, including «אין לי אתר»."}}},"DecisionRecommendationDto":{"type":"object","properties":{"title":{"type":"string"},"summary":{"type":"string"},"rationale":{"type":"string"},"confidence":{"type":"number","description":"Engine confidence 0..1."},"expectedImpact":{"type":"string","enum":["low","medium","high"]},"urgency":{"type":"string","enum":["low","medium","high"]}},"required":["title","summary","rationale","confidence"]},"NextBestActionDto":{"type":"object","properties":{"actionKey":{"type":"string","enum":["ask_for_website","confirm_org_profile","ask_for_campaign_goal","ask_reason_why_now","collect_first_10_people","collect_50_name_list","classify_people","identify_core_team","identify_major_donor_candidates","calculate_goal_range","design_donation_ladder","recommend_campaign_type","plan_activation_event","create_ambassador_targets","generate_messaging_pack","build_campaign_page","check_payment_infrastructure","run_launch_readiness_check","start_soft_launch","monitor_live_campaign","generate_post_campaign_report","ask_human_advisor_review","start_next_campaign_journey"],"description":"The single next action the advisor wants the user to take."},"userQuestion":{"type":"string","description":"The exact question the chat should ask the user, if any."}},"required":["actionKey"]},"DecisionEvidenceDto":{"type":"object","properties":{"stateSignals":{"type":"array","items":{"type":"string"}},"knowledgeReferences":{"type":"array","items":{"type":"string"}},"rankedBlockers":{"description":"Blockers the LLM ranked most-important-first (advisory reasoning only).","type":"array","items":{"type":"string"}},"missingInputs":{"description":"Strategic inputs the LLM identified as missing in order to advance.","type":"array","items":{"type":"string"}}},"required":["stateSignals","knowledgeReferences"]},"DecisionGuardrailsDto":{"type":"object","properties":{"allowedActions":{"type":"array","items":{"type":"string","enum":["ask_for_website","confirm_org_profile","ask_for_campaign_goal","ask_reason_why_now","collect_first_10_people","collect_50_name_list","classify_people","identify_core_team","identify_major_donor_candidates","calculate_goal_range","design_donation_ladder","recommend_campaign_type","plan_activation_event","create_ambassador_targets","generate_messaging_pack","build_campaign_page","check_payment_infrastructure","run_launch_readiness_check","start_soft_launch","monitor_live_campaign","generate_post_campaign_report","ask_human_advisor_review","start_next_campaign_journey"]}},"blockedActions":{"type":"array","items":{"type":"string"}},"reasonBlocked":{"type":"string"}},"required":["allowedActions","blockedActions"]},"DecisionProvenanceDto":{"type":"object","properties":{"model":{"type":"string","nullable":true,"description":"LLM model id / Azure deployment name."},"provider":{"type":"string","nullable":true,"description":"LLM provider (openai | azure)."},"promptVersion":{"type":"string","nullable":true,"description":"Versioned strategy prompt id."},"inputSummary":{"type":"object","additionalProperties":true,"description":"Redacted, non-PII summary of the state the model saw (counts/flags only)."}}},"DecisionCandidateActionDto":{"type":"object","properties":{"actionKey":{"type":"string","enum":["ask_for_website","confirm_org_profile","ask_for_campaign_goal","ask_reason_why_now","collect_first_10_people","collect_50_name_list","classify_people","identify_core_team","identify_major_donor_candidates","calculate_goal_range","design_donation_ladder","recommend_campaign_type","plan_activation_event","create_ambassador_targets","generate_messaging_pack","build_campaign_page","check_payment_infrastructure","run_launch_readiness_check","start_soft_launch","monitor_live_campaign","generate_post_campaign_report","ask_human_advisor_review","start_next_campaign_journey"]},"title":{"type":"string"},"summary":{"type":"string"},"rationale":{"type":"string"},"source":{"type":"string","enum":["rule","llm","knowledge","hybrid"]},"score":{"type":"number"},"blocked":{"type":"boolean"},"blockedReason":{"type":"string","nullable":true}},"required":["actionKey","title","summary","rationale","source","score","blocked"]},"DecisionEngineMetaDto":{"type":"object","properties":{"engineMode":{"type":"string","enum":["rule_based","llm","hybrid"]},"llmUsed":{"type":"boolean"},"fallbackReason":{"type":"string","enum":["invalid_json","low_confidence","forbidden_action","timeout","error","safety_override","hard_blocker","llm_disabled"],"nullable":true},"model":{"type":"string","nullable":true},"promptVersion":{"type":"string","nullable":true},"knowledgeReferencesUsed":{"type":"array","items":{"type":"string"}},"candidateActions":{"type":"array","items":{"$ref":"#/components/schemas/DecisionCandidateActionDto"}},"rejectedActions":{"type":"array","items":{"$ref":"#/components/schemas/DecisionCandidateActionDto"}},"whyThisActionWon":{"type":"string"},"ruleScore":{"type":"number","nullable":true},"llmConfidence":{"type":"number","nullable":true},"finalConfidence":{"type":"number"},"evaluationPending":{"type":"boolean"}},"required":["engineMode","llmUsed","knowledgeReferencesUsed","candidateActions","rejectedActions","whyThisActionWon","finalConfidence","evaluationPending"]},"CampaignContentBriefDto":{"type":"object","properties":{"storyAngle":{"type":"string","description":"The core story angle the brain recommends the page lead with."},"headlineOptions":{"description":"1-3 proposed headline phrasings.","type":"array","items":{"type":"string"}},"keyMessages":{"description":"1-5 key messages the copy should carry.","type":"array","items":{"type":"string"}},"toneWords":{"description":"1-6 tone words (mapped to the page-engine tone).","type":"array","items":{"type":"string"}},"ctaText":{"type":"string"},"donorPromise":{"type":"string"},"directions":{"description":"Up to 3 ranked campaign directions.","type":"array","items":{"$ref":"#/components/schemas/CampaignDirectionDto"}},"chosenDirectionId":{"type":"string","description":"Chosen direction id (defaults to the first)."},"openQuestions":{"description":"Questions the brain still wants to ask the client.","type":"array","items":{"type":"string"}},"relatedActionKey":{"type":"string","enum":["ask_for_website","confirm_org_profile","ask_for_campaign_goal","ask_reason_why_now","collect_first_10_people","collect_50_name_list","classify_people","identify_core_team","identify_major_donor_candidates","calculate_goal_range","design_donation_ladder","recommend_campaign_type","plan_activation_event","create_ambassador_targets","generate_messaging_pack","build_campaign_page","check_payment_infrastructure","run_launch_readiness_check","start_soft_launch","monitor_live_campaign","generate_post_campaign_report","ask_human_advisor_review","start_next_campaign_journey"]},"sourceSignals":{"description":"State signals the brief was grounded in.","type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["gathering","proposed","ready"],"description":"Conversation state; only \"ready\" is safe to apply to a page."}},"required":["storyAngle","headlineOptions","keyMessages","toneWords","status"]},"StrategicDecisionDto":{"type":"object","properties":{"id":{"type":"string"},"orgId":{"type":"string"},"campaignId":{"type":"string","nullable":true},"advisorSessionId":{"type":"string"},"stageBefore":{"type":"string","enum":["dna_scan","diagnostic","foundation_track","strategic_tailoring","matcher_pitch","network_import","campaign_in_a_box","compliance_ocr","hatrama","daily_copilot","live","post_campaign"],"nullable":true},"stageAfter":{"type":"string","enum":["dna_scan","diagnostic","foundation_track","strategic_tailoring","matcher_pitch","network_import","campaign_in_a_box","compliance_ocr","hatrama","daily_copilot","live","post_campaign"],"nullable":true},"decisionType":{"type":"string","enum":["ask_question","recommend_action","block_progress","advance_stage","change_campaign_type","generate_asset","run_diagnostic","request_human_review"]},"diagnosis":{"type":"string"},"mainBlocker":{"type":"string"},"recommendation":{"$ref":"#/components/schemas/DecisionRecommendationDto"},"nextBestAction":{"$ref":"#/components/schemas/NextBestActionDto"},"evidence":{"$ref":"#/components/schemas/DecisionEvidenceDto"},"guardrails":{"$ref":"#/components/schemas/DecisionGuardrailsDto"},"decisionMode":{"type":"string","enum":["rule_based","llm_assisted","llm_based","fallback"],"description":"How the decision was reached: rule_based | llm_assisted | llm_based | fallback."},"fallbackReason":{"type":"string","enum":["invalid_json","low_confidence","forbidden_action","timeout","error","safety_override","hard_blocker","llm_disabled"],"description":"Why the rule-based draft overrode an attempted LLM decision, if it did."},"provenance":{"description":"LLM provenance, if LLM-influenced.","allOf":[{"$ref":"#/components/schemas/DecisionProvenanceDto"}]},"engine":{"description":"Transparent engine trace metadata.","allOf":[{"$ref":"#/components/schemas/DecisionEngineMetaDto"}]},"contentBrief":{"description":"Content brief the brain proposed at a content-stage action (proposal only).","allOf":[{"$ref":"#/components/schemas/CampaignContentBriefDto"}]},"userResponse":{"type":"string","enum":["pending","accepted","rejected","ignored","implemented"]},"createdAt":{"type":"string"}},"required":["id","orgId","advisorSessionId","decisionType","diagnosis","recommendation","nextBestAction","evidence","guardrails","decisionMode","userResponse","createdAt"]},"RelationshipCapitalDto":{"type":"object","properties":{"knownPeopleCount":{"type":"number"},"warmContactsCount":{"type":"number"},"coreContactsCount":{"type":"number"},"potentialAmbassadorsCount":{"type":"number"},"potentialMajorDonorsCount":{"type":"number"},"classifiedPeopleCount":{"type":"number"},"relationshipMapCompleteness":{"type":"number","description":"0-100 share of mapped people that are classified."}},"required":["knownPeopleCount","warmContactsCount","coreContactsCount","potentialAmbassadorsCount","potentialMajorDonorsCount","classifiedPeopleCount","relationshipMapCompleteness"]},"OrganizationStrategicStateDto":{"type":"object","properties":{"orgId":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"},"sector":{"type":"string"},"hasWebsiteProfile":{"type":"boolean"},"hasOrganizationIntelligenceProfile":{"type":"boolean","description":"A deep Organization Intelligence scan produced a structured profile."},"hasBrandAssets":{"type":"boolean"},"hasSocialProfiles":{"type":"boolean"},"hasDonationPage":{"type":"boolean"},"hasPaymentSignal":{"type":"boolean"},"hasReasonWhyNowHypothesis":{"type":"boolean"},"organizationProfileConfirmed":{"type":"boolean"},"likelySector":{"type":"string"},"likelyAudience":{"type":"array","items":{"type":"string"}},"missionSummary":{"type":"string","description":"Mission summary inferred from the org website."},"campaignStorySummary":{"type":"string","description":"Narrative summary of the campaign story signals."},"audienceSummary":{"type":"string","description":"Summary of the likely audiences the scan inferred."},"reasonWhyNowHypothesis":{"type":"string","description":"Best \"reason why now\" hypothesis inferred from the site."},"storySignals":{"type":"object","description":"Raw story-signal evidence lines (pain/hope/whyNow/proofPoints/weaknesses)."},"persona":{"type":"object","description":"Synthesized Organization Persona (archetype, voice, audience, posture). Present only when the organization.persona feature flag is enabled and a persona has been synthesized."},"intelligenceConfidence":{"type":"number","description":"0..1 blended intelligence profile confidence."},"profileCompleteness":{"type":"number"},"diagnosticComplete":{"type":"boolean"},"relationshipCapital":{"$ref":"#/components/schemas/RelationshipCapitalDto"},"campaignCount":{"type":"number"},"hasActiveCampaign":{"type":"boolean"},"pastCampaignCount":{"type":"number","description":"Number of campaigns that already finished (ended / completed / archived)."},"hasActiveJourney":{"type":"boolean","description":"A campaign journey (agency-engagement flow) is currently active for the org."},"lastEndedCampaign":{"type":"object","description":"Compact summary of the most recently finished campaign (campaignId, name, endedAt, raisedMinor, currency). Grounds the start_next_campaign_journey recommendation."},"advisorStage":{"type":"string","enum":["dna_scan","diagnostic","foundation_track","strategic_tailoring","matcher_pitch","network_import","campaign_in_a_box","compliance_ocr","hatrama","daily_copilot","live","post_campaign"]}},"required":["orgId","hasWebsiteProfile","hasOrganizationIntelligenceProfile","hasBrandAssets","hasSocialProfiles","hasDonationPage","hasPaymentSignal","hasReasonWhyNowHypothesis","organizationProfileConfirmed","likelyAudience","profileCompleteness","diagnosticComplete","relationshipCapital","campaignCount","hasActiveCampaign"]},"CampaignStoryDto":{"type":"object","properties":{"rawNeed":{"type":"string"},"reasonWhyNow":{"type":"string"},"urgencyLevel":{"type":"string","enum":["unknown","low","medium","high","existential"]},"concretenessLevel":{"type":"string","enum":["unknown","abstract","somewhat_concrete","concrete"]},"beneficiaryClarity":{"type":"string","enum":["unknown","low","medium","high"]},"isSufficient":{"type":"boolean"}},"required":["urgencyLevel","concretenessLevel","beneficiaryClarity","isSufficient"]},"CampaignStrategicStateDto":{"type":"object","properties":{"campaignId":{"type":"string"},"orgId":{"type":"string"},"name":{"type":"string"},"currency":{"type":"string"},"publicGoal":{"type":"number"},"campaignType":{"type":"string"},"status":{"type":"string","enum":["draft","active","paused","ended","completed","archived","unknown"]},"story":{"$ref":"#/components/schemas/CampaignStoryDto"},"ambassadorCandidateCount":{"type":"number"},"majorDonorCandidateCount":{"type":"number"},"hasGoal":{"type":"boolean"}},"required":["campaignId","orgId","status","story","ambassadorCandidateCount","majorDonorCandidateCount","hasGoal"]},"AdvisorBlockerDto":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable blocker code, if known."},"message":{"type":"string","description":"Human-readable description of the blocker."}},"required":["message"]},"StrategyCandidateActionDto":{"type":"object","properties":{"actionKey":{"type":"string","enum":["ask_for_website","confirm_org_profile","ask_for_campaign_goal","ask_reason_why_now","collect_first_10_people","collect_50_name_list","classify_people","identify_core_team","identify_major_donor_candidates","calculate_goal_range","design_donation_ladder","recommend_campaign_type","plan_activation_event","create_ambassador_targets","generate_messaging_pack","build_campaign_page","check_payment_infrastructure","run_launch_readiness_check","start_soft_launch","monitor_live_campaign","generate_post_campaign_report","ask_human_advisor_review","start_next_campaign_journey"]},"title":{"type":"string"},"summary":{"type":"string"},"rationale":{"type":"string"},"source":{"type":"string","enum":["rule","llm","knowledge","hybrid"]},"score":{"type":"number","description":"Normalized score 0..1."},"blocked":{"type":"boolean"},"blockedReason":{"type":"string","nullable":true}},"required":["actionKey","title","summary","rationale","source","score","blocked"]},"StrategyDecisionEngineMetaDto":{"type":"object","properties":{"engineMode":{"type":"string","enum":["rule_based","llm","hybrid"]},"llmUsed":{"type":"boolean"},"fallbackReason":{"type":"string","enum":["invalid_json","low_confidence","forbidden_action","timeout","error","safety_override","hard_blocker","llm_disabled"],"nullable":true},"model":{"type":"string","nullable":true},"promptVersion":{"type":"string","nullable":true},"knowledgeReferencesUsed":{"type":"array","items":{"type":"string"}},"candidateActions":{"type":"array","items":{"$ref":"#/components/schemas/StrategyCandidateActionDto"}},"rejectedActions":{"type":"array","items":{"$ref":"#/components/schemas/StrategyCandidateActionDto"}},"whyThisActionWon":{"type":"string"},"ruleScore":{"type":"number","nullable":true},"llmConfidence":{"type":"number","nullable":true},"finalConfidence":{"type":"number"},"evaluationPending":{"type":"boolean"},"llmReasoningSummary":{"type":"string"}},"required":["engineMode","llmUsed","knowledgeReferencesUsed","candidateActions","rejectedActions","whyThisActionWon","finalConfidence","evaluationPending"]},"AdvisorNextStepResponseDto":{"type":"object","properties":{"decision":{"$ref":"#/components/schemas/StrategicDecisionDto"},"organizationState":{"$ref":"#/components/schemas/OrganizationStrategicStateDto"},"campaignState":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/CampaignStrategicStateDto"}]},"decisionId":{"type":"string","description":"UUID of the persisted decision."},"actionKey":{"type":"string","enum":["ask_for_website","confirm_org_profile","ask_for_campaign_goal","ask_reason_why_now","collect_first_10_people","collect_50_name_list","classify_people","identify_core_team","identify_major_donor_candidates","calculate_goal_range","design_donation_ladder","recommend_campaign_type","plan_activation_event","create_ambassador_targets","generate_messaging_pack","build_campaign_page","check_payment_infrastructure","run_launch_readiness_check","start_soft_launch","monitor_live_campaign","generate_post_campaign_report","ask_human_advisor_review","start_next_campaign_journey"],"description":"The single next action to drive."},"stageBefore":{"type":"string","enum":["dna_scan","diagnostic","foundation_track","strategic_tailoring","matcher_pitch","network_import","campaign_in_a_box","compliance_ocr","hatrama","daily_copilot","live","post_campaign"],"nullable":true},"stageAfter":{"type":"string","enum":["dna_scan","diagnostic","foundation_track","strategic_tailoring","matcher_pitch","network_import","campaign_in_a_box","compliance_ocr","hatrama","daily_copilot","live","post_campaign"],"nullable":true},"confidence":{"type":"number","description":"Engine confidence 0..1 for the chosen action."},"userQuestion":{"type":"string","nullable":true,"description":"Exact question to ask the user, if any."},"persisted":{"type":"boolean","description":"Whether the decision was persisted (always true on success)."},"decisionMode":{"type":"string","enum":["rule_based","llm_assisted","llm_based","fallback"],"description":"rule_based | llm_assisted | llm_based | fallback."},"fallbackReason":{"type":"string","enum":["invalid_json","low_confidence","forbidden_action","timeout","error","safety_override","hard_blocker","llm_disabled"],"description":"Why the rule-based draft overrode an attempted LLM decision, if it did."},"knowledgeReferences":{"description":"Stable knowledge-base reference ids used, if any.","type":"array","items":{"type":"string"}},"explanationForUser":{"type":"string","description":"User-facing explanation of the recommended next step."},"blocker":{"description":"Present when progress is blocked.","allOf":[{"$ref":"#/components/schemas/AdvisorBlockerDto"}]},"suggestedDashboardPath":{"type":"string","description":"Relative dashboard path to deep-link the user to act on the recommendation."},"engine":{"$ref":"#/components/schemas/StrategyDecisionEngineMetaDto"},"engineMode":{"type":"string","enum":["rule_based","llm","hybrid"]},"llmUsed":{"type":"boolean"},"model":{"type":"string","nullable":true},"promptVersion":{"type":"string","nullable":true},"knowledgeReferencesUsed":{"type":"array","items":{"type":"string"}},"candidateActions":{"type":"array","items":{"$ref":"#/components/schemas/StrategyCandidateActionDto"}},"rejectedActions":{"type":"array","items":{"$ref":"#/components/schemas/StrategyCandidateActionDto"}},"whyThisActionWon":{"type":"string"},"ruleScore":{"type":"number","nullable":true},"llmConfidence":{"type":"number","nullable":true},"finalConfidence":{"type":"number"},"evaluationPending":{"type":"boolean"},"contentBrief":{"nullable":true,"description":"Content brief the brain proposed at a content-stage action (proposal only; null unless STRATEGY_CONTENT_BRIEF_ENABLED and the action is content-oriented).","allOf":[{"$ref":"#/components/schemas/CampaignContentBriefDto"}]}},"required":["decision","organizationState","decisionId","actionKey","confidence","persisted","decisionMode","knowledgeReferences","explanationForUser","engineMode","llmUsed","knowledgeReferencesUsed","candidateActions","rejectedActions","whyThisActionWon","finalConfidence","evaluationPending"]},"RunReadinessDiagnosticRequestDto":{"type":"object","properties":{"campaignId":{"type":"string","description":"Campaign to snapshot readiness for. Optional."}}},"ReadinessBlockerDto":{"type":"object","properties":{"code":{"type":"string"},"severity":{"type":"string","enum":["hard","soft"]},"message":{"type":"string"},"suggestedAction":{"type":"string","enum":["ask_for_website","confirm_org_profile","ask_for_campaign_goal","ask_reason_why_now","collect_first_10_people","collect_50_name_list","classify_people","identify_core_team","identify_major_donor_candidates","calculate_goal_range","design_donation_ladder","recommend_campaign_type","plan_activation_event","create_ambassador_targets","generate_messaging_pack","build_campaign_page","check_payment_infrastructure","run_launch_readiness_check","start_soft_launch","monitor_live_campaign","generate_post_campaign_report","ask_human_advisor_review","start_next_campaign_journey"]}},"required":["code","severity","message"]},"ReadinessWarningDto":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"CampaignReadinessDto":{"type":"object","properties":{"overallScore":{"type":"number"},"humanCapitalScore":{"type":"number"},"storyScore":{"type":"number"},"donorBaseScore":{"type":"number"},"teamCapacityScore":{"type":"number"},"infrastructureScore":{"type":"number"},"timingScore":{"type":"number"},"trustScore":{"type":"number"},"blockers":{"type":"array","items":{"$ref":"#/components/schemas/ReadinessBlockerDto"}},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/ReadinessWarningDto"}}},"required":["overallScore","humanCapitalScore","storyScore","donorBaseScore","teamCapacityScore","infrastructureScore","timingScore","trustScore","blockers","warnings"]},"RunReadinessDiagnosticResponseDto":{"type":"object","properties":{"campaignId":{"type":"string","nullable":true},"diagnosticComplete":{"type":"boolean"},"readiness":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/CampaignReadinessDto"}]},"decision":{"$ref":"#/components/schemas/StrategicDecisionDto"}},"required":["diagnosticComplete","decision"]},"RejectDecisionRequestDto":{"type":"object","properties":{"reason":{"type":"string","description":"Why the user rejected the recommendation."}}},"RecordCampaignOutcomeRequestDto":{"type":"object","properties":{"publicGoal":{"type":"number"},"amountRaised":{"type":"number"},"goalCompletionRate":{"type":"number","description":"0..1 goal completion ratio."},"donorCount":{"type":"number"},"uniqueDonorCount":{"type":"number"},"ambassadorCount":{"type":"number"},"activeAmbassadorCount":{"type":"number"},"recurringDonorCount":{"type":"number"},"recurringMonthlyAmount":{"type":"number"},"averageDonation":{"type":"number"},"medianDonation":{"type":"number"},"conversionRate":{"type":"number"},"mobileShare":{"type":"number"},"directLinkShare":{"type":"number"},"emailShare":{"type":"number"},"paidAdsShare":{"type":"number"},"paymentFailuresCount":{"type":"number"},"notes":{"type":"string"},"rawMetrics":{"type":"object","additionalProperties":true}}},"RecordCampaignOutcomeResponseDto":{"type":"object","properties":{"outcomeId":{"type":"string"},"linkedDecisionCount":{"type":"number","description":"Number of prior decisions linked to this outcome."},"evaluationStatus":{"type":"string","enum":["completed","failed"],"nullable":true,"description":"AI outcome-evaluation status. Null when evaluation was not attempted."},"aiEvaluationSummary":{"type":"string","nullable":true},"aiEvaluationModel":{"type":"string","nullable":true},"aiEvaluationPromptVersion":{"type":"string","nullable":true},"aiEvaluationCreatedAt":{"type":"string","nullable":true},"aiEvaluationFailureReason":{"type":"string","nullable":true}},"required":["outcomeId","linkedDecisionCount"]},"AdvisorKnowledgeDocumentDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string","description":"Stable slug (matches the seed manifest id when seeded)."},"title":{"type":"string"},"category":{"type":"string","description":"Category, e.g. principle / playbook / readiness / next_action."},"body":{"type":"string","description":"Markdown body."},"status":{"type":"string","enum":["draft","published","archived"]},"appliesToStages":{"type":"array","items":{"type":"string"}},"appliesToActions":{"type":"array","items":{"type":"string"}},"confidence":{"type":"string","enum":["high","medium","low"]},"source":{"type":"string","enum":["seed","manual","self_improvement","conversation"]},"version":{"type":"number"},"publishedAt":{"type":"object","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"chunkCount":{"type":"number","description":"Number of chunk rows derived from this document."},"embeddedChunkCount":{"type":"number","description":"Number of chunks with a stored embedding vector."},"sourceFileName":{"type":"object","nullable":true,"description":"Original file name when this document was created from a file upload."},"sourceContentType":{"type":"object","nullable":true,"description":"MIME type of the uploaded source file (e.g. application/pdf)."},"sourceBlobKey":{"type":"object","nullable":true,"description":"Blob key of the stored original upload in the imports container."}},"required":["id","slug","title","category","body","status","appliesToStages","appliesToActions","confidence","source","version","createdAt","updatedAt","chunkCount","embeddedChunkCount"]},"AdvisorKnowledgeDocumentListDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AdvisorKnowledgeDocumentDto"}}},"required":["items"]},"CreateAdvisorKnowledgeDocumentDto":{"type":"object","properties":{"slug":{"type":"string"},"title":{"type":"string"},"category":{"type":"string"},"body":{"type":"string"},"appliesToStages":{"type":"array","items":{"type":"string"}},"appliesToActions":{"type":"array","items":{"type":"string"}},"confidence":{"type":"string","enum":["high","medium","low"]}},"required":["slug","title","category","body"]},"UploadAdvisorKnowledgeDocumentDto":{"type":"object","properties":{"fileName":{"type":"string","description":"Original file name (used for type detection and provenance)."},"contentType":{"type":"string","description":"MIME type of the file (e.g. application/pdf). Falls back to fileName extension."},"dataBase64":{"type":"string","description":"File bytes as base64 (raw or a data: URI). Supports PDF, DOCX, HTML, TXT, and Markdown."},"title":{"type":"string","description":"Document title. Defaults to the file name (sans extension)."},"category":{"type":"string","description":"Category. Defaults to \"uploaded\"."},"appliesToStages":{"type":"array","items":{"type":"string"}},"appliesToActions":{"type":"array","items":{"type":"string"}},"confidence":{"type":"string","enum":["high","medium","low"]},"autoPublish":{"type":"boolean","description":"Publish immediately after extraction (chunks + queues embedding). Defaults to true."}},"required":["fileName","dataBase64"]},"UpdateAdvisorKnowledgeDocumentDto":{"type":"object","properties":{"title":{"type":"string"},"category":{"type":"string"},"body":{"type":"string"},"appliesToStages":{"type":"array","items":{"type":"string"}},"appliesToActions":{"type":"array","items":{"type":"string"}},"confidence":{"type":"string","enum":["high","medium","low"]}}},"AdvisorProactivityRuleDto":{"type":"object","properties":{"stage":{"type":"string","description":"Advisor stage key this rule configures."},"enabled":{"type":"boolean"},"suggestedActions":{"type":"array","items":{"type":"object","additionalProperties":true},"description":"Suggested-action descriptors emitted by startAdvisorSession for this stage."},"notes":{"type":"object","nullable":true},"updatedAt":{"type":"string","format":"date-time"}},"required":["stage","enabled","suggestedActions","updatedAt"]},"AdvisorProactivityRuleListDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AdvisorProactivityRuleDto"}}},"required":["items"]},"UpsertAdvisorProactivityRuleDto":{"type":"object","properties":{"enabled":{"type":"boolean"},"suggestedActions":{"type":"array","items":{"type":"object","additionalProperties":true}},"notes":{"type":"string","nullable":true}},"required":["enabled"]},"AdvisorBrainRetrievalTestDto":{"type":"object","properties":{"stage":{"type":"string","description":"Advisor stage to simulate."},"actionKey":{"type":"string","description":"Next-action key to simulate."},"topN":{"type":"number","description":"How many snippets to return (1-10)."}}},"AdvisorBrainRetrievalSnippetDto":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"category":{"type":"string"},"text":{"type":"string"}},"required":["id","title","category","text"]},"AdvisorBrainRetrievalResultDto":{"type":"object","properties":{"mode":{"type":"string","description":"How retrieval was performed: vector | keyword | none."},"references":{"type":"array","items":{"type":"string"}},"snippets":{"type":"array","items":{"$ref":"#/components/schemas/AdvisorBrainRetrievalSnippetDto"}}},"required":["mode","references","snippets"]},"AdvisorBrainChatRequestDto":{"type":"object","properties":{"question":{"type":"string","description":"The question to ask the advisor brain."},"topN":{"type":"number","description":"How many knowledge snippets to ground on (1-10)."}},"required":["question"]},"AdvisorBrainChatResultDto":{"type":"object","properties":{"answer":{"type":"string","description":"The grounded answer, or a notice when the LLM is unavailable."},"llmAvailable":{"type":"boolean","description":"Whether the answer came from the LLM or a fallback notice."},"mode":{"type":"string","description":"How retrieval was performed: vector | keyword | none."},"references":{"description":"Slugs of the knowledge documents grounding the answer.","type":"array","items":{"type":"string"}},"snippets":{"type":"array","items":{"$ref":"#/components/schemas/AdvisorBrainRetrievalSnippetDto"}}},"required":["answer","llmAvailable","mode","references","snippets"]},"AdvisorBrainHealthDto":{"type":"object","properties":{"embeddingsEnabled":{"type":"boolean"},"embeddingModel":{"type":"string"},"publishedDocuments":{"type":"number"},"draftDocuments":{"type":"number"},"archivedDocuments":{"type":"number"},"totalChunks":{"type":"number"},"embeddedChunks":{"type":"number"},"proactivityRules":{"type":"number","description":"Number of stages with a proactivity rule configured."}},"required":["embeddingsEnabled","embeddingModel","publishedDocuments","draftDocuments","archivedDocuments","totalChunks","embeddedChunks","proactivityRules"]},"AdvisorActionStatDto":{"type":"object","properties":{"actionKey":{"type":"string"},"decisions":{"type":"number","description":"Total decisions recorded for this action key."},"accepted":{"type":"number"},"implemented":{"type":"number"},"linkedOutcomes":{"type":"number","description":"Number of decisions linked to a measured campaign outcome."},"avgGoalCompletion":{"type":"object","nullable":true,"description":"Average goal-completion rate (0-1+) across linked outcomes, or null."},"metGoalRate":{"type":"number","description":"Fraction of linked outcomes that met or exceeded goal (0-1)."}},"required":["actionKey","decisions","accepted","implemented","linkedOutcomes","avgGoalCompletion","metGoalRate"]},"AdvisorBrainInsightsDto":{"type":"object","properties":{"actionStats":{"type":"array","items":{"$ref":"#/components/schemas/AdvisorActionStatDto"}},"responseBreakdown":{"type":"object","additionalProperties":{"type":"number"},"description":"Counts of decisions by user response (pending/accepted/rejected/ignored/implemented)."},"campaignsWithOutcome":{"type":"number","description":"Campaigns with a recorded outcome."},"avgGoalCompletion":{"type":"object","nullable":true},"metGoalCount":{"type":"number","description":"Campaigns that met or exceeded goal."}},"required":["actionStats","responseBreakdown","campaignsWithOutcome","avgGoalCompletion","metGoalCount"]},"AdvisorDecisionListItemDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"organizationId":{"type":"string","format":"uuid"},"campaignId":{"type":"object","format":"uuid","nullable":true},"advisorSessionId":{"type":"string","format":"uuid"},"stageBefore":{"type":"object","nullable":true},"stageAfter":{"type":"object","nullable":true},"decisionType":{"type":"string"},"actionKey":{"type":"string"},"confidence":{"type":"object","nullable":true,"description":"Decision confidence (0-1) when recorded."},"userResponse":{"type":"string","enum":["pending","accepted","rejected","ignored","implemented"]},"recommendationTitle":{"type":"object","nullable":true}},"required":["id","createdAt","organizationId","advisorSessionId","decisionType","actionKey","userResponse"]},"AdvisorDecisionListDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AdvisorDecisionListItemDto"}},"nextCursor":{"type":"object","nullable":true,"description":"Cursor for the next page, or null."}},"required":["items"]},"AdvisorDecisionOutcomeLinkDto":{"type":"object","properties":{"campaignOutcomeId":{"type":"string","format":"uuid"},"assumedEffect":{"type":"object","nullable":true},"successSignal":{"type":"object","nullable":true},"failureSignal":{"type":"object","nullable":true},"goalCompletionRate":{"type":"object","nullable":true,"description":"Goal-completion rate (0-1+) of the linked outcome."}},"required":["campaignOutcomeId"]},"AdvisorDecisionDetailDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"organizationId":{"type":"string","format":"uuid"},"campaignId":{"type":"object","format":"uuid","nullable":true},"advisorSessionId":{"type":"string","format":"uuid"},"stageBefore":{"type":"object","nullable":true},"stageAfter":{"type":"object","nullable":true},"decisionType":{"type":"string"},"actionKey":{"type":"string"},"confidence":{"type":"object","nullable":true,"description":"Decision confidence (0-1) when recorded."},"userResponse":{"type":"string","enum":["pending","accepted","rejected","ignored","implemented"]},"recommendationTitle":{"type":"object","nullable":true},"diagnosis":{"type":"object","nullable":true},"mainBlocker":{"type":"object","nullable":true},"recommendationSummary":{"type":"object","nullable":true},"rationale":{"type":"object","nullable":true},"expectedImpact":{"type":"object","nullable":true},"urgency":{"type":"object","nullable":true},"decisionJson":{"type":"object","additionalProperties":true,"description":"Full structured decision payload (StrategicDecision)."},"knowledgeReferences":{"description":"Slugs of advisor-brain knowledge documents used to ground this decision.","type":"array","items":{"type":"string"}},"outcomes":{"type":"array","items":{"$ref":"#/components/schemas/AdvisorDecisionOutcomeLinkDto"}}},"required":["id","createdAt","organizationId","advisorSessionId","decisionType","actionKey","userResponse","decisionJson","knowledgeReferences","outcomes"]},"ReembedResultDto":{"type":"object","properties":{"documents":{"type":"number","description":"Number of published documents re-enqueued for embedding."},"chunks":{"type":"number","description":"Number of chunk vectors cleared for re-embedding."}},"required":["documents","chunks"]},"AdvisorKnowledgeDocumentVersionDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"version":{"type":"number"},"title":{"type":"string"},"category":{"type":"string"},"body":{"type":"string"},"confidence":{"type":"string"},"status":{"type":"string"},"source":{"type":"string"},"createdByUserId":{"type":"object","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","version","title","category","body","confidence","status","source","createdAt"]},"AdvisorKnowledgeDocumentVersionListDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AdvisorKnowledgeDocumentVersionDto"}}},"required":["items"]},"AdvisorTeachSessionDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"status":{"type":"string","enum":["active","archived"]},"messageCount":{"type":"number","description":"Number of messages in the session."},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","title","status","messageCount","createdAt","updatedAt"]},"AdvisorTeachSessionListDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AdvisorTeachSessionDto"}}},"required":["items"]},"CreateAdvisorTeachSessionDto":{"type":"object","properties":{"title":{"type":"string","description":"A short title for the teaching session."}},"required":["title"]},"AdvisorTeachMessageDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["operator","advisor"]},"content":{"type":"string"},"proposedDocumentId":{"type":"object","format":"uuid","nullable":true},"proposedDocumentSlug":{"type":"object","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","role","content","createdAt"]},"AdvisorTeachAttachmentDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"fileName":{"type":"string"},"contentType":{"type":"string"},"extractedCharacters":{"type":"number","description":"Number of text characters extracted for conversational context."},"createdAt":{"type":"string","format":"date-time"}},"required":["id","fileName","contentType","extractedCharacters","createdAt"]},"AdvisorTeachSessionDetailDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"status":{"type":"string","enum":["active","archived"]},"messageCount":{"type":"number","description":"Number of messages in the session."},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"messages":{"type":"array","items":{"$ref":"#/components/schemas/AdvisorTeachMessageDto"}},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/AdvisorTeachAttachmentDto"}}},"required":["id","title","status","messageCount","createdAt","updatedAt","messages","attachments"]},"UploadAdvisorTeachAttachmentDto":{"type":"object","properties":{"fileName":{"type":"string","description":"Original file name shown in the teaching conversation."},"contentType":{"type":"string","description":"MIME type. Falls back to the file extension when omitted."},"dataBase64":{"type":"string","description":"File bytes as base64. Supports PDF, DOCX, HTML, TXT, and Markdown."}},"required":["fileName","dataBase64"]},"AdvisorTeachFinalizeResultDto":{"type":"object","properties":{"proposal":{"$ref":"#/components/schemas/AdvisorKnowledgeDocumentDto"},"summary":{"type":"string","description":"Short plain-language description of what was organized."},"llmAvailable":{"type":"boolean","description":"Whether the reasoning LLM authored the final organized proposal."}},"required":["proposal","summary","llmAvailable"]},"AdvisorTeachMessageRequestDto":{"type":"object","properties":{"content":{"type":"string","description":"What you want to teach the advisor (an idea, story, or campaign insight)."}},"required":["content"]},"AdvisorTeachTurnResultDto":{"type":"object","properties":{"advisorMessage":{"description":"The advisor reply message.","allOf":[{"$ref":"#/components/schemas/AdvisorTeachMessageDto"}]},"proposal":{"nullable":true,"description":"The draft knowledge document this turn produced/updated (if any). Never auto-published.","allOf":[{"$ref":"#/components/schemas/AdvisorKnowledgeDocumentDto"}]},"proposalIsNew":{"type":"boolean","description":"True when a new draft was created; false when an existing draft was merged."},"llmAvailable":{"type":"boolean","description":"Whether the reasoning LLM produced the reply/curation."},"mode":{"type":"string","description":"How the operator turn was interpreted: knowledge (a draft was produced) | clarify (the advisor asked follow-up questions to co-develop the idea) | chat (nothing to save)."}},"required":["advisorMessage","proposalIsNew","llmAvailable","mode"]},"AdvisorMemoryBlockDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["core","archival","recall"]},"label":{"type":"string"},"content":{"type":"string"},"importance":{"type":"number"},"pinned":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","kind","label","content","importance","pinned","createdAt","updatedAt"]},"AdvisorMemoryBlockListDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AdvisorMemoryBlockDto"}}},"required":["items"]},"UpsertAdvisorMemoryBlockDto":{"type":"object","properties":{"kind":{"type":"string","enum":["core","archival","recall"]},"label":{"type":"string"},"content":{"type":"string"},"importance":{"type":"number","description":"Ranking weight for recall (higher = surfaced first)."},"pinned":{"type":"boolean","description":"Pin a core memory so it is always in context."}},"required":["kind","label","content"]},"AdvisorGraphStatsDto":{"type":"object","properties":{"entities":{"type":"number"},"edges":{"type":"number"},"communities":{"type":"number"},"enabled":{"type":"boolean","description":"Whether GraphRAG expansion is enabled at runtime."}},"required":["entities","edges","communities","enabled"]},"BrandSettingsResponseDto":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"orgName":{"type":"string","nullable":true,"description":"Display/footer org name."},"logoUrl":{"type":"string","nullable":true,"description":"Absolute https URL to the org logo."},"logoMediaAssetId":{"type":"string","nullable":true,"format":"uuid","description":"Charidy-hosted logo media asset id."},"primaryColor":{"type":"string","nullable":true,"example":"#2563eb","description":"Primary brand colour."},"accentColor":{"type":"string","nullable":true,"example":"#1d4ed8","description":"Accent colour."},"backgroundColor":{"type":"string","nullable":true,"example":"#f4f5f7"},"surfaceColor":{"type":"string","nullable":true,"example":"#ffffff"},"textColor":{"type":"string","nullable":true,"example":"#111827"},"fontFamily":{"type":"string","nullable":true,"description":"CSS font-family stack."},"designSystem":{"type":"object","nullable":true,"additionalProperties":true,"description":"The org's Design DNA — the compact spec its FULL design system expands from: `palette` {primary, secondary?, background?, surface?, text?} (hex), `accent` (hex), `fontPack` ('editorial'|'impact'|'friendly'|'modern'|'brand'|'editorial-fraunces'|'letter-lora'|'plex'), `shape` ('pill'|'rounded'|'soft'|'sharp'), `elevation` ('soft'|'flat'|'crisp'), `density` ('airy'|'standard'|'compact'), `motion` ('standard'|'calm'|'none'). Synthesized from the website scan at onboarding; every generated campaign page derives its complete token system from it."},"footerAddress":{"type":"string","nullable":true,"description":"Legal/physical mailing address for the footer."},"websiteUrl":{"type":"string","nullable":true},"source":{"type":"string","nullable":true,"description":"How the brand was derived: website_scan | org_intelligence | manual."},"confirmedAt":{"type":"string","nullable":true,"format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["organizationId","updatedAt"]},"UpdateBrandSettingsDto":{"type":"object","properties":{"orgName":{"type":"string","description":"Display/footer org name."},"logoUrl":{"type":"string","description":"Absolute https URL to the org logo."},"logoMediaAssetId":{"type":"string","format":"uuid","description":"Charidy-hosted logo media asset id."},"primaryColor":{"type":"string","example":"#2563eb"},"accentColor":{"type":"string","example":"#1d4ed8"},"backgroundColor":{"type":"string","example":"#f4f5f7"},"surfaceColor":{"type":"string","example":"#ffffff"},"textColor":{"type":"string","example":"#111827"},"fontFamily":{"type":"string","description":"CSS font-family stack."},"designSystem":{"type":"object","additionalProperties":true,"description":"The org's Design DNA (see the response field of the same name). Validated against DesignDnaSchema — an invalid shape is rejected with DESIGN_DNA_INVALID."},"footerAddress":{"type":"string","description":"Legal/physical mailing address for the footer."},"websiteUrl":{"type":"string"}}},"OrchestrateConfirmDto":{"type":"object","properties":{"decisionId":{"type":"string","format":"uuid","description":"The strategy decision being confirmed."},"actionKey":{"type":"string","enum":["ask_for_website","confirm_org_profile","ask_for_campaign_goal","ask_reason_why_now","collect_first_10_people","collect_50_name_list","classify_people","identify_core_team","identify_major_donor_candidates","calculate_goal_range","design_donation_ladder","recommend_campaign_type","plan_activation_event","create_ambassador_targets","generate_messaging_pack","build_campaign_page","check_payment_infrastructure","run_launch_readiness_check","start_soft_launch","monitor_live_campaign","generate_post_campaign_report","ask_human_advisor_review","start_next_campaign_journey"],"description":"The action key from the proposed decision (must be a content capability)."}},"required":["decisionId","actionKey"]},"OrchestrateNextStepRequestDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid","description":"Campaign to focus the reasoning loop on."},"lastUserMessage":{"type":"string","description":"Latest user message, for the brain to ground its reasoning."},"confirm":{"description":"Present ONLY to execute a previously proposed content action. Omit for the propose/recommend phase — the orchestrator never generates content without it.","allOf":[{"$ref":"#/components/schemas/OrchestrateConfirmDto"}]}}},"OrchestrateNextStepDto":{"type":"object","properties":{"actionKey":{"type":"string","enum":["ask_for_website","confirm_org_profile","ask_for_campaign_goal","ask_reason_why_now","collect_first_10_people","collect_50_name_list","classify_people","identify_core_team","identify_major_donor_candidates","calculate_goal_range","design_donation_ladder","recommend_campaign_type","plan_activation_event","create_ambassador_targets","generate_messaging_pack","build_campaign_page","check_payment_infrastructure","run_launch_readiness_check","start_soft_launch","monitor_live_campaign","generate_post_campaign_report","ask_human_advisor_review","start_next_campaign_journey"]},"question":{"type":"string","nullable":true},"explanation":{"type":"string","nullable":true},"confidence":{"type":"number","nullable":true},"stage":{"type":"string","nullable":true},"decisionMode":{"type":"string","nullable":true},"decisionId":{"type":"string","nullable":true},"suggestedDashboardPath":{"type":"string"},"toolToCallAfterUserInput":{"type":"string","description":"Tool the client should call after the user answers (the orchestrator itself)."},"requiredInputSchema":{"type":"object","description":"Inputs the follow-up tool call requires."}},"required":["actionKey"]},"OrchestrateCapabilityDto":{"type":"object","properties":{"actionKey":{"type":"string","enum":["design_donation_ladder","build_campaign_page","generate_messaging_pack","create_ambassador_targets"]},"tool":{"type":"string","description":"The generator tool operationId the orchestrator will invoke."},"produces":{"type":"string","enum":["donation_ladder","campaign_page_draft","messaging_pack","ambassador_pack"]},"needsCampaign":{"type":"boolean"}},"required":["actionKey","tool","produces","needsCampaign"]},"OrchestrateNextStepResponseDto":{"type":"object","properties":{"mode":{"type":"string","enum":["recommend","propose","executed"],"description":"recommend = brain returned a non-content step (no capability). propose = a content capability was chosen; awaiting confirmation (no content generated). executed = the confirmed capability ran and produced a draft."},"nextStep":{"$ref":"#/components/schemas/OrchestrateNextStepDto"},"requiresConfirmation":{"type":"boolean","description":"True in propose mode — the client must confirm before generating."},"capability":{"$ref":"#/components/schemas/OrchestrateCapabilityDto"},"confirm":{"description":"Echo the client sends back (as `confirm`) to execute the proposed action.","allOf":[{"$ref":"#/components/schemas/OrchestrateConfirmDto"}]},"produced":{"type":"string","enum":["donation_ladder","campaign_page_draft","messaging_pack","ambassador_pack"],"description":"What was produced (executed mode)."},"deliverable":{"type":"object","description":"The generator response (draft). Shape matches the underlying generator tool."},"campaignId":{"type":"object","format":"uuid"},"deduped":{"type":"boolean","description":"True when the decision was already implemented, so no new content was generated (idempotent replay)."}},"required":["mode","nextStep"]},"AgentToolDescriptorDto":{"type":"object","properties":{"name":{"type":"string","description":"Stable operation id — matches `@ApiOperation({ operationId })` on the NestJS controller and the SDK method name.","example":"createCampaign"},"description":{"type":"string","description":"Human + LLM-readable description of what this tool does, sourced from `@ApiOperation.description` (fallback to `summary`). Used by the agent as the natural-language hint when choosing tools."},"method":{"type":"string","description":"HTTP method this tool is invoked with (`GET`, `POST`, `PATCH`, `DELETE`, …)."},"path":{"type":"string","description":"Templated OpenAPI path (e.g. `/api/v1/campaigns/{campaignId}`)."},"inputSchema":{"type":"object","additionalProperties":true,"description":"JSON Schema describing the tool inputs (path params, query params, body). AI agents pass this directly to OpenAI / Anthropic function calling."},"outputSchema":{"type":"object","additionalProperties":true,"description":"JSON Schema describing the success response shape. Lets the agent know what to expect back and how to render results."},"permissions":{"description":"Permission keys required to invoke this tool.","type":"array","items":{"type":"string"}},"featureFlag":{"type":"string","nullable":true,"description":"Feature flag that must be enabled on the organization, or `null` when no flag gates this tool."},"scope":{"type":"string","description":"Tenant scope: `tenant` (requires `x-organization-id`), `super` (super-admin only), `anonymous` (public), `portal` (cross-tenant donor portal), or `unknown`.","enum":["tenant","super","anonymous","portal","unknown"]},"requiredHeaders":{"description":"Headers the caller must set for this tool (e.g. `x-organization-id`, `Idempotency-Key`).","type":"array","items":{"type":"string"}},"idempotent":{"type":"boolean","description":"True when the operation accepts an `Idempotency-Key` header — safe to retry."},"destructive":{"type":"boolean","description":"True when invoking this tool destroys or significantly mutates data (DELETE methods, archives, financial reversals, publish-gate overrides). AI agents must request explicit human confirmation before calling these."},"humanOnly":{"type":"boolean","description":"True when the tool is reserved for humans only (provider webhooks, impersonation, raw-body intake). AI agents must refuse to invoke these."},"tags":{"description":"OpenAPI tags for grouping tools by bounded context.","type":"array","items":{"type":"string"}}},"required":["name","description","inputSchema","outputSchema","permissions","scope","requiredHeaders","idempotent","destructive","humanOnly","tags"]},"AgentToolCatalogResponseDto":{"type":"object","properties":{"tools":{"description":"List of tool descriptors the current caller is allowed to invoke. Server-side filtering already removed human-only tools, super-admin tools (unless the caller is super-admin), and any tool whose feature flag is disabled on the active organization.","type":"array","items":{"$ref":"#/components/schemas/AgentToolDescriptorDto"}},"totalCount":{"type":"number","description":"Total number of tools in the returned list."},"generatedAt":{"type":"string","format":"date-time","description":"ISO timestamp at which the catalog snapshot was produced."}},"required":["tools","totalCount","generatedAt"]},"AgentDispatchRequestDto":{"type":"object","properties":{"input":{"type":"object","description":"Tool input payload. Path params, query fields, and request body fields are extracted from this object.","additionalProperties":true},"approvalToken":{"type":"string","description":"Optional approval token required for destructive operations."},"executionMode":{"type":"string","enum":["direct","planner","background"],"description":"Execution mode for quotas and policy selection. `planner/background` count toward LLM orchestration budgets."}}},"AgentDispatchResponseDto":{"type":"object","properties":{"auditId":{"type":"string","description":"Audit correlation id for this dispatch attempt."},"status":{"type":"string","enum":["ok","error","needs_approval","rejected"]},"code":{"type":"string","description":"Machine-readable code for clients and observability."},"retryable":{"type":"boolean","description":"Whether the call can be safely retried."},"error":{"type":"string","description":"Human-readable error detail."},"data":{"type":"object","additionalProperties":true,"description":"Operation result payload (or metadata for non-ok statuses)."}},"required":["auditId","status","code","retryable"]},"CreateAgentRunRequestDto":{"type":"object","properties":{"prompt":{"type":"string","description":"User instruction to the active agent runtime."},"mode":{"type":"string","enum":["recommendation","action"]},"locale":{"type":"string","description":"Locale to guide generation and retrieval strategy."},"direction":{"type":"string","enum":["ltr","rtl"]}},"required":["prompt"]},"AgentRunRecordDto":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"createdByUserId":{"type":"string"},"prompt":{"type":"string"},"mode":{"type":"string","enum":["recommendation","action"]},"status":{"type":"string","enum":["queued","running","needs_approval","cancelled","completed","failed"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"locale":{"type":"object"},"direction":{"type":"string","enum":["ltr","rtl"]},"routedAgent":{"type":"string","enum":["campaign-strategy","copywriting","analytics","onboarding","general"],"description":"Specialist routing decision produced by the multi-agent router layer."},"approvals":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"decision":{"type":"string"},"note":{"type":"string","nullable":true},"reviewerUserId":{"type":"string"}},"required":["at","decision","reviewerUserId"]}},"result":{"type":"object","additionalProperties":true},"error":{"type":"object"},"aiAssisted":{"type":"boolean"},"aiGenerationVersion":{"type":"string"}},"required":["id","organizationId","createdByUserId","prompt","mode","status","createdAt","updatedAt","routedAgent","approvals","aiAssisted","aiGenerationVersion"]},"CreateAgentRunResponseDto":{"type":"object","properties":{"run":{"$ref":"#/components/schemas/AgentRunRecordDto"},"queue":{"type":"object","additionalProperties":true}},"required":["run","queue"]},"AgentRunApprovalDto":{"type":"object","properties":{"decision":{"type":"string","enum":["approve","reject","revise","clarify","reroute","cancel"]},"note":{"type":"string","description":"Optional reviewer note for steering or clarification."}},"required":["decision"]},"AgentRunFeedbackDto":{"type":"object","properties":{"quality":{"type":"string","enum":["helpful","irrelevant","unsafe","outdated"]},"note":{"type":"string","description":"Optional free-text feedback for retrieval tuning."}},"required":["quality"]},"AgentUrlOnboardingRequestDto":{"type":"object","properties":{"sourceUrl":{"type":"string","description":"Organization URL to scrape for brand DNA extraction and profiling.","example":"https://example.org"},"locale":{"type":"string","description":"Requested locale for generated layout output.","example":"he"},"direction":{"type":"string","enum":["ltr","rtl"]}},"required":["sourceUrl"]},"AgentUrlOnboardingResponseDto":{"type":"object","properties":{"profile":{"type":"object","additionalProperties":true,"description":"Evidence-backed website profile, extracted content, and brand tokens."},"layout":{"type":"object","additionalProperties":true,"description":"Canonical page-builder LayoutConfig generated from the website profile."}},"required":["profile","layout"]},"AgentKnowledgeIngestRequestDto":{"type":"object","properties":{"sourceType":{"type":"string","enum":["post_mortem","torat_charidy_update","campaign_insight"],"description":"Knowledge source category used for recency weighting."},"content":{"type":"string","description":"Knowledge document body. This text is sanitized before indexing."},"campaignId":{"type":"string","description":"Optional campaign scope for strict tenant + campaign retrieval boundaries."},"locale":{"type":"string","description":"Locale of the knowledge payload."}},"required":["sourceType","content"]},"AgentRagRetrieveRequestDto":{"type":"object","properties":{"query":{"type":"string"},"campaignId":{"type":"string"},"topK":{"type":"number","default":5}},"required":["query"]},"AgentCompliancePurgeRequestDto":{"type":"object","properties":{"scope":{"type":"string","description":"Compliance purge scope. `organization` purges tenant memory/vectors. `user` reserves per-user purge flow.","enum":["organization","user"]},"userId":{"type":"string","description":"Optional user id for user-scoped purge."}},"required":["scope"]},"AgentTelemetryOpenSessionDto":{"type":"object","properties":{"surface":{"type":"string","enum":["chat","page_builder","api","worker"]},"pagePathname":{"type":"string","description":"Pathname the session is being opened from."},"model":{"type":"string","description":"LLM model identifier when applicable (e.g. `gpt-4o-mini`)."},"firstUserPrompt":{"type":"string","description":"First user prompt — server-side, only the first 200 chars + redacted PII are persisted to `agent_sessions.first_user_prompt_digest`. Verbatim text is never stored."}},"required":["surface"]},"AgentTelemetryEventDto":{"type":"object","properties":{"eventName":{"type":"string","description":"Canonical dotted event name. Must match the `agent_events.event_name` regex `^[a-z][a-z0-9_]*\\.[a-z][a-z0-9_]*$ ` (validated server-side and at the DB).","example":"page_builder.block_added"},"surface":{"type":"string","enum":["chat","page_builder","api","worker"]},"severity":{"type":"string","enum":["info","warn","error"]},"attributes":{"type":"object","description":"Free-form structured attributes. Routed through @charidy/shared/observability redactor + 4 KiB cap server-side before persistence."},"latencyMs":{"type":"number","description":"Latency in milliseconds."},"errorCode":{"type":"string","description":"Optional stable error code (matches the error envelope `code`)."},"sessionId":{"type":"string","description":"Optional session id from a prior `openSession` response. The event will be linked to that session and bump its eventCount.","format":"uuid"}},"required":["eventName","surface"]},"AgentTelemetryRecordErrorDto":{"type":"object","properties":{"surface":{"type":"string","enum":["chat","page_builder","api","worker"]},"code":{"type":"string","description":"Stable error code (e.g. `LAYOUT_BLOCK_TYPE_UNKNOWN`)."},"message":{"type":"string","description":"Human-readable error message; redacted server-side before persistence."},"sessionId":{"type":"string","format":"uuid"},"attributes":{"type":"object"}},"required":["surface","code","message"]},"AgentTelemetryBatchDto":{"type":"object","properties":{"openSession":{"description":"When set, opens a fresh `agent_sessions` row before processing the batch. The new session id is returned at the same path.","allOf":[{"$ref":"#/components/schemas/AgentTelemetryOpenSessionDto"}]},"events":{"description":"Up to 50 events per batch. Each event is redacted + size-capped server-side.","type":"array","items":{"$ref":"#/components/schemas/AgentTelemetryEventDto"}},"errors":{"description":"Up to 20 errors per batch. Each upserts the matching `agent_error_groups` row.","type":"array","items":{"$ref":"#/components/schemas/AgentTelemetryRecordErrorDto"}},"closeSessions":{"description":"Session ids to mark as ended (sets `agent_sessions.ended_at`).","type":"array","items":{"type":"string"}}}},"AgentTelemetryBatchResponseDto":{"type":"object","properties":{"sessionId":{"type":"string","description":"Newly minted session id when `openSession` was provided in the request.","format":"uuid"},"acceptedEvents":{"type":"number","description":"Number of events accepted (events failing redact/validation are dropped server-side)."},"acceptedErrors":{"type":"number","description":"Number of error rows recorded."},"closedSessions":{"type":"number","description":"Number of sessions closed."}},"required":["acceptedEvents","acceptedErrors","closedSessions"]},"AgentChatSessionDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"userId":{"type":"string","format":"uuid"},"title":{"type":"string","nullable":true},"pagePathname":{"type":"string","nullable":true},"campaignId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["active","archived"]},"lastMessageAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","userId","status","lastMessageAt","createdAt","updatedAt"]},"AgentChatSessionListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/AgentChatSessionDto"}},"totalCount":{"type":"number"}},"required":["rows","totalCount"]},"CreateAgentChatSessionDto":{"type":"object","properties":{"title":{"type":"string","maxLength":200},"pagePathname":{"type":"string","maxLength":500},"campaignId":{"type":"string","format":"uuid"}}},"AgentChatMessageDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"sessionId":{"type":"string","format":"uuid"},"clientMessageId":{"type":"string","description":"Client-side UIMessage.id used for idempotent upserts."},"role":{"type":"string","enum":["user","assistant","system"]},"parts":{"type":"array","description":"AI SDK UIMessage.parts payload (text, tool invocations, etc.).","items":{"type":"object","additionalProperties":true}},"createdAt":{"type":"string","format":"date-time"}},"required":["id","sessionId","clientMessageId","role","parts","createdAt"]},"AgentChatSessionDetailDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"userId":{"type":"string","format":"uuid"},"title":{"type":"string","nullable":true},"pagePathname":{"type":"string","nullable":true},"campaignId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["active","archived"]},"lastMessageAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"messages":{"type":"array","items":{"$ref":"#/components/schemas/AgentChatMessageDto"}}},"required":["id","organizationId","userId","status","lastMessageAt","createdAt","updatedAt","messages"]},"UpdateAgentChatSessionDto":{"type":"object","properties":{"title":{"type":"string","maxLength":200},"status":{"type":"string","enum":["active","archived"]}}},"AppendAgentChatMessageDto":{"type":"object","properties":{"clientMessageId":{"type":"string","description":"Client-side UIMessage.id used for idempotent upserts.","maxLength":200},"role":{"type":"string","enum":["user","assistant","system"]},"parts":{"type":"array","description":"AI SDK UIMessage.parts payload.","items":{"type":"object","additionalProperties":true}}},"required":["clientMessageId","role","parts"]},"AppendAgentChatMessagesDto":{"type":"object","properties":{"messages":{"maxItems":40,"type":"array","items":{"$ref":"#/components/schemas/AppendAgentChatMessageDto"}}},"required":["messages"]},"AppendAgentChatMessagesResponseDto":{"type":"object","properties":{"messages":{"type":"array","items":{"$ref":"#/components/schemas/AgentChatMessageDto"}},"session":{"$ref":"#/components/schemas/AgentChatSessionDto"}},"required":["messages","session"]},"AutomationCatalogResponseDto":{"type":"object","properties":{"catalog":{"type":"object","additionalProperties":true},"labels":{"type":"object","additionalProperties":{"type":"string"}},"gaps":{"type":"array","items":{"type":"object","additionalProperties":true}},"operations":{"type":"array","items":{"type":"object","additionalProperties":true},"description":"Automatable operations by entity and verb, e.g. Task -> Complete. Each verb carries the operationId an `operation` step stores and the operation's accepted/required input keys."},"recordActions":{"type":"array","items":{"type":"object","additionalProperties":true},"description":"Per catalog entity, the operation behind record.create / record.update / record.delete and how a record is addressed (idParam, parentParams)."}},"required":["catalog","labels","gaps","operations","recordActions"]},"CalendarPackOptionDto":{"type":"object","properties":{"key":{"type":"string"},"kind":{"type":"string","enum":["enum","time"]},"values":{"type":"array","items":{"type":"string"}},"default":{"type":"string","description":"Used when the organization does not set the option."}},"required":["key","kind","default"]},"CalendarPackDto":{"type":"object","properties":{"key":{"type":"string","description":"Stable key to put in an activity window's calendarPacks."},"labelEn":{"type":"string"},"labelHe":{"type":"string"},"descriptionEn":{"type":"string"},"descriptionHe":{"type":"string"},"approximate":{"type":"boolean","description":"True when boundaries are fixed clock times rather than computed from a location."},"options":{"type":"array","items":{"$ref":"#/components/schemas/CalendarPackOptionDto"}}},"required":["key","labelEn","labelHe","descriptionEn","descriptionHe","approximate","options"]},"SuggestedCalendarPackDto":{"type":"object","properties":{"key":{"type":"string"},"options":{"type":"object","additionalProperties":{"type":"string"},"description":"Suggested option values, e.g. {region: \"israel\"}."},"reason":{"type":"string","description":"Why it is suggested (organization_country_is_israel, organization_language_is_hebrew, ...)."}},"required":["key","reason"]},"AutomationSettingsResponseDto":{"type":"object","properties":{"activityWindow":{"type":"object","additionalProperties":true,"description":"The window in force (the platform default when none is saved). Activity window: {days: [\"sun\"..\"sat\"], start: \"HH:MM\", end: \"HH:MM\" (or \"24:00\"), timezone? (IANA, default the organization's), blackoutDates: [\"YYYY-MM-DD\"], calendarPacks: [packKey], packOptions?: {packKey: {option: value}}}. Outside the window an automation's email waits for the next allowed moment (or is skipped, per automation). Transactional mail from default automations ignores it."},"isDefaultActivityWindow":{"type":"boolean","description":"True while no window has been saved and the platform default (every day 08:00-21:00, no packs) applies."},"frequencyCap":{"type":"object","additionalProperties":true,"description":"The cap in force. Marketing frequency cap: {enabled, maxPerWeek (rolling 7 days), maxPerDay}. Counts marketing email only (transactional is never counted or capped)."},"isDefaultFrequencyCap":{"type":"boolean"},"timezone":{"type":"string","nullable":true,"description":"The organization timezone (organization settings); null means UTC is used."},"effectiveTimezone":{"type":"string","description":"The timezone windows, caps and date triggers actually use."},"calendarPacks":{"type":"array","items":{"$ref":"#/components/schemas/CalendarPackDto"}},"suggestedCalendarPacks":{"type":"array","items":{"$ref":"#/components/schemas/SuggestedCalendarPackDto"}}},"required":["activityWindow","isDefaultActivityWindow","frequencyCap","isDefaultFrequencyCap","timezone","effectiveTimezone","calendarPacks","suggestedCalendarPacks"]},"UpdateAutomationSettingsDto":{"type":"object","properties":{"activityWindow":{"type":"object","additionalProperties":true,"nullable":true,"description":"Omit to leave unchanged; null resets to the platform default. Activity window: {days: [\"sun\"..\"sat\"], start: \"HH:MM\", end: \"HH:MM\" (or \"24:00\"), timezone? (IANA, default the organization's), blackoutDates: [\"YYYY-MM-DD\"], calendarPacks: [packKey], packOptions?: {packKey: {option: value}}}. Outside the window an automation's email waits for the next allowed moment (or is skipped, per automation). Transactional mail from default automations ignores it."},"frequencyCap":{"type":"object","additionalProperties":true,"nullable":true,"description":"Omit to leave unchanged; null resets to the platform default (3 per week, 1 per day). Marketing frequency cap: {enabled, maxPerWeek (rolling 7 days), maxPerDay}. Counts marketing email only (transactional is never counted or capped)."}}},"CalendarPacksResponseDto":{"type":"object","properties":{"packs":{"type":"array","items":{"$ref":"#/components/schemas/CalendarPackDto"}},"suggestedCalendarPacks":{"description":"Packs that fit the organization profile (country, language). Suggestions only: nothing is enabled automatically.","type":"array","items":{"$ref":"#/components/schemas/SuggestedCalendarPackDto"}}},"required":["packs","suggestedCalendarPacks"]},"CalendarPreferencesDto":{"type":"object","properties":{"enabledPacks":{"description":"Explicitly selected calendar-pack keys. Empty means campaign scheduling advice is disabled.","type":"array","items":{"type":"string"}},"packOptions":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{"type":"string"}}}},"required":["enabledPacks","packOptions"]},"UpdateCalendarPreferencesDto":{"type":"object","properties":{"enabledPacks":{"type":"array","items":{"type":"string"}},"packOptions":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{"type":"string"}}}},"required":["enabledPacks"]},"PreviewCalendarPreferencesDto":{"type":"object","properties":{"enabledPacks":{"type":"array","items":{"type":"string"}},"packOptions":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{"type":"string"}}},"start":{"type":"string","example":"2027-05-20"},"end":{"type":"string","example":"2027-06-10"}},"required":["enabledPacks","start","end"]},"AutomationResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"status":{"type":"string","enum":["draft","active","paused","archived"]},"isDefault":{"type":"boolean"},"defaultKey":{"type":"string","nullable":true},"shadow":{"type":"boolean","description":"Shadow mode: evaluated and recorded as simulated, never sends."},"currentVersionId":{"type":"string","nullable":true,"format":"uuid"},"currentVersion":{"type":"number","nullable":true},"definition":{"type":"object","additionalProperties":true,"nullable":true,"description":"Definition of the current version."},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"enrollmentCount":{"type":"number","description":"How many times this automation enrolled a record (every status, shadow included)."},"lastRunAt":{"type":"string","nullable":true,"description":"When the most recent enrollment started (null when it never ran)."}},"required":["id","name","status","isDefault","defaultKey","shadow","currentVersionId","currentVersion","definition","createdAt","updatedAt","enrollmentCount","lastRunAt"]},"AutomationsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/AutomationResponseDto"}},"totalCount":{"type":"number"}},"required":["rows","totalCount"]},"ShadowComparisonRowDto":{"type":"object","properties":{"automationId":{"type":"string","format":"uuid"},"defaultKey":{"type":"string","nullable":true},"name":{"type":"string"},"legacyRuleId":{"type":"string","nullable":true,"description":"Legacy rule this default mirrors (by name)."},"legacyActed":{"type":"number","description":"Legacy runs in the window that enqueued at least one message/task (status success/partial)."},"legacyRuns":{"type":"number","description":"Legacy runs in the window of any status."},"shadowEnrollments":{"type":"number","description":"Shadow enrollments in the window."},"shadowWouldAct":{"type":"number","description":"Shadow enrollments whose steps would have acted (a simulated, non-skipped step)."},"shadowFailed":{"type":"number","description":"Shadow enrollments that failed."}},"required":["automationId","defaultKey","name","legacyRuleId","legacyActed","legacyRuns","shadowEnrollments","shadowWouldAct","shadowFailed"]},"ShadowComparisonResponseDto":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"},"rows":{"type":"array","items":{"$ref":"#/components/schemas/ShadowComparisonRowDto"}}},"required":["from","to","rows"]},"CreateAutomationDto":{"type":"object","properties":{"name":{"type":"string","maxLength":200},"definition":{"type":"object","additionalProperties":true,"description":"Versioned automation definition (`schemaVersion: 1`): `trigger` ({kind: record_changed|event|manual|date_field|schedule|segment_membership}), optional `conditions` (fail-closed DSL over trigger.record.*, trigger.event.*, trigger.occurrence.*, steps.<id>.output.*), ordered `steps` (send_email, create_task, wait, branch, exit), optional `exitWhen`, `enrollment` ({policy: every_time|once|once_per, period?}), optional `window` (activity-window override: {inherit?: organization|none, days?, start?, end?, timezone?, blackoutDates?, calendarPacks?, packOptions?, outside?: wait|skip, applyToTransactional?}) and optional `frequencyCap` ({onExceeded: wait|skip}). Time triggers: date_field {entity, field (a date field, incl. contact custom date fields), offsetDays -365..365, recurrence: once|yearly, calendar: gregorian|hebrew, at: HH:MM organization time, audience? (segment id: for a date on a campaign, every member of the segment is enrolled as the contact), maxRecipients?}; schedule {frequency: daily|weekly|monthly, at, dayOfWeek? (sun..sat), dayOfMonth?, audience? (segment id), maxRecipients?}; segment_membership {segmentId, change: entered|exited} (first evaluation enrolls nobody). Call getAutomationCatalog for the valid entities and fields. record/webhook/ai/for_each/wait_for_event steps are reserved for later phases and rejected."}},"required":["name","definition"]},"UpdateAutomationDto":{"type":"object","properties":{"name":{"type":"string","maxLength":200},"definition":{"type":"object","additionalProperties":true,"description":"Providing a definition creates a NEW immutable version; enrollments already running stay pinned to theirs. Versioned automation definition (`schemaVersion: 1`): `trigger` ({kind: record_changed|event|manual|date_field|schedule|segment_membership}), optional `conditions` (fail-closed DSL over trigger.record.*, trigger.event.*, trigger.occurrence.*, steps.<id>.output.*), ordered `steps` (send_email, create_task, wait, branch, exit), optional `exitWhen`, `enrollment` ({policy: every_time|once|once_per, period?}), optional `window` (activity-window override: {inherit?: organization|none, days?, start?, end?, timezone?, blackoutDates?, calendarPacks?, packOptions?, outside?: wait|skip, applyToTransactional?}) and optional `frequencyCap` ({onExceeded: wait|skip}). Time triggers: date_field {entity, field (a date field, incl. contact custom date fields), offsetDays -365..365, recurrence: once|yearly, calendar: gregorian|hebrew, at: HH:MM organization time, audience? (segment id: for a date on a campaign, every member of the segment is enrolled as the contact), maxRecipients?}; schedule {frequency: daily|weekly|monthly, at, dayOfWeek? (sun..sat), dayOfMonth?, audience? (segment id), maxRecipients?}; segment_membership {segmentId, change: entered|exited} (first evaluation enrolls nobody). Call getAutomationCatalog for the valid entities and fields. record/webhook/ai/for_each/wait_for_event steps are reserved for later phases and rejected."}}},"RequestAutomationScanResponseDto":{"type":"object","properties":{"requested":{"type":"boolean"},"note":{"type":"string","description":"When the worker will evaluate it (its scanner runs every minute)."}},"required":["requested","note"]},"TestAutomationDto":{"type":"object","properties":{"recordId":{"type":"string","format":"uuid","description":"Live record to run against (record_changed triggers; for event triggers it is the aggregate id)."},"op":{"type":"string","enum":["insert","update","delete"],"description":"Change operation to simulate for record_changed triggers. Default update."},"changedFields":{"description":"Catalog column names to treat as changed (record_changed fieldChanged triggers).","type":"array","items":{"type":"string"}},"eventPayload":{"type":"object","additionalProperties":true,"description":"Outbox payload to simulate for event triggers (e.g. {contact_id, amount_minor})."},"definition":{"type":"object","additionalProperties":true,"description":"Test a definition that is not saved yet. Defaults to the automation's current version."},"ignoreTriggerMatch":{"type":"boolean","description":"Run the plan even when the trigger would not match this record. Default false."}}},"WindowEffectDto":{"type":"object","properties":{"stepId":{"type":"string"},"templateKey":{"type":"string"},"templateCategory":{"type":"string","nullable":true,"description":"transactional / marketing / ... (null when the template is not found)."},"windowApplies":{"type":"boolean","description":"False when windows are off for this automation or it is a default automation sending transactional mail."},"evaluatedAt":{"type":"string","description":"The moment evaluated: the next occurrence for time triggers, now otherwise."},"allowed":{"type":"boolean","description":"True when the email would go out at `evaluatedAt`."},"nextAllowedAt":{"type":"string","nullable":true,"description":"When it would actually go out if it is held back (null when allowed, or when it would be skipped)."},"reason":{"type":"string","nullable":true,"description":"weekday, hours, blackout, pack:<key>, windows_off_for_this_automation, transactional_default_automation."},"whenOutside":{"type":"string","enum":["wait","skip"],"description":"What happens outside the window for this automation."}},"required":["stepId","templateKey","templateCategory","windowApplies","evaluatedAt","allowed","nextAllowedAt","reason","whenOutside"]},"TestPlanStepDto":{"type":"object","properties":{"stepId":{"type":"string"},"status":{"type":"string","enum":["succeeded","skipped","simulated","failed","deferred"]},"input":{"type":"object","additionalProperties":true},"output":{"type":"object","additionalProperties":true},"detail":{"type":"string","nullable":true},"assumedWaitElapsed":{"type":"string","nullable":true,"description":"For wait steps: when the wait would end (assumed elapsed in the plan)."}},"required":["stepId","status","input","output","detail","assumedWaitElapsed"]},"TestAutomationResponseDto":{"type":"object","properties":{"simulated":{"type":"boolean","description":"Always true: nothing was written and nothing was sent."},"triggerMatched":{"type":"boolean"},"triggerReason":{"type":"string","nullable":true},"conditionsMatched":{"type":"boolean"},"conditionsDetail":{"type":"string","nullable":true},"wouldEnroll":{"type":"boolean","description":"True when a real event would enroll this record."},"finalState":{"type":"string","enum":["completed","exited","not_run"]},"exitReason":{"type":"string","nullable":true},"nextOccurrenceAt":{"type":"string","nullable":true,"description":"Time triggers: when it fires next for this record / on its schedule (ISO). Null when it never fires or the trigger is event driven."},"occurrenceNote":{"type":"string","nullable":true,"description":"Plain explanation of the occurrence (which date, which timezone, what the segment first-run does)."},"windowEffects":{"description":"For each email step: whether the activity window holds it back and until when.","type":"array","items":{"$ref":"#/components/schemas/WindowEffectDto"}},"steps":{"type":"array","items":{"$ref":"#/components/schemas/TestPlanStepDto"}}},"required":["simulated","triggerMatched","triggerReason","conditionsMatched","conditionsDetail","wouldEnroll","finalState","exitReason","nextOccurrenceAt","occurrenceNote","windowEffects","steps"]},"EnrollmentResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"automationId":{"type":"string","format":"uuid"},"automationVersionId":{"type":"string","format":"uuid"},"recordEntity":{"type":"string"},"recordId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["running","waiting","completed","failed","exited","skipped"]},"currentStepId":{"type":"string","nullable":true},"shadow":{"type":"boolean"},"depth":{"type":"number"},"causedByEnrollmentId":{"type":"string","nullable":true,"format":"uuid"},"attemptCount":{"type":"number"},"errorCode":{"type":"string","nullable":true},"errorMessage":{"type":"string","nullable":true},"startedAt":{"type":"string"},"finishedAt":{"type":"string","nullable":true}},"required":["id","automationId","automationVersionId","recordEntity","recordId","status","currentStepId","shadow","depth","causedByEnrollmentId","attemptCount","errorCode","errorMessage","startedAt","finishedAt"]},"EnrollmentsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/EnrollmentResponseDto"}},"totalCount":{"type":"number"}},"required":["rows","totalCount"]},"StepRunResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"stepId":{"type":"string"},"status":{"type":"string","enum":["succeeded","skipped","simulated","failed","deferred"],"description":"`deferred`: the email was held back by the activity window or the frequency cap and the run is waiting to try again."},"input":{"type":"object","additionalProperties":true},"output":{"type":"object","additionalProperties":true},"errorCode":{"type":"string","nullable":true},"errorMessage":{"type":"string","nullable":true},"attempt":{"type":"number"},"startedAt":{"type":"string"},"finishedAt":{"type":"string","nullable":true}},"required":["id","stepId","status","input","output","errorCode","errorMessage","attempt","startedAt","finishedAt"]},"EnrollmentDetailResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"automationId":{"type":"string","format":"uuid"},"automationVersionId":{"type":"string","format":"uuid"},"recordEntity":{"type":"string"},"recordId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["running","waiting","completed","failed","exited","skipped"]},"currentStepId":{"type":"string","nullable":true},"shadow":{"type":"boolean"},"depth":{"type":"number"},"causedByEnrollmentId":{"type":"string","nullable":true,"format":"uuid"},"attemptCount":{"type":"number"},"errorCode":{"type":"string","nullable":true},"errorMessage":{"type":"string","nullable":true},"startedAt":{"type":"string"},"finishedAt":{"type":"string","nullable":true},"context":{"type":"object","additionalProperties":true,"description":"Run context: trigger snapshot (PII-redacted) and step outputs."},"stepRuns":{"type":"array","items":{"$ref":"#/components/schemas/StepRunResponseDto"}}},"required":["id","automationId","automationVersionId","recordEntity","recordId","status","currentStepId","shadow","depth","causedByEnrollmentId","attemptCount","errorCode","errorMessage","startedAt","finishedAt","context","stepRuns"]},"AutomationRecipeEmailDto":{"type":"object","properties":{"templateKey":{"type":"string","description":"Template key in the communications catalog (English and Hebrew versions exist)."},"when":{"description":"When this email goes out, in plain language.","allOf":[{"$ref":"#/components/schemas/LocalizedTextDto"}]},"subject":{"type":"string","nullable":true,"description":"The email's subject line in the requested language, as this organization has it (its own edit, or the default)."},"preview":{"type":"string","nullable":true,"description":"The email as plain text, rendered with a sample name and the campaign's name. Figures such as the goal appear only when real."}},"required":["templateKey","when","subject","preview"]},"AutomationRecipeInstanceDto":{"type":"object","properties":{"automationId":{"type":"string","format":"uuid"},"name":{"type":"string"},"status":{"type":"string","enum":["draft","active","paused","archived"]}},"required":["automationId","name","status"]},"AutomationRecipeResponseDto":{"type":"object","properties":{"key":{"type":"string","description":"Stable key, pass it to createAutomationFromRecipe."},"group":{"type":"string","enum":["campaign","donors","operational"]},"scope":{"type":"string","enum":["organization","campaign"],"description":"`campaign` recipes need a campaignId (one set per campaign)."},"name":{"$ref":"#/components/schemas/LocalizedTextDto"},"description":{"$ref":"#/components/schemas/LocalizedTextDto"},"category":{"type":"string","enum":["marketing","transactional"],"description":"Marketing emails go only to people who agreed to receive them, and are capped."},"defaultState":{"type":"string","enum":["on","off"],"description":"What a new organization (or campaign) gets: `on` is created switched on, `off` is created as a ready draft that does nothing until a person turns it on."},"runsOnEveryPlan":{"type":"boolean","description":"Keeps working on every plan (transactional defaults only)."},"emails":{"type":"array","items":{"$ref":"#/components/schemas/AutomationRecipeEmailDto"}},"audiences":{"description":"Preset segments (listSegmentPresets keys) this journey sends to.","type":"array","items":{"type":"string"}},"instance":{"nullable":true,"description":"The automation this recipe already became (for the campaign, when campaignId was given), or null.","allOf":[{"$ref":"#/components/schemas/AutomationRecipeInstanceDto"}]}},"required":["key","group","scope","name","description","category","defaultState","runsOnEveryPlan","emails","audiences","instance"]},"AutomationRecipesListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/AutomationRecipeResponseDto"}}},"required":["rows"]},"CreateAutomationFromRecipeDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid","description":"Required for a campaign recipe, not allowed for an organization recipe."},"locale":{"type":"string","enum":["en","he"],"default":"en","description":"Language of the generated automation and audience names."}}},"AutomationWebhookEndpointDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"automationId":{"type":"string","format":"uuid"},"tokenPrefix":{"type":"string","description":"First characters of the token, to tell endpoints apart. The token itself is never shown again."},"requireSignature":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"rotatedAt":{"type":"string","format":"date-time","nullable":true},"lastUsedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","automationId","tokenPrefix","requireSignature","createdAt","rotatedAt","lastUsedAt"]},"AutomationWebhookEndpointsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/AutomationWebhookEndpointDto"}}},"required":["rows"]},"CreateAutomationWebhookEndpointDto":{"type":"object","properties":{"requireSignature":{"type":"boolean","default":false,"description":"Require the sender to sign each request with the endpoint signing secret (`X-Givearoo-Signature: t=<unix>,v1=<hex hmac-sha256 of \"<t>.<raw body>\">`). Unsigned or badly signed requests are rejected with 401."}}},"AutomationWebhookEndpointSecretResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"automationId":{"type":"string","format":"uuid"},"tokenPrefix":{"type":"string","description":"First characters of the token, to tell endpoints apart. The token itself is never shown again."},"requireSignature":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"rotatedAt":{"type":"string","format":"date-time","nullable":true},"lastUsedAt":{"type":"string","format":"date-time","nullable":true},"path":{"type":"string","description":"The secret URL path to give to the sender: POST it a JSON object body (at most 64 KB). SHOWN ONCE: only a hash is stored, so a lost token means rotating the endpoint.","example":"/api/v1/public/automations/webhooks/<token>"},"token":{"type":"string","description":"The token inside `path` (same secret). Shown once."},"signingSecret":{"type":"string","description":"The signing secret, present when `requireSignature` is on."}},"required":["id","automationId","tokenPrefix","requireSignature","createdAt","rotatedAt","lastUsedAt","path","token"]},"AutomationWebhookSigningSecretResponseDto":{"type":"object","properties":{"signingSecret":{"type":"string","description":"Secret that signs this automation's OUTBOUND webhook requests: `X-Givearoo-Signature: t=<unix>,v1=<hex hmac-sha256 of \"<t>.<raw body>\">`. Receivers verify with it."},"version":{"type":"number","description":"Bumps every time the secret is rotated."}},"required":["signingSecret","version"]},"AutomationActionDto":{"type":"object","properties":{"type":{"type":"string","description":"Action type. Supported: `enqueue_comms` (send an email) and `create_task` (open a unified task).","enum":["enqueue_comms","create_task"]},"payload":{"type":"object","description":"Action-specific payload.\n\n`enqueue_comms`: { template_key | template_id, channel?, to: { contact_id | global_user_id | raw_address }, locale?, sender_identity_id?, merge_context_overrides?, bypass_consent?, receipt_attachment_url?, receipt_attachment_mime?, idempotency_key? }. `receipt_attachment_url` (interpolable, e.g. `${event.payload.receipt_url}`) attaches a fetched document to the email; `idempotency_key` (interpolable, e.g. `donation-ack:${event.payload.contribution_id}`) overrides the default per-event key so multiple rules can collapse to a single send.\n\n`create_task`: { title (required, interpolable), type? (call|email|meeting|whatsapp|sms|todo|donation_chase|custom, default todo), priority? (low|normal|high|urgent), description?, assigned_to_global_user_id? (interpolable), contact_id? / campaign_id? / contribution_id? (interpolable, e.g. `${event.contact.id}`), due_in_hours? (number, sets due_at relative to now), remind_in_hours? (number). Creates a task with source=automation and emits `task.created`.","additionalProperties":true}},"required":["type","payload"]},"AutomationRuleResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"name":{"type":"string"},"isEnabled":{"type":"boolean"},"triggerEvent":{"type":"string"},"eventFilterJson":{"type":"object","additionalProperties":true,"nullable":true},"conditionDsl":{"type":"object","additionalProperties":true},"actions":{"type":"array","items":{"$ref":"#/components/schemas/AutomationActionDto"}},"campaignId":{"type":"object","format":"uuid","nullable":true},"priority":{"type":"number"},"version":{"type":"number"},"createdById":{"type":"object","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","isEnabled","triggerEvent","eventFilterJson","conditionDsl","actions","campaignId","priority","version","createdById","createdAt","updatedAt"]},"AutomationRulesListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/AutomationRuleResponseDto"}},"totalCount":{"type":"number"}},"required":["rows","totalCount"]},"CreateAutomationRuleDto":{"type":"object","properties":{"name":{"type":"string","description":"Admin label for this rule.","maxLength":200},"isEnabled":{"type":"boolean","description":"Whether the rule is active. Defaults to true.","default":true},"triggerEvent":{"type":"string","description":"Outbox `event_type` to react to. Must be in the canonical allowlist.","enum":["contact.created","contact.updated","contribution.created","contribution.succeeded","contribution.receipt_issued","contribution.receipt_selfissued","contribution.failed","contribution.matched","contribution.refunded","contribution.canceled","recurring.renewed","recurring.failed","recurring.canceled","campaign.created","campaign.team.created","campaign.published","campaign.paused","campaign.resumed","campaign.ended","campaign.archived","campaign.duplicated","campaign.matcher.activated","campaign.matcher.exhausted","campaign.umbrella.child_added","campaign.umbrella.child_removed","ambassador.created","ambassador.updated","ambassador.status_changed","task.created","task.completed"]},"eventFilterJson":{"type":"object","description":"Shallow JSON filter applied before condition_dsl (e.g. `{\"source_plugin_id\":\"...\"}`).","additionalProperties":true,"nullable":true},"conditionDsl":{"type":"object","description":"Boolean expression DSL evaluated against the outbox payload. Empty object = always true. See SPEC/10 §5.2.","additionalProperties":true},"actions":{"description":"Ordered list of actions to execute when the rule matches and conditions pass.","minItems":1,"type":"array","items":{"$ref":"#/components/schemas/AutomationActionDto"}},"campaignId":{"type":"object","description":"Restrict the rule to events whose payload `campaign_id` equals this value.","format":"uuid","nullable":true},"priority":{"type":"number","description":"Tie-breaker when multiple rules match (lower runs first).","minimum":0,"maximum":1000,"default":100}},"required":["name","triggerEvent","actions"]},"CreateEmailAutomationDto":{"type":"object","properties":{"name":{"type":"string","description":"Admin label for this rule.","maxLength":200},"triggerEvent":{"type":"string","description":"Outbox `event_type` to react to. Must be in the canonical allowlist.","enum":["contact.created","contact.updated","contribution.created","contribution.succeeded","contribution.receipt_issued","contribution.receipt_selfissued","contribution.failed","contribution.matched","contribution.refunded","contribution.canceled","recurring.renewed","recurring.failed","recurring.canceled","campaign.created","campaign.team.created","campaign.published","campaign.paused","campaign.resumed","campaign.ended","campaign.archived","campaign.duplicated","campaign.matcher.activated","campaign.matcher.exhausted","campaign.umbrella.child_added","campaign.umbrella.child_removed","ambassador.created","ambassador.updated","ambassador.status_changed","task.created","task.completed"]},"templateKey":{"type":"string","description":"Communication template key to send (e.g. `donation.thank_you`)."},"recipientContactRef":{"type":"string","description":"Recipient reference resolved against the event context. Defaults to `${event.contact.id}`.","default":"${event.contact.id}"},"locale":{"type":"string","description":"Locale override for the send (en | he)."},"isEnabled":{"type":"boolean","description":"Whether the rule is active. Defaults to true.","default":true}},"required":["name","triggerEvent","templateKey"]},"UpdateAutomationRuleDto":{"type":"object","properties":{"name":{"type":"string","maxLength":200},"isEnabled":{"type":"boolean"},"triggerEvent":{"type":"string","enum":["contact.created","contact.updated","contribution.created","contribution.succeeded","contribution.receipt_issued","contribution.receipt_selfissued","contribution.failed","contribution.matched","contribution.refunded","contribution.canceled","recurring.renewed","recurring.failed","recurring.canceled","campaign.created","campaign.team.created","campaign.published","campaign.paused","campaign.resumed","campaign.ended","campaign.archived","campaign.duplicated","campaign.matcher.activated","campaign.matcher.exhausted","campaign.umbrella.child_added","campaign.umbrella.child_removed","ambassador.created","ambassador.updated","ambassador.status_changed","task.created","task.completed"]},"eventFilterJson":{"type":"object","additionalProperties":true,"nullable":true},"conditionDsl":{"type":"object","additionalProperties":true},"actions":{"type":"array","items":{"$ref":"#/components/schemas/AutomationActionDto"}},"campaignId":{"type":"object","format":"uuid","nullable":true},"priority":{"type":"number","minimum":0,"maximum":1000}}},"AutomationRunResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"automationRuleId":{"type":"string","format":"uuid"},"outboxId":{"type":"string","format":"uuid"},"dedupeKey":{"type":"string"},"status":{"type":"string","enum":["success","failed","partial","skipped"]},"logJson":{"type":"array","items":{"type":"object","additionalProperties":true}},"errorCode":{"type":"object","nullable":true},"errorMessage":{"type":"object","nullable":true},"startedAt":{"type":"string"},"finishedAt":{"type":"object","nullable":true}},"required":["id","organizationId","automationRuleId","outboxId","dedupeKey","status","logJson","errorCode","errorMessage","startedAt","finishedAt"]},"AutomationRunsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/AutomationRunResponseDto"}},"totalCount":{"type":"number"}},"required":["rows","totalCount"]},"ListContactsQueryDto":{"type":"object","properties":{"limit":{"type":"number","default":50,"maximum":100,"minimum":1,"description":"Maximum contacts to return in this page. Page past it with the opaque `cursor` returned in `pagination.cursor`."},"cursor":{"type":"string","maxLength":512,"description":"Opaque keyset cursor from a previous response's `pagination.cursor`. Returns the rows that follow that page in `createdAt DESC, id DESC` order. Pass every filter unchanged alongside it — a cursor is only meaningful for the same filter set that produced it. Omit for the first page. A cursor that cannot be decoded is rejected with `INVALID_CURSOR`."},"search":{"type":"string","description":"Case-insensitive search over display name, email, and phone.","maxLength":120},"source":{"type":"string","enum":["api","portal","import","donation_form","ambassador","manual","system"],"description":"Filter contacts by acquisition source."},"tagKey":{"type":"string","description":"Filter contacts by CRM tag key, including tags applied by donation levels.","maxLength":80},"campaignId":{"type":"string","format":"uuid","description":"Campaign context for participation filters and per-campaign CRM workflows."},"inCampaignOnly":{"type":"boolean","default":false,"description":"When true, returns only contacts that participate in the campaign provided by campaignId."},"participationMin":{"type":"number","minimum":0,"maximum":100,"description":"Minimum number of campaigns this contact participates in."},"participationMax":{"type":"number","minimum":0,"maximum":100,"description":"Maximum number of campaigns this contact participates in."},"ids":{"description":"Filter to exactly these contact ids, comma-separated or repeated. Bypasses `search`/`inCampaignOnly` paging entirely so a caller that already knows which contacts it needs (e.g. the donor names on a page of contribution rows) can fetch them in one bounded round trip instead of paging through `inCampaignOnly` results and hoping the ones it wants are on the page. Maximum 100 ids per request.","maxItems":100,"type":"array","items":{"type":"string"}}}},"ContactAddressDto":{"type":"object","properties":{"formatted":{"type":"string","nullable":true},"provider":{"type":"string","enum":["google_places","manual","import","system"],"nullable":true},"placeId":{"type":"string","nullable":true},"lat":{"type":"number","nullable":true},"lng":{"type":"number","nullable":true},"verifiedAt":{"type":"string","format":"date-time","nullable":true},"components":{"type":"object","additionalProperties":true,"nullable":true}}},"ContactScoreDto":{"type":"object","properties":{"value":{"type":"number","nullable":true,"minimum":0,"maximum":100,"description":"Engagement score 0–100 — higher means the contact is more likely to respond to outreach. `null` when no score has been computed yet."},"source":{"type":"string","enum":["heuristic","ml","manual"],"nullable":true,"description":"Where the score came from: `heuristic` (rule-based), `ml` (model), or `manual` (operator override)."},"explanation":{"type":"object","nullable":true,"additionalProperties":true,"description":"Free-form JSON breakdown of which signals contributed to the score. Used by the donor profile UI to show \"why\" the score is what it is."},"computedAt":{"type":"string","nullable":true,"format":"date-time","description":"ISO timestamp the score was last recomputed."}}},"ContactConsentDto":{"type":"object","properties":{"emailOptIn":{"type":"boolean","description":"True when the contact has opted in to transactional + marketing email. Required before broadcast email channels can target this contact."},"smsOptIn":{"type":"boolean","description":"True when the contact has opted in to SMS messages. STOP keywords flip this to false automatically via the suppressions ingest worker."},"whatsappOptIn":{"type":"boolean","description":"True when the contact has opted in to WhatsApp business messages."}},"required":["emailOptIn","smsOptIn","whatsappOptIn"]},"ContactResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable UUID of the contact within the host organization."},"organizationId":{"type":"string","format":"uuid","description":"UUID of the organization that owns this contact."},"displayName":{"type":"string","example":"Jane Donor","description":"Human-readable display name, derived from first + last name. Used wherever the UI / AI agent surfaces the contact in conversation."},"linkedGlobalUserId":{"type":"string","format":"uuid","nullable":true,"description":"Linked global user (donor portal account) if the contact has claimed their profile across multiple organizations. `null` otherwise."},"firstName":{"type":"string","nullable":true,"description":"Given / first name as captured."},"lastName":{"type":"string","nullable":true,"description":"Family / last name as captured."},"salutation":{"type":"string","nullable":true,"description":"Honorific / salutation (e.g. \"Dr.\", \"Rabbi\")."},"gender":{"type":"string","enum":["male","female","other","prefer_not_say"],"nullable":true,"description":"Self-declared gender."},"familyStatus":{"type":"string","enum":["single","married","divorced","widowed","other"],"nullable":true,"description":"Family status (single, married, ...). Drives relationship-aware messaging."},"email":{"type":"string","nullable":true,"description":"Primary email address (citext, lower-cased)."},"phoneE164":{"type":"string","nullable":true,"description":"E.164 phone number, including `+` and country code."},"ilNationalId":{"type":"string","nullable":true,"description":"Israeli teudat-zehut or company number (digits only). Used by IL-specific compliance flows."},"countryCode":{"type":"string","nullable":true,"description":"ISO-3166-1 alpha-2 country code."},"city":{"type":"string","nullable":true,"description":"City / locality."},"street":{"type":"string","nullable":true,"description":"Street name."},"streetNumber":{"type":"string","nullable":true,"description":"Street / house number."},"aptNumber":{"type":"string","nullable":true,"description":"Apartment / unit number."},"zip":{"type":"string","nullable":true,"description":"Postal / ZIP code."},"stateProvince":{"type":"string","nullable":true,"description":"State / province / region (free text)."},"doNotContact":{"type":"boolean","description":"Global do-not-contact suppression flag. Comms-consent-adjacent — surfaced prominently on the profile. Enforcement in broadcast/automation expansion is a follow-up."},"preferredContactChannel":{"type":"string","enum":["email","sms","whatsapp","phone"],"nullable":true,"description":"Preferred outreach channel (email / sms / whatsapp / phone)."},"dateOfBirth":{"type":"string","format":"date","nullable":true,"description":"Date of birth (YYYY-MM-DD)."},"anniversaryAt":{"type":"string","format":"date","nullable":true,"description":"Anniversary date (YYYY-MM-DD)."},"yahrzeitAt":{"type":"string","format":"date","nullable":true,"description":"Yahrzeit / memorial date (YYYY-MM-DD)."},"assignedGlobalUserId":{"type":"string","format":"uuid","nullable":true,"description":"CRM staff member assigned to manage this contact. `null` when unassigned."},"source":{"type":"string","enum":["api","portal","import","donation_form","ambassador","manual","system"],"description":"How this contact entered the system: API, donor portal, file import, donation form, ambassador signup, manual entry, or system-generated."},"sourceRefId":{"type":"string","nullable":true,"description":"Provider-side reference id (e.g. import job batch id, donation form submission id). Useful for replay / audit but not user-facing."},"preferredLocale":{"type":"string","nullable":true,"enum":["en","he"],"description":"Preferred UI / outbound communications locale."},"avatarUrl":{"type":"string","nullable":true,"description":"Provider-hosted profile photo URL captured during contact import (Google People / Microsoft Graph). `null` when no photo was available. Note: Google photo URLs are publicly hotlinkable; Microsoft Graph photo URLs generally require an auth token and may not render directly."},"customProperties":{"type":"object","additionalProperties":true,"description":"Topic 24 custom-field payload — tenant-defined fields whose schemas are registered via custom_field_definitions and enforced by CustomFieldValidator."},"address":{"description":"Normalized address metadata. Split address fields remain the reporting/source-of-truth columns.","allOf":[{"$ref":"#/components/schemas/ContactAddressDto"}]},"score":{"description":"Engagement score with explanation. Drives CRM list color coding and donor wall featured-donor ordering.","allOf":[{"$ref":"#/components/schemas/ContactScoreDto"}]},"lastInteractionAt":{"type":"string","nullable":true,"format":"date-time","description":"ISO timestamp of the last interaction (any inbound or outbound touch) with this contact."},"consent":{"description":"Per-channel opt-in flags. Communications workers refuse to deliver on channels where the corresponding flag is false.","allOf":[{"$ref":"#/components/schemas/ContactConsentDto"}]},"createdAt":{"type":"string","format":"date-time","description":"ISO timestamp this contact was first created in our system."},"updatedAt":{"type":"string","format":"date-time","description":"ISO timestamp of the last update to any field on this contact."}},"required":["id","organizationId","displayName","doNotContact","source","customProperties","address","score","consent","createdAt","updatedAt"]},"ContactsListPaginationDto":{"type":"object","properties":{"cursor":{"type":"string","nullable":true,"description":"Opaque cursor for the next page. Pass it back as `cursor` on the next request. `null` when there are no more pages."},"hasMore":{"type":"boolean","description":"True when there is at least one more page after this one."},"pageSize":{"type":"number","minimum":1,"maximum":100,"description":"Effective page size used for this response."}},"required":["hasMore","pageSize"]},"ContactsListResponseDto":{"type":"object","properties":{"rows":{"description":"Page of contact rows, newest first (`createdAt DESC, id DESC`).","type":"array","items":{"$ref":"#/components/schemas/ContactResponseDto"}},"totalCount":{"type":"number","minimum":0,"description":"Exact number of visible tenant contacts matching the list filters — the total across all pages, not the size of this page."},"pagination":{"description":"Keyset pagination metadata for fetching the next page.","allOf":[{"$ref":"#/components/schemas/ContactsListPaginationDto"}]}},"required":["rows","totalCount","pagination"]},"DuplicateLookupResponseDto":{"type":"object","properties":{"matches":{"type":"array","items":{"$ref":"#/components/schemas/ContactResponseDto"}}},"required":["matches"]},"ValidateContactAddressDto":{"type":"object","properties":{"query":{"type":"string","maxLength":512},"provider":{"type":"string","enum":["google_places","manual","import","system"],"default":"google_places"}},"required":["query"]},"ValidateContactAddressResponseDto":{"type":"object","properties":{"formatted":{"type":"string"},"provider":{"type":"string","enum":["google_places","manual","import","system"]},"placeId":{"type":"string","nullable":true},"lat":{"type":"number","nullable":true},"lng":{"type":"number","nullable":true},"components":{"type":"object","additionalProperties":true}},"required":["formatted","provider","components"]},"LargestDonationDto":{"type":"object","properties":{"amountMinor":{"type":"number","format":"int64","nullable":false},"currency":{"type":"string","nullable":false},"campaignName":{"type":"string","nullable":true},"donatedAt":{"type":"string","format":"date-time","nullable":false}},"required":["amountMinor","currency","campaignName","donatedAt"]},"CurrentCampaignDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","nullable":false},"name":{"type":"string","nullable":false},"givenMinor":{"type":"number","format":"int64","nullable":false},"currency":{"type":"string","nullable":false},"lastGivenAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","name","givenMinor","currency","lastGivenAt"]},"GivingByCampaignDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid","nullable":true},"campaignName":{"type":"string","nullable":true},"totalMinor":{"type":"number","format":"int64","nullable":false},"currency":{"type":"string","nullable":false},"count":{"type":"number","nullable":false}},"required":["campaignId","campaignName","totalMinor","currency","count"]},"OpenPledgeDto":{"type":"object","properties":{"amountMinor":{"type":"number","format":"int64","nullable":false},"currency":{"type":"string","nullable":false},"dueAt":{"type":"string","format":"date-time","nullable":false},"taskId":{"type":"string","format":"uuid","nullable":false}},"required":["amountMinor","currency","dueAt","taskId"]},"ContactStatsDto":{"type":"object","properties":{"contactId":{"type":"string","format":"uuid"},"totalDonatedMinor":{"type":"number","format":"int64"},"totalDonatedCurrency":{"type":"string","nullable":true},"donationsCount":{"type":"number","minimum":0},"donationsLast12moCount":{"type":"number","minimum":0},"donationsLast12moMinor":{"type":"number","format":"int64"},"lastDonatedAt":{"type":"string","format":"date-time","nullable":true},"lastDonationAmountMinor":{"type":"number","format":"int64","nullable":true},"lastDonationCurrency":{"type":"string","nullable":true},"lastDonationId":{"type":"string","format":"uuid","nullable":true},"recurringActiveCount":{"type":"number","minimum":0},"monthlyRecurringMinor":{"type":"number","format":"int64"},"monthlyRecurringCurrency":{"type":"string","nullable":true},"hasActiveRecurring":{"type":"boolean"},"lastFollowupAt":{"type":"string","format":"date-time","nullable":true},"lastNoteAt":{"type":"string","format":"date-time","nullable":true},"lastInboundCommunicationAt":{"type":"string","format":"date-time","nullable":true},"recomputeVersion":{"type":"number","minimum":1},"lastRecomputedAt":{"type":"string","format":"date-time"},"largestDonation":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/LargestDonationDto"}]},"currentCampaign":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/CurrentCampaignDto"}]},"givingByCampaign":{"nullable":false,"type":"array","items":{"$ref":"#/components/schemas/GivingByCampaignDto"}},"openPledge":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/OpenPledgeDto"}]}},"required":["contactId","totalDonatedMinor","donationsCount","donationsLast12moCount","donationsLast12moMinor","recurringActiveCount","monthlyRecurringMinor","hasActiveRecurring","recomputeVersion","lastRecomputedAt","largestDonation","currentCampaign","givingByCampaign","openPledge"]},"ContactTagResponseDto":{"type":"object","properties":{"key":{"type":"string","description":"Stable, machine-readable tag key used by segment filters."},"label":{"type":"string","description":"Human-readable tag label for display in pickers."},"colorHex":{"type":"object","nullable":true,"description":"Optional hex color used to render the tag chip.","example":"#2563eb"}},"required":["key","label"]},"ContactActivityEventDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contactId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["contact","note","followup","contribution","communication","tag","merge","segment","system"]},"title":{"type":"string"},"bodyText":{"type":"string","nullable":true},"sourceTable":{"type":"string","nullable":true},"sourceId":{"type":"string","format":"uuid","nullable":true},"occurredAt":{"type":"string","format":"date-time"},"actorGlobalUserId":{"type":"string","format":"uuid","nullable":true},"payload":{"type":"object","additionalProperties":true}},"required":["id","contactId","kind","title","occurredAt","payload"]},"ContactTimelineResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/ContactActivityEventDto"}},"totalCount":{"type":"number","minimum":0}},"required":["rows","totalCount"]},"ContactAiInsightDto":{"type":"object","properties":{"status":{"type":"string","enum":["not_ready","stale","ready"]},"summary":{"type":"string","nullable":true},"nextBestAction":{"type":"string","nullable":true},"sourceEventIds":{"type":"array","items":{"type":"string"}}},"required":["status","sourceEventIds"]},"BroughtByDto":{"type":"object","properties":{"label":{"type":"string"},"campaignName":{"type":"string","nullable":true}},"required":["label","campaignName"]},"ContactProfileResponseDto":{"type":"object","properties":{"contact":{"$ref":"#/components/schemas/ContactResponseDto"},"stats":{"$ref":"#/components/schemas/ContactStatsDto"},"tags":{"type":"array","items":{"$ref":"#/components/schemas/ContactTagResponseDto"}},"timeline":{"$ref":"#/components/schemas/ContactTimelineResponseDto"},"aiInsight":{"$ref":"#/components/schemas/ContactAiInsightDto"},"broughtBy":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/BroughtByDto"}]}},"required":["contact","stats","tags","timeline","aiInsight","broughtBy"]},"UpdateContactDto":{"type":"object","properties":{"firstName":{"type":"object","maxLength":120,"nullable":true},"lastName":{"type":"object","maxLength":120,"nullable":true},"salutation":{"type":"object","maxLength":40,"nullable":true},"gender":{"type":"string","enum":["male","female","other","prefer_not_say"],"nullable":true},"familyStatus":{"type":"string","enum":["single","married","divorced","widowed","other"],"nullable":true},"email":{"type":"object","maxLength":320,"nullable":true},"phoneE164":{"type":"object","nullable":true},"ilNationalId":{"type":"object","nullable":true},"countryCode":{"type":"object","nullable":true},"city":{"type":"object","maxLength":160,"nullable":true},"street":{"type":"object","maxLength":160,"nullable":true},"streetNumber":{"type":"object","maxLength":40,"nullable":true},"aptNumber":{"type":"object","maxLength":40,"nullable":true},"zip":{"type":"object","maxLength":40,"nullable":true},"stateProvince":{"type":"object","maxLength":120,"nullable":true,"description":"State / province / region (free text)."},"doNotContact":{"type":"boolean","description":"Global do-not-contact suppression flag."},"emailOptIn":{"type":"boolean","description":"Whether email communication is allowed."},"preferredContactChannel":{"type":"string","enum":["email","sms","whatsapp","phone"],"nullable":true},"dateOfBirth":{"type":"object","format":"date","nullable":true},"anniversaryAt":{"type":"object","format":"date","nullable":true},"yahrzeitAt":{"type":"object","format":"date","nullable":true},"assignedGlobalUserId":{"type":"object","format":"uuid","nullable":true},"preferredLocale":{"type":"string","enum":["en","he"],"nullable":true},"customProperties":{"type":"object","additionalProperties":true},"addressFormatted":{"type":"object","nullable":true},"addressProvider":{"type":"string","enum":["google_places","manual","import","system"],"nullable":true},"addressPlaceId":{"type":"object","nullable":true},"addressLat":{"type":"number","nullable":true},"addressLng":{"type":"number","nullable":true},"addressComponents":{"type":"object","additionalProperties":true,"nullable":true}}},"MergeContactsDto":{"type":"object","properties":{"targetContactId":{"type":"string","format":"uuid"},"reason":{"type":"string","maxLength":1000}},"required":["targetContactId"]},"MergeContactsResponseDto":{"type":"object","properties":{"mergeId":{"type":"string","format":"uuid"},"sourceContact":{"$ref":"#/components/schemas/ContactResponseDto"},"targetContact":{"$ref":"#/components/schemas/ContactResponseDto"},"rollbackUntil":{"type":"string","format":"date-time"}},"required":["mergeId","sourceContact","targetContact","rollbackUntil"]},"AssignContactTagDto":{"type":"object","properties":{"tagKey":{"type":"string","description":"Existing tag key to assign to the contact."}},"required":["tagKey"]},"ContactTagAssignmentResponseDto":{"type":"object","properties":{"tag":{"$ref":"#/components/schemas/ContactTagResponseDto"},"appliedAt":{"type":"string","format":"date-time"}},"required":["tag","appliedAt"]},"CreateNoteDto":{"type":"object","properties":{"kind":{"type":"string","enum":["note","interaction","donation_comment","system"],"default":"note"},"bodyText":{"type":"string","maxLength":8000},"taskId":{"type":"string","format":"uuid","description":"Optional unified task this note is attached to."},"contributionId":{"type":"string","format":"uuid"},"customProperties":{"type":"object","additionalProperties":true}},"required":["bodyText"]},"NoteResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contactId":{"type":"object","format":"uuid"},"kind":{"type":"string","enum":["note","interaction","donation_comment","system"]},"bodyText":{"type":"string"},"customProperties":{"type":"object","additionalProperties":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdByGlobalUserId":{"type":"string","format":"uuid","nullable":true}},"required":["id","contactId","kind","bodyText","customProperties","createdAt","updatedAt"]},"CreateFollowupDto":{"type":"object","properties":{"kind":{"type":"string","enum":["call","email","meeting","task","donation_chase","custom"],"default":"task"},"title":{"type":"string","maxLength":240},"description":{"type":"string","maxLength":4000},"priority":{"type":"string","enum":["low","normal","high","urgent"],"default":"normal"},"assignedToGlobalUserId":{"type":"string","format":"uuid"},"dueAt":{"type":"string","format":"date-time"},"contributionId":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"customProperties":{"type":"object","additionalProperties":true}},"required":["title"]},"FollowupResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contactId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["call","email","meeting","task","donation_chase","custom"]},"title":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["open","in_progress","done","canceled"]},"priority":{"type":"string","enum":["low","normal","high","urgent"]},"overdue":{"type":"boolean"},"assignedToGlobalUserId":{"type":"string","format":"uuid","nullable":true},"dueAt":{"type":"string","format":"date-time","nullable":true},"completedAt":{"type":"string","format":"date-time","nullable":true},"outcomeText":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","contactId","kind","title","status","priority","overdue","createdAt","updatedAt"]},"UpdateFollowupDto":{"type":"object","properties":{"status":{"type":"string","enum":["open","in_progress","done","canceled"]},"title":{"type":"string","maxLength":240},"description":{"type":"object","maxLength":4000,"nullable":true},"priority":{"type":"string","enum":["low","normal","high","urgent"]},"dueAt":{"type":"object","format":"date-time","nullable":true},"outcomeText":{"type":"object","maxLength":4000,"nullable":true}}},"ContactAmbassadorParticipationDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"UUID of the ambassador participation row."},"campaignId":{"type":"string","format":"uuid","description":"UUID of the campaign this ambassador is signed up for."},"campaignName":{"type":"string","description":"Campaign display name."},"campaignSlug":{"type":"string","description":"URL slug of the campaign."},"displayName":{"type":"string","description":"Ambassador display name (defaults to contact name)."},"customSlug":{"type":"string","description":"Per-campaign custom slug used in the ambassador public URL `/{orgSlug}/{campaignSlug}/a/{customSlug}`."},"raisedAmountMinor":{"type":"number","format":"int64","description":"Total raised by this ambassador participation in minor currency units (e.g. cents)."},"goalAmountMinor":{"type":"number","format":"int64","nullable":true,"description":"Ambassador goal in minor units. `null` when no goal is set."},"currency":{"type":"string","description":"ISO-4217 currency code (3 letters)."},"contributionCount":{"type":"number","description":"Total succeeded contributions attributed to this ambassador."},"status":{"type":"string","description":"Lifecycle status of the ambassador participation (e.g. `active`)."},"parentAmbassadorParticipationId":{"type":"string","format":"uuid","nullable":true,"description":"Parent ambassador participation when this row sits under a team / sub-ambassador."},"createdAt":{"type":"string","format":"date-time","description":"ISO timestamp the ambassador participation was created."}},"required":["id","campaignId","campaignName","campaignSlug","displayName","customSlug","raisedAmountMinor","currency","contributionCount","status","createdAt"]},"ContactAmbassadorParticipationsResponseDto":{"type":"object","properties":{"rows":{"description":"All ambassador participations linked to the given contact.","type":"array","items":{"$ref":"#/components/schemas/ContactAmbassadorParticipationDto"}},"totalCount":{"type":"number","minimum":0,"description":"Total rows returned (no pagination here — the list is bounded by contact)."}},"required":["rows","totalCount"]},"CreateContactDto":{"type":"object","properties":{"firstName":{"type":"string","example":"Jane","maxLength":120,"description":"Given / first name. At least one of firstName, lastName, or email is required."},"lastName":{"type":"string","example":"Donor","maxLength":120,"description":"Family / last name."},"salutation":{"type":"string","example":"Dr.","maxLength":40,"description":"Honorific / salutation (e.g. \"Dr.\", \"Rabbi\"). Free text."},"gender":{"type":"string","enum":["male","female","other","prefer_not_say"],"description":"Self-declared gender. Optional and used only where local regulation allows."},"familyStatus":{"type":"string","enum":["single","married","divorced","widowed","other"],"description":"Family status (e.g. single, married). Used for relationship-aware messaging."},"email":{"type":"string","example":"jane@example.org","maxLength":320,"description":"Primary email. Stored case-insensitively and used for dedup / matching."},"phoneE164":{"type":"string","example":"+15555550100","description":"E.164 phone number. Loose input normalization will be added with the full CRM import flow."},"ilNationalId":{"type":"string","example":"123456789","description":"Israeli ID or company number, digits only."},"countryCode":{"type":"string","example":"US","description":"ISO-3166-1 alpha-2 country code."},"city":{"type":"string","example":"New York","maxLength":160},"street":{"type":"string","example":"Main St","maxLength":160},"streetNumber":{"type":"string","example":"12A","maxLength":40},"aptNumber":{"type":"string","example":"4B","maxLength":40},"zip":{"type":"string","example":"10001","maxLength":40},"stateProvince":{"type":"string","example":"NY","maxLength":120,"description":"State / province / region (free text)."},"doNotContact":{"type":"boolean","description":"Global do-not-contact suppression flag. Comms-consent-adjacent. Defaults to false (DB-enforced)."},"preferredContactChannel":{"type":"string","enum":["email","sms","whatsapp","phone"],"description":"Preferred outreach channel (email / sms / whatsapp / phone)."},"dateOfBirth":{"type":"string","example":"1980-01-31","format":"date"},"anniversaryAt":{"type":"string","example":"2004-06-10","format":"date"},"yahrzeitAt":{"type":"string","example":"2026-04-28","format":"date"},"assignedGlobalUserId":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["api","portal","import","donation_form","ambassador","manual","system"],"default":"api"},"sourceRefId":{"type":"string","example":"manual-entry-2026-04-28","maxLength":160},"preferredLocale":{"type":"string","enum":["en","he"]},"customProperties":{"type":"object","additionalProperties":true,"description":"Topic 24 custom field payload. Values are validated by CustomFieldValidator against active custom_field_definitions for the contact entity (unknown keys pass through)."},"onDuplicate":{"type":"string","enum":["reject","merge","override"],"default":"reject"}}},"ContactTagsListResponseDto":{"type":"object","properties":{"rows":{"description":"All active tags in the organization, ordered by label. Powers audience tag filters.","type":"array","items":{"$ref":"#/components/schemas/ContactTagResponseDto"}},"totalCount":{"type":"number","minimum":0,"description":"Total number of active tags returned."}},"required":["rows","totalCount"]},"BatchContactContributionsSummaryQueryDto":{"type":"object","properties":{"contactIds":{"description":"Comma-separated or repeated contact IDs. Maximum 200 contacts per request.","example":"00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000002","maxItems":200,"minItems":1,"type":"array","items":{"type":"string"}}},"required":["contactIds"]},"ContributionMetaJsonDto":{"type":"object","properties":{"chequeNumber":{"type":"string","maxLength":120},"chequeBank":{"type":"string","maxLength":160},"chequeDueDate":{"type":"string","format":"date"},"receiptName":{"type":"string","maxLength":320},"note":{"type":"string","maxLength":2000}}},"CreateContributionDto":{"type":"object","properties":{"contactId":{"type":"string","format":"uuid","description":"Tenant-local contact receiving this donation."},"campaignId":{"type":"string","format":"uuid","nullable":true,"description":"Optional tenant campaign this contribution should count toward."},"amountMinor":{"type":"number","example":18000,"minimum":1,"maximum":9007199254740991,"description":"Donation amount in the smallest currency unit, e.g. cents or agorot."},"currency":{"type":"string","example":"USD","description":"ISO-4217 currency code."},"status":{"type":"string","enum":["pending","succeeded","failed","refunded","canceled"],"default":"succeeded"},"paymentMethod":{"type":"string","enum":["card","cash","check","bank_transfer","other"]},"ambassadorParticipationId":{"type":"string","format":"uuid","nullable":true,"deprecated":true,"description":"DEPRECATED — send `teamId` instead. A personal fundraiser is a team node (a node of one), so this is resolved server-side to the node the ambassador was merged into and recorded as a normal team allocation. Requires `campaignId`."},"teamId":{"type":"string","format":"uuid","nullable":true,"description":"Fundraising team this gift should count toward. Records a full-amount allocation row so team progress (a live SUM over allocations) picks it up. Requires `campaignId`, and the team must belong to that campaign."},"isAnonymous":{"type":"boolean","default":false,"description":"Donor asked not to be named on the public campaign page. The organization still sees the donor everywhere in the CRM."},"metaJson":{"nullable":true,"description":"Allowlisted operator metadata. Unknown keys are removed by the validation pipe.","allOf":[{"$ref":"#/components/schemas/ContributionMetaJsonDto"}]},"receiptFirstName":{"type":"string","nullable":true,"maxLength":120,"description":"First name printed on this donation's receipt (PDF and receipt email). When `receiptFirstName` and `receiptLastName` are both null the receipt prints the contact's first and last name; when either is set the receipt prints this pair. Blank clears it. Changing it never alters a receipt that was already issued: it applies to receipts generated afterwards."},"receiptLastName":{"type":"string","nullable":true,"maxLength":120,"description":"Last name printed on this donation's receipt. See `receiptFirstName`."},"dedication":{"type":"string","nullable":true,"maxLength":500,"description":"Free-text dedication for this donation, e.g. \"In honor of Sarah Levi\". Blank clears it. Not shown on the public campaign page; separate from `publicDisplayName`."},"tags":{"maxItems":20,"description":"Labels on this donation only, separate from contact tags. Trimmed and de-duplicated (case-insensitive); the list replaces the existing tags. Send [] to clear.","example":["major-gift","board"],"type":"array","items":{"type":"string"}},"paymentReceived":{"type":"boolean","description":"Offline gifts only. True sets payment_received_at to now; false clears it. Omitted leaves it null on create."},"checkNumber":{"type":"string","nullable":true,"maxLength":40},"bankName":{"type":"string","nullable":true,"maxLength":80},"bankBranch":{"type":"string","nullable":true,"maxLength":40},"bankAccountNumber":{"type":"string","nullable":true,"maxLength":34,"description":"Account number as typed. Only the last 4 digits are stored."}},"required":["contactId","amountMinor","currency","paymentMethod"]},"ContributionBillingAddressDto":{"type":"object","properties":{"line1":{"type":"string","nullable":true},"line2":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"region":{"type":"string","nullable":true,"description":"State, province or zone."},"postalCode":{"type":"string","nullable":true},"country":{"type":"string","nullable":true,"description":"Free text as the donor typed it (\"Israel\", \"ישראל\" or \"IL\"), not a normalised code."},"capturedAt":{"type":"string","format":"date-time","nullable":true}}},"ContributionResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"contactId":{"type":"string","format":"uuid"},"donorName":{"type":"string","nullable":true,"description":"Donor contact's display name at read time, resolved from the linked contact so a donations list can label who gave without a second lookup. Null when the contact has no name (or was later merged / soft-deleted — the donation keeps its place, the name simply falls back). The organization sees the real donor here even for gifts marked `isAnonymous`: anonymity hides the donor on the PUBLIC campaign page only."},"publicDisplayName":{"type":"string","nullable":true,"maxLength":160,"description":"Name shown for this gift on the public campaign page. Null means the page uses donorName, the contact. A value here (for example a family or honorific) does not rename the contact, and isAnonymous still hides it on the public page."},"receiptFirstName":{"type":"string","nullable":true,"description":"First name printed on this donation's receipt (PDF and receipt email). When `receiptFirstName` and `receiptLastName` are both null the receipt prints the contact's first and last name; when either is set the receipt prints this pair. Blank clears it. Changing it never alters a receipt that was already issued: it applies to receipts generated afterwards."},"receiptLastName":{"type":"string","nullable":true,"description":"Last name printed on this donation's receipt. See `receiptFirstName`."},"dedication":{"type":"string","nullable":true,"description":"Free-text dedication for this donation, e.g. \"In honor of Sarah Levi\". Blank clears it. Not shown on the public campaign page; separate from `publicDisplayName`."},"tags":{"description":"Labels on this donation only, separate from contact tags.","type":"array","items":{"type":"string"}},"billingAddress":{"nullable":true,"description":"Billing address as the donor gave it at checkout (snapshot, never rewritten). Null when no address was captured.","allOf":[{"$ref":"#/components/schemas/ContributionBillingAddressDto"}]},"campaignId":{"type":"string","format":"uuid","nullable":true},"campaignName":{"type":"string","nullable":true,"description":"The campaign's name at read time, resolved from `campaignId` so a donations list can label which campaign a gift counts toward without a second lookup (CHAR-36). Null when `campaignId` is null (a campaign-less / general gift) — never a stand-in for \"no campaign\", which stays a `campaignId: null` sentinel, not a magic name."},"matcherId":{"type":"string","format":"uuid","nullable":true},"streamId":{"type":"string","format":"uuid","nullable":true},"teamId":{"type":"string","format":"uuid","nullable":true},"attributionLabel":{"type":"string","nullable":true,"description":"Display name of the fundraising team or ambassador node allocated to this contribution; null for direct gifts."},"checkoutSessionId":{"type":"string","format":"uuid","nullable":true},"recurringPlanId":{"type":"string","format":"uuid","nullable":true},"amountMinor":{"type":"number","format":"int64"},"currency":{"type":"string","example":"USD"},"providerFeeMinor":{"type":"number","format":"int64","nullable":true,"description":"Payment-provider processing fee in minor units. Null until known/settled."},"charidyCommissionMinor":{"type":"number","format":"int64","nullable":true,"description":"Charidy/platform commission in minor units. Null until known/settled."},"netAmountMinor":{"type":"number","format":"int64","nullable":true,"description":"Net amount credited to the org after fees + commission, in minor units."},"feeSource":{"type":"string","enum":["estimated","reconciled"],"nullable":true,"description":"Whether the fee / net figures are estimated or reconciled against the provider."},"status":{"type":"string","enum":["pending","succeeded","failed","refunded","canceled"]},"paymentMethod":{"type":"string","enum":["card","cash","check","bank_transfer","other"]},"billingType":{"type":"string","enum":["one_time","installments","recurring"]},"installmentsCount":{"type":"number","minimum":1},"paymentProvider":{"type":"string","enum":["stripe","meshulam","wallet","crowded"],"nullable":true},"donationNumber":{"type":"number","format":"int64","nullable":true,"description":"Givearoo donation number: one running number across every organization and campaign, assigned to every donation attempt (including failed ones) and carried onto the donation. Use it for reconciliation. Distinct from `providerChargeId` (the payment provider transaction id) and from `receiptNumber`. Null only if the row could not be read with it."},"receiptNumber":{"type":"number","nullable":true,"description":"Israeli organizations only: the organization's own sequential receipt number (from its starting number), set when Givearoo issued the receipt. Null for organizations abroad, whose receipt shows `donationNumber`, for provider-issued (Grow) receipts and for receipts issued before numbering."},"providerChargeId":{"type":"string","nullable":true,"description":"Payment provider transaction id (e.g. Stripe `ch_…`, Grow transaction code). Not a Givearoo number."},"providerPaymentIntentId":{"type":"string","nullable":true},"providerSubscriptionId":{"type":"string","nullable":true},"receiptUrl":{"type":"string","nullable":true,"format":"uri"},"isAnonymous":{"type":"boolean"},"paymentReceivedAt":{"type":"string","format":"date-time","nullable":true,"description":"When staff marked an offline gift as received. Online successes leave this null; paymentReceived is derived for them."},"paymentReceived":{"type":"boolean","description":"True when paymentReceivedAt is set, or when an online gift succeeded (the column stays null for those)."},"checkNumber":{"type":"string","nullable":true},"bankName":{"type":"string","nullable":true},"bankBranch":{"type":"string","nullable":true},"bankAccountLast4":{"type":"string","nullable":true,"description":"Last 4 digits of an offline account. The full number is never stored or returned."},"utmSource":{"type":"string","nullable":true},"utmMedium":{"type":"string","nullable":true},"utmCampaign":{"type":"string","nullable":true},"utmTerm":{"type":"string","nullable":true},"utmContent":{"type":"string","nullable":true},"referrerUrl":{"type":"string","nullable":true},"shortLinkSlug":{"type":"string","nullable":true},"levelId":{"type":"string","format":"uuid","nullable":true},"levelTitle":{"type":"string","nullable":true},"cardBrand":{"type":"string","nullable":true},"cardLast4":{"type":"string","nullable":true,"description":"Card last 4. Never a full card number or token."},"cardExpMonth":{"type":"number","nullable":true,"minimum":1,"maximum":12},"cardExpYear":{"type":"number","nullable":true},"approvalCode":{"type":"string","nullable":true},"matchedAmountMinor":{"type":"number","format":"int64","nullable":true,"description":"Matcher bonus in minor units: amount × (coefficient − 1), capped by the pool. Refunds keep this original."},"matchCoefficient":{"type":"string","nullable":true,"description":"Matcher coefficient stored at success, as a decimal string."},"metaJson":{"type":"object","description":"Provider and campaign enrichment metadata used by donation-detail surfaces (matcher, stream, level labels, attribution)."},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","contactId","tags","amountMinor","currency","status","paymentMethod","billingType","installmentsCount","isAnonymous","paymentReceived","createdAt","updatedAt"]},"ContributionsListPaginationDto":{"type":"object","properties":{"cursor":{"type":"string","nullable":true,"description":"Opaque cursor for the next page. Pass it back as `cursor` on the next request. `null` when there are no more pages."},"hasMore":{"type":"boolean","description":"True when there is at least one more page after this one."},"pageSize":{"type":"number","minimum":1,"maximum":100,"description":"Effective page size used for this response."}},"required":["hasMore","pageSize"]},"ContributionsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/ContributionResponseDto"}},"totalCount":{"type":"number"},"pagination":{"$ref":"#/components/schemas/ContributionsListPaginationDto"}},"required":["rows","totalCount","pagination"]},"CampaignDonorDto":{"type":"object","properties":{"contactId":{"type":"string","format":"uuid"},"displayName":{"type":"string","nullable":true,"description":"Null when the donor contact was merged away or soft-deleted."},"email":{"type":"string","nullable":true},"currency":{"type":"string","example":"ILS"},"totalAmountMinor":{"type":"number","format":"int64","description":"Sum of this donor’s donations in this currency, in minor units."},"donationsCount":{"type":"number","minimum":1},"anonymousDonationsCount":{"type":"number","minimum":0,"description":"How many of those donations the donor asked to keep anonymous. Anonymity hides the donor on the public campaign page only — the organization still sees who gave, and this count is the signal that the team should not name them publicly."},"lastDonationAt":{"type":"string","format":"date-time"}},"required":["contactId","displayName","email","currency","totalAmountMinor","donationsCount","anonymousDonationsCount","lastDonationAt"]},"CampaignDonorsResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/CampaignDonorDto"}},"totalCount":{"type":"number","minimum":0,"description":"Total donor rows matching the filter, ignoring limit/offset."}},"required":["rows","totalCount"]},"ContributionTagUsageDto":{"type":"object","properties":{"tag":{"type":"string","example":"major-gift"},"count":{"type":"number","description":"How many donations in the organization carry this tag."}},"required":["tag","count"]},"ContributionTagsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/ContributionTagUsageDto"}}},"required":["rows"]},"ContributionTimelineActorDto":{"type":"object","properties":{"name":{"type":"string","nullable":true,"description":"Display name of the person who did this, when a user lookup has one. Null when the actor is known but unnamed."}},"required":["name"]},"ContributionTimelineEventDto":{"type":"object","properties":{"id":{"type":"string","description":"Stable id for this timeline row."},"type":{"type":"string","enum":["created","succeeded","receipt_issued","refunded","canceled","edited","task_created","note_added"]},"occurredAt":{"type":"string","format":"date-time"},"actor":{"nullable":true,"description":"Null when no actor was recorded for this event.","allOf":[{"$ref":"#/components/schemas/ContributionTimelineActorDto"}]},"detail":{"type":"string","nullable":true,"description":"For an edit, a comma-separated list of field tokens that changed. Null for every other event. Never a raw value."}},"required":["id","type","occurredAt","actor","detail"]},"ContributionTimelineResponseDto":{"type":"object","properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/ContributionTimelineEventDto"}}},"required":["events"]},"UpdateContributionDisplayNameDto":{"type":"object","properties":{"publicDisplayName":{"type":"string","nullable":true,"maxLength":160,"description":"Public name for this gift on the campaign page. Null or a blank string clears the override and the page falls back to the contact name. This does not rename the contact."}},"required":["publicDisplayName"]},"UpdateContributionDetailsDto":{"type":"object","properties":{"receiptFirstName":{"type":"string","nullable":true,"maxLength":120,"description":"First name printed on this donation's receipt (PDF and receipt email). When `receiptFirstName` and `receiptLastName` are both null the receipt prints the contact's first and last name; when either is set the receipt prints this pair. Blank clears it. Changing it never alters a receipt that was already issued: it applies to receipts generated afterwards."},"receiptLastName":{"type":"string","nullable":true,"maxLength":120,"description":"Last name printed on this donation's receipt. See `receiptFirstName`."},"dedication":{"type":"string","nullable":true,"maxLength":500,"description":"Free-text dedication for this donation, e.g. \"In honor of Sarah Levi\". Blank clears it. Not shown on the public campaign page; separate from `publicDisplayName`."},"tags":{"maxItems":20,"description":"Labels on this donation only, separate from contact tags. Trimmed and de-duplicated (case-insensitive); the list replaces the existing tags. Send [] to clear.","example":["major-gift","board"],"type":"array","items":{"type":"string"}}}},"UpdateManualContributionDto":{"type":"object","properties":{"amountMinor":{"type":"number","example":18000,"minimum":1,"maximum":9007199254740991,"description":"Corrected amount in the smallest currency unit. The currency does not change."},"paymentMethod":{"type":"string","enum":["card","cash","check","bank_transfer","other"]},"contactId":{"type":"string","format":"uuid","description":"Move the donation to another existing contact in the active organization."},"donatedAt":{"type":"string","format":"date-time","description":"Corrected date the donation was received (stored as the donation date). Cannot be in the future."},"paymentReceived":{"type":"boolean"},"checkNumber":{"type":"string","nullable":true,"maxLength":40},"bankName":{"type":"string","nullable":true,"maxLength":80},"bankBranch":{"type":"string","nullable":true,"maxLength":40},"bankAccountNumber":{"type":"string","nullable":true,"maxLength":34,"description":"Full account number as typed. Only the last 4 digits are stored."}}},"CancelManualContributionDto":{"type":"object","properties":{"reason":{"type":"string","maxLength":500,"description":"Optional reason, kept on the donation and in the audit log."}}},"RefundContributionDto":{"type":"object","properties":{"refundAmountMinor":{"type":"number","format":"int64","minimum":1,"description":"Amount to refund in the smallest currency unit. Omit to refund the full donation. Partial refunds are only supported for Grow (Meshulam/Bit); Crowded refunds the full amount."},"reason":{"type":"string","maxLength":500,"description":"Optional reason for the refund, forwarded to providers that accept one (Crowded)."},"stopFutureCharges":{"type":"boolean","default":false,"description":"For a recurring / direct-debit donation, also stop future scheduled charges after refunding."}}},"RefundGuidanceDto":{"type":"object","properties":{"reason":{"type":"string","description":"Stable machine code; map it to localized copy in the UI or branch on it in an agent.","example":"STRIPE_REFUND_NOT_WIRED"},"message":{"type":"string","description":"Default human-readable explanation of why the refund was not automated."},"steps":{"description":"Ordered, actionable steps to complete the refund another way.","type":"array","items":{"type":"string"}}},"required":["reason","message","steps"]},"RefundContributionResponseDto":{"type":"object","properties":{"status":{"type":"string","enum":["refunded","manual_action_required"],"description":"`refunded` when the provider reversed the charge; `manual_action_required` when the operator must complete it elsewhere (see `guidance`)."},"contribution":{"description":"The contribution. Updated to `refunded` after a successful full refund; unchanged when manual action is required.","allOf":[{"$ref":"#/components/schemas/ContributionResponseDto"}]},"refundedAmountMinor":{"type":"number","format":"int64","nullable":true,"description":"Amount refunded in minor units. Null when no automatic refund happened."},"providerRefundId":{"type":"string","nullable":true,"description":"Provider's id for the refund, when it returned one."},"strategy":{"type":"string","nullable":true,"description":"Which underlying provider action was taken or considered (e.g. `grow_refund`, `grow_bit_cancel`, `crowded_refund`, `stripe_manual`)."},"guidance":{"nullable":true,"description":"Present only when `status=manual_action_required` — how to complete the refund.","allOf":[{"$ref":"#/components/schemas/RefundGuidanceDto"}]}},"required":["status","contribution"]},"RegenerateReceiptResponseDto":{"type":"object","properties":{"queued":{"type":"boolean","description":"Whether a receipt job was queued. `false` means the contribution already carries a receipt, or its provider issues the statutory receipt itself (Grow), so Charidy must not add a second tax document."},"reason":{"type":"string","description":"Stable reason code: `queued`, `already_has_receipt`, `provider_issues_own_receipt`, `no_payment_provider`, `not_succeeded` (a manual donation that is not succeeded), or `payment_not_received` (a manual offline donation whose payment is not marked received).","enum":["queued","already_has_receipt","provider_issues_own_receipt","no_payment_provider","not_succeeded","payment_not_received"]},"message":{"type":"string","description":"Human-readable explanation when a receipt was not queued.","nullable":true},"receiptUrl":{"type":"string","description":"Existing receipt URL when one was already attached.","nullable":true}},"required":["queued","reason"]},"ContactContributionTotalDto":{"type":"object","properties":{"currency":{"type":"string","example":"USD"},"totalAmountMinor":{"type":"number","format":"int64"},"contributionCount":{"type":"number","minimum":0},"averageMinor":{"type":"number","format":"int64","nullable":true,"description":"Average succeeded contribution in this currency, in minor units, rounded half away from zero. Null when this currency has no succeeded contributions."}},"required":["currency","totalAmountMinor","contributionCount","averageMinor"]},"ContactContributionsSummaryDto":{"type":"object","properties":{"contactId":{"type":"string","format":"uuid"},"totals":{"type":"array","items":{"$ref":"#/components/schemas/ContactContributionTotalDto"}},"contributionCount":{"type":"number","minimum":0},"firstContributionAt":{"type":"string","format":"date-time","nullable":true,"description":"Timestamp of the earliest succeeded contribution for this contact. Null when the contact has none."},"lastContributionAt":{"type":"string","format":"date-time","nullable":true,"description":"Timestamp of the latest succeeded contribution for this contact. Null when the contact has none."}},"required":["contactId","totals","contributionCount","firstContributionAt","lastContributionAt"]},"BatchContactContributionsSummaryResponseDto":{"type":"object","properties":{"summaries":{"type":"array","items":{"$ref":"#/components/schemas/ContactContributionsSummaryDto"}}},"required":["summaries"]},"ContactSyncProviderAccountResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"provider":{"type":"string","enum":["google_people","microsoft_graph","csv_upload"]},"ownerGlobalUserId":{"type":"string","format":"uuid"},"externalAccountId":{"type":"string","nullable":true},"displayName":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["connected","token_expired","revoked","error","disabled"]},"syncMode":{"type":"string","enum":["manual","scheduled"]},"syncIntervalMinutes":{"type":"number","minimum":30,"maximum":10080},"lastSyncAt":{"type":"string","nullable":true,"format":"date-time"},"nextSyncAt":{"type":"string","nullable":true,"format":"date-time"},"lastErrorCode":{"type":"string","nullable":true},"lastErrorMessage":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","provider","ownerGlobalUserId","displayName","scopes","status","syncMode","syncIntervalMinutes","createdAt","updatedAt"]},"ListContactSyncProviderAccountsResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/ContactSyncProviderAccountResponseDto"}}},"required":["rows"]},"ContactImportConnectCheckResponseDto":{"type":"object","properties":{"allowed":{"type":"boolean","description":"Always true when the call succeeds. A refusal (permission, feature off, support session) arrives as an error envelope instead."}},"required":["allowed"]},"GoogleConnectorTokensDto":{"type":"object","properties":{"accessToken":{"type":"string","description":"OAuth access token returned by Google."},"refreshToken":{"type":"string","description":"OAuth refresh token (long-lived)."},"expiresAtEpoch":{"type":"number","description":"Unix epoch seconds at which the access token expires."},"scopes":{"description":"Granted OAuth scopes.","type":"array","items":{"type":"string"}},"email":{"type":"string","description":"Owner's Google account email (display only)."}},"required":["accessToken","refreshToken"]},"ConnectGoogleProviderAccountDto":{"type":"object","properties":{"displayName":{"type":"string","description":"Display label shown in the connector list."},"syncMode":{"type":"string","enum":["manual","scheduled"],"default":"scheduled"},"syncIntervalMinutes":{"type":"number","minimum":30,"maximum":10080,"default":1440},"tokens":{"$ref":"#/components/schemas/GoogleConnectorTokensDto"}},"required":["displayName","syncMode","tokens"]},"StartGoogleContactSyncOAuthDto":{"type":"object","properties":{"returnToChatUrl":{"type":"string","description":"Safe chat URL to return to after Google grants contact access. Allowed chat origins only."},"campaignId":{"type":"string","format":"uuid","description":"Campaign id to carry into the dashboard fallback import flow."},"displayName":{"type":"string","description":"Display label stored with the Google connector account."}}},"StartGoogleContactSyncOAuthResponseDto":{"type":"object","properties":{"authorizationUrl":{"type":"string","format":"uri","description":"Browser URL the user should open to grant or re-grant Google Contacts access."},"returnTo":{"type":"string","format":"uri","description":"Where the OAuth callback will send the browser after reconnect succeeds."},"requiredScopes":{"description":"Google OAuth scopes required for contact import.","type":"array","items":{"type":"string"}},"nextInstruction":{"type":"string","description":"Instruction for chat clients after the user returns from Google and tells the chat they connected."}},"required":["authorizationUrl","returnTo","requiredScopes","nextInstruction"]},"ConnectGoogleProviderAccountOAuthDto":{"type":"object","properties":{"code":{"type":"string","description":"OAuth authorization code returned by Google/Microsoft callback.","minLength":8},"codeVerifier":{"type":"string","description":"PKCE code verifier generated before redirecting to the provider.","minLength":43,"maxLength":128},"redirectUri":{"type":"string","format":"uri"},"displayName":{"type":"string","description":"Display label shown in the connector list."},"syncMode":{"type":"string","enum":["manual","scheduled"],"default":"scheduled"},"syncIntervalMinutes":{"type":"number","minimum":30,"maximum":10080,"default":1440}},"required":["code","codeVerifier","redirectUri"]},"MicrosoftConnectorTokensDto":{"type":"object","properties":{"accessToken":{"type":"string","description":"OAuth access token returned by Microsoft Identity."},"refreshToken":{"type":"string","description":"OAuth refresh token (long-lived)."},"expiresAtEpoch":{"type":"number","description":"Unix epoch seconds at which the access token expires."},"scopes":{"description":"Granted OAuth scopes.","type":"array","items":{"type":"string"}},"upn":{"type":"string","description":"Owner's Microsoft account UPN / email (display only)."}},"required":["accessToken","refreshToken"]},"ConnectMicrosoftProviderAccountDto":{"type":"object","properties":{"displayName":{"type":"string"},"syncMode":{"type":"string","enum":["manual","scheduled"],"default":"scheduled"},"syncIntervalMinutes":{"type":"number","minimum":30,"maximum":10080,"default":1440},"tokens":{"$ref":"#/components/schemas/MicrosoftConnectorTokensDto"}},"required":["displayName","syncMode","tokens"]},"ConnectMicrosoftProviderAccountOAuthDto":{"type":"object","properties":{"code":{"type":"string","description":"OAuth authorization code returned by Google/Microsoft callback.","minLength":8},"codeVerifier":{"type":"string","description":"PKCE code verifier generated before redirecting to the provider.","minLength":43,"maxLength":128},"redirectUri":{"type":"string","format":"uri"},"displayName":{"type":"string","description":"Display label shown in the connector list."},"syncMode":{"type":"string","enum":["manual","scheduled"],"default":"scheduled"},"syncIntervalMinutes":{"type":"number","minimum":30,"maximum":10080,"default":1440}},"required":["code","codeVerifier","redirectUri"]},"UpdateContactSyncProviderAccountDto":{"type":"object","properties":{"syncMode":{"type":"string","enum":["manual","scheduled"]},"syncIntervalMinutes":{"type":"number","minimum":30,"maximum":10080},"displayName":{"type":"string"}}},"StartProviderSyncDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"fullResync":{"type":"boolean","description":"Force a full re-sync (ignore incremental cursor)."}}},"ContactSyncJobResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"providerAccountId":{"type":"string","nullable":true,"format":"uuid"},"provider":{"type":"string","enum":["google_people","microsoft_graph","csv_upload"]},"triggerMode":{"type":"string","enum":["manual","scheduled"]},"status":{"type":"string","enum":["pending","running","succeeded","failed","cancelled"]},"requestedByGlobalUserId":{"type":"string","nullable":true,"format":"uuid"},"campaignId":{"type":"string","nullable":true,"format":"uuid"},"sourceLabel":{"type":"string","nullable":true},"progressPercent":{"type":"number","minimum":0,"maximum":100},"stats":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"created":{"type":"integer","minimum":0},"updated":{"type":"integer","minimum":0},"skipped":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0}},"additionalProperties":false},"errorCode":{"type":"string","nullable":true},"errorMessage":{"type":"string","nullable":true},"startedAt":{"type":"string","nullable":true,"format":"date-time"},"finishedAt":{"type":"string","nullable":true,"format":"date-time"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","provider","triggerMode","status","progressPercent","stats","createdAt"]},"StartProviderSyncResponseDto":{"type":"object","properties":{"job":{"$ref":"#/components/schemas/ContactSyncJobResponseDto"}},"required":["job"]},"ContactSyncCsvRowDto":{"type":"object","properties":{"firstName":{"type":"string","maxLength":120},"lastName":{"type":"string","maxLength":120},"email":{"type":"string","maxLength":320},"phone":{"type":"string","description":"Free-form phone string; will be normalized to E.164 when possible."},"ilNationalId":{"type":"string","description":"Israeli national ID, digits only."},"externalRef":{"type":"string","description":"Stable cross-import identifier (e.g. row index, external system id).","maxLength":160}}},"StartCsvImportDto":{"type":"object","properties":{"sourceLabel":{"type":"string","description":"Optional source label (filename / dataset name).","maxLength":160},"campaignId":{"type":"string","format":"uuid","description":"Optional campaign to attribute the import to."},"rows":{"minItems":1,"maxItems":5000,"type":"array","items":{"$ref":"#/components/schemas/ContactSyncCsvRowDto"}}},"required":["rows"]},"StartCsvImportResponseDto":{"type":"object","properties":{"job":{"$ref":"#/components/schemas/ContactSyncJobResponseDto"}},"required":["job"]},"ContactSyncJobsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/ContactSyncJobResponseDto"}}},"required":["rows"]},"CampaignContactProfileWithContactDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"contactId":{"type":"string","format":"uuid"},"tier":{"type":"string","enum":["unclassified","inner_circle","active_community","wider_community","cold_outreach"]},"depth":{"type":"string","enum":["unclassified","core","temporary"]},"noBulk":{"type":"boolean"},"lockedAt":{"type":"string","nullable":true,"format":"date-time"},"recommendedGoalMinor":{"type":"number","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"contactDisplayName":{"type":"string","description":"Display name resolved from the linked contact."},"contactEmail":{"type":"string","nullable":true},"contactPhoneE164":{"type":"string","nullable":true}},"required":["id","organizationId","campaignId","contactId","tier","depth","noBulk","createdAt","updatedAt","contactDisplayName"]},"CampaignContactProfilesListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/CampaignContactProfileWithContactDto"}},"countsByTier":{"type":"object","properties":{"unclassified":{"type":"integer","minimum":0},"inner_circle":{"type":"integer","minimum":0},"active_community":{"type":"integer","minimum":0},"wider_community":{"type":"integer","minimum":0},"cold_outreach":{"type":"integer","minimum":0}},"additionalProperties":false},"countsByDepth":{"type":"object","properties":{"core":{"type":"integer","minimum":0},"temporary":{"type":"integer","minimum":0},"unclassified":{"type":"integer","minimum":0}},"additionalProperties":false},"lockedInnerCircleCount":{"type":"number","description":"How many contacts are locked into the inner circle for this campaign.","minimum":0}},"required":["rows","countsByTier","countsByDepth","lockedInnerCircleCount"]},"ClassifyCampaignContactDto":{"type":"object","properties":{"contactId":{"type":"string","format":"uuid"},"tier":{"type":"string","enum":["unclassified","inner_circle","active_community","wider_community","cold_outreach"]},"depth":{"type":"string","enum":["unclassified","core","temporary"]},"recommendedGoalMinor":{"type":"number","minimum":0},"notes":{"type":"string","maxLength":1000}},"required":["contactId","tier"]},"ClassifyCampaignContactsBatchDto":{"type":"object","properties":{"items":{"minItems":1,"maxItems":500,"type":"array","items":{"$ref":"#/components/schemas/ClassifyCampaignContactDto"}}},"required":["items"]},"CampaignClassificationSummaryDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"countsByTier":{"type":"object","properties":{"inner_circle":{"type":"integer","minimum":0},"active_community":{"type":"integer","minimum":0},"wider_community":{"type":"integer","minimum":0},"cold_outreach":{"type":"integer","minimum":0},"unclassified":{"type":"integer","minimum":0}},"additionalProperties":false},"countsByDepth":{"type":"object","properties":{"core":{"type":"integer","minimum":0},"temporary":{"type":"integer","minimum":0},"unclassified":{"type":"integer","minimum":0}},"additionalProperties":false},"lockedInnerCircleCount":{"type":"number","minimum":0},"importedContactsCount":{"type":"number","minimum":0}},"required":["campaignId","countsByTier","countsByDepth","lockedInnerCircleCount","importedContactsCount"]},"ClassifyCampaignContactsBatchResponseDto":{"type":"object","properties":{"updatedCount":{"type":"number","minimum":0},"summary":{"$ref":"#/components/schemas/CampaignClassificationSummaryDto"}},"required":["updatedCount","summary"]},"LockInnerCircleDto":{"type":"object","properties":{"contactIds":{"minItems":1,"maxItems":25,"description":"Contacts (within the active campaign) to lock as the inner circle.","type":"array","items":{"type":"string"}}},"required":["contactIds"]},"LockInnerCircleResponseDto":{"type":"object","properties":{"lockedContactIds":{"type":"array","items":{"type":"string"}},"summary":{"$ref":"#/components/schemas/CampaignClassificationSummaryDto"}},"required":["lockedContactIds","summary"]},"CustomFieldValidationDto":{"type":"object","properties":{"minLength":{"type":"number","description":"text: minimum length."},"maxLength":{"type":"number","description":"text: maximum length."},"pattern":{"type":"string","description":"text: JS-compatible regex the value must match (anchored)."},"min":{"type":"number","description":"number: minimum allowed value."},"max":{"type":"number","description":"number: maximum allowed value."},"integer":{"type":"boolean","description":"number: require an integer value."}}},"CustomFieldOptionDto":{"type":"object","properties":{"value":{"type":"string","description":"Stored value (what is written to custom_properties)."},"label":{"type":"string","description":"Human-readable label shown in the UI."}},"required":["value","label"]},"CreateCustomFieldDefinitionDto":{"type":"object","properties":{"entityType":{"type":"string","enum":["contact"],"default":"contact","description":"Host entity the field attaches to. MVP supports `contact` only."},"fieldKey":{"type":"string","example":"shul_membership_id","description":"Immutable machine key used inside custom_properties. Lowercase snake_case, unique per (organization, entity_type)."},"fieldType":{"type":"string","enum":["text","number","date","select"],"description":"Value type. Immutable once any value exists."},"label":{"type":"string","example":"Membership ID","maxLength":120,"description":"Human-readable field label."},"description":{"type":"string","maxLength":500,"description":"Optional help text shown under the field."},"displayOrder":{"type":"number","default":0,"description":"Sort order in forms (ascending)."},"isRequired":{"type":"boolean","default":false,"description":"Require a value when the host entity is written."},"validation":{"description":"Type-specific validation rules.","allOf":[{"$ref":"#/components/schemas/CustomFieldValidationDto"}]},"options":{"description":"Allowed options — required for `select`, forbidden otherwise.","type":"array","items":{"$ref":"#/components/schemas/CustomFieldOptionDto"}}},"required":["fieldKey","fieldType","label"]},"CustomFieldDefinitionResponseDto":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"entityType":{"type":"string","enum":["contact"]},"fieldKey":{"type":"string"},"fieldType":{"type":"string","enum":["text","number","date","select"]},"label":{"type":"string"},"description":{"type":"object","nullable":true},"displayOrder":{"type":"number"},"isRequired":{"type":"boolean"},"validation":{"$ref":"#/components/schemas/CustomFieldValidationDto"},"options":{"nullable":true,"type":"array","items":{"$ref":"#/components/schemas/CustomFieldOptionDto"}},"status":{"type":"string","enum":["active","archived"]},"source":{"type":"string","enum":["tenant"]},"archivedAt":{"type":"object","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","entityType","fieldKey","fieldType","label","displayOrder","isRequired","validation","status","source","createdAt","updatedAt"]},"CustomFieldDefinitionListResponseDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/CustomFieldDefinitionResponseDto"}}},"required":["items"]},"UpdateCustomFieldDefinitionDto":{"type":"object","properties":{"label":{"type":"string","maxLength":120,"description":"Human-readable field label."},"description":{"type":"string","maxLength":500,"description":"Optional help text."},"displayOrder":{"type":"number","description":"Sort order in forms (ascending)."},"isRequired":{"type":"boolean","description":"Require a value when the host entity is written."},"validation":{"description":"Type-specific validation rules.","allOf":[{"$ref":"#/components/schemas/CustomFieldValidationDto"}]},"options":{"description":"Allowed options for a `select` field (additive — narrowing may orphan stored values).","type":"array","items":{"$ref":"#/components/schemas/CustomFieldOptionDto"}}}},"UploadImportFileDto":{"type":"object","properties":{"fileBase64":{"type":"string","description":"Raw base64 bytes of the file (or a `data:...;base64,...` URI — the prefix is stripped). Same convention as `ingestMediaAsset`: this is the MCP/agent-safe path, since a remote chat client cannot PUT to a signed blob URL."},"filename":{"type":"string","maxLength":260,"description":"Original filename, including extension."},"contentType":{"type":"string","description":"MIME type if known. Falls back to extension-based detection from `filename`.","maxLength":160}},"required":["fileBase64","filename"]},"ImportColumnProfileDto":{"type":"object","properties":{"header":{"type":"string"},"detectedKind":{"type":"string","enum":["email","phone","date","amount","enum_like","ilNationalId","text","empty"]},"kindConfidence":{"type":"number","minimum":0,"maximum":1},"nullRate":{"type":"number","minimum":0,"maximum":1},"distinctRatio":{"type":"number","minimum":0,"maximum":1},"sampleValues":{"type":"array","items":{"type":"string"}},"detectedDateFormat":{"type":"string","nullable":true,"enum":["dd/mm/yyyy","mm/dd/yyyy","yyyy-mm-dd","excel_serial"]},"currency":{"type":"object","nullable":true,"properties":{"symbol":{"type":"string"},"code":{"type":"string"}},"additionalProperties":false}},"required":["header","detectedKind","kindConfidence","nullRate","distinctRatio","sampleValues"]},"ImportFileSheetDto":{"type":"object","properties":{"name":{"type":"string","description":"Sheet/tab name (XLSX) or a synthetic name for single-dataset formats (CSV/vCard)."},"headers":{"type":"array","items":{"type":"string"}},"rowCount":{"type":"number","minimum":0},"columnProfiles":{"type":"array","items":{"$ref":"#/components/schemas/ImportColumnProfileDto"}}},"required":["name","headers","rowCount","columnProfiles"]},"UploadImportFileResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"blobRef":{"type":"string","description":"Storage container + blob path. Not a public URL."},"sha256":{"type":"string"},"byteSize":{"type":"string","description":"Byte size, as a string (BigInt-safe)."},"originalFilename":{"type":"string"},"mimeType":{"type":"string","nullable":true},"detectedEncoding":{"type":"string","nullable":true,"description":"Populated by the parse worker (later wave). Null until parsed."},"detectedFormat":{"type":"string","nullable":true,"enum":["csv","tsv","xlsx","vcard"],"description":"Detected from filename/content-type at upload time."},"sheetsJson":{"description":"Empty until the parse worker (queue `crm.imports.parse`) has processed this file. Poll this endpoint until non-empty before calling `proposeImportMapping`.","type":"array","items":{"$ref":"#/components/schemas/ImportFileSheetDto"}},"errorCode":{"type":"string","nullable":true,"description":"Set only when the parse worker failed to parse this file — `sheetsJson` will never become non-empty in that case. Null while parsing is pending or succeeded."},"errorMessage":{"type":"string","nullable":true},"uploadedByGlobalUserId":{"type":"string","nullable":true,"format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"duplicateOfRecentImport":{"type":"boolean","description":"True when this organization has already uploaded a file with the same content (sha256) before. Not blocked — a client may legitimately re-run the same export — but worth surfacing."},"nextInstruction":{"type":"string","description":"What the agent should do next.","example":"Parsing runs asynchronously. Poll getImportFile until sheetsJson is populated, then call proposeImportMapping. If errorCode/errorMessage become set instead, parsing failed — re-upload a corrected file."}},"required":["id","organizationId","blobRef","sha256","byteSize","originalFilename","sheetsJson","createdAt","updatedAt","duplicateOfRecentImport","nextInstruction"]},"ImportFileResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"blobRef":{"type":"string","description":"Storage container + blob path. Not a public URL."},"sha256":{"type":"string"},"byteSize":{"type":"string","description":"Byte size, as a string (BigInt-safe)."},"originalFilename":{"type":"string"},"mimeType":{"type":"string","nullable":true},"detectedEncoding":{"type":"string","nullable":true,"description":"Populated by the parse worker (later wave). Null until parsed."},"detectedFormat":{"type":"string","nullable":true,"enum":["csv","tsv","xlsx","vcard"],"description":"Detected from filename/content-type at upload time."},"sheetsJson":{"description":"Empty until the parse worker (queue `crm.imports.parse`) has processed this file. Poll this endpoint until non-empty before calling `proposeImportMapping`.","type":"array","items":{"$ref":"#/components/schemas/ImportFileSheetDto"}},"errorCode":{"type":"string","nullable":true,"description":"Set only when the parse worker failed to parse this file — `sheetsJson` will never become non-empty in that case. Null while parsing is pending or succeeded."},"errorMessage":{"type":"string","nullable":true},"uploadedByGlobalUserId":{"type":"string","nullable":true,"format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","blobRef","sha256","byteSize","originalFilename","sheetsJson","createdAt","updatedAt"]},"ProposeImportMappingDto":{"type":"object","properties":{"fileId":{"type":"string","format":"uuid"},"datasetRef":{"type":"string","description":"Sheet name within the file. Defaults to the first (or only) sheet.","maxLength":160},"entity":{"type":"string","description":"Registered import-entity key. Phase 1 only registers `contact`.","example":"contact"},"save":{"type":"boolean","description":"Persist the result as a reusable ImportMappingProfile."},"name":{"type":"string","maxLength":160,"description":"Required when `save` is true. Unique per (organization, entity)."},"defaultPhoneRegion":{"type":"string","minLength":2,"maxLength":2,"pattern":"^[A-Z]{2}$","description":"ISO-3166-1 alpha-2 override of the phone-region default used to normalize this profile's `contact.phone` column (plan §5.5: per-mapping-profile > organization country > 'IL'). Only used when `save` is true.","example":"US"}},"required":["fileId","entity"]},"ImportCustomFieldProposalDto":{"type":"object","properties":{"suggestedKey":{"type":"string","description":"Proposed machine key for the custom field (lowercase snake_case)."},"suggestedLabel":{"type":"string","description":"Proposed human-readable label (the column header)."},"suggestedFieldType":{"type":"string","enum":["text","number","date","select"]},"suggestedOptions":{"description":"Candidate option values, only present when `suggestedFieldType` is `select`.","type":"array","items":{"type":"string"}},"populatedRowCount":{"type":"number","minimum":0,"description":"Estimated number of non-empty rows for this column."},"approved":{"type":"boolean","nullable":true,"description":"Set once an approve decision has been recorded for this proposal. Null while still pending."}},"required":["suggestedKey","suggestedLabel","suggestedFieldType","populatedRowCount"]},"ImportColumnMappingEntryDto":{"type":"object","properties":{"header":{"type":"string","description":"Source column header, verbatim from the file."},"target":{"type":"string","nullable":true,"description":"Namespaced target field key (e.g. `contact.email`, or `custom.<key>` once approved). Null if unmapped."},"confidence":{"type":"number","minimum":0,"maximum":1},"source":{"type":"string","nullable":true,"enum":["synonym","kind_inference","manual","llm"]},"customFieldProposal":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/ImportCustomFieldProposalDto"}]}},"required":["header","confidence"]},"ImportMappingProfileResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"name":{"type":"string"},"entity":{"type":"string","description":"Registered import-entity key."},"sourceProfile":{"type":"string","nullable":true,"description":"Known source-export vocabulary (phase 3)."},"columnMappings":{"type":"array","items":{"$ref":"#/components/schemas/ImportColumnMappingEntryDto"}},"valueMappings":{"type":"object","additionalProperties":true,"description":"Per-field enum vocabulary translation tables (plan §5.6), keyed by target field."},"defaultPhoneRegion":{"type":"string","nullable":true,"minLength":2,"maxLength":2,"description":"ISO-3166-1 alpha-2 phone-region override for this profile. Null falls through to the organization's country, then 'IL'."},"createdByGlobalUserId":{"type":"string","nullable":true,"format":"uuid"},"lastUsedAt":{"type":"string","nullable":true,"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","name","entity","columnMappings","valueMappings","createdAt","updatedAt"]},"ProposeImportMappingResponseDto":{"type":"object","properties":{"entity":{"type":"string"},"fileId":{"type":"string","format":"uuid"},"datasetRef":{"type":"string","nullable":true},"columnMappings":{"type":"array","items":{"$ref":"#/components/schemas/ImportColumnMappingEntryDto"}},"customFieldProposals":{"description":"Confidently-typed unmapped columns proposed as new Custom Fields. Proposal only — nothing is created here.","type":"array","items":{"$ref":"#/components/schemas/ImportCustomFieldProposalDto"}},"savedProfile":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/ImportMappingProfileResponseDto"}]},"aiEnrichment":{"type":"string","enum":["skipped","applied","failed"],"description":"`skipped` = LLM not called (disabled, or the dictionary already resolved every column). `applied` = the LLM was called and its (validated) response was merged in for still-unmapped columns. `failed` = the LLM call errored or its response failed validation (one attempt only, no retry) — columnMappings/customFieldProposals reflect the dictionary-only result in that case."},"nextInstruction":{"type":"string","description":"What the agent should do next.","example":"Review columnMappings and customFieldProposals with the user, then call startImportJob with mode=dry_run using this mapping profile."}},"required":["entity","fileId","columnMappings","customFieldProposals","aiEnrichment","nextInstruction"]},"ImportMappingProfilesListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/ImportMappingProfileResponseDto"}}},"required":["rows"]},"UpdateImportColumnMappingEntryDto":{"type":"object","properties":{"header":{"type":"string"},"target":{"type":"string","nullable":true},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["header"]},"UpdateImportMappingProfileDto":{"type":"object","properties":{"name":{"type":"string","maxLength":160},"columnMappings":{"type":"array","items":{"$ref":"#/components/schemas/UpdateImportColumnMappingEntryDto"}},"valueMappings":{"type":"object","additionalProperties":true},"defaultPhoneRegion":{"type":"string","minLength":2,"maxLength":2,"pattern":"^[A-Z]{2}$","description":"ISO-3166-1 alpha-2 override of the phone-region default (plan §5.5).","example":"US"}}},"StartImportJobDto":{"type":"object","properties":{"entity":{"type":"string","description":"Registered import-entity key."},"fileId":{"type":"string","format":"uuid"},"datasetRef":{"type":"string","maxLength":160},"mappingProfileId":{"type":"string","format":"uuid"},"mode":{"type":"string","enum":["dry_run","commit"]},"sessionId":{"type":"string","format":"uuid"},"dryRunJobId":{"type":"string","format":"uuid","description":"Required when mode=commit: must reference a succeeded dry_run job for the same file + mapping profile. Normally you do not call this directly for commit — use approveImportJob instead."}},"required":["entity","fileId","mappingProfileId","mode"]},"ImportJobStatsDto":{"type":"object","properties":{"total":{"type":"number","minimum":0},"created":{"type":"number","minimum":0},"merged":{"type":"number","minimum":0},"updated":{"type":"number","minimum":0},"rejected":{"type":"number","minimum":0},"failed":{"type":"number","minimum":0}},"required":["total","created","merged","updated","rejected","failed"]},"StartImportJobResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"sessionId":{"type":"string","nullable":true,"format":"uuid"},"entity":{"type":"string"},"mode":{"type":"string","enum":["dry_run","commit"]},"fileId":{"type":"string","nullable":true,"format":"uuid"},"datasetRef":{"type":"string","nullable":true},"mappingProfileId":{"type":"string","nullable":true,"format":"uuid"},"status":{"type":"string","enum":["pending","running","succeeded","failed","canceled"]},"stats":{"$ref":"#/components/schemas/ImportJobStatsDto"},"progressPercent":{"type":"number","minimum":0,"maximum":100},"errorCode":{"type":"string","nullable":true},"errorMessage":{"type":"string","nullable":true},"dryRunJobId":{"type":"string","nullable":true,"format":"uuid"},"approvedByGlobalUserId":{"type":"string","nullable":true,"format":"uuid"},"approvedAt":{"type":"string","nullable":true,"format":"date-time"},"requestedByGlobalUserId":{"type":"string","nullable":true,"format":"uuid"},"startedAt":{"type":"string","nullable":true,"format":"date-time"},"finishedAt":{"type":"string","nullable":true,"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"nextInstruction":{"type":"string","description":"What the agent should do next.","example":"Job runs asynchronously. Poll getImportJob until status is succeeded/failed, then show the report to the user."}},"required":["id","organizationId","entity","mode","status","stats","progressPercent","createdAt","updatedAt","nextInstruction"]},"ImportJobReasonCodeCountDto":{"type":"object","properties":{"code":{"type":"string"},"count":{"type":"number","minimum":0}},"required":["code","count"]},"ImportJobReportDto":{"type":"object","properties":{"countsByOutcome":{"type":"object","additionalProperties":{"type":"integer","minimum":0},"description":"Row count per ImportRowOutcomeKind, computed from import_row_outcomes."},"topReasonCodes":{"type":"array","items":{"$ref":"#/components/schemas/ImportJobReasonCodeCountDto"}},"needsDecisionCount":{"type":"number","minimum":0,"description":"Rows outcome=needs_decision — ambiguous identity matches awaiting a human call."}},"required":["countsByOutcome","topReasonCodes","needsDecisionCount"]},"GetImportJobResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"sessionId":{"type":"string","nullable":true,"format":"uuid"},"entity":{"type":"string"},"mode":{"type":"string","enum":["dry_run","commit"]},"fileId":{"type":"string","nullable":true,"format":"uuid"},"datasetRef":{"type":"string","nullable":true},"mappingProfileId":{"type":"string","nullable":true,"format":"uuid"},"status":{"type":"string","enum":["pending","running","succeeded","failed","canceled"]},"stats":{"$ref":"#/components/schemas/ImportJobStatsDto"},"progressPercent":{"type":"number","minimum":0,"maximum":100},"errorCode":{"type":"string","nullable":true},"errorMessage":{"type":"string","nullable":true},"dryRunJobId":{"type":"string","nullable":true,"format":"uuid"},"approvedByGlobalUserId":{"type":"string","nullable":true,"format":"uuid"},"approvedAt":{"type":"string","nullable":true,"format":"date-time"},"requestedByGlobalUserId":{"type":"string","nullable":true,"format":"uuid"},"startedAt":{"type":"string","nullable":true,"format":"date-time"},"finishedAt":{"type":"string","nullable":true,"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"report":{"$ref":"#/components/schemas/ImportJobReportDto"},"customFieldProposals":{"description":"Pending Custom Field proposals from the mapping profile. Only populated when mode=dry_run.","type":"array","items":{"$ref":"#/components/schemas/ImportCustomFieldProposalDto"}}},"required":["id","organizationId","entity","mode","status","stats","progressPercent","createdAt","updatedAt","report"]},"ImportRowOutcomeResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"rowIndex":{"type":"number","minimum":0},"fingerprint":{"type":"string"},"outcome":{"type":"string","enum":["created","merged","updated","rejected","failed","needs_decision","would_create","would_merge","would_update","would_reject"]},"reasonCodes":{"type":"array","items":{"type":"string"}},"entityRefs":{"type":"object","additionalProperties":true},"sourcePayload":{"type":"object","additionalProperties":true},"divergedFromDryRun":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","rowIndex","fingerprint","outcome","reasonCodes","entityRefs","sourcePayload","divergedFromDryRun","createdAt"]},"ImportJobOutcomesListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/ImportRowOutcomeResponseDto"}},"offset":{"type":"number","minimum":0},"limit":{"type":"number","minimum":0},"total":{"type":"number","minimum":0}},"required":["rows","offset","limit","total"]},"ImportCustomFieldApprovalItemDto":{"type":"object","properties":{"columnKey":{"type":"string","description":"The proposal's `suggestedKey` (from getImportJob / proposeImportMapping) being decided on."},"approved":{"type":"boolean","description":"true = create this Custom Field and map the column to it; false = leave the column ignored."}},"required":["columnKey","approved"]},"ImportPolicyOverridesDto":{"type":"object","properties":{"mergeStrategy":{"type":"string","enum":["enrich_only","overwrite"]},"qualityFilterOverrides":{"description":"Quality-filter reason codes (plan §5.5) to bypass for this commit instead of flagging.","type":"array","items":{"type":"string"}}}},"ApproveImportJobDto":{"type":"object","properties":{"customFieldApprovals":{"default":[],"type":"array","items":{"$ref":"#/components/schemas/ImportCustomFieldApprovalItemDto"}},"policyOverrides":{"$ref":"#/components/schemas/ImportPolicyOverridesDto"}}},"ImportJobResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"sessionId":{"type":"string","nullable":true,"format":"uuid"},"entity":{"type":"string"},"mode":{"type":"string","enum":["dry_run","commit"]},"fileId":{"type":"string","nullable":true,"format":"uuid"},"datasetRef":{"type":"string","nullable":true},"mappingProfileId":{"type":"string","nullable":true,"format":"uuid"},"status":{"type":"string","enum":["pending","running","succeeded","failed","canceled"]},"stats":{"$ref":"#/components/schemas/ImportJobStatsDto"},"progressPercent":{"type":"number","minimum":0,"maximum":100},"errorCode":{"type":"string","nullable":true},"errorMessage":{"type":"string","nullable":true},"dryRunJobId":{"type":"string","nullable":true,"format":"uuid"},"approvedByGlobalUserId":{"type":"string","nullable":true,"format":"uuid"},"approvedAt":{"type":"string","nullable":true,"format":"date-time"},"requestedByGlobalUserId":{"type":"string","nullable":true,"format":"uuid"},"startedAt":{"type":"string","nullable":true,"format":"date-time"},"finishedAt":{"type":"string","nullable":true,"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","entity","mode","status","stats","progressPercent","createdAt","updatedAt"]},"CreateImportSessionDto":{"type":"object","properties":{"fileId":{"type":"string","format":"uuid"},"label":{"type":"string","maxLength":200}}},"ImportSessionResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"fileId":{"type":"string","nullable":true,"format":"uuid"},"label":{"type":"string","nullable":true},"status":{"type":"string","enum":["pending","running","succeeded","failed","canceled"]},"createdByGlobalUserId":{"type":"string","nullable":true,"format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","status","createdAt","updatedAt"]},"GetImportSessionResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"fileId":{"type":"string","nullable":true,"format":"uuid"},"label":{"type":"string","nullable":true},"status":{"type":"string","enum":["pending","running","succeeded","failed","canceled"]},"createdByGlobalUserId":{"type":"string","nullable":true,"format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"jobs":{"type":"array","items":{"$ref":"#/components/schemas/ImportJobResponseDto"}}},"required":["id","organizationId","status","createdAt","updatedAt","jobs"]},"PublicCheckoutDonorDto":{"type":"object","properties":{"firstName":{"type":"string","example":"Jane","maxLength":120},"lastName":{"type":"string","example":"Donor","maxLength":120},"email":{"type":"string","example":"jane@example.org","maxLength":320},"phoneE164":{"type":"string","example":"+972501234567"},"ilNationalId":{"type":"string","example":"123456789","description":"Israeli ID, digits only."},"preferredLocale":{"type":"string","enum":["en","he"],"example":"he"}}},"PublicCheckoutAttributionDto":{"type":"object","properties":{"ambassadorParticipationId":{"type":"string","format":"uuid","deprecated":true,"description":"DEPRECATED — legacy ambassador link attribution. Resolved server-side to the campaign team node that ambassador was merged into. Send `teamIds` instead."},"levelId":{"type":"string","format":"uuid"},"matcherId":{"type":"string","format":"uuid"},"streamId":{"type":"string","format":"uuid"},"teamId":{"type":"string","format":"uuid","description":"The \"primary\" team when donating through a single group. When `teamIds` is also sent, the primary is `teamIds[0]` unless this is set explicitly. Kept for backward compatibility with single-team callers; new clients should prefer `teamIds`."},"teamIds":{"maxItems":5,"description":"CHAR-56: one or more campaign teams the donor chose to give \"through\". When more than one is sent, the donation amount is split between them for each team's own goal/progress, while the donation appears in every chosen team's donor list. Every id must belong to the SAME campaign as the checkout — validated server-side, never trusted as received.","type":"array","items":{"type":"string","format":"uuid"}},"utmSource":{"type":"string","maxLength":255},"utmMedium":{"type":"string","maxLength":255},"utmCampaign":{"type":"string","maxLength":255},"utmTerm":{"type":"string","maxLength":255},"utmContent":{"type":"string","maxLength":255},"referrerUrl":{"type":"string","maxLength":2048,"description":"document.referrer reduced to origin and path. Query and fragment are stripped before storage."},"shortLinkSlug":{"type":"string","maxLength":80,"description":"Short-link slug when the visit arrived through one."},"commsToken":{"type":"string","maxLength":128,"description":"Opaque email-attribution token (`gv_cl`) from the landing URL. Optional; checkout behaves identically without it."},"extra":{"type":"object","additionalProperties":true}}},"PublicCheckoutBillingAddressDto":{"type":"object","properties":{"line1":{"type":"string","maxLength":200},"line2":{"type":"string","maxLength":200},"city":{"type":"string","maxLength":120},"region":{"type":"string","maxLength":120},"postalCode":{"type":"string","maxLength":32},"country":{"type":"string","maxLength":120}}},"CreatePublicCheckoutDto":{"type":"object","properties":{"amountMinor":{"type":"number","example":18000,"minimum":100,"description":"Charge amount in currency minor units. With attribution.levelId, must match the server-resolved level price and billing mode; stale or forged prices are rejected."},"currency":{"type":"string","example":"ILS"},"levelLocale":{"type":"string","enum":["en","he"],"description":"Locale of the displayed level price. Defaults to the campaign page locale; never performs currency conversion."},"billingType":{"type":"string","enum":["one_time","installments","recurring"]},"installmentsCount":{"type":"number","default":1,"minimum":1,"description":"Number of installments, bounded by the campaign maxInstallments (default 12) and by the provider ceiling when one exists (Grow: 12). For an active recurring Grow level, count must equal its configured commitment (recurringMonths); mismatches return INSTALLMENTS_COUNT_INVALID and total is unit price times that commitment. Only Grow supports installments. Stripe/Crowded return PROVIDER_UNSUPPORTED_BILLING_TYPE; above-limit Grow requests return INSTALLMENTS_ABOVE_LIMIT."},"provider":{"type":"string","enum":["stripe","meshulam","wallet","crowded"]},"donor":{"$ref":"#/components/schemas/PublicCheckoutDonorDto"},"attribution":{"$ref":"#/components/schemas/PublicCheckoutAttributionDto"},"isAnonymous":{"type":"boolean","default":false},"flow":{"type":"string","enum":["embedded","redirect"],"description":"Preferred completion flow. Defaults to `embedded` for Stripe/Meshulam and `redirect` for Bit."},"legalConsent":{"description":"CHAR-12 — the Terms of Use / Privacy Notice versions shown to the donor before they confirmed. Snapshotted onto the checkout row and copied forward onto the contribution, so a past donation always says which document its donor accepted. Deliberately a first-class field rather than a key in `attribution.extra`, which is key-allowlisted and byte-capped and would silently drop it. Optional while clients roll out; enforced when LEGAL_CONSENT_REQUIRED is on.","allOf":[{"$ref":"#/components/schemas/LegalConsentDto"}]},"billingAddress":{"description":"The donor's billing address as given at the moment of the charge. Snapshotted onto the checkout row and copied forward onto the contribution, so a receipt, an AVS check or a chargeback defence can always state the address that was actually used — it is never rewritten if the donor later moves. Gated by the campaign's `settings.checkout.showBillingAddress` / `requireBillingAddress`. A first-class field rather than a key in `attribution.extra`, which is key-allowlisted and byte-capped and dropped this object in full until 9.9.2026.","allOf":[{"$ref":"#/components/schemas/PublicCheckoutBillingAddressDto"}]}},"required":["amountMinor","currency","billingType","provider","donor"]},"PublicCheckoutResponseDto":{"type":"object","properties":{"checkoutId":{"type":"string","format":"uuid"},"provider":{"type":"string","enum":["stripe","meshulam","wallet","crowded"]},"status":{"type":"string","enum":["created","provider_pending","succeeded","failed","canceled","expired"]},"flow":{"type":"string","enum":["embedded","redirect"],"description":"How the donor completes payment: `embedded` (provider iframe inside Charidy) or `redirect` (provider-hosted page)."},"redirectUrl":{"type":"object","nullable":true,"format":"uri","description":"Hosted checkout URL. Always present for `flow=redirect`; for `flow=embedded` it points to the campaign page used as the Stripe `return_url` after SCA challenges."},"expiresAt":{"type":"object","nullable":true,"format":"date-time"},"clientSecret":{"type":"object","nullable":true,"description":"Stripe Checkout Session client_secret. Returned only for `flow=embedded` with provider=stripe; the browser passes it to Stripe Embedded Checkout. Never appears in logs (redacted)."},"checkoutSessionId":{"type":"object","nullable":true,"description":"Stripe Checkout Session identifier (cs_*) mirrored on the checkout row. Returned only for embedded Stripe Checkout Sessions."},"paymentIntentId":{"type":"object","nullable":true,"description":"Stripe PaymentIntent identifier when already available. For Checkout Sessions this is usually populated later by webhook reconciliation."},"publishableKey":{"type":"object","nullable":true,"description":"Stripe publishable key for the org account. Returned only for `flow=embedded` with provider=stripe; the browser uses it to load Stripe.js."},"stripeAccountId":{"type":"object","nullable":true,"description":"Stripe connected account id. Returned for Connect embedded Stripe flows so Stripe.js can mount the connected-account Checkout Session."},"meshulamIframeUrl":{"type":"object","nullable":true,"format":"uri","description":"Meshulam-hosted tokenization iframe URL. Returned only for `flow=embedded` with provider=meshulam."},"meshulamSessionToken":{"type":"object","nullable":true,"description":"Meshulam tokenization session token. Returned only for `flow=embedded` with provider=meshulam."},"crowdedPaymentUrl":{"type":"object","nullable":true,"format":"uri","description":"Crowded Payment Iframe URL (`paymentUrl`). Returned only for `flow=embedded` with provider=crowded; the browser embeds it as the iframe `src` and drives it via postMessage."},"crowdedCollectionId":{"type":"object","nullable":true,"description":"Crowded Collection UUID backing this checkout. Returned for embedded Crowded flows."},"crowdedIntentId":{"type":"object","nullable":true,"description":"Crowded Payment Intent UUID for this donor. Returned for embedded Crowded flows."},"growWalletAuthCode":{"type":"object","nullable":true,"description":"Grow wallet authCode for the Growin Wallet SDK (growPayment.renderPaymentOptions). Returned only for `flow=embedded` with provider=wallet; single-use, renders the in-page wallet (Bit / Apple Pay / Google Pay / card)."},"growWalletEnvironment":{"type":"object","nullable":true,"description":"Grow SDK environment for the wallet: \"DEV\" (sandbox) or \"PRODUCTION\"."}},"required":["checkoutId","provider","status","flow"]},"PublicCheckoutStatusResponseDto":{"type":"object","properties":{"checkoutId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["created","provider_pending","succeeded","failed","canceled","expired"]},"contributionId":{"type":"string","nullable":true,"format":"uuid"},"receiptUrl":{"type":"string","nullable":true,"format":"uri"},"failureCode":{"type":"string","nullable":true},"failureMessage":{"type":"string","nullable":true},"amountMinor":{"type":"string","description":"Minor units, matches contributions.amount_minor."},"currency":{"type":"string","example":"ILS"},"billingType":{"type":"string","enum":["one_time","installments","recurring"]},"installmentsCount":{"type":"number"},"orgSlug":{"type":"string"},"campaignSlug":{"type":"string"},"teamIds":{"type":"array","items":{"type":"string","format":"uuid"}}},"required":["checkoutId","status","amountMinor","currency","billingType","installmentsCount","orgSlug","campaignSlug","teamIds"]},"PaymentGatewayResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"provider":{"type":"string","enum":["stripe","meshulam","wallet","crowded"]},"displayName":{"type":"string"},"status":{"type":"string","enum":["active","disabled"]},"configured":{"type":"boolean"},"defaultCurrency":{"type":"string","nullable":true},"maskedCredentialSuffix":{"type":"string","nullable":true},"stripeAccountId":{"type":"string","nullable":true},"readiness":{"type":"string","description":"Provider-reported readiness. `status` only means a credential blob exists; THIS is whether the account can take money. `unknown` means no provider snapshot was ever mirrored (e.g. manually pasted credentials) — treat it as \"cannot assert\", not as broken.","enum":["ready","pending","action_required","disabled","unknown"]},"readyToCharge":{"type":"boolean","description":"True only when the provider explicitly confirmed this account can accept charges."},"requirementsCurrentlyDue":{"description":"Provider-reported requirements still owed before the account can go live.","type":"array","items":{"type":"string"}},"readinessCheckedAt":{"type":"string","description":"When the provider readiness snapshot was last taken. Null means never checked, which is not the same as \"no problem found\".","format":"date-time","nullable":true},"accountReference":{"type":"string","description":"Non-secret provider account identifier this org is connected to (Crowded chapter id, Grow userId, Stripe acct_…). Answers \"which account did I just connect?\".","nullable":true},"environment":{"type":"string","description":"Provider environment the account transacts in, when the provider reports it (Grow sandbox vs live). Null when unknown.","enum":["live","sandbox"],"nullable":true},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","provider","displayName","status","configured","readiness","readyToCharge","requirementsCurrentlyDue","updatedAt"]},"PaymentGatewaysOrganizationDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","description":"Organization legal name."},"slug":{"type":"string","description":"Organization slug, as used in public URLs."},"country":{"type":"string","description":"ISO 3166-1 alpha-2 country code from the organization profile. This is the organization market, not the acting user's UI locale.","example":"IL"},"defaultCurrency":{"type":"string","description":"ISO 4217 default currency from the organization profile. Used with campaign donation currencies to determine which market-specific gateways are relevant.","example":"ILS"},"donationCurrencies":{"description":"Distinct ISO 4217 base currencies used by the organization's non-deleted campaigns. These are existing campaign donation currencies, not currencies inferred from the UI locale or from a gateway connection.","example":["ILS","USD"],"type":"array","items":{"type":"string"}}},"required":["id","name","slug","country","defaultCurrency","donationCurrencies"]},"PaymentGatewaysListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/PaymentGatewayResponseDto"}},"organization":{"description":"The organization these gateway rows belong to.","nullable":true,"allOf":[{"$ref":"#/components/schemas/PaymentGatewaysOrganizationDto"}]}},"required":["rows"]},"PaymentGatewayCredentialsDto":{"type":"object","properties":{"userId":{"type":"string","description":"Grow (Meshulam) business identifier (`userId`). Required for the Grow Light API. Stored encrypted.","maxLength":160},"apiKey":{"type":"string","description":"Grow (Meshulam) secret API key, sent as the `x-api-key` header. Required for the Grow Light API. Stored encrypted; never returned.","maxLength":512},"pageCodeCard":{"type":"string","description":"Grow card-only page code (regular / installments). Stored encrypted.","maxLength":160},"pageCodeWallet":{"type":"string","description":"Grow wallet page code (Bit / Apple Pay / Google Pay). Stored encrypted.","maxLength":160},"pageCodeDirectDebit":{"type":"string","description":"Grow direct-debit page code (recurring / הוראת קבע). Stored encrypted.","maxLength":160},"apiBaseUrl":{"type":"string","description":"Grow (Meshulam) API base URL override. Must be exactly `https://sandbox.meshulam.co.il` or `https://secure.meshulam.co.il` — this selects which Grow environment the org transacts in. Omit for the deployment default. Stored encrypted.","enum":["https://sandbox.meshulam.co.il","https://secure.meshulam.co.il"],"maxLength":200},"pageCode":{"type":"string","description":"Legacy Meshulam/Bit single page code (old Light Server API). Stored encrypted.","maxLength":160},"token":{"type":"string","description":"Legacy Meshulam/Bit API token or secret (old Light Server API). Stored encrypted.","maxLength":512},"stripeAccountId":{"type":"string","description":"Stripe connected account id. Stored encrypted and mirrored masked in config.","maxLength":160},"stripeSecretKey":{"type":"string","description":"Stripe restricted key or OAuth access token, if supplied manually. Stored encrypted.","maxLength":512},"stripePublishableKey":{"type":"string","description":"Stripe publishable key (`pk_…`). Stored encrypted alongside the secret key; surfaced to the browser only via the embedded checkout response.","maxLength":200},"stripeWebhookSecret":{"type":"string","description":"Signing secret (`whsec_…`) for a webhook endpoint on THIS org's own Stripe account. For a manual (non-Connect) Stripe connection, Charidy provisions this automatically — creating the webhook endpoint on the org's account via the supplied stripeSecretKey and capturing the secret Stripe returns — so this field is normally omitted. Pass it explicitly only to override that with an endpoint the org already manages themselves. Stored encrypted; never returned.","maxLength":200}}},"UpsertPaymentGatewayDto":{"type":"object","properties":{"displayName":{"type":"string","maxLength":120,"example":"Main Meshulam account"},"defaultCurrency":{"type":"string","example":"ILS","description":"Default currency for this gateway."},"credentials":{"$ref":"#/components/schemas/PaymentGatewayCredentialsDto"}},"required":["credentials"]},"StripeConnectStartDto":{"type":"object","properties":{"country":{"type":"string","description":"ISO 3166-1 alpha-2 country code of the receiving organization.","example":"US","maxLength":2}}},"StripeConnectStartResponseDto":{"type":"object","properties":{"accountId":{"type":"string","description":"Stripe Express account id that will receive donations for the active org.","example":"acct_1Su3TJI9wWkmJ7EO"},"onboardingUrl":{"type":"string","description":"One-time Stripe-hosted onboarding URL. Open this in a popup so the donor can complete KYC inside Stripe. URL expires after 5 minutes.","format":"uri"},"expiresAt":{"type":"string","description":"ISO timestamp at which the onboarding URL expires.","format":"date-time"},"detailsSubmitted":{"type":"boolean","description":"Whether this account already finished KYC before the onboarding link was created. Useful for clients that want to skip the popup if status is already complete."}},"required":["accountId","onboardingUrl","expiresAt","detailsSubmitted"]},"StripeConnectOAuthStartDto":{"type":"object","properties":{"origin":{"type":"string","description":"Surface the connection was initiated from. Stored in signed state so the public callback can route the user back (chat/MCP vs the dashboard popup). Defaults to `settings`.","enum":["chat","dashboard","mcp","settings"]}}},"StripeConnectOAuthStartResponseDto":{"type":"object","properties":{"authorizationUrl":{"type":"string","description":"Stripe-hosted OAuth authorization URL for connecting an existing Stripe account.","format":"uri"},"state":{"type":"string","description":"Opaque signed state that must be returned to the OAuth completion endpoint."},"expiresAt":{"type":"string","description":"ISO timestamp at which this OAuth state expires.","format":"date-time"}},"required":["authorizationUrl","state","expiresAt"]},"StripeConnectOAuthCompleteDto":{"type":"object","properties":{"code":{"type":"string","description":"Authorization code returned by Stripe to the web callback page."},"state":{"type":"string","description":"Signed state returned by Stripe to the web callback page."}},"required":["code","state"]},"StripeConnectStatusResponseDto":{"type":"object","properties":{"configured":{"type":"boolean","description":"Whether the active org has any Stripe Connect account at all."},"accountId":{"type":"string","description":"Stripe Express account id if configured, otherwise null.","nullable":true},"connectMode":{"type":"string","description":"How the active org connected Stripe, if known.","enum":["connect_express","connect_standard","manual"],"nullable":true},"detailsSubmitted":{"type":"boolean","description":"True once the donor finished the Stripe-hosted onboarding flow."},"chargesEnabled":{"type":"boolean","description":"True once Stripe has cleared the account to accept charges. Drives the Donate flow gate."},"payoutsEnabled":{"type":"boolean","description":"True once Stripe has cleared the account to receive payouts."},"requirementsCurrentlyDue":{"description":"List of Stripe-reported requirements still owed before charges/payouts unlock.","type":"array","items":{"type":"string"}},"lastCheckedAt":{"type":"string","description":"ISO timestamp of the last status check against Stripe.","format":"date-time"}},"required":["configured","detailsSubmitted","chargesEnabled","payoutsEnabled","requirementsCurrentlyDue","lastCheckedAt"]},"StripeConnectTestResponseDto":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the test PaymentIntent (and its cancellation) round-tripped successfully."},"paymentIntentId":{"type":"string","description":"Stripe PaymentIntent id of the test charge. The intent is canceled before any real authorization happens; no donor is charged.","nullable":true},"message":{"type":"string","description":"Human-readable result message; populated even on `ok=true`.","nullable":true},"status":{"description":"Mirror of the latest status snapshot for convenience.","allOf":[{"$ref":"#/components/schemas/StripeConnectStatusResponseDto"}]}},"required":["ok","status"]},"StripeConnectOAuthCallbackResponseDto":{"type":"object","properties":{"origin":{"type":"string","description":"Surface the connection was initiated from (recovered from signed state). The web callback uses this to route the user back to chat/MCP or the dashboard.","enum":["chat","dashboard","mcp","settings"]},"status":{"description":"The connect status snapshot after the code exchange + persist.","allOf":[{"$ref":"#/components/schemas/StripeConnectStatusResponseDto"}]}},"required":["origin","status"]},"CreateCrowdedOnboardingInviteDto":{"type":"object","properties":{"deliveryMode":{"type":"string","description":"How Crowded delivers the single-use hosted onboarding invitation. Link mode returns a URL; email mode sends it through Crowded.","enum":["link","email"],"example":"link"},"email":{"type":"string","description":"Recipient email for email delivery. Required for email mode and whenever firstName or lastName is supplied.","example":"treasurer@example.org","maxLength":320},"firstName":{"type":"string","description":"Recipient first name. May only be supplied together with email.","example":"Jane","maxLength":120},"lastName":{"type":"string","description":"Recipient last name. May only be supplied together with email.","example":"Director","maxLength":120}},"required":["deliveryMode"]},"CrowdedOnboardingInviteResponseDto":{"type":"object","properties":{"id":{"type":"string","description":"Charidy identifier for the persisted onboarding invitation.","format":"uuid"},"deliveryMode":{"type":"string","description":"How Crowded delivered the invitation.","enum":["link","email"]},"status":{"type":"string","description":"Current lifecycle state mirrored in Charidy.","enum":["pending","claimed","expired","revoked"]},"shortUrl":{"type":"string","description":"Single-use Crowded registration URL for link delivery. Null for email delivery and after no URL was returned.","nullable":true},"sentToEmail":{"type":"string","description":"Recipient address for email delivery. Null for link delivery.","nullable":true},"expiresAt":{"type":"string","description":"When Crowded stops accepting this invitation.","format":"date-time"},"claimedChapterId":{"type":"string","description":"Crowded Chapter identifier received after the invitation is claimed.","nullable":true},"claimedAt":{"type":"string","description":"When the platform webhook marked the invitation claimed.","format":"date-time","nullable":true}},"required":["id","deliveryMode","status","shortUrl","sentToEmail","expiresAt","claimedChapterId","claimedAt"]},"CrowdedOnboardingInviteStateResponseDto":{"type":"object","properties":{"invite":{"description":"Latest onboarding invitation for the active organization, or null when none has been created.","nullable":true,"allOf":[{"$ref":"#/components/schemas/CrowdedOnboardingInviteResponseDto"}]}},"required":["invite"]},"CrowdedConnectOwnerDto":{"type":"object","properties":{"firstName":{"type":"string","example":"Jane","maxLength":120},"lastName":{"type":"string","example":"Director","maxLength":120},"email":{"type":"string","example":"jane@example.org","maxLength":320},"mobile":{"type":"string","example":"+12345678901","description":"E.164 mobile number."},"dateOfBirth":{"type":"string","example":"1980-01-01","description":"ISO date of birth."}},"required":["firstName","lastName","email","mobile"]},"CrowdedConnectFullNameDto":{"type":"object","properties":{"first":{"type":"string","example":"John"},"last":{"type":"string","example":"Smith"}},"required":["first","last"]},"CrowdedConnectAddressDto":{"type":"object","properties":{"street":{"type":"string","example":"123 Main Street"},"street2":{"type":"string","example":"Suite 100"},"city":{"type":"string","example":"San Francisco"},"state":{"type":"string","example":"CA"},"postalCode":{"type":"string","example":"94102"},"country":{"type":"string","example":"US"}},"required":["street","city","state","postalCode","country"]},"CrowdedConnectPhoneDto":{"type":"object","properties":{"countryCode":{"type":"string","example":"1"},"number":{"type":"string","example":"4155551234"}},"required":["countryCode","number"]},"CrowdedConnectOfficerDto":{"type":"object","properties":{"fullName":{"$ref":"#/components/schemas/CrowdedConnectFullNameDto"},"address":{"$ref":"#/components/schemas/CrowdedConnectAddressDto"},"phone":{"$ref":"#/components/schemas/CrowdedConnectPhoneDto"},"title":{"type":"string","example":"CEO"},"dateOfBirth":{"type":"string","example":"1985-03-15"},"ssn":{"type":"string","example":"000000009","description":"Officer SSN (sandbox uses test values)."},"email":{"type":"string","example":"john.smith@example.org"}},"required":["fullName","address","phone","title","dateOfBirth","ssn","email"]},"CrowdedConnectApplicationDto":{"type":"object","properties":{"officer":{"$ref":"#/components/schemas/CrowdedConnectOfficerDto"},"address":{"$ref":"#/components/schemas/CrowdedConnectAddressDto"},"phone":{"$ref":"#/components/schemas/CrowdedConnectPhoneDto"},"ein":{"type":"string","example":"123451349","description":"Employer Identification Number."},"stateOfIncorporation":{"type":"string","example":"DE"},"website":{"type":"string","example":"https://www.example.org"},"yearOfIncorporation":{"type":"string","example":"2020"},"contactIp":{"type":"string","example":"203.0.113.7","description":"Consent/applicant IP recorded with the bank application. Defaults to the request IP."}},"required":["officer","address","phone","ein","stateOfIncorporation"]},"CrowdedConnectStartDto":{"type":"object","properties":{"organizationName":{"type":"string","description":"Display name for the Crowded Organization. Defaults to the Charidy org name.","maxLength":255},"businessVertical":{"type":"string","description":"Crowded business vertical. Defaults to ReligiousCivicAndSocialOrganizations.","maxLength":120},"owner":{"description":"Owner/admin user created for the chapter.","allOf":[{"$ref":"#/components/schemas/CrowdedConnectOwnerDto"}]},"application":{"description":"Bank application details. When present the application is submitted immediately; otherwise the chapter is created and the application is reported as pending details.","allOf":[{"$ref":"#/components/schemas/CrowdedConnectApplicationDto"}]}}},"CrowdedConnectStartResponseDto":{"type":"object","properties":{"configured":{"type":"boolean","description":"Whether the active org has a Crowded chapter at all."},"organizationId":{"type":"string","nullable":true,"description":"Crowded Organization UUID."},"chapterId":{"type":"string","nullable":true,"description":"Crowded Chapter UUID."},"applicationId":{"type":"string","nullable":true,"description":"Crowded bank application UUID."},"applicationStatus":{"type":"string","nullable":true,"description":"Application status: submitted | approved | denied | null."},"chargesEnabled":{"type":"boolean","description":"True once Crowded can accept charges for this chapter."},"payoutsEnabled":{"type":"boolean","description":"True once Crowded can disburse payouts for this chapter."},"requirementsCurrentlyDue":{"description":"Outstanding onboarding requirements.","type":"array","items":{"type":"string"}},"lastCheckedAt":{"type":"string","format":"date-time","description":"ISO timestamp of the last status reconciliation."},"applicationSubmitted":{"type":"boolean","description":"Whether the bank application was submitted during this call."}},"required":["configured","chargesEnabled","payoutsEnabled","requirementsCurrentlyDue","lastCheckedAt","applicationSubmitted"]},"CrowdedConnectStatusResponseDto":{"type":"object","properties":{"configured":{"type":"boolean","description":"Whether the active org has a Crowded chapter at all."},"organizationId":{"type":"string","nullable":true,"description":"Crowded Organization UUID."},"chapterId":{"type":"string","nullable":true,"description":"Crowded Chapter UUID."},"applicationId":{"type":"string","nullable":true,"description":"Crowded bank application UUID."},"applicationStatus":{"type":"string","nullable":true,"description":"Application status: submitted | approved | denied | null."},"chargesEnabled":{"type":"boolean","description":"True once Crowded can accept charges for this chapter."},"payoutsEnabled":{"type":"boolean","description":"True once Crowded can disburse payouts for this chapter."},"requirementsCurrentlyDue":{"description":"Outstanding onboarding requirements.","type":"array","items":{"type":"string"}},"lastCheckedAt":{"type":"string","format":"date-time","description":"ISO timestamp of the last status reconciliation."}},"required":["configured","chargesEnabled","payoutsEnabled","requirementsCurrentlyDue","lastCheckedAt"]},"CrowdedConnectTestResponseDto":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the Crowded chapter is reachable with the platform token."},"message":{"type":"string","nullable":true,"description":"Human-readable result message."},"status":{"$ref":"#/components/schemas/CrowdedConnectStatusResponseDto"}},"required":["ok","status"]},"CrowdedAccountDto":{"type":"object","properties":{"id":{"type":"string","description":"Crowded account UUID."},"accountType":{"type":"string","nullable":true,"description":"Account type."},"status":{"type":"string","nullable":true,"description":"Account status."},"balance":{"type":"number","nullable":true,"description":"Balance in cents."},"currency":{"type":"string","nullable":true,"description":"ISO currency code."}},"required":["id"]},"CrowdedAccountsResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/CrowdedAccountDto"}}},"required":["rows"]},"CrowdedTransactionsResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"type":"object","additionalProperties":true},"description":"Raw Crowded transaction rows for the active org chapter."}},"required":["rows"]},"CrowdedReleaseFundsDto":{"type":"object","properties":{"payload":{"type":"object","additionalProperties":true,"description":"Crowded release-funds payload (forwarded as-is to the Crowded API)."}},"required":["payload"]},"CrowdedFinanceResultDto":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the Crowded API accepted the operation."},"result":{"type":"object","additionalProperties":true,"nullable":true,"description":"Raw Crowded response data."}},"required":["ok"]},"CrowdedMoveFeesDto":{"type":"object","properties":{"payload":{"type":"object","additionalProperties":true,"description":"Crowded move-fees payload (forwarded as-is to the Crowded API)."}},"required":["payload"]},"PayoutConnectionStatusDto":{"type":"object","properties":{"payoutsEnabled":{"type":"boolean","nullable":true},"lastCheckedAt":{"type":"string","nullable":true,"format":"date-time"}}},"StripeBalanceAmountDto":{"type":"object","properties":{"amountMinor":{"type":"number","description":"Amount in the currency minor unit."},"currency":{"type":"string","description":"Lowercase ISO currency code."}},"required":["amountMinor","currency"]},"StripePayoutDto":{"type":"object","properties":{"id":{"type":"string"},"amountMinor":{"type":"number","description":"Amount in the currency minor unit."},"currency":{"type":"string"},"status":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"arrivalAt":{"type":"string","nullable":true,"format":"date-time"},"destination":{"type":"string","nullable":true}},"required":["id","amountMinor","currency","status","createdAt"]},"StripePayoutsDashboardDto":{"type":"object","properties":{"connectStatus":{"$ref":"#/components/schemas/PayoutConnectionStatusDto"},"available":{"type":"array","items":{"$ref":"#/components/schemas/StripeBalanceAmountDto"}},"pending":{"type":"array","items":{"$ref":"#/components/schemas/StripeBalanceAmountDto"}},"payouts":{"type":"array","items":{"$ref":"#/components/schemas/StripePayoutDto"}}},"required":["connectStatus","available","pending","payouts"]},"CrowdedPayoutsDashboardDto":{"type":"object","properties":{"connectStatus":{"$ref":"#/components/schemas/PayoutConnectionStatusDto"},"accounts":{"type":"array","items":{"$ref":"#/components/schemas/CrowdedAccountDto"}},"transactions":{"type":"array","items":{"type":"object","additionalProperties":true},"description":"Read-only transaction activity from the organization chapter."}},"required":["connectStatus","accounts","transactions"]},"OrgPayoutsDashboardResponseDto":{"type":"object","properties":{"stripe":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/StripePayoutsDashboardDto"}]},"crowded":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/CrowdedPayoutsDashboardDto"}]}}},"MeshulamConnectStartDto":{"type":"object","properties":{"origin":{"type":"string","description":"Surface the connection was initiated from. The dashboard uses it to route the user back to chat/MCP vs the settings page. Defaults to `settings`.","enum":["chat","dashboard","mcp","settings"]}}},"MeshulamConnectPageCodesDto":{"type":"object","properties":{"card":{"type":"boolean","description":"Card-only page code is configured."},"wallet":{"type":"boolean","description":"Wallet page code (Bit / Apple Pay / Google Pay) is configured."},"directDebit":{"type":"boolean","description":"Direct-debit page code (recurring / הוראת קבע) is configured."}},"required":["card","wallet","directDebit"]},"MeshulamConnectStatusResponseDto":{"type":"object","properties":{"configured":{"type":"boolean","description":"Whether the active org has Grow (Meshulam) credentials stored."},"userId":{"type":"string","description":"Grow business identifier (userId), if configured. Non-secret.","nullable":true},"chargesEnabled":{"type":"boolean","description":"True once a Grow credential probe confirmed the account can accept charges."},"pageCodes":{"description":"Which page codes are configured.","allOf":[{"$ref":"#/components/schemas/MeshulamConnectPageCodesDto"}]},"sandbox":{"type":"boolean","description":"Whether the stored Grow credentials target the sandbox host (apiBaseUrl = https://sandbox.meshulam.co.il). Used to hydrate the connect dialog so a re-save does not revert a sandbox account to live."},"requirementsCurrentlyDue":{"description":"Outstanding onboarding requirements still owed before go-live.","type":"array","items":{"type":"string"}},"lastCheckedAt":{"type":"string","description":"ISO timestamp of the last credential validation.","format":"date-time"},"lastError":{"type":"object","nullable":true,"description":"Grow's own message from the last failed capability check (e.g. an invalid-userId error when the page code belongs to a different Grow business). Null when the last check passed. Shown to the admin so a broken gateway is visible here instead of surfacing as a failed donation."},"autoReceiptEmail":{"type":"boolean","description":"Opt-in: when true, the donor acknowledgement is deferred so a single branded email (thank-you + the Grow-issued tax receipt PDF) is sent when Grow delivers the invoice document, with a 15-minute fallback to a thank-you-only email. When false the donor gets the immediate thank-you and the receipt URL is only stored on the contribution."}},"required":["configured","chargesEnabled","pageCodes","sandbox","requirementsCurrentlyDue","lastCheckedAt","autoReceiptEmail"]},"MeshulamConnectStartResponseDto":{"type":"object","properties":{"onboardingUrl":{"type":"string","description":"Secure dashboard onboarding URL. Open it so the org admin can paste their Grow userId / apiKey / page codes. Credentials are NEVER entered in chat.","format":"uri"},"status":{"description":"The connect status snapshot at the time the link was issued.","allOf":[{"$ref":"#/components/schemas/MeshulamConnectStatusResponseDto"}]}},"required":["onboardingUrl","status"]},"MeshulamConnectTestResponseDto":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the Grow credential probe round-tripped successfully."},"message":{"type":"string","description":"Human-readable result message.","nullable":true},"status":{"description":"Mirror of the latest status snapshot for convenience.","allOf":[{"$ref":"#/components/schemas/MeshulamConnectStatusResponseDto"}]}},"required":["ok","status"]},"MeshulamAutoReceiptUpdateDto":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Enable (true) or disable (false) the deferred single combined thank-you + tax-receipt email for Grow donations."}},"required":["enabled"]},"RecurringPlanDto":{"type":"object","properties":{"id":{"type":"string","description":"Recurring plan UUID."},"organizationId":{"type":"string","description":"Owning organization UUID."},"campaignId":{"type":"string","nullable":true,"description":"Campaign UUID, if scoped."},"campaignTitle":{"type":"string","nullable":true,"description":"Campaign display title."},"contactId":{"type":"string","description":"Donor contact UUID."},"donorDisplayName":{"type":"string","nullable":true,"description":"Donor display name."},"donorEmail":{"type":"string","nullable":true,"description":"Donor email."},"amountMinor":{"type":"number","description":"Recurring amount per cycle, in minor units."},"currency":{"type":"string","description":"ISO currency code."},"frequency":{"type":"string","description":"Billing frequency (e.g. monthly)."},"status":{"type":"string","description":"Plan status: active | canceled | completed."},"paymentProvider":{"type":"string","description":"Payment provider (crowded | meshulam | wallet | stripe)."},"providerSubscriptionId":{"type":"string","nullable":true,"description":"Provider subscription/plan id."},"contributionCount":{"type":"number","description":"Number of recorded contributions (cycles) for this plan."},"lastContributionAt":{"type":"string","nullable":true,"description":"ISO timestamp of the most recent recorded cycle."},"nextChargeAt":{"type":"string","nullable":true,"description":"ISO next scheduled charge, if known."},"canceledAt":{"type":"string","nullable":true,"description":"ISO cancellation timestamp."},"startedAt":{"type":"string","description":"ISO plan start timestamp."}},"required":["id","organizationId","contactId","amountMinor","currency","frequency","status","paymentProvider","contributionCount","startedAt"]},"RecurringPlansListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/RecurringPlanDto"}},"totalCount":{"type":"number","description":"Total matching plans (ignoring the page limit)."}},"required":["rows","totalCount"]},"CancelRecurringPlanResponseDto":{"type":"object","properties":{"plan":{"description":"The plan after cancellation.","allOf":[{"$ref":"#/components/schemas/RecurringPlanDto"}]},"providerStopConfirmed":{"type":"boolean","description":"Whether the provider's stop-recurring call was confirmed. When false, the plan is canceled in Charidy but the provider may keep charging until reconciled."}},"required":["plan","providerStopConfirmed"]},"CampaignPlatformFeeDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"campaignName":{"type":"string","description":"Campaign display name."},"campaignStatus":{"type":"string","description":"Campaign lifecycle status."},"platformFeeBpsOverride":{"type":"number","nullable":true,"minimum":0,"maximum":10000,"description":"Campaign platform fee in basis points. NULL inherits the active organization+provider fee config; 0 explicitly disables the campaign fee."}},"required":["campaignId","campaignName","campaignStatus"]},"CampaignPlatformFeeListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/CampaignPlatformFeeDto"}},"platformFeeBpsMax":{"type":"number","nullable":true,"description":"Resolved transactions.platformFeeBpsMax entitlement. NULL means unlimited or undeclared."}},"required":["rows"]},"SetCampaignPlatformFeeDto":{"type":"object","properties":{"platformFeeBpsOverride":{"type":"number","nullable":true,"minimum":0,"maximum":10000,"description":"Set an explicit campaign rate in basis points, including 0 for no fee; send NULL to inherit the organization fee config."}},"required":["platformFeeBpsOverride"]},"OrgPaymentFeeConfigDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"provider":{"type":"string","enum":["stripe","meshulam","wallet","crowded"]},"charidyShareBps":{"type":"number","description":"Charidy commission as basis points of gross processed volume (provider revenue share).","minimum":0,"maximum":10000},"providerFeeBps":{"type":"number","nullable":true,"description":"Estimated total provider fee in basis points (used for the org-net calculation)."},"providerFixedFeeMinor":{"type":"number","description":"Estimated fixed provider fee per donation, in minor units."},"isActive":{"type":"boolean","description":"Whether this config is active and used by the fee-estimate trigger."},"notes":{"type":"string","nullable":true},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","provider","charidyShareBps","providerFixedFeeMinor","isActive","updatedAt"]},"OrgPaymentFeeConfigListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/OrgPaymentFeeConfigDto"}}},"required":["rows"]},"UpsertOrgPaymentFeeConfigDto":{"type":"object","properties":{"provider":{"type":"string","enum":["stripe","meshulam","wallet","crowded"],"description":"Payment provider this revenue-share rate applies to."},"charidyShareBps":{"type":"number","description":"Charidy commission as basis points of gross processed volume (provider revenue share).","minimum":0,"maximum":10000},"providerFeeBps":{"type":"number","description":"Estimated total provider fee in basis points (for org-net calculation).","minimum":0,"maximum":10000},"providerFixedFeeMinor":{"type":"number","description":"Estimated fixed provider fee per donation, in minor units.","minimum":0},"isActive":{"type":"boolean","description":"Whether this config is active. Defaults to true."},"notes":{"type":"string","maxLength":500}},"required":["provider","charidyShareBps"]},"CrowdedCollectPaymentsSyncQueuedDto":{"type":"object","properties":{"queued":{"type":"boolean","example":true,"description":"True after BullMQ accepted the job."},"jobId":{"type":"string","description":"Stable queue job id for operational correlation."}},"required":["queued","jobId"]},"PaymentReconciliationExceptionDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Internal exception id."},"organizationId":{"type":"string","format":"uuid","nullable":true,"description":"Charidy organization proven by a contribution or gateway mapping. NULL means the partner-wide finding is visible only to super-admins and has not been assigned by guesswork."},"organizationName":{"type":"string","nullable":true,"description":"Organization display name, or NULL for an unassigned cross-tenant finding."},"paymentId":{"type":"string","description":"Crowded collect-payment id."},"intentId":{"type":"string","nullable":true,"description":"Crowded payment-intent id used as the primary contribution join key."},"kind":{"type":"string","enum":["missing_contribution","amount_mismatch"],"description":"Missing local contribution or amount mismatch."},"providerAmountMinor":{"type":"number","format":"int64","minimum":0,"description":"Amount Crowded reports, in currency minor units."},"contributionAmountMinor":{"type":"number","format":"int64","minimum":0,"nullable":true,"description":"Amount on the matched contribution, or NULL when none exists."},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO currency code."},"status":{"type":"string","enum":["open","resolved","ignored"],"description":"Operator lifecycle state for this finding."},"firstSeenAt":{"type":"string","format":"date-time","description":"First observation time."},"lastSeenAt":{"type":"string","format":"date-time","description":"Most recent observation time."}},"required":["id","paymentId","kind","providerAmountMinor","currency","status","firstSeenAt","lastSeenAt"]},"PaymentReconciliationExceptionsResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/PaymentReconciliationExceptionDto"}},"total":{"type":"number","minimum":0,"description":"Total findings matching the filters."},"page":{"type":"number","minimum":1,"description":"Current one-based page."},"limit":{"type":"number","minimum":1,"maximum":200,"description":"Requested page size."}},"required":["rows","total","page","limit"]},"ProviderFeeReconcileResultDto":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"provider":{"type":"string","description":"Provider the reconciliation ran against.","example":"crowded"},"checkedCount":{"type":"number","description":"Number of provider transactions inspected."},"reconciledCount":{"type":"number","description":"Number of contributions whose fees were reconciled to actuals."},"skipped":{"type":"string","nullable":true,"description":"Set when reconciliation was skipped (e.g. crowded_not_configured)."}},"required":["organizationId","provider","checkedCount","reconciledCount"]},"ReportSpecMetricDto":{"type":"object","properties":{"id":{"type":"string","description":"Catalog metric id (e.g. contactCount)."}},"required":["id"]},"ReportSpecFilterDto":{"type":"object","properties":{"field":{"type":"string","description":"Catalog field id to filter on."},"operator":{"type":"string","enum":["eq","neq","in","contains","gt","gte","lt","lte","is_null","is_not_null"]},"value":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"number"}]}}],"description":"Comparison value: a scalar (string/number/boolean) or, for the `in` operator, an array of strings/numbers. Omit for is_null/is_not_null."}},"required":["field","operator"]},"ReportSpecSortDto":{"type":"object","properties":{"field":{"type":"string","description":"Catalog field id (or metric id for aggregate reports)."},"direction":{"type":"string","enum":["asc","desc"],"default":"desc"}},"required":["field"]},"ReportSpecDateRangeDto":{"type":"object","properties":{"preset":{"type":"string","enum":["this_week","last_week","last_7_days","this_month","last_month","last_30_days","custom"]},"fromIso":{"type":"string","format":"date-time"},"toIso":{"type":"string","format":"date-time"}}},"ReportSpecDeliveryDto":{"type":"object","properties":{"mode":{"type":"string","enum":["inline","email","email+download"],"default":"inline"},"format":{"type":"string","enum":["csv","xlsx","pdf"]},"recipientEmail":{"type":"string","format":"email"}}},"ReportSpecPivotDto":{"type":"object","properties":{"rows":{"minItems":1,"maxItems":4,"description":"Groupable field ids down the side (1-4).","type":"array","items":{"type":"string"}},"columns":{"type":"string","description":"Groupable field id across the top. At most 20 distinct values (REPORT_PIVOT_COLUMNS_EXCEEDED otherwise). Must not also be a row dimension."},"metrics":{"minItems":1,"maxItems":6,"description":"Metric ids. Each is split across the column dimension and gets a total column; money metrics are also split per currency, never summed across currencies.","type":"array","items":{"$ref":"#/components/schemas/ReportSpecMetricDto"}}},"required":["rows","columns","metrics"]},"ReportSpecDto":{"type":"object","properties":{"mode":{"type":"string","enum":["rows","aggregate","pivot"],"description":"`rows` (list) or `aggregate` (grouped)."},"datasetId":{"type":"string","enum":["contacts","contributions","campaigns","recurring_plans","ambassadors","checkout_attempts","team_allocations","teams_export","campaigns_export"],"description":"Reportable dataset id from the catalog."},"fields":{"description":"Field ids for rows mode.","type":"array","items":{"type":"string"}},"metrics":{"description":"Metrics for aggregate mode.","type":"array","items":{"$ref":"#/components/schemas/ReportSpecMetricDto"}},"filters":{"type":"array","items":{"$ref":"#/components/schemas/ReportSpecFilterDto"}},"groupBy":{"description":"Groupable field ids (aggregate mode).","type":"array","items":{"type":"string"}},"sort":{"type":"array","items":{"$ref":"#/components/schemas/ReportSpecSortDto"}},"limit":{"type":"number","minimum":1,"maximum":5000},"dateRange":{"$ref":"#/components/schemas/ReportSpecDateRangeDto"},"delivery":{"$ref":"#/components/schemas/ReportSpecDeliveryDto"},"pivot":{"description":"Required when mode=`pivot`, rejected otherwise. A cross-tab: `rows` down the side, one `columns` dimension across the top, `metrics` split across it, with a totals column and totals row.","allOf":[{"$ref":"#/components/schemas/ReportSpecPivotDto"}]}},"required":["mode","datasetId"]},"ReportParamsDto":{"type":"object","properties":{"datePreset":{"type":"string","enum":["this_week","last_week","last_7_days","this_month","last_month","last_30_days","custom"],"default":"last_7_days","description":"Date window preset. Weeks start on Monday (ISO). Use `custom` together with fromIso/toIso."},"fromIso":{"type":"string","format":"date-time","description":"Inclusive lower bound for datePreset=custom."},"toIso":{"type":"string","format":"date-time","description":"Exclusive upper bound for datePreset=custom."},"campaignId":{"type":"string","format":"uuid","description":"Restrict to one campaign."},"currency":{"type":"string","example":"USD","description":"ISO currency filter."},"paymentProvider":{"type":"string","enum":["stripe","meshulam","wallet","crowded"],"description":"Payment processor filter."},"source":{"type":"string","maxLength":120,"description":"Acquisition source (utmSource) filter."},"dimensions":{"type":"array","description":"Breakdown dimensions (max 3). Defaults per template — donation_summary defaults to payment_provider + source.","items":{"type":"string","enum":["payment_provider","source","campaign","currency"]}}}},"ReportDeliveryDto":{"type":"object","properties":{"mode":{"type":"string","enum":["inline","email","email+download"],"description":"`inline` computes and returns facts immediately; `email` runs async and emails a signed download link when ready. ALWAYS confirm the recipient email with the user before creating an email-delivery report."},"recipientEmail":{"type":"string","format":"email","description":"Recipient for email delivery. Defaults to the requesting user account email."},"format":{"type":"string","enum":["csv","xlsx","pdf"],"default":"csv","description":"Export file format for email delivery."}},"required":["mode"]},"CreateReportDto":{"type":"object","properties":{"templateId":{"type":"string","enum":["donation_summary","campaign_comparison","donor_retention","recurring_health","top_donors","source_attribution","payment_reconciliation","ambassador_performance","custom"],"description":"Runnable report template: donation_summary (totals, average gift, and source/provider/currency breakdowns), campaign_comparison (per-campaign raised vs goal), source_attribution (per-source funnel and share of total), payment_reconciliation (gross, fees, commission, and net per processor), ambassador_performance (per-ambassador raised vs goal), top_donors (largest givers; requires the contacts.read permission), recurring_health (active, new, and canceled plans, MRR-equivalent, and failed charges), or donor_retention (new vs returning donors, repeat-gift rate, and lapsed donors). Use `custom` for an ad-hoc report and supply customSpec."},"customSpec":{"description":"Required when templateId=`custom`. Ad-hoc report definition validated against the dataset catalog.","allOf":[{"$ref":"#/components/schemas/ReportSpecDto"}]},"params":{"$ref":"#/components/schemas/ReportParamsDto"},"delivery":{"description":"Defaults to inline delivery.","allOf":[{"$ref":"#/components/schemas/ReportDeliveryDto"}]},"insightLocale":{"type":"string","enum":["en","he"],"description":"Locale for the generated insight summary. Defaults to en."}},"required":["templateId"]},"ReportMoneyTotalDto":{"type":"object","properties":{"currency":{"type":"string","example":"USD"},"grossAmountMinor":{"type":"string","description":"Gross succeeded donations, minor units, as string."},"contributionCount":{"type":"number"},"donorCount":{"type":"number"},"averageGiftMinor":{"type":"string","description":"Average gift, minor units, as string."}},"required":["currency","grossAmountMinor","contributionCount","donorCount","averageGiftMinor"]},"ReportSourceBreakdownDto":{"type":"object","properties":{"source":{"type":"string","description":"Acquisition source (utmSource, ambassador/team fallback, or \"direct\")."},"currency":{"type":"string","example":"USD"},"grossAmountMinor":{"type":"string"},"contributionCount":{"type":"number"}},"required":["source","currency","grossAmountMinor","contributionCount"]},"ReportProviderBreakdownDto":{"type":"object","properties":{"provider":{"type":"string","description":"Payment processor (stripe / meshulam / bit / crowded / manual)."},"currency":{"type":"string","example":"USD"},"grossAmountMinor":{"type":"string"},"contributionCount":{"type":"number"}},"required":["provider","currency","grossAmountMinor","contributionCount"]},"ReportDonationCampaignBreakdownDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid","nullable":true,"description":"Null when the donation was not linked to any campaign."},"campaignName":{"type":"string","nullable":true,"description":"Campaign name; null when no campaign could be resolved for this donation."},"currency":{"type":"string","example":"USD"},"grossAmountMinor":{"type":"string"},"contributionCount":{"type":"number"}},"required":["currency","grossAmountMinor","contributionCount"]},"ReportCampaignBreakdownDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"campaignName":{"type":"string"},"status":{"type":"string"},"currency":{"type":"string","example":"USD"},"goalAmountMinor":{"type":"string","nullable":true},"grossAmountMinor":{"type":"string"},"contributionCount":{"type":"number"},"donorCount":{"type":"number"},"averageGiftMinor":{"type":"string"},"goalAttainmentPercent":{"type":"number","nullable":true,"description":"Raised / goal * 100, null when no goal."}},"required":["campaignId","campaignName","status","currency","goalAmountMinor","grossAmountMinor","contributionCount","donorCount","averageGiftMinor"]},"ReportSourceAttributionDto":{"type":"object","properties":{"source":{"type":"string"},"currency":{"type":"string","example":"USD"},"grossAmountMinor":{"type":"string"},"contributionCount":{"type":"number"},"donorCount":{"type":"number"},"averageGiftMinor":{"type":"string"},"sharePercent":{"type":"number","nullable":true,"description":"Share of currency total, %."}},"required":["source","currency","grossAmountMinor","contributionCount","donorCount","averageGiftMinor"]},"ReportReconciliationDto":{"type":"object","properties":{"provider":{"type":"string"},"currency":{"type":"string","example":"USD"},"grossAmountMinor":{"type":"string"},"providerFeeMinor":{"type":"string"},"charidyCommissionMinor":{"type":"string"},"netAmountMinor":{"type":"string"},"contributionCount":{"type":"number"},"reconciledCount":{"type":"number"},"estimatedCount":{"type":"number"}},"required":["provider","currency","grossAmountMinor","providerFeeMinor","charidyCommissionMinor","netAmountMinor","contributionCount","reconciledCount","estimatedCount"]},"ReportAmbassadorDto":{"type":"object","properties":{"ambassadorId":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"currency":{"type":"string","example":"USD"},"goalAmountMinor":{"type":"string","nullable":true},"grossAmountMinor":{"type":"string"},"contributionCount":{"type":"number"},"donorCount":{"type":"number"},"goalAttainmentPercent":{"type":"number","nullable":true}},"required":["ambassadorId","displayName","currency","grossAmountMinor","contributionCount","donorCount"]},"ReportTopDonorDto":{"type":"object","properties":{"contactId":{"type":"string","nullable":true,"description":"Null when the donor is anonymous."},"displayName":{"type":"string"},"isAnonymous":{"type":"boolean"},"currency":{"type":"string","example":"USD"},"periodAmountMinor":{"type":"string"},"periodContributionCount":{"type":"number"},"lifetimeAmountMinor":{"type":"string"}},"required":["displayName","isAnonymous","currency","periodAmountMinor","periodContributionCount","lifetimeAmountMinor"]},"ReportRecurringCurrencyDto":{"type":"object","properties":{"currency":{"type":"string","example":"USD"},"activePlans":{"type":"number"},"mrrEquivalentMinor":{"type":"string"},"newPlans":{"type":"number"},"canceledPlans":{"type":"number"}},"required":["currency","activePlans","mrrEquivalentMinor","newPlans","canceledPlans"]},"ReportRecurringDto":{"type":"object","properties":{"byCurrency":{"type":"array","items":{"$ref":"#/components/schemas/ReportRecurringCurrencyDto"}},"failedChargeCount":{"type":"number"}},"required":["byCurrency","failedChargeCount"]},"ReportRetentionDto":{"type":"object","properties":{"newDonors":{"type":"number"},"returningDonors":{"type":"number"},"repeatGiftRatePercent":{"type":"number","nullable":true},"lapsedDonors":{"type":"number"}},"required":["newDonors","returningDonors","lapsedDonors"]},"ReportCustomColumnDto":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","description":"Cell type: string | integer | money | date | datetime | boolean | enum."},"isMetric":{"type":"boolean"},"enumLabels":{"type":"object","additionalProperties":{"type":"string"},"description":"Enum columns only: raw value → display label in the report's `insightLocale`. Cells in `rows` always carry the RAW value (e.g. `manual`), so match on the cell and use this map only for display."},"currencyColumnId":{"type":"string","description":"Money columns: id of the column in this same result that names the currency of the minor units."}},"required":["id","label","type","isMetric"]},"ReportCustomFactsDto":{"type":"object","properties":{"mode":{"type":"string","enum":["rows","aggregate","pivot"]},"datasetId":{"type":"string"},"datasetLabel":{"type":"string"},"columns":{"type":"array","items":{"$ref":"#/components/schemas/ReportCustomColumnDto"}},"rows":{"type":"array","items":{"type":"array","items":{}},"description":"Rows as arrays aligned to `columns` (values may be string | number | boolean | null)."},"rowCount":{"type":"number"},"truncated":{"type":"boolean","description":"True when the row limit was hit and results were truncated."}},"required":["mode","datasetId","datasetLabel","columns","rows","rowCount","truncated"]},"ReportFactsDto":{"type":"object","properties":{"templateId":{"type":"string","enum":["donation_summary","campaign_comparison","donor_retention","recurring_health","top_donors","source_attribution","payment_reconciliation","ambassador_performance","custom"]},"fromIso":{"type":"string","format":"date-time","description":"Inclusive-window start. Empty string when `allTime` is true (custom reports with no dateRange)."},"toIso":{"type":"string","format":"date-time","description":"Exclusive-window end. Empty string when `allTime` is true (custom reports with no dateRange)."},"allTime":{"type":"boolean","description":"True when the report has no date window (all-time query). Clients must prefer this over formatting fromIso/toIso."},"scope":{"type":"object","description":"Filters applied to this run. Empty results are limited to these filters, not to the whole organization.","properties":{"currency":{"type":"string"},"campaignId":{"type":"string"},"paymentProvider":{"type":"string"},"source":{"type":"string"}}},"totals":{"type":"array","items":{"$ref":"#/components/schemas/ReportMoneyTotalDto"}},"notes":{"description":"Methodology note codes for this report, resolved to localized text by the client. Informational only.","type":"array","items":{"type":"string"}},"bySource":{"type":"array","items":{"$ref":"#/components/schemas/ReportSourceBreakdownDto"}},"byProvider":{"type":"array","items":{"$ref":"#/components/schemas/ReportProviderBreakdownDto"}},"byCampaignBreakdown":{"type":"array","items":{"$ref":"#/components/schemas/ReportDonationCampaignBreakdownDto"}},"byCampaign":{"type":"array","items":{"$ref":"#/components/schemas/ReportCampaignBreakdownDto"}},"sourceAttribution":{"type":"array","items":{"$ref":"#/components/schemas/ReportSourceAttributionDto"}},"reconciliation":{"type":"array","items":{"$ref":"#/components/schemas/ReportReconciliationDto"}},"byAmbassador":{"type":"array","items":{"$ref":"#/components/schemas/ReportAmbassadorDto"}},"topDonors":{"type":"array","items":{"$ref":"#/components/schemas/ReportTopDonorDto"}},"recurring":{"$ref":"#/components/schemas/ReportRecurringDto"},"retention":{"$ref":"#/components/schemas/ReportRetentionDto"},"custom":{"description":"Present for ad-hoc (custom) reports: a generic table of columns + rows.","allOf":[{"$ref":"#/components/schemas/ReportCustomFactsDto"}]}},"required":["templateId","fromIso","toIso","totals"]},"ReportJobResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"templateId":{"type":"string","enum":["donation_summary","campaign_comparison","donor_retention","recurring_health","top_donors","source_attribution","payment_reconciliation","ambassador_performance","custom"]},"status":{"type":"string","enum":["queued","running","succeeded","failed","expired"],"description":"Report-generation lifecycle (artifact/query path). Email-delivery outcomes are in `deliveryStatus`."},"params":{"type":"object","additionalProperties":true},"facts":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/ReportFactsDto"}]},"insightText":{"type":"string","nullable":true,"description":"AI-written (or deterministic fallback) insight summary derived only from computed facts."},"insightLocale":{"type":"string","nullable":true},"deliveryMode":{"type":"string","enum":["inline","email","email+download"]},"deliveryStatus":{"type":"string","enum":["not_requested","unknown","pending","queued","retrying","sent","delivered","opened","clicked","unsubscribed","failed","bounced","complained","skipped_no_consent","skipped_suppressed","skipped_invalid"],"description":"Async delivery lifecycle for email jobs. `unknown` marks legacy email reports with no linked communication log. `queued` = waiting for first send attempt, `retrying` = at least one provider attempt already failed and BullMQ will retry. `sent` means accepted by provider (not necessarily delivered yet). Terminal failures are `failed | bounced | complained | skipped_*`. `not_requested` is inline mode."},"deliveryErrorCode":{"type":"string","nullable":true,"description":"Latest email-delivery error code from communication_logs (for debugging/support). Null when delivery has no provider error yet or delivery was not requested."},"exportFormat":{"type":"string","nullable":true},"exportAssetKey":{"type":"string","nullable":true},"recipientEmail":{"type":"string","format":"email","nullable":true},"errorCode":{"type":"string","nullable":true,"description":"Raw failure code from the layer that failed. Open-ended — new codes appear without notice; branch on `errorReason` instead and use this only for support/debugging."},"errorReason":{"type":"string","enum":["delivery_failed","invalid_request","unsupported_report","limit_exceeded","not_permitted","query_failed","unknown"],"nullable":true,"description":"Closed set describing WHY this report is not fully successful, safe to show a tenant (the raw error message is never published — it can name internal tables and template keys). `delivery_failed` means the export exists but the email could not be sent."},"rowCount":{"type":"number","nullable":true},"requestedById":{"type":"string","format":"uuid"},"signedUrlExpiresAt":{"type":"string","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"},"startedAt":{"type":"string","format":"date-time","nullable":true},"completedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","organizationId","templateId","status","params","deliveryMode","deliveryStatus","requestedById","createdAt"]},"ReportJobsListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/ReportJobResponseDto"}},"totalCount":{"type":"number","minimum":0}},"required":["rows","totalCount"]},"ReportPreviewRequestDto":{"type":"object","properties":{"spec":{"description":"The ad-hoc spec to preview (rows, aggregate or pivot). `delivery` is ignored. Rows and aggregate previews are capped at 200 rows (`truncated` says so); a pivot is never truncated, it is rejected over its caps.","allOf":[{"$ref":"#/components/schemas/ReportSpecDto"}]},"locale":{"type":"string","enum":["en","he"],"description":"Display-label locale. Defaults to en."}},"required":["spec"]},"ReportRowsColumnDto":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string","description":"Display label in the requested locale."},"type":{"type":"string","description":"string | integer | money | date | datetime | boolean | enum | id. Money cells are minor units as strings; the row currency is in the `currency` column when present."},"isMetric":{"type":"boolean"},"enumLabels":{"type":"object","additionalProperties":{"type":"string"},"description":"Raw enum value → display label in the requested locale."},"hidden":{"type":"boolean","description":"Machine column (ids, keys) used for linking/counting, not for display."},"currencyColumnId":{"type":"string","description":"For money columns: the column holding each row currency."}},"required":["id","label","type","isMetric"]},"ReportPivotColumnValueDto":{"type":"object","properties":{"key":{"type":"string","nullable":true,"description":"Raw value of the column dimension; null is the \"no value\" bucket."},"label":{"type":"string","description":"Display label in the requested locale."}},"required":["key","label"]},"ReportPivotMetricDto":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"type":{"type":"string"},"currencyColumnId":{"type":"string","description":"Money metrics: the column that names each row currency."}},"required":["id","label","type"]},"ReportPivotMetaDto":{"type":"object","properties":{"rowDimensionIds":{"type":"array","items":{"type":"string"}},"columnDimensionId":{"type":"string"},"columnValues":{"description":"Column values in display order. Output column ids for a metric are `<metricId>::<key>` (empty key for null) and `<metricId>::__total`.","type":"array","items":{"$ref":"#/components/schemas/ReportPivotColumnValueDto"}},"metrics":{"type":"array","items":{"$ref":"#/components/schemas/ReportPivotMetricDto"}},"totalRowIndexes":{"description":"Index into `rows` of every totals row (one per currency present).","type":"array","items":{"type":"number"}},"maxColumns":{"type":"number"},"maxRows":{"type":"number"}},"required":["rowDimensionIds","columnDimensionId","columnValues","metrics","totalRowIndexes","maxColumns","maxRows"]},"ReportPreviewResponseDto":{"type":"object","properties":{"datasetId":{"type":"string"},"datasetLabel":{"type":"string"},"mode":{"type":"string","enum":["rows","aggregate","pivot"]},"columns":{"type":"array","items":{"$ref":"#/components/schemas/ReportRowsColumnDto"}},"rows":{"type":"array","items":{"type":"array","items":{}},"description":"Rows as arrays aligned to `columns`. Money cells are minor units as strings."},"rowCount":{"type":"number"},"truncated":{"type":"boolean","description":"True when a rows/aggregate preview hit the preview row cap. Never true for a pivot."},"previewRowCap":{"type":"number","description":"Row cap applied to rows/aggregate previews."},"pivot":{"description":"Present only for pivot previews.","allOf":[{"$ref":"#/components/schemas/ReportPivotMetaDto"}]}},"required":["datasetId","datasetLabel","mode","columns","rows","rowCount","truncated","previewRowCap"]},"AvailableReportTemplateDto":{"type":"object","properties":{"id":{"type":"string","enum":["donation_summary","campaign_comparison","donor_retention","recurring_health","top_donors","source_attribution","payment_reconciliation","ambassador_performance"]},"labelEn":{"type":"string"},"labelHe":{"type":"string"}},"required":["id","labelEn","labelHe"]},"ReportCatalogFieldDto":{"type":"object","properties":{"id":{"type":"string"},"labelEn":{"type":"string"},"labelHe":{"type":"string"},"type":{"type":"string","description":"string | integer | money | date | datetime | boolean | enum."},"pii":{"type":"boolean","description":"True when the value can identify/contact an individual."},"sortable":{"type":"boolean"},"groupable":{"type":"boolean"},"filterable":{"type":"boolean"},"operators":{"type":"array","items":{"type":"string","enum":["eq","neq","in","contains","gt","gte","lt","lte","is_null","is_not_null"]}},"enumValues":{"description":"Every value this column can hold. A filter on any other value matches nothing, so pick from this list rather than guessing.","type":"array","items":{"type":"string"}},"enumLabelsEn":{"type":"object","additionalProperties":{"type":"string"},"description":"Enum value → English display label. Filters must still send the raw value."},"enumLabelsHe":{"type":"object","additionalProperties":{"type":"string"},"description":"Enum value → Hebrew display label. Filters must still send the raw value."}},"required":["id","labelEn","labelHe","type","pii","sortable","groupable","filterable","operators"]},"ReportCatalogMetricDto":{"type":"object","properties":{"id":{"type":"string"},"labelEn":{"type":"string"},"labelHe":{"type":"string"},"type":{"type":"string"}},"required":["id","labelEn","labelHe","type"]},"ReportCatalogDatasetDto":{"type":"object","properties":{"id":{"type":"string"},"labelEn":{"type":"string"},"labelHe":{"type":"string"},"descriptionEn":{"type":"string"},"descriptionHe":{"type":"string"},"fields":{"type":"array","items":{"$ref":"#/components/schemas/ReportCatalogFieldDto"}},"metrics":{"type":"array","items":{"$ref":"#/components/schemas/ReportCatalogMetricDto"}},"requiredPermissions":{"description":"Permissions required in addition to reports.read.","type":"array","items":{"type":"string"}},"maxLimit":{"type":"number"},"defaultLimit":{"type":"number"},"defaultFields":{"type":"array","items":{"type":"string"}}},"required":["id","labelEn","labelHe","descriptionEn","descriptionHe","fields","metrics","requiredPermissions","maxLimit","defaultLimit","defaultFields"]},"ReportCatalogResponseDto":{"type":"object","properties":{"exportTables":{"description":"Registered row-export table ids; source permissions are checked when exporting.","type":"array","items":{"type":"string"}},"templates":{"type":"array","items":{"$ref":"#/components/schemas/AvailableReportTemplateDto"}},"customEnabled":{"type":"boolean"},"aiEnabled":{"type":"boolean"},"datasets":{"type":"array","items":{"$ref":"#/components/schemas/ReportCatalogDatasetDto"}}},"required":["exportTables","templates","customEnabled","aiEnabled","datasets"]},"ReportRowsResponseDto":{"type":"object","properties":{"kind":{"type":"string","enum":["donations","custom"],"description":"`donations` — the individual succeeded donations behind a template report, read live with the job window + filters. `custom` — the stored rows of an ad-hoc report."},"columns":{"type":"array","items":{"$ref":"#/components/schemas/ReportRowsColumnDto"}},"rows":{"type":"array","items":{"type":"array","items":{}},"description":"Rows as arrays aligned to `columns` (values may be string | number | boolean | null)."},"rowCount":{"type":"number"},"truncated":{"type":"boolean","description":"True when the window held more rows than the 5000-row limit."},"donorNamesHidden":{"type":"boolean","description":"True when donor names were omitted because the caller lacks contacts.read."},"totalRowIndexes":{"description":"Pivot custom reports only: index into `rows` of every totals row. These rows repeat figures already in the data rows — do not add them into any sum or count.","type":"array","items":{"type":"number"}}},"required":["kind","columns","rows","rowCount","truncated","donorNamesHidden"]},"ReportDownloadUrlDto":{"type":"object","properties":{"signedUrl":{"type":"string","format":"uri"},"expiresAt":{"type":"string","format":"date-time"}},"required":["signedUrl","expiresAt"]},"InterpretReportRequestDto":{"type":"object","properties":{"text":{"type":"string","maxLength":600,"description":"Free-text report request in the user language (Hebrew or English), e.g. \"כמה תרומות נכנסו השבוע לפי מקור הגעה וסליקה\"."},"locale":{"type":"string","enum":["en","he"],"description":"Preferred response locale."}},"required":["text"]},"InterpretReportResponseDto":{"type":"object","properties":{"templateId":{"type":"string","enum":["donation_summary","campaign_comparison","donor_retention","recurring_health","top_donors","source_attribution","payment_reconciliation","ambassador_performance","custom"],"description":"`custom` when the request maps to an ad-hoc report (see customSpec)."},"params":{"$ref":"#/components/schemas/ReportParamsDto"},"summary":{"type":"string","description":"Human-readable, localized recap of exactly what will run (template, period, filters, breakdowns), e.g. \"Donation summary, last 20 days, broken down by payment provider and source.\" Show this to the user for confirmation before createReport."},"customSpec":{"nullable":true,"description":"Present when templateId=`custom`: the ready-to-run ad-hoc ReportSpec inferred from the request.","allOf":[{"$ref":"#/components/schemas/ReportSpecDto"}]},"confidence":{"type":"number","minimum":0,"maximum":1,"description":"Interpretation confidence. Below ~0.5 the caller should ask the user to confirm."},"clarification":{"type":"string","nullable":true,"description":"A clarifying question when the request was ambiguous."},"llmUsed":{"type":"boolean","description":"True when the LLM produced the interpretation; false when the deterministic keyword fallback was used."},"unsupported":{"type":"boolean","description":"True when the request cannot be expressed as a preset template AND has no custom spec — do NOT run templateId; show clarification instead."}},"required":["templateId","params","summary","confidence","llmUsed","unsupported"]},"ReportExportFieldDto":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"pii":{"type":"boolean"},"sensitive":{"type":"boolean"},"presets":{"type":"array","items":{"type":"string"}},"group":{"type":"string"}},"required":["key","label","pii","sensitive","presets","group"]},"ReportExportFieldsDto":{"type":"object","properties":{"kind":{"type":"string","enum":["donations","teams","campaigns"]},"fields":{"type":"array","items":{"$ref":"#/components/schemas/ReportExportFieldDto"}}},"required":["kind","fields"]},"CharidyExportSheetsDto":{"type":"object","properties":{"processed":{"type":"boolean"},"pending_canceled":{"type":"boolean"},"failed":{"type":"boolean"},"refunded":{"type":"boolean"},"team_donations":{"type":"boolean"},"recurring_estimate":{"type":"boolean"}}},"CreateCharidyExportDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"billingType":{"type":"string","enum":["all","recurring","one_time"]},"provider":{"type":"string","enum":["stripe","meshulam","wallet","crowded","manual"]},"teamId":{"type":"string","format":"uuid"},"includeSubTeams":{"type":"boolean"},"parentTeamId":{"type":"string","format":"uuid"},"linkedUserId":{"type":"string","format":"uuid"},"datePreset":{"type":"string","enum":["today","this_month","last_7_days","last_month","all","custom"]},"fromIso":{"type":"string","nullable":true},"toIso":{"type":"string","nullable":true},"preset":{"type":"string","enum":["basic","full"]},"fieldKeys":{"type":"array","items":{"type":"string"}},"format":{"type":"string","enum":["xlsx","csv"],"default":"xlsx"},"locale":{"type":"string","enum":["en","he"]},"sheets":{"$ref":"#/components/schemas/CharidyExportSheetsDto"}}},"ReportExportPresetDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"exportKind":{"type":"string","enum":["donations","teams","campaigns"]},"name":{"type":"string"},"fieldKeys":{"type":"array","items":{"type":"string"}}},"required":["id","exportKind","name","fieldKeys"]},"ReportExportPresetListDto":{"type":"object","properties":{"builtins":{"description":"Built-in preset keys. These are not rows.","type":"array","items":{"type":"string"}},"saved":{"type":"array","items":{"$ref":"#/components/schemas/ReportExportPresetDto"}}},"required":["builtins","saved"]},"SaveReportExportPresetDto":{"type":"object","properties":{"exportKind":{"type":"string","enum":["donations","teams","campaigns"]},"name":{"type":"string","maxLength":80},"fieldKeys":{"type":"array","items":{"type":"string"}}},"required":["exportKind","name","fieldKeys"]},"TableExportCatalogDto":{"type":"object","properties":{"tables":{"description":"Registered table ids; all exports additionally require the source-table permission.","type":"array","items":{"type":"string"}}},"required":["tables"]},"TableExportSortDto":{"type":"object","properties":{"id":{"type":"string","description":"Optional UI sort-row id."},"field":{"type":"string","description":"Registered source-table field id."},"direction":{"type":"string","enum":["asc","desc"]}},"required":["field","direction"]},"CreateTableExportDto":{"type":"object","properties":{"tableId":{"type":"string","description":"Registered table id, for example dashboard-contacts, dashboard-donations or campaign-detail-teams."},"columns":{"description":"Visible column ids from the table. Unknown columns are rejected.","type":"array","items":{"type":"string"}},"searchColumns":{"description":"All searchable source-table column ids, including hidden columns.","type":"array","items":{"type":"string"}},"quickFilter":{"type":"string","default":""},"filterRoot":{"type":"object","additionalProperties":true,"description":"Shared table filter tree: logic=and/or, conditions=[{field,operator,value}], groups=[nested tree]. Validated against server-owned field metadata."},"sorts":{"type":"array","items":{"$ref":"#/components/schemas/TableExportSortDto"}},"campaignId":{"type":"string","format":"uuid"},"contactId":{"type":"string","format":"uuid"},"contributionId":{"type":"string","format":"uuid"},"teamId":{"type":"string","format":"uuid"},"automationId":{"type":"string","format":"uuid"},"broadcastId":{"type":"string","format":"uuid"},"rowIds":{"description":"Optional selected row UUIDs; this only narrows the already authorized source scope.","type":"array","items":{"type":"string"}},"sourceFilters":{"type":"object","additionalProperties":true,"description":"Source list filters (validated per registered table), independent of the shared table filter tree."},"format":{"type":"string","enum":["csv","xlsx"],"default":"csv"},"locale":{"type":"string","enum":["en","he"],"default":"en"}},"required":["tableId","columns"]},"SurfaceInsightResponseDto":{"type":"object","properties":{"surface":{"type":"string","enum":["campaigns","donations","contacts"]},"insightText":{"type":"string","description":"A one-to-two sentence localized summary of the surface, phrased by the platform LLM from server-computed facts (deterministic fallback when the LLM is disabled)."},"severity":{"type":"string","enum":["info","warning"],"description":"Display severity derived from the facts. `warning` marks a blocker the user should act on (e.g. no active payment provider connected); otherwise `info`."},"ctaHref":{"type":"string","nullable":true,"description":"In-app path for the primary call-to-action, or null when the insight is not actionable."},"ctaLabel":{"type":"string","nullable":true,"description":"Localized label for the primary call-to-action, or null when there is no action."},"facts":{"type":"object","additionalProperties":true,"description":"The computed facts behind the summary."},"computedAt":{"type":"string","format":"date-time"},"llmUsed":{"type":"boolean"}},"required":["surface","insightText","severity","ctaHref","ctaLabel","facts","computedAt","llmUsed"]},"TableColumnOptionDto":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]},"TableColumnSchemaDto":{"type":"object","properties":{"id":{"type":"string","description":"Stable column id (matches the row field)."},"label":{"type":"string","description":"Human label shown in the table header."},"type":{"type":"string","enum":["string","number","date","boolean","enum"]},"filterOptions":{"description":"Enum options for select-style filters.","type":"array","items":{"$ref":"#/components/schemas/TableColumnOptionDto"}},"groupable":{"type":"boolean","default":true},"hideable":{"type":"boolean","default":true}},"required":["id","label"]},"InterpretTableQueryDto":{"type":"object","properties":{"text":{"type":"string","maxLength":400,"description":"Free-text table request in the user language, e.g. \"campaigns that start next month, only name and status\"."},"columns":{"description":"The columns available on the calling table.","type":"array","items":{"$ref":"#/components/schemas/TableColumnSchemaDto"}},"locale":{"type":"string","enum":["en","he"]}},"required":["text","columns"]},"TablePromptConditionDto":{"type":"object","properties":{"field":{"type":"string"},"operator":{"type":"string","enum":["contains","not_contains","eq","neq","starts_with","ends_with","gt","gte","lt","lte","is_empty","not_empty"]},"value":{"type":"string"}},"required":["field","operator","value"]},"InterpretTableQueryResponseDto":{"type":"object","properties":{"conditions":{"description":"Filter conditions to apply (AND).","type":"array","items":{"$ref":"#/components/schemas/TablePromptConditionDto"}},"groups":{"description":"Column ids to group by.","type":"array","items":{"type":"string"}},"hiddenFields":{"description":"Column ids to hide.","type":"array","items":{"type":"string"}},"matched":{"type":"boolean","description":"True when the interpretation produced any control changes."},"llmUsed":{"type":"boolean","description":"True when the LLM produced the plan; false when nothing usable was returned."}},"required":["conditions","groups","hiddenFields","matched","llmUsed"]},"DashboardRangeDto":{"type":"object","properties":{"preset":{"type":"string","enum":["today","last_7_days","this_month","last_month","last_30_days","this_year","custom"],"example":"last_30_days"},"fromIso":{"type":"string","format":"date-time","description":"Inclusive lower bound."},"toIso":{"type":"string","format":"date-time","description":"Exclusive upper bound."}},"required":["preset","fromIso","toIso"]},"DashboardOrgHealthDto":{"type":"object","properties":{"contactsTotal":{"type":"number","minimum":0},"newContactsInWindow":{"type":"number","minimum":0},"activeRelationships":{"type":"number","minimum":0},"donorRatePercent":{"type":"number","minimum":0,"maximum":100},"openTaskCount":{"type":"number","minimum":0},"blockingTaskCount":{"type":"number","minimum":0},"activeCampaignCount":{"type":"number","minimum":0},"draftCampaignCount":{"type":"number","minimum":0}},"required":["contactsTotal","newContactsInWindow","activeRelationships","donorRatePercent","openTaskCount","blockingTaskCount","activeCampaignCount","draftCampaignCount"]},"DashboardMoneyTotalDto":{"type":"object","properties":{"currency":{"type":"string","example":"USD"},"totalAmountMinor":{"type":"number","format":"int64","minimum":0},"contributionCount":{"type":"number","minimum":0}},"required":["currency","totalAmountMinor","contributionCount"]},"DashboardCampaignStatusCountDto":{"type":"object","properties":{"status":{"type":"string","enum":["draft","pending_approval","active","paused","ended","completed","archived"]},"count":{"type":"number","minimum":0}},"required":["status","count"]},"DashboardActionDto":{"type":"object","properties":{"kind":{"type":"string","enum":["open_builder","publish_campaign_page","share_campaign","review_tasks","review_failed_payments","review_donors","review_contacts"]},"priority":{"type":"string","enum":["critical","high","medium","low"]},"title":{"type":"string","description":"Human-readable action title, already localized. For task-derived actions this is the task's own title — clients must render it rather than a per-`kind` label, or N distinct tasks collapse into N identical rows (CHAR-74)."},"description":{"type":"string","description":"Localized detail line. Task-derived actions carry the task's own description."},"href":{"type":"string"},"taskId":{"type":"string","format":"uuid","nullable":true,"description":"Set when this action came from a specific copilot task, in which case `title`/`description` are that task's own copy. Null for actions the dashboard synthesizes (page readiness, failed payments), whose copy is a generic per-`kind` label."},"campaignId":{"type":"string","format":"uuid","nullable":true},"campaignName":{"type":"string","nullable":true}},"required":["kind","priority","title","description","href"]},"DashboardOverviewResponseDto":{"type":"object","properties":{"range":{"$ref":"#/components/schemas/DashboardRangeDto"},"windowDays":{"type":"number","minimum":1,"description":"Length of `range` in whole days. Derived; kept for existing callers."},"defaultCurrency":{"type":"string","example":"ILS","description":"The organization's default currency (ISO 4217), used to format zero/empty money totals."},"orgHealth":{"$ref":"#/components/schemas/DashboardOrgHealthDto"},"raisedTotals":{"type":"array","items":{"$ref":"#/components/schemas/DashboardMoneyTotalDto"}},"campaignStatusCounts":{"type":"array","items":{"$ref":"#/components/schemas/DashboardCampaignStatusCountDto"}},"topActions":{"type":"array","items":{"$ref":"#/components/schemas/DashboardActionDto"}}},"required":["range","windowDays","defaultCurrency","orgHealth","raisedTotals","campaignStatusCounts","topActions"]},"DashboardCampaignPerformanceDto":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"status":{"type":"string","enum":["draft","pending_approval","active","paused","ended","completed","archived"]},"currency":{"type":"string","example":"USD"},"goalAmount":{"type":"string","nullable":true,"example":"500000.00"},"publicUrl":{"type":"string","nullable":true},"livePublishedAt":{"type":"string","format":"date-time","nullable":true},"raisedAmountMinor":{"type":"number","format":"int64","minimum":0,"description":"Raised within the requested analysis window."},"raisedAllTimeAmountMinor":{"type":"number","format":"int64","minimum":0,"description":"Raised since the campaign began, ignoring the analysis window. Progress toward a goal is cumulative, so this — not the windowed figure — is what `goalProgressPercent` is computed from."},"contributionCount":{"type":"number","minimum":0,"description":"Contributions within the requested analysis window."},"donorCount":{"type":"number","minimum":0,"description":"Distinct donors within the requested analysis window."},"goalProgressPercent":{"type":"number","minimum":0,"maximum":100,"description":"Cumulative progress toward the goal — never scoped to the analysis window."},"openTaskCount":{"type":"number","minimum":0,"description":"Open tasks right now, not scoped to the window."},"blockingTaskCount":{"type":"number","minimum":0,"description":"Blocking tasks right now, not scoped to the window."}},"required":["campaignId","name","slug","status","currency","raisedAmountMinor","raisedAllTimeAmountMinor","contributionCount","donorCount","goalProgressPercent","openTaskCount","blockingTaskCount"]},"DashboardCampaignPerformanceResponseDto":{"type":"object","properties":{"range":{"$ref":"#/components/schemas/DashboardRangeDto"},"statusCounts":{"description":"Campaign counts by status right now, not scoped to the analysis window.","type":"array","items":{"$ref":"#/components/schemas/DashboardCampaignStatusCountDto"}},"campaigns":{"type":"array","items":{"$ref":"#/components/schemas/DashboardCampaignPerformanceDto"}}},"required":["range","statusCounts","campaigns"]},"DashboardTrendBucketDto":{"type":"object","properties":{"date":{"type":"string","format":"date"},"currency":{"type":"string","example":"USD"},"raisedAmountMinor":{"type":"number","format":"int64","minimum":0},"contributionCount":{"type":"number","minimum":0},"donorCount":{"type":"number","minimum":0},"averageGiftMinor":{"type":"number","format":"int64","minimum":0}},"required":["date","currency","raisedAmountMinor","contributionCount","donorCount","averageGiftMinor"]},"DashboardComparisonDto":{"type":"object","properties":{"current":{"description":"Current rolling-window donation metrics.","allOf":[{"$ref":"#/components/schemas/DashboardMoneyTotalDto"}]},"baseline":{"description":"Previous equal-length baseline window.","allOf":[{"$ref":"#/components/schemas/DashboardMoneyTotalDto"}]},"changePercent":{"type":"number","description":"Percentage delta between current and baseline raised totals."}},"required":["current","baseline","changePercent"]},"DashboardDonationTrendsResponseDto":{"type":"object","properties":{"range":{"$ref":"#/components/schemas/DashboardRangeDto"},"windowDays":{"type":"number","minimum":1,"description":"Length of `range` in whole days. Derived; kept for existing callers."},"compareMode":{"type":"string","enum":["all","campaign_day","baseline"]},"buckets":{"type":"array","items":{"$ref":"#/components/schemas/DashboardTrendBucketDto"}},"comparisons":{"type":"array","items":{"$ref":"#/components/schemas/DashboardComparisonDto"}}},"required":["range","windowDays","compareMode","buckets","comparisons"]},"DashboardWorkflowResponseDto":{"type":"object","properties":{"openTaskCount":{"type":"number","minimum":0},"blockingTaskCount":{"type":"number","minimum":0},"failedPaymentCount":{"type":"number","minimum":0},"actions":{"type":"array","items":{"$ref":"#/components/schemas/DashboardActionDto"}}},"required":["openTaskCount","blockingTaskCount","failedPaymentCount","actions"]},"GlobalSearchMatchDto":{"type":"object","properties":{"field":{"type":"string","description":"Field that matched the query.","example":"name"},"value":{"type":"string","description":"Display value for the matched field.","example":"Spring Giving Day"}},"required":["field","value"]},"GlobalSearchResultDto":{"type":"object","properties":{"type":{"type":"string","enum":["campaign","contact","contribution","team","matcher","donation_level","task","media_asset","automation"]},"id":{"type":"string","format":"uuid"},"title":{"type":"string","description":"Primary display title for the result."},"subtitle":{"type":"string","nullable":true,"description":"Short secondary label."},"href":{"type":"string","description":"Dashboard route to open this entity."},"matches":{"type":"array","items":{"$ref":"#/components/schemas/GlobalSearchMatchDto"}},"score":{"type":"number","description":"Relative score used to rank merged results."},"updatedAt":{"type":"string","format":"date-time","nullable":true},"metadata":{"type":"object","additionalProperties":true,"description":"Small entity-specific metadata for agents and UI labels."}},"required":["type","id","title","subtitle","href","matches","score","updatedAt","metadata"]},"GlobalSearchGroupDto":{"type":"object","properties":{"type":{"type":"string","enum":["campaign","contact","contribution","team","matcher","donation_level","task","media_asset","automation"]},"results":{"type":"array","items":{"$ref":"#/components/schemas/GlobalSearchResultDto"}}},"required":["type","results"]},"GlobalSearchResponseDto":{"type":"object","properties":{"query":{"type":"string","description":"Original normalized query."},"totalCount":{"type":"number"},"groups":{"type":"array","items":{"$ref":"#/components/schemas/GlobalSearchGroupDto"}},"results":{"type":"array","items":{"$ref":"#/components/schemas/GlobalSearchResultDto"}}},"required":["query","totalCount","groups","results"]},"JourneyQuestChoiceDto":{"type":"object","properties":{"value":{"type":"string"},"labelKey":{"type":"string"}},"required":["value","labelKey"]},"JourneyQuestPayloadDto":{"type":"object","properties":{"choices":{"type":"array","items":{"$ref":"#/components/schemas/JourneyQuestChoiceDto"}},"min":{"type":"number"},"max":{"type":"number"},"step":{"type":"number"},"defaultValue":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]},"inputMode":{"type":"string","enum":["text","url","numeric"]},"autoComplete":{"type":"string"}}},"JourneyQuestDto":{"type":"object","properties":{"id":{"type":"string","enum":["confirm_currency","confirm_sector","inner_circle_size","weekly_hours","urgency","anchor_donor_yes_no","let_us_show_what_is_achievable","story_extraction.problem","story_extraction.proof","story_extraction.moment","team_invite"]},"microCopyKey":{"type":"string"},"inputKind":{"type":"string","enum":["choice","slider","short_text","url","tap_target"]},"payload":{"$ref":"#/components/schemas/JourneyQuestPayloadDto"}},"required":["id","microCopyKey","inputKind","payload"]},"JourneyNextResponseDto":{"type":"object","properties":{"quest":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/JourneyQuestDto"}]},"progressPct":{"type":"number","minimum":0,"maximum":100},"celebrate":{"type":"boolean"},"awaitingApproval":{"type":"boolean"}},"required":["quest","progressPct"]},"JourneyAnswerBodyDto":{"type":"object","properties":{"value":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]}},"required":["value"]},"JourneySkipBodyDto":{"type":"object","properties":{"reason":{"type":"string","maxLength":240}}},"FormationRoadmapStepDto":{"type":"object","properties":{"key":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"category":{"type":"string","enum":["registration","tax","banking","governance","reporting","sector_permit","other"]},"order":{"type":"number"},"requiresProfessionalReview":{"type":"boolean","description":"When true, this step carries a legal/regulatory conclusion and cannot be completed without acknowledging professional review."},"status":{"type":"string","enum":["pending","in_progress","completed","not_applicable"]},"sourceCitation":{"type":"string","description":"Curated authority / source name (never LLM-invented)."},"officialUrl":{"type":"object","nullable":true},"confidence":{"type":"number","minimum":0,"maximum":1},"lastReviewedAt":{"type":"object","nullable":true,"description":"ISO date the content was last human-reviewed. Null = un-signed placeholder."},"reviewedBy":{"type":"object","nullable":true,"description":"Human legal reviewer who signed this step. Null = un-signed placeholder."},"professionalReviewAckAt":{"type":"object","nullable":true},"completedAt":{"type":"object","nullable":true},"completedByGlobalUserId":{"type":"object","nullable":true}},"required":["key","title","description","category","order","requiresProfessionalReview","status","sourceCitation","officialUrl","confidence","lastReviewedAt","reviewedBy","professionalReviewAckAt","completedAt","completedByGlobalUserId"]},"FormationRoadmapDto":{"type":"object","properties":{"generated":{"type":"boolean","description":"True when a roadmap snapshot exists for the org."},"decision":{"type":"string","enum":["informational","needs_review","unsupported_jurisdiction"],"description":"Never an absolute regulatory conclusion. `needs_review` for legal content pending human sign-off; `unsupported_jurisdiction` for a country with no maintained ruleset."},"disclaimer":{"type":"string","description":"Non-removable \"general information, not legal advice\" notice. Always present; surface it wherever the roadmap is shown."},"country":{"type":"object","nullable":true},"sector":{"type":"object","nullable":true},"provider":{"type":"string"},"rulesetVersion":{"type":"string"},"pendingLegalReview":{"type":"boolean","description":"True while any step still carries un-signed placeholder legal content."},"steps":{"type":"array","items":{"$ref":"#/components/schemas/FormationRoadmapStepDto"}},"aiAssisted":{"type":"boolean"},"aiGenerationVersion":{"type":"object","nullable":true},"generatedAt":{"type":"object","nullable":true,"description":"ISO timestamp of the last roadmap write."}},"required":["generated","decision","disclaimer","country","sector","provider","rulesetVersion","pendingLegalReview","steps","aiAssisted","aiGenerationVersion","generatedAt"]},"GenerateFormationRoadmapBodyDto":{"type":"object","properties":{"locale":{"type":"string","enum":["he","en"],"description":"Output locale for the roadmap + disclaimer. Defaults to `he`."}}},"CompleteFormationStepBodyDto":{"type":"object","properties":{"professionalReviewAck":{"type":"boolean","description":"Set true to acknowledge that professional/legal review was obtained. REQUIRED to complete a step whose `requiresProfessionalReview` is true — otherwise the request is rejected with FORMATION_STEP_REQUIRES_PROFESSIONAL_REVIEW."}}},"AgentToolSearchResponseDto":{"type":"object","properties":{"tools":{"description":"Caller-authorized tool descriptors in descending relevance order.","type":"array","items":{"$ref":"#/components/schemas/AgentToolDescriptorDto"}},"totalCount":{"type":"number","description":"Number of ranked tools returned."}},"required":["tools","totalCount"]},"McpToolCallLogDto":{"type":"object","properties":{"id":{"type":"string","description":"agent_events row id (use with getMcpToolCallLog).","format":"uuid"},"occurredAt":{"format":"date-time","type":"string","description":"When the tool call completed."},"toolName":{"type":"string","description":"MCP tool operationId that was invoked.","example":"listCampaigns"},"transport":{"type":"string","description":"Where the tool ran: `mcp` (native Charidy tool) or `upstream` (proxied Linear/Sentry/…).","enum":["mcp","upstream"]},"status":{"type":"string","description":"Terminal outcome of the call.","enum":["ok","error","needs_approval"]},"severity":{"type":"string","description":"Severity of the captured event.","enum":["info","warn","error"]},"latencyMs":{"type":"object","description":"Wall-clock duration of the dispatch in milliseconds.","nullable":true},"errorCode":{"type":"object","description":"Stable error/approval code when the call did not succeed.","nullable":true},"errorType":{"type":"object","description":"Coarse failure category: `transport` | `tool` | `needs_approval` (null on success).","nullable":true},"requestId":{"type":"object","description":"Correlation id (x-correlation-id / requestId) joining this call to logs, Sentry, and traces.","nullable":true,"format":"uuid"},"userId":{"type":"object","description":"Authenticated user id behind the call, when known.","nullable":true,"format":"uuid"},"message":{"type":"object","description":"Short, already-redacted error message sample (null on success).","nullable":true}},"required":["id","occurredAt","toolName","transport","status","severity"]},"McpToolCallLogPageDto":{"type":"object","properties":{"items":{"description":"Page of MCP tool-call log rows, newest first.","type":"array","items":{"$ref":"#/components/schemas/McpToolCallLogDto"}},"nextCursor":{"type":"object","description":"Opaque cursor for the next page (pass back as `cursor`); null when there are no more rows.","nullable":true}},"required":["items"]},"McpToolCallCountDto":{"type":"object","properties":{"toolName":{"type":"string","description":"MCP tool operationId."},"count":{"type":"number","description":"Total calls to this tool in the window."},"errorCount":{"type":"number","description":"How many of those calls failed."}},"required":["toolName","count","errorCount"]},"McpErrorCodeCountDto":{"type":"object","properties":{"errorCode":{"type":"string","description":"Stable error/approval code."},"count":{"type":"number","description":"How many calls failed with this code in the window."}},"required":["errorCode","count"]},"McpActivitySummaryDto":{"type":"object","properties":{"windowDays":{"type":"number","description":"Window length in days used for the rollup (1–90)."},"totalCalls":{"type":"number","description":"Total MCP tool calls captured in the window."},"okCount":{"type":"number","description":"Successful calls."},"errorCount":{"type":"number","description":"Failed calls (transport or tool error)."},"needsApprovalCount":{"type":"number","description":"Calls that returned `needs_approval` (a destructive tool awaiting human sign-off)."},"errorRatePercent":{"type":"number","description":"Error rate as a percentage of total calls (0–100, 2 dp)."},"p50DurationMs":{"type":"object","description":"Median (p50) call duration in ms over the window.","nullable":true},"p95DurationMs":{"type":"object","description":"95th percentile call duration in ms over the window.","nullable":true},"topTools":{"description":"Most-invoked tools with their failure counts.","type":"array","items":{"$ref":"#/components/schemas/McpToolCallCountDto"}},"topErrors":{"description":"Most frequent error/approval codes in the window.","type":"array","items":{"$ref":"#/components/schemas/McpErrorCodeCountDto"}}},"required":["windowDays","totalCalls","okCount","errorCount","needsApprovalCount","errorRatePercent","topTools","topErrors"]},"McpIncidentRowDto":{"type":"object","properties":{"id":{"type":"string","description":"mcp_incidents row id (also the reportId once reported).","format":"uuid"},"code":{"type":"string","description":"The code handed to the client.","example":"MCP-8F3K-2QD7"},"occurredAt":{"format":"date-time","type":"string","description":"When the failing call happened."},"toolName":{"type":"string","description":"MCP tool operationId that failed.","example":"createContact"},"transport":{"type":"string","description":"Where the tool ran.","enum":["mcp","upstream"]},"errorCode":{"type":"string","description":"Stable error code of the failure.","nullable":true},"errorType":{"type":"string","description":"Coarse failure category: `transport` | `tool`.","nullable":true},"messageSample":{"type":"string","description":"Redacted server error sample.","nullable":true},"expected":{"type":"boolean","description":"True when the failure was the system answering correctly (permission, plan gate, quota) rather than a defect. Use it to triage, not to dismiss."},"userId":{"type":"string","description":"User behind the failing call.","nullable":true,"format":"uuid"},"requestId":{"type":"string","description":"Correlation id joining this incident to logs, Sentry, and the tool-call log row.","nullable":true,"format":"uuid"},"reportedAt":{"type":"string","description":"When the customer asked for this to be reported. Null means it was never reported.","nullable":true,"format":"date-time"},"reportedByUserId":{"type":"string","description":"Who reported it.","nullable":true,"format":"uuid"},"reportNote":{"type":"string","description":"The reporter’s own note, redacted.","nullable":true},"reportChannel":{"type":"string","description":"`internal` while stored only here, `linear` once a ticket was filed.","nullable":true},"reportRef":{"type":"string","description":"External ticket identifier/URL — null means no ticket exists yet.","nullable":true}},"required":["id","code","occurredAt","toolName","transport","expected"]},"McpIncidentPageDto":{"type":"object","properties":{"items":{"description":"Page of incidents, newest first.","type":"array","items":{"$ref":"#/components/schemas/McpIncidentRowDto"}},"nextCursor":{"type":"string","description":"Opaque cursor for the next page; null when there are no more rows.","nullable":true}},"required":["items"]},"McpToolCallLogDetailDto":{"type":"object","properties":{"id":{"type":"string","description":"agent_events row id (use with getMcpToolCallLog).","format":"uuid"},"occurredAt":{"format":"date-time","type":"string","description":"When the tool call completed."},"toolName":{"type":"string","description":"MCP tool operationId that was invoked.","example":"listCampaigns"},"transport":{"type":"string","description":"Where the tool ran: `mcp` (native Charidy tool) or `upstream` (proxied Linear/Sentry/…).","enum":["mcp","upstream"]},"status":{"type":"string","description":"Terminal outcome of the call.","enum":["ok","error","needs_approval"]},"severity":{"type":"string","description":"Severity of the captured event.","enum":["info","warn","error"]},"latencyMs":{"type":"object","description":"Wall-clock duration of the dispatch in milliseconds.","nullable":true},"errorCode":{"type":"object","description":"Stable error/approval code when the call did not succeed.","nullable":true},"errorType":{"type":"object","description":"Coarse failure category: `transport` | `tool` | `needs_approval` (null on success).","nullable":true},"requestId":{"type":"object","description":"Correlation id (x-correlation-id / requestId) joining this call to logs, Sentry, and traces.","nullable":true,"format":"uuid"},"userId":{"type":"object","description":"Authenticated user id behind the call, when known.","nullable":true,"format":"uuid"},"message":{"type":"object","description":"Short, already-redacted error message sample (null on success).","nullable":true},"attributes":{"type":"object","description":"Full redacted event attributes (toolName, transport, status, redacted input, …). Redacted via @charidy/shared and capped at 4 KiB.","additionalProperties":true}},"required":["id","occurredAt","toolName","transport","status","severity","attributes"]},"ReportMcpIncidentDto":{"type":"object","properties":{"note":{"type":"string","description":"Optional free-text note from the person reporting (\"I was adding a donor from the CSV\"). Stored redacted; never include card numbers, passwords, or a full contact record.","nullable":true,"maxLength":1000}}},"McpIncidentReportResponseDto":{"type":"object","properties":{"reportId":{"type":"string","description":"Id of the report — the incident row itself. Quote this back to the user as confirmation.","format":"uuid"},"code":{"type":"string","description":"The incident code that was reported.","example":"MCP-8F3K-2QD7"},"status":{"type":"string","description":"`reported` on the first report; `already_reported` when this incident was reported before (the call is idempotent, no duplicate ticket is created).","enum":["reported","already_reported"]},"toolName":{"type":"string","description":"The MCP tool whose call failed.","example":"createContact"},"reportedAt":{"format":"date-time","type":"string","description":"When the report was recorded."},"channel":{"type":"string","description":"Where the report was delivered: `internal` (stored for the Charidy team) or `linear` once a ticket was actually created.","example":"internal"},"reference":{"type":"string","description":"External ticket identifier, present only once a ticket was really created. Null means the report is stored internally and awaiting relay — never tell the user a ticket exists when this is null.","nullable":true}},"required":["reportId","code","status","toolName","reportedAt","channel"]},"NotificationResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"recipientGlobalUserId":{"type":"string","format":"uuid","description":"Global user id of the recipient (always the caller)."},"type":{"type":"string","enum":["task_assigned","task_due","task_reminder","task_completed","task_comment","task_overdue","advisor_nudge","team_invitation_accepted","campaign_page_ready","campaign_published","campaign_paused","campaign_resumed","campaign_ended","subscription_billing","donation_received","campaign_goal_reached","recurring_payment_failed"],"description":"Notification category (also the preference event type)."},"title":{"type":"string","description":"Localized short headline for the bell / center row."},"body":{"type":"string","nullable":true,"description":"Localized one-line body."},"entityType":{"type":"string","nullable":true,"description":"Linked entity type (e.g. \"task\")."},"entityId":{"type":"string","format":"uuid","nullable":true,"description":"Linked entity id."},"taskId":{"type":"string","format":"uuid","nullable":true,"description":"Linked task id when the notification is task-related."},"payload":{"type":"object","additionalProperties":true,"description":"Structured payload for deep-linking / rendering."},"readAt":{"type":"string","nullable":true,"description":"ISO timestamp when the recipient read the notification (null = unread)."},"createdAt":{"type":"string","description":"ISO creation timestamp."}},"required":["id","organizationId","recipientGlobalUserId","type","title","body","entityType","entityId","taskId","payload","readAt","createdAt"]},"NotificationListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/NotificationResponseDto"}},"totalCount":{"type":"number","description":"Total notifications matching the filter (for pagination)."},"unreadCount":{"type":"number","description":"Total unread notifications for the caller (independent of the filter)."}},"required":["rows","totalCount","unreadCount"]},"UnreadNotificationCountResponseDto":{"type":"object","properties":{"unreadCount":{"type":"number","description":"Number of unread notifications for the caller."}},"required":["unreadCount"]},"NotificationPreferenceDto":{"type":"object","properties":{"eventType":{"type":"string","enum":["task_assigned","task_due","task_reminder","task_completed","task_comment","task_overdue","advisor_nudge","team_invitation_accepted","campaign_page_ready","campaign_published","campaign_paused","campaign_resumed","campaign_ended","subscription_billing","donation_received","campaign_goal_reached","recurring_payment_failed"]},"channelInApp":{"type":"boolean","description":"Deliver this category to the in-app notification center."},"channelEmail":{"type":"boolean","description":"Deliver this category by email."},"channelPush":{"type":"boolean","description":"Push this category to the caller’s registered devices (installed app). Defaults to on; omitted keeps the stored value. Push mirrors the in-app row, so it only fires while channelInApp is on."}},"required":["eventType","channelInApp","channelEmail"]},"NotificationPreferencesResponseDto":{"type":"object","properties":{"preferences":{"description":"Effective preference per event type. Categories without an explicit row are returned with sane defaults (in-app on; email on only for task_assigned / task_due).","type":"array","items":{"$ref":"#/components/schemas/NotificationPreferenceDto"}}},"required":["preferences"]},"UpdateNotificationPreferencesDto":{"type":"object","properties":{"preferences":{"description":"Preference rows to upsert. Only the provided event types are changed.","type":"array","items":{"$ref":"#/components/schemas/NotificationPreferenceDto"}}},"required":["preferences"]},"PushConfigResponseDto":{"type":"object","properties":{"enabled":{"type":"boolean","description":"True when this environment can send push notifications (VAPID keys configured)."},"vapidPublicKey":{"type":"string","nullable":true,"description":"Public VAPID key (base64url) the browser passes to pushManager.subscribe. Null when push is disabled."}},"required":["enabled","vapidPublicKey"]},"PushSubscriptionResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"endpoint":{"type":"string","description":"Push service endpoint URL (the caller’s own device)."},"platform":{"type":"string","enum":["ios","android","desktop","other"]},"timeZone":{"type":"string","nullable":true},"quietOnShabbat":{"type":"boolean"},"lastSuccessAt":{"type":"string","nullable":true,"description":"ISO time of the last push the service accepted."},"createdAt":{"type":"string","description":"ISO creation timestamp."}},"required":["id","endpoint","platform","timeZone","quietOnShabbat","lastSuccessAt","createdAt"]},"PushSubscriptionListResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/PushSubscriptionResponseDto"}}},"required":["rows"]},"PushSubscriptionKeysDto":{"type":"object","properties":{"p256dh":{"type":"string","description":"Browser-generated P-256 public key (base64url), from PushSubscription.toJSON().keys."},"auth":{"type":"string","description":"Browser-generated auth secret (base64url), from PushSubscription.toJSON().keys."}},"required":["p256dh","auth"]},"RegisterPushSubscriptionDto":{"type":"object","properties":{"endpoint":{"type":"string","description":"Push service endpoint URL from PushSubscription.endpoint."},"keys":{"$ref":"#/components/schemas/PushSubscriptionKeysDto"},"platform":{"type":"string","enum":["ios","android","desktop","other"],"default":"other","description":"Device family, for display and support."},"timeZone":{"type":"string","description":"IANA time zone of the device (Intl.DateTimeFormat().resolvedOptions().timeZone). Decides when Shabbat starts for quietOnShabbat.","example":"Asia/Jerusalem"},"quietOnShabbat":{"type":"boolean","description":"Hold back pushes to this device during Shabbat and Jewish holidays (in-app rows still arrive). Defaults to off; omitted keeps the stored value."}},"required":["endpoint","keys"]},"RemovePushSubscriptionDto":{"type":"object","properties":{"endpoint":{"type":"string","description":"Endpoint of the device to stop pushing to."}},"required":["endpoint"]},"RemovePushSubscriptionResponseDto":{"type":"object","properties":{"removed":{"type":"boolean","description":"True when a registration for that endpoint existed and was removed."}},"required":["removed"]},"MarkAllNotificationsReadResponseDto":{"type":"object","properties":{"updatedCount":{"type":"number","description":"Number of notifications marked read by this call."}},"required":["updatedCount"]},"ActivationFunnelStagesDto":{"type":"object","properties":{"signup":{"type":"number","description":"Organizations that completed signup in the window."},"setup":{"type":"number","description":"Organizations where a campaign was created."},"aha":{"type":"number","description":"Organizations with BOTH a published page and a first donation — activation."},"habit":{"type":"number","description":"Organizations that returned within 7 days of signing up."},"published":{"type":"number"},"firstDonation":{"type":"number"},"emailVerified":{"type":"number"}},"required":["signup","setup","aha","habit","published","firstDonation","emailVerified"]},"ActivationTimeToLiveDto":{"type":"object","properties":{"count":{"type":"number","description":"Organizations that reached both ends of the measured span."},"medianMinutes":{"type":"number","nullable":true},"p90Minutes":{"type":"number","nullable":true},"withinOneHourCount":{"type":"number","description":"Organizations that published within 60 minutes of signing up."},"withinOneHourRate":{"type":"number","nullable":true,"description":"withinOneHourCount / count, 0–1. Null when nothing published yet."}},"required":["count","medianMinutes","p90Minutes","withinOneHourCount","withinOneHourRate"]},"ActivationDurationStatsDto":{"type":"object","properties":{"count":{"type":"number","description":"Organizations that reached both ends of the measured span."},"medianMinutes":{"type":"number","nullable":true},"p90Minutes":{"type":"number","nullable":true}},"required":["count","medianMinutes","p90Minutes"]},"ActivationSeedingDto":{"type":"object","properties":{"scanSeeded":{"type":"number","description":"Organizations whose wizard was seeded by a website scan."},"blankStart":{"type":"number","description":"Organizations that started blank (no site, or an unusable scan)."},"unknown":{"type":"number","description":"Organizations that never reached the scan step."}},"required":["scanSeeded","blankStart","unknown"]},"ActivationAntiMetricsDto":{"type":"object","properties":{"abandonedWaiting":{"type":"number","description":"Generation started, never reported ready, never published — lost while waiting for the page."},"abandonedDesignRefine":{"type":"number","description":"Page generated but never published — lost during design refinement."},"lastStepCounts":{"type":"object","additionalProperties":{"type":"number"},"description":"Last wizard step recorded for each organization that never published."}},"required":["abandonedWaiting","abandonedDesignRefine","lastStepCounts"]},"ActivationFunnelResponseDto":{"type":"object","properties":{"fromIso":{"type":"string","format":"date-time"},"toIso":{"type":"string","format":"date-time"},"cohortSize":{"type":"number","description":"Organizations in the cohort."},"funnel":{"$ref":"#/components/schemas/ActivationFunnelStagesDto"},"timeToLive":{"description":"signup → published. Target: median ≤ 60 minutes.","allOf":[{"$ref":"#/components/schemas/ActivationTimeToLiveDto"}]},"timeToFirstDonation":{"$ref":"#/components/schemas/ActivationDurationStatsDto"},"seeding":{"$ref":"#/components/schemas/ActivationSeedingDto"},"antiMetrics":{"$ref":"#/components/schemas/ActivationAntiMetricsDto"}},"required":["fromIso","toIso","cohortSize","funnel","timeToLive","timeToFirstDonation","seeding","antiMetrics"]},"PlatformProviderRevenueRowDto":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"organizationName":{"type":"string"},"organizationSlug":{"type":"string"},"provider":{"type":"string","enum":["stripe","meshulam","wallet","crowded"]},"currency":{"type":"string","description":"ISO 4217 currency of the processed volume."},"contributionCount":{"type":"number","description":"Number of succeeded donations."},"grossAmountMinor":{"type":"string","description":"Gross processed volume in minor units (string-encoded bigint)."},"providerFeeMinor":{"type":"string","description":"Total provider fee in minor units (string-encoded bigint)."},"charidyCommissionMinor":{"type":"string","description":"Commission Charidy earned from this customer+provider (string-encoded bigint)."},"netAmountMinor":{"type":"string","description":"Net to the organization after provider fees (string-encoded bigint)."},"reconciledCount":{"type":"number","description":"Donations whose fees were reconciled against provider actuals."},"estimatedCount":{"type":"number","description":"Donations still on estimated fees."},"crowdedGrossAmountMinor":{"type":"string","nullable":true,"description":"Crowded collect-payments gross in minor units (string-encoded bigint), or NULL for another provider / before this row has any Stage 4 sync evidence. Derived server-side from synced contributions plus open discrepancy rows."},"crowdedGrossDifferenceMinor":{"type":"string","nullable":true,"description":"Crowded gross minus Charidy contribution gross in minor units (string-encoded signed bigint), or NULL when Crowded truth is not applicable/available."},"crowdedReleasedAmountMinor":{"type":"string","nullable":true,"description":"Gross minor-unit amount marked isReleased by Crowded among locally matched collect-payments, or NULL when unavailable."},"crowdedFeeTakenMinor":{"type":"string","nullable":true,"description":"Actual Crowded fee minor units whose collect-payment is marked isFeeTaken, or NULL when unavailable."},"crowdedTrackedPaymentCount":{"type":"number","nullable":true,"minimum":0,"description":"Number of local contributions observed by the partner-wide collect-payments sync, or NULL for non-Crowded rows."},"crowdedMissingPaymentCount":{"type":"number","nullable":true,"minimum":0,"description":"Open Crowded payments assigned to this organization but missing a local contribution, or NULL for non-Crowded rows."},"crowdedOnboardingStatus":{"type":"string","enum":["not_started","invited","pending","claimed","approved","denied"],"nullable":true,"description":"Server-resolved Crowded onboarding lifecycle from the latest invitation and gateway connect-status snapshot. NULL for non-Crowded rows."}},"required":["organizationId","organizationName","organizationSlug","provider","currency","contributionCount","grossAmountMinor","providerFeeMinor","charidyCommissionMinor","netAmountMinor","reconciledCount","estimatedCount","crowdedGrossAmountMinor","crowdedGrossDifferenceMinor","crowdedReleasedAmountMinor","crowdedFeeTakenMinor","crowdedTrackedPaymentCount","crowdedMissingPaymentCount","crowdedOnboardingStatus"]},"ListPlatformProviderRevenueResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/PlatformProviderRevenueRowDto"}}},"required":["rows"]},"PlatformProviderRevenueTotalDto":{"type":"object","properties":{"provider":{"type":"string","enum":["stripe","meshulam","wallet","crowded"]},"currency":{"type":"string"},"contributionCount":{"type":"number"},"grossAmountMinor":{"type":"string","description":"Gross processed volume in minor units (string-encoded bigint)."},"charidyCommissionMinor":{"type":"string","description":"Commission Charidy earned (string-encoded bigint)."},"providerFeeMinor":{"type":"string","description":"Total provider fees (string-encoded bigint)."}},"required":["provider","currency","contributionCount","grossAmountMinor","charidyCommissionMinor","providerFeeMinor"]},"PlatformRevenueSummaryResponseDto":{"type":"object","properties":{"byProvider":{"description":"Per-provider/currency rollup across all customers.","type":"array","items":{"$ref":"#/components/schemas/PlatformProviderRevenueTotalDto"}},"organizationCount":{"type":"number","description":"Distinct organizations (customers) that processed at least one donation in scope."}},"required":["byProvider","organizationCount"]},"TeamMemberDto":{"type":"object","properties":{"membershipId":{"type":"string","format":"uuid","description":"Organization membership row id."},"globalUserId":{"type":"string","format":"uuid","description":"Global user id of the member."},"email":{"type":"string","description":"Member email address."},"displayName":{"type":"string","nullable":true,"description":"Member display name, when known."},"status":{"type":"string","description":"Membership status.","enum":["invited","active","suspended","removed"]},"roleId":{"type":"string","format":"uuid","description":"Assigned role id."},"roleKey":{"type":"string","description":"Assigned role key.","example":"org_admin"},"roleName":{"type":"string","description":"Assigned role display name."},"joinedAt":{"type":"string","nullable":true,"description":"ISO timestamp the member joined."},"createdAt":{"type":"string","description":"ISO timestamp the membership row was created."},"isSelf":{"type":"boolean","description":"Whether this membership belongs to the calling user."}},"required":["membershipId","globalUserId","email","displayName","status","roleId","roleKey","roleName","joinedAt","createdAt","isSelf"]},"TeamMembersResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/TeamMemberDto"}},"totalCount":{"type":"number","description":"Total membership count for the organization."}},"required":["rows","totalCount"]},"TeamRoleDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string","example":"org_admin"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"isSystem":{"type":"boolean","description":"Whether this is a built-in system role."},"permissionKeys":{"description":"Permission keys this role grants, sorted. Lets the invite form state what a role actually allows instead of relying on hand-written prose that drifts from the seed. Ignore when `isAllowAll` is true.","example":["contacts.read","tasks.manage"],"type":"array","items":{"type":"string"}},"isAllowAll":{"type":"boolean","description":"True when holding this role bypasses permission resolution altogether (`org_owner`), so `permissionKeys` under-reports it — AuthorizationGuard grants such a holder every permission a route asks for. Render \"full access\" rather than the enumerated list."}},"required":["id","key","name","description","isSystem","permissionKeys","isAllowAll"]},"TeamPermissionDto":{"type":"object","properties":{"key":{"type":"string","example":"campaigns.publish"},"module":{"type":"string","example":"campaigns","description":"Catalog module this permission belongs to. NOT derivable from the key prefix — `custom_fields.*`, `tags.*` and `segments.*` are all filed under `contacts`, and `masav.manage` under `receipts` — so a client grouping permissions by area must use this value."},"isSensitive":{"type":"boolean","description":"Whether granting this permission is security-sensitive."}},"required":["key","module","isSensitive"]},"TeamRolesResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/TeamRoleDto"}},"permissions":{"description":"The full permission catalog, so a client can turn a role's `permissionKeys` into \"what this role can and cannot reach\" without a second round trip. Returned here rather than as its own endpoint to keep `team.read` the single gate for the team screen.","type":"array","items":{"$ref":"#/components/schemas/TeamPermissionDto"}}},"required":["rows","permissions"]},"UpdateTeamMemberRoleDto":{"type":"object","properties":{"roleId":{"type":"string","format":"uuid","description":"Role id to assign to the member."},"reason":{"type":"string","description":"Optional audit reason for the role change."}},"required":["roleId"]},"TeamInvitationDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","description":"Invited email address."},"roleId":{"type":"string","format":"uuid"},"roleKey":{"type":"string","example":"agent"},"roleName":{"type":"string"},"status":{"type":"string","description":"Invitation status.","enum":["pending","accepted","revoked","expired"]},"invitedByEmail":{"type":"string","nullable":true,"description":"Email of the inviter, when known."},"expiresAt":{"type":"string","description":"ISO timestamp the invitation expires."},"createdAt":{"type":"string","description":"ISO timestamp the invitation was created."}},"required":["id","email","roleId","roleKey","roleName","status","invitedByEmail","expiresAt","createdAt"]},"TeamInvitationsResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/TeamInvitationDto"}},"totalCount":{"type":"number","description":"Total invitation count for the organization."}},"required":["rows","totalCount"]},"CreateTeamInvitationDto":{"type":"object","properties":{"email":{"type":"string","description":"Email address to invite to the organization."},"roleId":{"type":"string","format":"uuid","description":"Role id to grant on acceptance."}},"required":["email","roleId"]},"CreateTeamInvitationResponseDto":{"type":"object","properties":{"invitation":{"$ref":"#/components/schemas/TeamInvitationDto"},"emailDelivered":{"type":"boolean","description":"Whether the invitation email was dispatched."}},"required":["invitation","emailDelivered"]},"InvitationPreviewDto":{"type":"object","properties":{"valid":{"type":"boolean","description":"Whether the invitation token is valid and still pending."},"status":{"type":"string","description":"Invitation status.","enum":["pending","accepted","revoked","expired"]},"organizationId":{"type":"string","format":"uuid","nullable":true},"organizationName":{"type":"string","nullable":true,"description":"Organization legal name."},"organizationSlug":{"type":"string","nullable":true,"description":"Organization slug."},"roleKey":{"type":"string","nullable":true,"description":"Role key the invitee will receive."},"roleName":{"type":"string","nullable":true,"description":"Role display name the invitee will receive."},"email":{"type":"string","nullable":true,"description":"Email address the invitation was sent to."},"expiresAt":{"type":"string","nullable":true,"description":"ISO timestamp the invitation expires."},"accountExists":{"type":"boolean","description":"Whether the invited email already belongs to an existing account. Evaluated only for the email bound to a valid pending invitation token; false for every other case."}},"required":["valid","status","organizationId","organizationName","organizationSlug","roleKey","roleName","email","expiresAt","accountExists"]},"AcceptInvitationResponseDto":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"organizationSlug":{"type":"string","description":"Organization slug for redirect after acceptance."},"membershipId":{"type":"string","format":"uuid","description":"Membership row id that was created or activated."},"roleKey":{"type":"string","description":"Role key granted to the member."}},"required":["organizationId","organizationSlug","membershipId","roleKey"]},"SignupFromInvitationDto":{"type":"object","properties":{"password":{"type":"string","description":"Password for the new account."},"firstName":{"type":"string","maxLength":100},"lastName":{"type":"string","maxLength":100},"preferredLocale":{"type":"string","enum":["en","he"]},"termsAccepted":{"type":"boolean","description":"Must be true — the invitee is creating a Charidy account."},"legalConsent":{"description":"CHAR-12 — which document versions the invitee was shown when they accepted. Optional while clients roll out; enforced when LEGAL_CONSENT_REQUIRED is on. Without it nothing is recorded — the server never invents a version.","allOf":[{"$ref":"#/components/schemas/LegalConsentDto"}]}},"required":["password","termsAccepted"]},"SignupFromInvitationSessionDto":{"type":"object","properties":{"accessToken":{"type":"string"},"accessTokenExpiresAt":{"type":"string","format":"date-time"},"refreshToken":{"type":"string"},"refreshTokenExpiresAt":{"type":"string","format":"date-time"}},"required":["accessToken","accessTokenExpiresAt","refreshToken","refreshTokenExpiresAt"]},"SignupFromInvitationResponseDto":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"organizationSlug":{"type":"string","description":"Organization slug, so the client can land inside it directly."},"organizationName":{"type":"string"},"membershipId":{"type":"string","format":"uuid"},"roleKey":{"type":"string","example":"agent"},"roleName":{"type":"string"},"globalUserId":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"session":{"description":"Issued in the same transaction, so the caller lands inside the organization without a second round trip — and never exists as an authenticated user with zero organizations.","allOf":[{"$ref":"#/components/schemas/SignupFromInvitationSessionDto"}]}},"required":["organizationId","organizationSlug","organizationName","membershipId","roleKey","roleName","globalUserId","email","session"]},"MyOrganizationResponseDto":{"type":"object","properties":{"id":{"type":"string","description":"Organization UUID","format":"uuid"},"slug":{"type":"string","description":"Organization unique slug","example":"charidy"},"name":{"type":"string","description":"Organization legal name","example":"Charidy Inc."},"roleKey":{"type":"string","description":"User role in this organization","example":"admin"},"status":{"type":"string","description":"User status in this organization","enum":["invited","active","suspended","removed"]},"orgStatus":{"type":"string","description":"Organization status","enum":["pending_approval","active","suspended","pending_deletion","disabled"]},"readOnly":{"type":"boolean","description":"Whether the organization currently rejects tenant writes because its subscription is locked"}},"required":["id","slug","name","roleKey","status","orgStatus","readOnly"]},"MyPendingInvitationDto":{"type":"object","properties":{"invitationId":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"organizationName":{"type":"string"},"organizationSlug":{"type":"string"},"roleKey":{"type":"string","example":"agent"},"roleName":{"type":"string"},"invitedByName":{"type":"string","nullable":true,"description":"Display name of the inviter, when known."},"expiresAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"}},"required":["invitationId","organizationId","organizationName","organizationSlug","roleKey","roleName","invitedByName","expiresAt","createdAt"]},"MyPendingInvitationsResponseDto":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/MyPendingInvitationDto"}},"totalCount":{"type":"number"},"emailVerified":{"type":"boolean","description":"False when the caller has not verified their email address; `rows` is then always empty. A flag rather than a 403, because refusing would itself reveal whether invitations exist for an address the caller may not own."}},"required":["rows","totalCount","emailVerified"]},"AcceptMyInvitationResponseDto":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"organizationSlug":{"type":"string"},"membershipId":{"type":"string","format":"uuid"},"roleKey":{"type":"string","example":"agent"}},"required":["organizationId","organizationSlug","membershipId","roleKey"]},"MySuperAdminStatusResponseDto":{"type":"object","properties":{"isSuperAdmin":{"type":"boolean","description":"Whether the current user holds any platform super-admin system role (resolved from global system-role grants, not organization memberships).","example":true},"tier":{"type":"string","description":"Highest super-admin tier the user holds, or null when the user is not a super-admin.","enum":["super_admin_tier_1","super_admin_tier_2","super_admin_tier_3"],"nullable":true,"example":"super_admin_tier_3"}},"required":["isSuperAdmin","tier"]},"ConnectedAuthProviderDto":{"type":"object","properties":{"provider":{"type":"string","enum":["google","microsoft","apple"]},"label":{"type":"string"},"canImportAvatar":{"type":"boolean"},"accessTokenExpiresAt":{"type":"object","format":"date-time","nullable":true}},"required":["provider","label","canImportAvatar"]},"MyProfileResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"firstName":{"type":"object","nullable":true},"lastName":{"type":"object","nullable":true},"displayName":{"type":"object","nullable":true},"phone":{"type":"object","nullable":true},"preferredLocale":{"type":"string","enum":["en","he"],"nullable":true},"timezone":{"type":"string","nullable":true,"example":"Asia/Jerusalem"},"grammaticalGender":{"type":"string","enum":["masculine","feminine","neutral"],"nullable":true},"avatarUrl":{"type":"object","nullable":true},"avatarSourceProvider":{"type":"object","nullable":true},"avatarSyncedAt":{"type":"object","format":"date-time","nullable":true},"emailVerifiedAt":{"type":"object","format":"date-time","nullable":true},"lastLoginAt":{"type":"object","format":"date-time","nullable":true},"hasPassword":{"type":"boolean"},"connectedProviders":{"type":"array","items":{"$ref":"#/components/schemas/ConnectedAuthProviderDto"}},"pendingEmail":{"type":"object","format":"email","nullable":true},"pendingEmailExpiresAt":{"type":"object","format":"date-time","nullable":true},"jobTitle":{"type":"object","nullable":true,"maxLength":120,"description":"Free-text job title the member wrote about themselves, scoped to this organization.","example":"Fundraising manager"},"roleKey":{"type":"object","nullable":true,"description":"Stable key of the assigned role, e.g. `org_admin`. Use this for logic and for localized labels.","example":"org_admin"},"roleName":{"type":"object","nullable":true,"description":"English role name as stored in the database. Display fallback for roles with no translation.","example":"Organization admin"},"organizationName":{"type":"object","nullable":true,"description":"Name of the organization this profile view is scoped to."},"permissionKeys":{"description":"Permission keys the caller effectively holds in this organization, sorted. Same class of fact as `roleKey` — it answers 'who am I here' — and it is what lets the UI hide navigation the member cannot use instead of letting them click into a 403. Empty when the caller has no membership row in this org, and meaningless when `allowAllPermissions` is true.","example":["contacts.read","campaigns.read"],"type":"array","items":{"type":"string"}},"allowAllPermissions":{"type":"boolean","description":"True when the caller holds everything in this organization (`org_owner`, or a tier-3 platform admin), matching the short-circuits in AuthorizationGuard. A flag rather than an enumerated list on purpose: an owner must not appear to lose access on the day a new permission is seeded ahead of the migration that grants it."}},"required":["id","email","hasPassword","connectedProviders","permissionKeys","allowAllPermissions"]},"UpdateMyProfileDto":{"type":"object","properties":{"firstName":{"type":"object","nullable":true,"minLength":1,"maxLength":100},"lastName":{"type":"object","nullable":true,"minLength":1,"maxLength":100},"displayName":{"type":"object","nullable":true,"minLength":1,"maxLength":160},"phone":{"type":"object","nullable":true,"maxLength":16,"description":"E.164 phone number, e.g. +972501234567."},"preferredLocale":{"type":"string","enum":["en","he"],"nullable":true},"timezone":{"type":"string","nullable":true,"maxLength":64,"example":"Asia/Jerusalem"},"grammaticalGender":{"type":"string","enum":["masculine","feminine","neutral"],"nullable":true},"jobTitle":{"type":"object","nullable":true,"maxLength":120,"description":"Free-text job title within the current organization. Descriptive only — it grants no permissions.","example":"Fundraising manager"}}},"SetOrChangeMyPasswordDto":{"type":"object","properties":{"currentPassword":{"type":"string","description":"Required when the account already has a password."},"newPassword":{"type":"string","minLength":10,"maxLength":200}},"required":["newPassword"]},"RequestMyEmailChangeDto":{"type":"object","properties":{"newEmail":{"type":"string","format":"email"}},"required":["newEmail"]},"RequestMyEmailChangeResponseDto":{"type":"object","properties":{"ok":{"type":"boolean"},"pendingEmail":{"type":"string","format":"email"},"expiresAt":{"type":"string","format":"date-time"}},"required":["ok","pendingEmail","expiresAt"]},"ConfirmMyEmailChangeDto":{"type":"object","properties":{"token":{"type":"string","minLength":20}},"required":["token"]},"UpdateMyAvatarDto":{"type":"object","properties":{"contentType":{"type":"string","enum":["image/jpeg","image/png","image/webp","image/gif"]},"imageBase64":{"type":"string","description":"Image bytes as base64 or a data URI. Use this for MCP clients that can pass file content."},"sourceUrl":{"type":"string","description":"Remote HTTPS image URL for the API to fetch and store."}},"required":["contentType"]},"ImportMyAvatarFromProviderDto":{"type":"object","properties":{"provider":{"type":"string","enum":["google","microsoft"]}},"required":["provider"]}}},"externalDocs":{"description":"Givearoo connection and API guide","url":"https://www.givearoo.com/en/connect"}}