openapi: 3.1.0 info: title: Fast ACCOUNT_COSTS PAYMENT API version: 0.1.0 tags: - name: PAYMENT paths: /payment/checkout: post: tags: - PAYMENT summary: Create Checkout Session description: 'Creates a Checkout Session :param db: The database session for accessing the database. :param auth: The authorization token for the request. :return: checkout session url.' operationId: create_checkout_session_payment_checkout_post security: - HTTPBearer: [] - HTTPBearer: [] parameters: - name: x-tenant in: header required: false schema: type: string title: X-Tenant requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PaymentCheckoutRequest' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/PaymentCheckoutResponse' '400': description: Not supported for public user content: application/json: schema: type: object additionalProperties: true title: Response 400 Create Checkout Session Payment Checkout Post '403': description: Not supported for public user content: application/json: schema: type: object additionalProperties: true title: Response 403 Create Checkout Session Payment Checkout Post '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /payment/credits: get: tags: - PAYMENT summary: Get User Credits description: 'Fetches the spent and total credits for a user :param db: The database session for accessing the database. :param tenant: The current tenant :param auth: The authorization token for the request. :return: UserCreditsResponse.' operationId: get_user_credits_payment_credits_get security: - HTTPBearer: [] - HTTPBearer: [] parameters: - name: x-tenant in: header required: false schema: type: string title: X-Tenant responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/UserCreditsResponse' '400': description: Not supported for public user content: application/json: schema: type: object additionalProperties: true title: Response 400 Get User Credits Payment Credits Get '403': description: Not supported for public user content: application/json: schema: type: object additionalProperties: true title: Response 403 Get User Credits Payment Credits Get '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /payment/checkout/update: post: tags: - PAYMENT summary: Update User Credits Post Checkout description: 'Updates the user credits post checkout :param db: The database session for accessing the database. :param tenant: The current tenant :param auth: The authorization token for the request. :return: StandardResponse.' operationId: update_user_credits_post_checkout_payment_checkout_update_post security: - HTTPBearer: [] - HTTPBearer: [] parameters: - name: x-tenant in: header required: false schema: type: string title: X-Tenant requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PostPaymentCheckoutRequest' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/StandardResponse' '400': description: Not supported for public user content: application/json: schema: type: object additionalProperties: true title: Response 400 Update User Credits Post Checkout Payment Checkout Update Post '403': description: Not supported for public user content: application/json: schema: type: object additionalProperties: true title: Response 403 Update User Credits Post Checkout Payment Checkout Update Post '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /payment/downgrade: post: tags: - PAYMENT summary: Downgrade Subscription description: 'Downgrades the user subscription :param db: The database session for accessing the database. :param tenant: The current tenant :param auth: The authorization token for the request. :return: StandardResponse.' operationId: downgrade_subscription_payment_downgrade_post security: - HTTPBearer: [] - HTTPBearer: [] parameters: - name: x-tenant in: header required: false schema: type: string title: X-Tenant requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PaymentCheckoutRequest' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/StandardResponse' '400': description: Not supported for public user content: application/json: schema: type: object additionalProperties: true title: Response 400 Downgrade Subscription Payment Downgrade Post '403': description: Not supported for public user content: application/json: schema: type: object additionalProperties: true title: Response 403 Downgrade Subscription Payment Downgrade Post '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /payment/downgrade/feedback: post: tags: - PAYMENT summary: Downgrade Subscription Feedback operationId: downgrade_subscription_feedback_payment_downgrade_feedback_post security: - HTTPBearer: [] - HTTPBearer: [] parameters: - name: x-tenant in: header required: false schema: type: string title: X-Tenant requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/DowngradeFeedback' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/StandardResponse' '400': description: Not supported for public user content: application/json: schema: type: object additionalProperties: true title: Response 400 Downgrade Subscription Feedback Payment Downgrade Feedback Post '403': description: Not supported for public user content: application/json: schema: type: object additionalProperties: true title: Response 403 Downgrade Subscription Feedback Payment Downgrade Feedback Post '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /payment/downgrade/cancel: post: tags: - PAYMENT summary: Cancel Scheduled Downgrade operationId: cancel_scheduled_downgrade_payment_downgrade_cancel_post deprecated: true security: - HTTPBearer: [] - HTTPBearer: [] parameters: - name: x-tenant in: header required: false schema: type: string title: X-Tenant responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/StandardResponse' '400': description: Not supported for public user content: application/json: schema: type: object additionalProperties: true title: Response 400 Cancel Scheduled Downgrade Payment Downgrade Cancel Post '403': description: Not supported for public user content: application/json: schema: type: object additionalProperties: true title: Response 403 Cancel Scheduled Downgrade Payment Downgrade Cancel Post '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /payment/plans/{tenure}: get: tags: - PAYMENT summary: Get All Plans description: 'Fetches the all plans details :param db: The database session for accessing the database. :param tenant: The current tenant :param auth: The authorization token for the request. :return: UserCreditsResponse.' operationId: get_all_plans_payment_plans__tenure__get security: - HTTPBearer: [] - HTTPBearer: [] parameters: - name: tenure in: path required: true schema: type: string title: Tenure - name: x-tenant in: header required: false schema: type: string title: X-Tenant responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/AllPlansResponse' '400': description: Not supported for public user content: application/json: schema: type: object additionalProperties: true title: Response 400 Get All Plans Payment Plans Tenure Get '403': description: Not supported for public user content: application/json: schema: type: object additionalProperties: true title: Response 403 Get All Plans Payment Plans Tenure Get '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /payment/create: post: tags: - PAYMENT summary: Subscribe To Free Plan operationId: subscribe_to_free_plan_payment_create_post deprecated: true security: - HTTPBearer: [] parameters: - name: x-tenant in: header required: false schema: type: string title: X-Tenant responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/StandardResponse' '400': description: Not supported for public user content: application/json: schema: type: object additionalProperties: true title: Response 400 Subscribe To Free Plan Payment Create Post '403': description: Not supported for public user content: application/json: schema: type: object additionalProperties: true title: Response 403 Subscribe To Free Plan Payment Create Post '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /payment/enterprise: post: tags: - PAYMENT summary: Create Enterprise Plan description: Creates an enterprise plan operationId: create_enterprise_plan_payment_enterprise_post deprecated: true security: - HTTPBearer: [] - HTTPBearer: [] parameters: - name: x-tenant in: header required: false schema: type: string title: X-Tenant requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateEnterprisePlanRequest' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/StandardResponse' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /payment/enterprise/update: post: tags: - PAYMENT summary: Update Enterprise Plan description: Update an enterprise plan operationId: update_enterprise_plan_payment_enterprise_update_post deprecated: true security: - HTTPBearer: [] - HTTPBearer: [] parameters: - name: x-tenant in: header required: false schema: type: string title: X-Tenant requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/UpdateEnterprisePlanRequest' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/StandardResponse' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /payment/token-usage: get: tags: - PAYMENT summary: Get Token Usage description: Token usage for UI progress bar. operationId: get_token_usage_payment_token_usage_get security: - HTTPBearer: [] - HTTPBearer: [] parameters: - name: x-tenant in: header required: false schema: type: string title: X-Tenant responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/TokenUsageResponse' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /payment/wallet/deposit: post: tags: - PAYMENT summary: Create Wallet Deposit description: Create a Stripe Checkout session for a one-time wallet deposit. operationId: create_wallet_deposit_payment_wallet_deposit_post deprecated: true security: - HTTPBearer: [] - HTTPBearer: [] parameters: - name: x-tenant in: header required: false schema: type: string title: X-Tenant requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/WalletDepositRequest' responses: '200': description: Successful Response content: application/json: schema: type: object additionalProperties: true title: Response Create Wallet Deposit Payment Wallet Deposit Post '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /payment/wallet/deposit/confirm: post: tags: - PAYMENT summary: Confirm Wallet Deposit description: Confirm a wallet deposit after Stripe Checkout redirect. operationId: confirm_wallet_deposit_payment_wallet_deposit_confirm_post deprecated: true security: - HTTPBearer: [] - HTTPBearer: [] parameters: - name: x-tenant in: header required: false schema: type: string title: X-Tenant requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/WalletDepositConfirmRequest' responses: '200': description: Successful Response content: application/json: schema: type: object additionalProperties: true title: Response Confirm Wallet Deposit Payment Wallet Deposit Confirm Post '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /payment/wallet: get: tags: - PAYMENT summary: Get Wallet Info description: Get wallet state for the UI. operationId: get_wallet_info_payment_wallet_get security: - HTTPBearer: [] - HTTPBearer: [] parameters: - name: x-tenant in: header required: false schema: type: string title: X-Tenant responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/WalletResponse' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /payment/wallet/settings: put: tags: - PAYMENT summary: Update Wallet Settings description: Update wallet settings. Owner only. operationId: update_wallet_settings_payment_wallet_settings_put deprecated: true security: - HTTPBearer: [] - HTTPBearer: [] parameters: - name: x-tenant in: header required: false schema: type: string title: X-Tenant requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/WalletSettingsRequest' responses: '200': description: Successful Response content: application/json: schema: type: object additionalProperties: true title: Response Update Wallet Settings Payment Wallet Settings Put '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /payment/wallet/transactions: get: tags: - PAYMENT summary: Get Wallet Transaction History description: Get paginated wallet transaction history. operationId: get_wallet_transaction_history_payment_wallet_transactions_get deprecated: true security: - HTTPBearer: [] - HTTPBearer: [] parameters: - name: limit in: query required: false schema: type: integer default: 50 title: Limit - name: offset in: query required: false schema: type: integer default: 0 title: Offset - name: x-tenant in: header required: false schema: type: string title: X-Tenant responses: '200': description: Successful Response content: application/json: schema: type: object additionalProperties: true title: Response Get Wallet Transaction History Payment Wallet Transactions Get '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' components: schemas: AllPlansResponse: properties: plans: items: $ref: '#/components/schemas/app__schemas__payments__PlansResponse' type: array title: Plans current_tenure: type: string title: Current Tenure current_execuiton_count: type: integer title: Current Execuiton Count current_price: type: integer title: Current Price subscription_management_allowed: type: boolean title: Subscription Management Allowed type: object required: - plans - current_tenure - current_execuiton_count - current_price - subscription_management_allowed title: AllPlansResponse DowngradeFeedback: properties: feedback: type: string title: Feedback type: object required: - feedback title: DowngradeFeedback app__schemas__payments__PlansResponse: properties: plan_name: type: string title: Plan Name price: anyOf: - type: integer - type: string title: Price num_executions: anyOf: - type: integer - type: string title: Num Executions token_allowance: anyOf: - type: integer - type: string title: Token Allowance default: 0 type: object required: - plan_name - price - num_executions title: PlansResponse HTTPValidationError: properties: detail: items: $ref: '#/components/schemas/ValidationError' type: array title: Detail type: object title: HTTPValidationError DowngradeInfo: properties: plan_name: type: string title: Plan Name plan_display_name: type: string title: Plan Display Name current_subscription_end_date: type: string title: Current Subscription End Date tenure: type: string title: Tenure type: object required: - plan_name - plan_display_name - current_subscription_end_date - tenure title: DowngradeInfo PostPaymentCheckoutRequest: properties: checkout_session_id: type: string title: Checkout Session Id cancelled: type: boolean title: Cancelled default: false type: object required: - checkout_session_id title: PostPaymentCheckoutRequest WalletDepositRequest: properties: amount_cents: type: integer title: Amount Cents type: object required: - amount_cents title: WalletDepositRequest description: Request to add funds via Stripe Checkout. UserCreditsResponse: properties: ok: type: boolean title: Ok expired: type: boolean title: Expired plan_end_date: anyOf: - type: string - type: 'null' title: Plan End Date total_available_executions: type: integer title: Total Available Executions total_executions: type: integer title: Total Executions plan_total_executions: type: integer title: Plan Total Executions plan_available_executions: type: integer title: Plan Available Executions used_executions: type: integer title: Used Executions available_grant: type: integer title: Available Grant granted_executions: type: integer title: Granted Executions extra_executions: type: integer title: Extra Executions current_start_date: type: string title: Current Start Date next_refresh_date: type: string title: Next Refresh Date credit_type: type: string title: Credit Type tenure: type: string title: Tenure cost_per_execution: type: number title: Cost Per Execution total_cost: type: number title: Total Cost free_grant_remaining: type: boolean title: Free Grant Remaining downgraded_info: anyOf: - $ref: '#/components/schemas/DowngradeInfo' - type: 'null' plan_to_edition_map: additionalProperties: type: string type: object title: Plan To Edition Map current_edition: anyOf: - type: string - type: 'null' title: Current Edition expiry_projection: anyOf: - type: string - type: 'null' title: Expiry Projection feedback_grant_eligible: type: boolean title: Feedback Grant Eligible default: false feedback_grant_claimed: type: boolean title: Feedback Grant Claimed default: false feedback_grant_url: type: string title: Feedback Grant Url default: '' type: object required: - ok - expired - total_available_executions - total_executions - plan_total_executions - plan_available_executions - used_executions - available_grant - granted_executions - extra_executions - current_start_date - next_refresh_date - credit_type - tenure - cost_per_execution - total_cost - free_grant_remaining - plan_to_edition_map title: UserCreditsResponse CreateEnterprisePlanRequest: properties: num_executions: type: integer title: Num Executions total_cost: type: number title: Total Cost tenant: type: string title: Tenant start_date: type: string format: date-time title: Start Date end_date: type: string format: date-time title: End Date type: object required: - num_executions - total_cost - tenant - start_date - end_date title: CreateEnterprisePlanRequest WalletTransactionResponse: properties: id: type: integer title: Id transaction_type: type: string title: Transaction Type amount_cents: type: number title: Amount Cents balance_after_cents: type: number title: Balance After Cents tokens: anyOf: - type: integer - type: 'null' title: Tokens description: anyOf: - type: string - type: 'null' title: Description created_on: type: string title: Created On type: object required: - id - transaction_type - amount_cents - balance_after_cents - created_on title: WalletTransactionResponse description: Single wallet transaction for the ledger view. UpdateEnterprisePlanRequest: properties: num_executions: type: integer title: Num Executions total_cost: type: number title: Total Cost tenant: type: string title: Tenant end_date: type: string format: date-time title: End Date type: object required: - num_executions - total_cost - tenant - end_date title: UpdateEnterprisePlanRequest PaymentCheckoutResponse: properties: checkout_url: type: string title: Checkout Url type: object required: - checkout_url title: PaymentCheckoutResponse ValidationError: properties: loc: items: anyOf: - type: string - type: integer type: array title: Location msg: type: string title: Message type: type: string title: Error Type type: object required: - loc - msg - type title: ValidationError WalletSettingsRequest: properties: {} type: object title: WalletSettingsRequest description: Placeholder for future wallet settings. StandardResponse: properties: ok: type: boolean title: Ok type: object required: - ok title: StandardResponse TokenUsageResponse: properties: credit_type: type: string title: Credit Type unlimited: type: boolean title: Unlimited default: false total_tokens: type: integer title: Total Tokens default: 0 total_consumed: type: integer title: Total Consumed default: 0 total_remaining: type: integer title: Total Remaining default: 0 tokens_consumed: type: integer title: Tokens Consumed default: 0 tokens_included: type: integer title: Tokens Included default: 0 tokens_remaining: type: integer title: Tokens Remaining default: 0 overage_tokens: type: integer title: Overage Tokens default: 0 overage_rate_cents_per_million: type: integer title: Overage Rate Cents Per Million default: 0 grant_tokens_total: type: integer title: Grant Tokens Total default: 0 grant_tokens_consumed: type: integer title: Grant Tokens Consumed default: 0 grant_tokens_remaining: type: integer title: Grant Tokens Remaining default: 0 period_start: anyOf: - type: string - type: 'null' title: Period Start period_end: anyOf: - type: string - type: 'null' title: Period End wallet_balance_cents: type: number title: Wallet Balance Cents default: 0 wallet_spend_this_period_cents: type: number title: Wallet Spend This Period Cents default: 0 type: object required: - credit_type title: TokenUsageResponse description: Token usage data for UI progress bar + wallet state. WalletDepositConfirmRequest: properties: checkout_session_id: type: string title: Checkout Session Id type: object required: - checkout_session_id title: WalletDepositConfirmRequest description: Frontend sends this after Stripe Checkout redirect. PaymentCheckoutRequest: properties: plan_type: type: string title: Plan Type tenure: type: string title: Tenure default: month discount: type: integer title: Discount default: 20 type: object required: - plan_type title: PaymentCheckoutRequest WalletResponse: properties: balance_cents: type: number title: Balance Cents balance_tokens: type: integer title: Balance Tokens default: 0 spend_this_period_cents: type: number title: Spend This Period Cents default: 0 overage_rate_cents_per_million: type: integer title: Overage Rate Cents Per Million default: 0 transactions: items: $ref: '#/components/schemas/WalletTransactionResponse' type: array title: Transactions default: [] type: object required: - balance_cents title: WalletResponse description: Full wallet state for the UI. securitySchemes: HTTPBearer: type: http scheme: bearer