Teardrop Billing API

The Billing API from Teardrop — 10 operation(s) for billing.

GitHub OpenAPI

Operations 10

GET /billing/pricing Billing Pricing #
GET /billing/history Billing History #
GET /billing/balance Billing Balance #
GET /billing/invoices Billing Invoices #
GET /billing/invoice/{run_id} Billing Invoice By Run #
GET /billing/credit-history Billing Credit History #
POST /billing/topup/stripe Billing Topup Stripe #
GET /billing/topup/stripe/status Billing Topup Stripe Status #
GET /billing/topup/usdc/requirements Billing Usdc Topup Requirements #
POST /billing/topup/usdc Billing Topup Usdc #

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/teardrop-dev:teardrop-dev-billing-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

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. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

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

OpenAPI Specification

teardrop-dev-billing-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Teardrop Billing API
  description: The open API and billing gateway for autonomous economic agents
  version: 2.13.0
tags:
- name: Billing
paths:
  /billing/pricing:
    get:
      tags:
      - Billing
      summary: Billing Pricing
      description: Return current pricing rules (public).
      operationId: billing_pricing_billing_pricing_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BillingPricingResponse'
  /billing/history:
    get:
      tags:
      - Billing
      summary: Billing History
      description: Return settlement history for the authenticated user.
      operationId: billing_history_billing_history_get
      security:
      - HTTPBearer: []
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 50
          title: Limit
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/BillingHistoryItem'
                title: Response Billing History Billing History Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /billing/balance:
    get:
      tags:
      - Billing
      summary: Billing Balance
      description: Return the authenticated org's current credit balance.
      operationId: billing_balance_billing_balance_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BillingBalanceResponse'
      security:
      - HTTPBearer: []
  /billing/invoices:
    get:
      tags:
      - Billing
      summary: Billing Invoices
      description: Return per-run invoice records for the authenticated user (cursor paginated).
      operationId: billing_invoices_billing_invoices_get
      security:
      - HTTPBearer: []
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 50
          title: Limit
      - name: cursor
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Cursor
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceListResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /billing/invoice/{run_id}:
    get:
      tags:
      - Billing
      summary: Billing Invoice By Run
      description: Return a single run receipt scoped to the authenticated user.
      operationId: billing_invoice_by_run_billing_invoice__run_id__get
      security:
      - HTTPBearer: []
      parameters:
      - name: run_id
        in: path
        required: true
        schema:
          type: string
          title: Run Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceItem'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /billing/credit-history:
    get:
      tags:
      - Billing
      summary: Billing Credit History
      description: Return credit ledger entries for the authenticated org (cursor paginated).
      operationId: billing_credit_history_billing_credit_history_get
      security:
      - HTTPBearer: []
      parameters:
      - name: operation
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Operation
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 50
          title: Limit
      - name: cursor
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Cursor
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreditHistoryResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /billing/topup/stripe:
    post:
      tags:
      - Billing
      summary: Billing Topup Stripe
      description: 'Create a Stripe Checkout session for embedded checkout (prepaid credit top-up).


        Returns client_secret and session_id for embedding a Stripe form in the frontend.'
      operationId: billing_topup_stripe_billing_topup_stripe_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StripeTopupRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StripeTopupSessionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - HTTPBearer: []
  /billing/topup/stripe/status:
    get:
      tags:
      - Billing
      summary: Billing Topup Stripe Status
      description: 'Retrieve the status of a Stripe Checkout session and credit balance upon completion.


        Returns { status: ''open'' | ''complete'' | ''expired'', new_balance_fmt?: ''$X.XX'' }

        new_balance_fmt is included only when status is ''complete''.


        Returns HTTP 403 if the session does not belong to the authenticated org.'
      operationId: billing_topup_stripe_status_billing_topup_stripe_status_get
      security:
      - HTTPBearer: []
      parameters:
      - name: session_id
        in: query
        required: true
        schema:
          type: string
          description: Stripe Checkout session ID
          title: Session Id
        description: Stripe Checkout session ID
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StripeSessionStatusResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /billing/topup/usdc/requirements:
    get:
      tags:
      - Billing
      summary: Billing Usdc Topup Requirements
      description: 'Return x402 PaymentRequirements to sign for a USDC on-chain top-up.


        The client should sign the returned requirements using EIP-3009

        (same flow as /agent/run X-PAYMENT), then POST the signed

        payment_header to /billing/topup/usdc.


        Returns 503 if BILLING_ENABLED is false.'
      operationId: billing_usdc_topup_requirements_billing_topup_usdc_requirements_get
      security:
      - HTTPBearer: []
      parameters:
      - name: amount_usdc
        in: query
        required: true
        schema:
          type: integer
          maximum: 10000000000
          minimum: 1000000
          description: Amount in atomic USDC (6 decimals). Min $1.00 = 1_000_000. Max $10,000 = 10_000_000_000.
          title: Amount Usdc
        description: Amount in atomic USDC (6 decimals). Min $1.00 = 1_000_000. Max $10,000 = 10_000_000_000.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsdcTopupRequirementsResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /billing/topup/usdc:
    post:
      tags:
      - Billing
      summary: Billing Topup Usdc
      description: 'Top up org credit balance by submitting a signed USDC on-chain payment.


        The client obtains payment requirements from GET /billing/topup/usdc/requirements,

        signs them using EIP-3009 (MetaMask / wallet), and posts the base64-encoded

        payment_header here.


        The server verifies the signature, settles on-chain via the x402 facilitator,

        then credits the authenticated org''s balance atomically.


        Returns 402 if signature verification fails, 409 if the tx_hash was already

        processed (duplicate submission), 503 if billing is disabled.'
      operationId: billing_topup_usdc_billing_topup_usdc_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UsdcTopupRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsdcTopupResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - HTTPBearer: []
