AgenTrux Console Billing API

The console-billing API from AgenTrux — 14 operation(s) for console-billing.

Operations 14

GET /console/billing/plan Get Plan #
POST /console/billing/checkout/tier Checkout Tier #
POST /console/billing/upgrade Upgrade Tier Endpoint #
POST /console/billing/downgrade Downgrade Tier Endpoint #
POST /console/billing/checkout/topup Checkout Topup #
GET /console/billing/topup/history Topup History #
GET /console/billing/topup/return Topup Return #
GET /console/billing/warning-state Warning State #
POST /console/billing/portal Billing Portal #
GET /console/billing/usage Get Usage #
GET /console/billing/data-subscriptions List Data Subscriptions #
POST /console/billing/data-subscriptions/checkout Data Subscription Checkout #
DELETE /console/billing/data-subscriptions/{sub_id} Cancel Data Subscription #
GET /console/billing/connect/onboarding Stripe Connect Onboarding #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/agentrux-com:agentrux-com-console-billing-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

agentrux-com-console-billing-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: AgenTrux Console Billing API
  version: 0.1.0
tags:
- name: console-billing
paths:
  /console/billing/plan:
    get:
      tags:
      - console-billing
      summary: Get Plan
      description: 'active plan tier + resource counts (aliases/topics/scripts/grants) を返す.


        Pattern X B.5 partial: events/storage/egress の月次集計は Phase 5+ (usage_records 成熟後)、

        本 endpoint は SPA Billing / Dashboard の usage 表示と upgrade CTA に必要な

        **resource counts** を実 SQL で算出する。


        Header `X-Workspace-Account-Id` (acc_/org_) が指定されればその account を対象、

        無ければ caller の personal account を返す (legacy 互換)。 org の場合は caller が

        owner/admin role の member であることを検証 (checkout_tier と同じ A4 隠蔽パターン)。'
      operationId: get_plan_console_billing_plan_get
      parameters:
      - name: X-Workspace-Account-Id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Workspace-Account-Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Plan Console Billing Plan Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /console/billing/checkout/tier:
    post:
      tags:
      - console-billing
      summary: Checkout Tier
      description: 'Plan Subscription Checkout (mode=subscription) Session 作成。


        SSOT: docs/04_design/billing/pattern_x.md §5-4

        flow:

        1. X-Workspace-Account-Id header (acc_* / org_*) で対象 account を解決

        - personal account: session.user_id の users.primary_account_id と一致必須

        - group account: caller が owner / admin role の member であること

        2. success_url / cancel_url の origin allowlist 検証 (オープンリダイレクト面の閉鎖)

        3. purchase_tier command (price_id resolve → customer 取得/作成 → Checkout)

        4. checkout_url を返す (caller が SPA を URL に redirect)

        5. plan_subscriptions の活性化は webhook (checkout.session.completed mode=subscription)

        で _handle_subscription_created が upsert する (本 endpoint は非同期確定)'
      operationId: checkout_tier_console_billing_checkout_tier_post
      parameters:
      - name: X-Workspace-Account-Id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Workspace-Account-Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckoutTierBody'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Checkout Tier Console Billing Checkout Tier Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /console/billing/upgrade:
    post:
      tags:
      - console-billing
      summary: Upgrade Tier Endpoint
      description: 'postpaid tier 即時 UPGRADE (§10-2-T / P5)。


        `modify_subscription_item_price(..., proration_behavior="create_prorations")` で base+3軸 metered の

        全 item を上位 tier へ即時差替え (旧 overage 即精算・即アンブロック)。 ★none 厳禁は command 内で担保。

        flag `billing_postpaid_enabled` off は 404 (機能無効)。 Stripe subscription item が provisioned price と

        不整合なら TierChangeNotReadyError → 409 (誤課金防止 fail-closed、 flag-off 404 と峻別)。 config price_id

        未設定 (provisioning 前) は TierPriceNotConfiguredError → 503。 owner/admin gate (checkout_tier と同パターン、

        header 必須・org role 不足 403)。'
      operationId: upgrade_tier_endpoint_console_billing_upgrade_post
      parameters:
      - name: X-Workspace-Account-Id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Workspace-Account-Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TierChangeBody'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Upgrade Tier Endpoint Console Billing Upgrade Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /console/billing/downgrade:
    post:
      tags:
      - console-billing
      summary: Downgrade Tier Endpoint
      description: 'postpaid tier 期末発効 DOWNGRADE (§10-2-T / P5)。


        `schedule_downgrade_at_period_end(...)` で現 phase 期末 → 次 phase で下位 tier の base+3軸 (proration none)。

        期中は現 graduated price 維持 (当期 overage は期末全請求、 消失なし)。 ★即時 none-swap 禁止は

        command 内で担保。 flag off=404 / current_period_end 未確定=409 / config 未設定=503。 owner/admin gate。'
      operationId: downgrade_tier_endpoint_console_billing_downgrade_post
      parameters:
      - name: X-Workspace-Account-Id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Workspace-Account-Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TierChangeBody'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Downgrade Tier Endpoint Console Billing Downgrade Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /console/billing/checkout/topup:
    post:
      tags:
      - console-billing
      summary: Checkout Topup
      description: Pattern X B.8 本実装 (v3 credit pool、 単一 $10 SKU).
      operationId: checkout_topup_console_billing_checkout_topup_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckoutTopupBody'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Checkout Topup Console Billing Checkout Topup Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /console/billing/topup/history:
    get:
      tags:
      - console-billing
      summary: Topup History
      description: 購入履歴 (新しい順、 invalidate/consumed 済 含む).
      operationId: topup_history_console_billing_topup_history_get
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 50
          title: Limit
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Topup History Console Billing Topup History Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /console/billing/topup/return:
    get:
      tags:
      - console-billing
      summary: Topup Return
      description: 'success_url redirect 後の同期 fulfillment (webhook と二段構え、 Codex review #1).'
      operationId: topup_return_console_billing_topup_return_get
      parameters:
      - name: session_id
        in: query
        required: true
        schema:
          type: string
          title: Session Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Topup Return Console Billing Topup Return Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /console/billing/warning-state:
    get:
      tags:
      - console-billing
      summary: Warning State
      description: 80%/95% threshold 状態を per-metric で返す.
      operationId: warning_state_console_billing_warning_state_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Warning State Console Billing Warning State Get
  /console/billing/portal:
    post:
      tags:
      - console-billing
      summary: Billing Portal
      description: 'Stripe Customer Portal session を生成し、 portal_url を返す.


        Customer Portal で subscription cancel / payment method 変更 / invoice 履歴 を

        操作できる。 cancel は Stripe webhook (customer.subscription.deleted) で

        AgenTrux plan_subscriptions.status=''canceled'' に反映 (stripe_webhook_router)。'
      operationId: billing_portal_console_billing_portal_post
      parameters:
      - name: X-Workspace-Account-Id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Workspace-Account-Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BillingPortalBody'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Billing Portal Console Billing Portal Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /console/billing/usage:
    get:
      tags:
      - console-billing
      summary: Get Usage
      description: 'usage メーター表示。


        認可 (workspace/account 解決) は flag に関係なく先に行う (flag-off/on で認可セマンティクスを

        一致させる、 Codex 完了 #3)。


        flag `billing_postpaid_enabled` off は従来の legacy stub (全 0、 prod 挙動不変)。

        flag on は §10-8 の軸別メーター: events/egress/storage の {used, limit, pct, period_start,

        resets_at} を `axes` で返す (bytes は非課金 hard-cap ゆえ軸に含めない)。 ★金額は出さない。

        後方互換: 既存 SPA 向けに従来の top-level key (period_end / publish_count / storage_gb_avg /

        egress_gb / topup_publish_consumed / hard_block_active) も axes から導出して併載する (Codex 完了 #1)。'
      operationId: get_usage_console_billing_usage_get
      parameters:
      - name: X-Workspace-Account-Id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Workspace-Account-Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Usage Console Billing Usage Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /console/billing/data-subscriptions:
    get:
      tags:
      - console-billing
      summary: List Data Subscriptions
      operationId: list_data_subscriptions_console_billing_data_subscriptions_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response List Data Subscriptions Console Billing Data Subscriptions Get
  /console/billing/data-subscriptions/checkout:
    post:
      tags:
      - console-billing
      summary: Data Subscription Checkout
      operationId: data_subscription_checkout_console_billing_data_subscriptions_checkout_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DataSubscriptionCheckoutBody'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Data Subscription Checkout Console Billing Data Subscriptions Checkout Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /console/billing/data-subscriptions/{sub_id}:
    delete:
      tags:
      - console-billing
      summary: Cancel Data Subscription
      operationId: cancel_data_subscription_console_billing_data_subscriptions__sub_id__delete
      parameters:
      - name: sub_id
        in: path
        required: true
        schema:
          type: string
          title: Sub Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Cancel Data Subscription Console Billing Data Subscriptions  Sub Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /console/billing/connect/onboarding:
    get:
      tags:
      - console-billing
      summary: Stripe Connect Onboarding
      operationId: stripe_connect_onboarding_console_billing_connect_onboarding_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Stripe Connect Onboarding Console Billing Connect Onboarding Get
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    DataSubscriptionCheckoutBody:
      properties:
        topic_id:
          type: string
          minLength: 1
          title: Topic Id
        plan_id:
          type: string
          minLength: 1
          title: Plan Id
        success_url:
          type: string
          maxLength: 2083
          minLength: 1
          format: uri
          title: Success Url
        cancel_url:
          type: string
          maxLength: 2083
          minLength: 1
          format: uri
          title: Cancel Url
      additionalProperties: false
      type: object
      required:
      - topic_id
      - plan_id
      - success_url
      - cancel_url
      title: DataSubscriptionCheckoutBody
    CheckoutTopupBody:
      properties:
        success_url:
          type: string
          maxLength: 2083
          minLength: 1
          format: uri
          title: Success Url
        cancel_url:
          type: string
          maxLength: 2083
          minLength: 1
          format: uri
          title: Cancel Url
      type: object
      required:
      - success_url
      - cancel_url
      title: CheckoutTopupBody
      description: v3 credit pool は単一 $10 SKU。 旧 v2 残骸 topup_sku/quantity は無視 (extra=ignore)。
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    BillingPortalBody:
      properties:
        return_url:
          type: string
          maxLength: 2083
          minLength: 1
          format: uri
          title: Return Url
      additionalProperties: false
      type: object
      required:
      - return_url
      title: BillingPortalBody
    TierChangeBody:
      properties:
        tier:
          type: string
          enum:
          - starter
          - pro
          - business
          title: Tier
      additionalProperties: false
      type: object
      required:
      - tier
      title: TierChangeBody
      description: postpaid tier 変更 (upgrade/downgrade) の target tier。 free/enterprise は別経路。
    CheckoutTierBody:
      properties:
        tier:
          type: string
          enum:
          - starter
          - pro
          - business
          title: Tier
        success_url:
          type: string
          maxLength: 2083
          minLength: 1
          format: uri
          title: Success Url
        cancel_url:
          type: string
          maxLength: 2083
          minLength: 1
          format: uri
          title: Cancel Url
      additionalProperties: false
      type: object
      required:
      - tier
      - success_url
      - cancel_url
      title: CheckoutTierBody