components:
  schemas:
    UsdcTopupResponse:
      properties:
        status:
          type: string
          const: credited
          title: Status
        amount_usdc:
          type: integer
          title: Amount Usdc
        balance_usdc:
          type: integer
          title: Balance Usdc
        tx_hash:
          type: string
          title: Tx Hash
      type: object
      required:
      - status
      - amount_usdc
      - balance_usdc
      - tx_hash
      title: UsdcTopupResponse
    StripeSessionStatusResponse:
      properties:
        status:
          type: string
          title: Status
          description: '''open'', ''complete'', or ''expired''.'
        new_balance_fmt:
          anyOf:
          - type: string
          - type: 'null'
          title: New Balance Fmt
          description: Formatted new balance (e.g. '$12.34'); present only when status is 'complete'.
      type: object
      required:
      - status
      title: StripeSessionStatusResponse
    CreditHistoryResponse:
      properties:
        items:
          items:
            $ref: '#/components/schemas/CreditHistoryEntry'
          type: array
          title: Items
        next_cursor:
          anyOf:
          - type: string
          - type: 'null'
          title: Next Cursor
          description: ISO datetime cursor for the next page.
      type: object
      required:
      - items
      title: CreditHistoryResponse
    InvoiceListResponse:
      properties:
        items:
          items:
            $ref: '#/components/schemas/InvoiceItem'
          type: array
          title: Items
        next_cursor:
          anyOf:
          - type: string
          - type: 'null'
          title: Next Cursor
          description: ISO datetime cursor for the next page.
      type: object
      required:
      - items
      title: InvoiceListResponse
    CreditHistoryEntry:
      properties:
        id:
          type: string
          title: Id
        org_id:
          type: string
          title: Org Id
        operation:
          type: string
          title: Operation
        amount_usdc:
          type: integer
          title: Amount Usdc
        balance_usdc_after:
          type: integer
          title: Balance Usdc After
        reason:
          type: string
          title: Reason
        created_at:
          type: string
          title: Created At
          description: ISO 8601 timestamp.
      type: object
      required:
      - id
      - org_id
      - operation
      - amount_usdc
      - balance_usdc_after
      - reason
      - created_at
      title: CreditHistoryEntry
    UsdcTopupRequest:
      properties:
        amount_usdc:
          type: integer
          maximum: 10000000000.0
          minimum: 1000000.0
          title: Amount Usdc
          description: Amount in atomic USDC (6 decimals). Min $1.00 = 1_000_000.
        payment_header:
          type: string
          title: Payment Header
          description: Base64-encoded signed EIP-3009 PaymentPayload (X-PAYMENT format).
      type: object
      required:
      - amount_usdc
      - payment_header
      title: UsdcTopupRequest
    UsdcTopupRequirementsResponse:
      properties:
        accepts:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Accepts
          description: x402 PaymentRequirements objects (external x402-spec shape).
        x402Version:
          type: integer
          title: X402Version
      type: object
      required:
      - accepts
      - x402Version
      title: UsdcTopupRequirementsResponse
    BillingBalanceResponse:
      properties:
        org_id:
          type: string
          title: Org Id
        balance_usdc:
          type: integer
          title: Balance Usdc
        spending_limit_usdc:
          type: integer
          title: Spending Limit Usdc
        spending_limit_active:
          type: boolean
          title: Spending Limit Active
        is_paused:
          type: boolean
          title: Is Paused
        daily_spend_usdc:
          type: integer
          title: Daily Spend Usdc
      type: object
      required:
      - org_id
      - balance_usdc
      - spending_limit_usdc
      - spending_limit_active
      - is_paused
      - daily_spend_usdc
      title: BillingBalanceResponse
    PricingRuleWithOverrides:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        run_price_usdc:
          type: integer
          title: Run Price Usdc
        tokens_in_cost_per_1k:
          type: integer
          title: Tokens In Cost Per 1K
          default: 0
        tokens_out_cost_per_1k:
          type: integer
          title: Tokens Out Cost Per 1K
          default: 0
        tool_call_cost:
          type: integer
          title: Tool Call Cost
          default: 0
        effective_from:
          type: string
          format: date-time
          title: Effective From
        created_at:
          type: string
          format: date-time
          title: Created At
        tool_overrides:
          additionalProperties:
            type: integer
          type: object
          title: Tool Overrides
          description: tool_name -> cost_usdc overrides.
      type: object
      required:
      - id
      - name
      - run_price_usdc
      title: PricingRuleWithOverrides
    StripeTopupSessionResponse:
      properties:
        client_secret:
          type: string
          title: Client Secret
        session_id:
          type: string
          title: Session Id
      type: object
      required:
      - client_secret
      - session_id
      title: StripeTopupSessionResponse
    BillingPricingResponse:
      properties:
        billing_enabled:
          type: boolean
          title: Billing Enabled
        pricing:
          anyOf:
          - $ref: '#/components/schemas/PricingRuleWithOverrides'
          - type: 'null'
          description: Omitted/null when billing is disabled or no pricing rule is configured.
        network:
          anyOf:
          - type: string
          - type: 'null'
          title: Network
          description: x402 network name; only present when billing is enabled.
      type: object
      required:
      - billing_enabled
      title: BillingPricingResponse
    StripeTopupRequest:
      properties:
        amount_cents:
          type: integer
          maximum: 1000000.0
          minimum: 100.0
          title: Amount Cents
          description: USD cents (100 = $1.00, max $10,000)
        return_url:
          type: string
          maxLength: 500
          minLength: 20
          title: Return Url
          description: HTTPS return URL with {CHECKOUT_SESSION_ID} template
      type: object
      required:
      - amount_cents
      - return_url
      title: StripeTopupRequest
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    InvoiceItem:
      properties:
        id:
          type: string
          title: Id
        run_id:
          type: string
          title: Run Id
        tokens_in:
          type: integer
          title: Tokens In
        tokens_out:
          type: integer
          title: Tokens Out
        tool_calls:
          type: integer
          title: Tool Calls
        tool_names:
          items:
            type: string
          type: array
          title: Tool Names
        duration_ms:
          type: integer
          title: Duration Ms
        cost_usdc:
          type: integer
          title: Cost Usdc
        platform_fee_usdc:
          type: integer
          title: Platform Fee Usdc
        settlement_tx:
          type: string
          title: Settlement Tx
        settlement_status:
          type: string
          title: Settlement Status
        created_at:
          type: string
          title: Created At
          description: ISO 8601 timestamp.
        thread_id:
          type: string
          title: Thread Id
      type: object
      required:
      - id
      - run_id
      - tokens_in
      - tokens_out
      - tool_calls
      - tool_names
      - duration_ms
      - cost_usdc
      - platform_fee_usdc
      - settlement_tx
      - settlement_status
      - created_at
      - thread_id
      title: InvoiceItem
    BillingHistoryItem:
      properties:
        id:
          type: string
          title: Id
        run_id:
          type: string
          title: Run Id
        tokens_in:
          type: integer
          title: Tokens In
        tokens_out:
          type: integer
          title: Tokens Out
        tool_calls:
          type: integer
          title: Tool Calls
        tool_names:
          items:
            type: string
          type: array
          title: Tool Names
        duration_ms:
          type: integer
          title: Duration Ms
        cost_usdc:
          type: integer
          title: Cost Usdc
        platform_fee_usdc:
          type: integer
          title: Platform Fee Usdc
        settlement_tx:
          type: string
          title: Settlement Tx
        settlement_status:
          type: string
          title: Settlement Status
        created_at:
          type: string
          title: Created At
          description: ISO 8601 timestamp.
      type: object
      required:
      - id
      - run_id
      - tokens_in
      - tokens_out
      - tool_calls
      - tool_names
      - duration_ms
      - cost_usdc
      - platform_fee_usdc
      - settlement_tx
      - settlement_status
      - created_at
      title: BillingHistoryItem
    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
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer