TrustFabric Billing API

Plans, subscriptions, and billing cycles

GitHub OpenAPI

Operations 15

GET /v1/billing_cycles List billing cycles #
GET /v1/billing_cycles/{id} Get billing cycle #
POST /v1/billing_cycles/{id}/charge_result Record charge result #
GET /v1/plans List plans #
POST /v1/plans Create plan #
GET /v1/plans/{id} Get plan #
POST /v1/plans/{id}/activate Activate plan #
POST /v1/plans/{id}/archive Archive plan #
GET /v1/subscriptions List subscriptions #
POST /v1/subscriptions Create subscription #
GET /v1/subscriptions/{id} Get subscription #
POST /v1/subscriptions/{id}/cancel Cancel subscription #
POST /v1/subscriptions/{id}/generate_cycle Generate billing cycle #
POST /v1/subscriptions/{id}/pause Pause subscription #
POST /v1/subscriptions/{id}/resume Resume subscription #

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/trustfabric-ai:trustfabric-ai-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

trustfabric-ai-billing-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  contact:
    name: No Fate Platform
  description: 'Complete payment processing platform with PSP parity: payments, settlements, disputes, billing, payouts, verification, webhooks, and platform management. Supports date-based API versioning via the API-Version header (default: 2025-01-01). All amounts are in minor units (cents). All timestamps are RFC 3339 UTC.'
  title: No Fate Payment Platform Billing API
  version: 1.0.0
  x-api-versioning: Date-based (YYYY-MM-DD) via API-Version header. See /v1/versions for all supported versions.
servers:
- description: Current environment
  url: /
security:
- BearerAuth: []
tags:
- description: Plans, subscriptions, and billing cycles
  name: Billing
paths:
  /v1/billing_cycles:
    get:
      description: Lists billing cycles for the authenticated merchant.
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  data:
                    description: Result page
                    items:
                      $ref: '#/components/schemas/BillingCycle'
                    type: array
                  limit:
                    description: Page size
                    format: int64
                    type: integer
                  offset:
                    description: Offset of this page. Supplying a cursor query parameter instead returns a cursor-paginated envelope with next_cursor/has_more.
                    format: int64
                    type: integer
                required:
                - data
                type: object
          description: Success
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '429':
          description: Rate limited
        '500':
          description: Internal server error
      summary: List billing cycles
      tags:
      - Billing
      operationId: getV1BillingCycles
      x-operation-id-source: derived
  /v1/billing_cycles/{id}:
    get:
      description: Retrieves a billing cycle by ID.
      parameters:
      - description: Billing cycle ID
        in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BillingCycle'
          description: Success
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '429':
          description: Rate limited
        '500':
          description: Internal server error
      summary: Get billing cycle
      tags:
      - Billing
      operationId: getV1BillingCyclesById
      x-operation-id-source: derived
  /v1/billing_cycles/{id}/charge_result:
    post:
      description: Records the outcome of a charge attempt against a billing cycle. success=false increments retries and hard-fails the cycle once max_retries is reached.
      parameters:
      - description: Billing cycle ID
        in: path
        name: id
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RecordChargeResultRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BillingCycle'
          description: Success
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '429':
          description: Rate limited
        '500':
          description: Internal server error
      summary: Record charge result
      tags:
      - Billing
      operationId: postV1BillingCyclesByIdChargeResult
      x-operation-id-source: derived
  /v1/plans:
    get:
      description: Lists the authenticated merchant's billing plans.
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  data:
                    description: Result page
                    items:
                      $ref: '#/components/schemas/Plan'
                    type: array
                  limit:
                    description: Page size
                    format: int64
                    type: integer
                  offset:
                    description: Offset of this page. Supplying a cursor query parameter instead returns a cursor-paginated envelope with next_cursor/has_more.
                    format: int64
                    type: integer
                required:
                - data
                type: object
          description: Success
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '429':
          description: Rate limited
        '500':
          description: Internal server error
      summary: List plans
      tags:
      - Billing
      operationId: getV1Plans
      x-operation-id-source: derived
    post:
      description: Creates a billing plan in DRAFT status. A plan must be activated via POST /v1/plans/{id}/activate before any subscription can reference it — POST /v1/subscriptions against a draft plan returns 400 'Plan is not active'.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePlanRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Plan'
          description: Created
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '429':
          description: Rate limited
        '500':
          description: Internal server error
      summary: Create plan
      tags:
      - Billing
      operationId: postV1Plans
      x-operation-id-source: derived
  /v1/plans/{id}:
    get:
      description: Retrieves a billing plan by ID.
      parameters:
      - description: Plan ID
        in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Plan'
          description: Success
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '429':
          description: Rate limited
        '500':
          description: Internal server error
      summary: Get plan
      tags:
      - Billing
      operationId: getV1PlansById
      x-operation-id-source: derived
  /v1/plans/{id}/activate:
    post:
      description: Moves a draft plan to active so subscriptions can be created against it. Only draft plans can be activated; any other status returns 400.
      parameters:
      - description: Plan ID
        in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Plan'
          description: Success
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '429':
          description: Rate limited
        '500':
          description: Internal server error
      summary: Activate plan
      tags:
      - Billing
      operationId: postV1PlansByIdActivate
      x-operation-id-source: derived
  /v1/plans/{id}/archive:
    post:
      description: Retires an active plan. Existing subscriptions keep billing; no new subscription may reference it. Only active plans can be archived.
      parameters:
      - description: Plan ID
        in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Plan'
          description: Success
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '429':
          description: Rate limited
        '500':
          description: Internal server error
      summary: Archive plan
      tags:
      - Billing
      operationId: postV1PlansByIdArchive
      x-operation-id-source: derived
  /v1/subscriptions:
    get:
      description: Lists the authenticated merchant's subscriptions.
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  data:
                    description: Result page
                    items:
                      $ref: '#/components/schemas/Subscription'
                    type: array
                  limit:
                    description: Page size
                    format: int64
                    type: integer
                  offset:
                    description: Offset of this page. Supplying a cursor query parameter instead returns a cursor-paginated envelope with next_cursor/has_more.
                    format: int64
                    type: integer
                required:
                - data
                type: object
          description: Success
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '429':
          description: Rate limited
        '500':
          description: Internal server error
      summary: List subscriptions
      tags:
      - Billing
      operationId: getV1Subscriptions
      x-operation-id-source: derived
    post:
      description: 'Subscribes a customer to an ACTIVE plan. idempotency_key is required and travels in the BODY (this route does not read the Idempotency-Key header): replaying a key returns the existing subscription with HTTP 200 instead of creating a second one. A plan with trial_period_days > 0 starts the subscription in ''trialing'' and defers the first charge to trial_end.'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSubscriptionRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscription'
          description: Idempotent replay — a subscription already exists for this idempotency_key and is returned unchanged
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscription'
          description: Created
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '429':
          description: Rate limited
        '500':
          description: Internal server error
      summary: Create subscription
      tags:
      - Billing
      operationId: postV1Subscriptions
      x-operation-id-source: derived
  /v1/subscriptions/{id}:
    get:
      description: Retrieves a subscription by ID.
      parameters:
      - description: Subscription ID
        in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscription'
          description: Success
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '429':
          description: Rate limited
        '500':
          description: Internal server error
      summary: Get subscription
      tags:
      - Billing
      operationId: getV1SubscriptionsById
      x-operation-id-source: derived
  /v1/subscriptions/{id}/cancel:
    post:
      description: Cancels a subscription. at_period_end=true keeps status 'active' and sets cancel_at_end=true so the customer keeps access through the period already paid for; at_period_end=false (default) cancels immediately and stamps canceled_at.
      parameters:
      - description: Subscription ID
        in: path
        name: id
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelSubscriptionRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscription'
          description: Success
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '429':
          description: Rate limited
        '500':
          description: Internal server error
      summary: Cancel subscription
      tags:
      - Billing
      operationId: postV1SubscriptionsByIdCancel
      x-operation-id-source: derived
  /v1/subscriptions/{id}/generate_cycle:
    post:
      description: Generates the next billing cycle for a subscription. Normally unnecessary — the renewal scheduler generates cycles automatically once next_billing_date arrives — but exposed for merchants driving their own billing clock.
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BillingCycle'
          description: Created
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '429':
          description: Rate limited
        '500':
          description: Internal server error
      summary: Generate billing cycle
      tags:
      - Billing
      operationId: postV1SubscriptionsByIdGenerateCycle
      x-operation-id-source: derived
  /v1/subscriptions/{id}/pause:
    post:
      description: Suspends billing on an active subscription. Only active subscriptions can be paused.
      parameters:
      - description: Subscription ID
        in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscription'
          description: Success
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '429':
          description: Rate limited
        '500':
          description: Internal server error
      summary: Pause subscription
      tags:
      - Billing
      operationId: postV1SubscriptionsByIdPause
      x-operation-id-source: derived
  /v1/subscriptions/{id}/resume:
    post:
      description: Reactivates a paused subscription. Only paused subscriptions can be resumed.
      parameters:
      - description: Subscription ID
        in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscription'
          description: Success
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '429':
          description: Rate limited
        '500':
          description: Internal server error
      summary: Resume subscription
      tags:
      - Billing
      operationId: postV1SubscriptionsByIdResume
      x-operation-id-source: derived
components:
  schemas:
    Error:
      properties:
        details:
          description: Additional error context
        error:
          description: Error code
          type: string
        message:
          description: Human-readable message
          type: string
      required:
      - error
      - message
      type: object
    RecordChargeResultRequest:
      properties:
        payment_intent_id:
          description: Payment intent the charge was attempted under
          type: string
        success:
          description: true marks the cycle charged; false records a retry, hard-failing once max_retries is reached
          type: boolean
      required:
      - success
      type: object
    CancelSubscriptionRequest:
      properties:
        at_period_end:
          description: true schedules cancellation for the end of the paid period (status stays active, cancel_at_end becomes true); false cancels immediately
          type: boolean
        reason:
          description: Cancellation reason
          enum:
          - customer_request
          - payment_failure
          - merchant_action
          - plan_archived
          type: string
      required:
      - reason
      type: object
    BillingCycle:
      properties:
        account_id:
          description: Merchant account (tenant)
          type: string
        amount:
          description: Charge amount in minor units, before proration
          format: int64
          type: integer
        charged_at:
          description: When the charge succeeded
          format: date-time
          type:
          - string
          - 'null'
        created_at:
          description: Creation timestamp
          format: date-time
          type: string
        currency:
          description: ISO 4217 currency code
          type: string
        due_date:
          description: When the charge is due
          format: date-time
          type: string
        id:
          description: Unique billing cycle ID (billcycle_...)
          type: string
        idempotency_key:
          description: Derived key (bill_<subscription_id>_<period_start>) that makes a cycle unique per period
          type: string
        last_retry_at:
          description: Most recent retry timestamp
          format: date-time
          type:
          - string
          - 'null'
        max_retries:
          description: Retry ceiling before the cycle hard-fails (default 4)
          format: int64
          type: integer
        payment_intent_id:
          description: Payment intent created for this cycle
          type:
          - string
          - 'null'
        period_end:
          description: End of the period being charged
          format: date-time
          type: string
        period_start:
          description: Start of the period being charged
          format: date-time
          type: string
        plan_id:
          description: Plan the amount was derived from
          type: string
        proration_adjustment:
          description: Signed proration delta; positive charges more, negative credits. Effective charge is amount + proration_adjustment, floored at 0
          format: int64
          type: integer
        retries:
          description: Retry attempts so far
          format: int64
          type: integer
        status:
          description: Charge lifecycle
          enum:
          - pending
          - charged
          - failed
          - voided
          - refunded
          type: string
        subscription_id:
          description: Subscription this cycle belongs to
          type: string
        updated_at:
          description: Last update timestamp
          format: date-time
          type: string
        version:
          description: Optimistic-concurrency version
          format: int64
          type: integer
      required:
      - id
      - subscription_id
      - plan_id
      - account_id
      - period_start
      - period_end
      - amount
      - currency
      - status
      type: object
    CreatePlanRequest:
      properties:
        amount:
          description: Recurring amount in minor units (cents); must be > 0
          format: int64
          type: integer
        billing_period:
          description: Charge cadence
          enum:
          - weekly
          - monthly
          - quarterly
          - annual
          type: string
        currency:
          description: ISO 4217 currency code
          type: string
        description:
          description: Optional plan description
          type: string
        external_id:
          description: Optional merchant-side identifier
          type: string
        grace_period_days:
          description: Optional override for the post-due-date grace window (defaults to 3)
          format: int64
          type: integer
        name:
          description: Plan display name
          type: string
        trial_period_days:
          description: Optional free trial length in days
          format: int64
          type: integer
      required:
      - name
      - amount
      - currency
      - billing_period
      type: object
    Subscription:
      properties:
        account_id:
          description: Merchant account (tenant)
          type: string
        cancel_at_end:
          description: Cancellation is scheduled for the end of the current period rather than immediate
          type: boolean
        cancel_reason:
          description: 'Why it was canceled: customer_request, payment_failure, merchant_action, plan_archived'
          type:
          - string
          - 'null'
        canceled_at:
          description: When the subscription was canceled
          format: date-time
          type:
          - string
          - 'null'
        created_at:
          description: Creation timestamp
          format: date-time
          type: string
        current_period_end:
          description: End of the current billing period
          format: date-time
          type: string
        current_period_start:
          description: Start of the current billing period
          format: date-time
          type: string
        customer_id:
          description: End-customer reference
          type: string
        failed_attempts:
          description: Consecutive failed charge attempts (reset on success)
          format: int64
          type: integer
        id:
          description: Unique subscription ID (sub_...)
          type: string
        idempotency_key:
          description: Key supplied at creation; replaying it returns this same subscription
          type: string
        last_payment_intent_id:
          description: Payment intent from the most recent successful charge
          type:
          - string
          - 'null'
        metadata:
          additionalProperties:
            type: string
          description: Merchant metadata copied from the originating checkout session; echoed on every subscription.* webhook
          type: object
        next_billing_date:
          description: When the renewal scheduler will next charge
          format: date-time
          type: string
        payment_method_id:
          description: Vaulted payment method (pm_...) the renewal scheduler charges
          type: string
        plan_id:
          description: Plan this subscription bills against
          type: string
        status:
          description: Lifecycle state
          enum:
          - trialing
          - active
          - past_due
          - paused
          - canceled
          type: string
        trial_end:
          description: End of the trial (null = no trial)
          format: date-time
          type:
          - string
          - 'null'
        updated_at:
          description: Last update timestamp
          format: date-time
          type: string
        version:
          description: Optimistic-concurrency version
          format: int64
          type: integer
      required:
      - id
      - plan_id
      - account_id
      - customer_id
      - status
      - current_period_start
      - current_period_end
      - next_billing_date
      type: object
    CreateSubscriptionRequest:
      properties:
        customer_id:
          description: Merchant's end-customer reference
          type: string
        idempotency_key:
          description: Required. Replaying a key returns the existing subscription with HTTP 200 instead of creating a second one
          type: string
        plan_id:
          description: An ACTIVE plan ID; a draft or archived plan is rejected with 400
          type: string
      required:
      - plan_id
      - customer_id
      - idempotency_key
      type: object
    Plan:
      properties:
        account_id:
          description: Merchant account that owns this plan
          type: string
        allow_proration:
          description: Whether mid-cycle plan changes are prorated
          type: boolean
        amount:
          description: Recurring amount in minor units (cents)
          format: int64
          type: integer
        billing_period:
          description: Charge cadence
          enum:
          - weekly
          - monthly
          - quarterly
          - annual
          type: string
        created_at:
          description: Creation timestamp
          format: date-time
          type: string
        currency:
          description: ISO 4217 currency code
          type: string
        description:
          description: Plan description
          type: string
        external_id:
          description: Merchant's own identifier for the plan
          type: string
        grace_period_days:
          description: Days after the due date before a failed cycle hard-fails (default 3)
          format: int64
          type: integer
        id:
          description: Unique plan ID (plan_...)
          type: string
        name:
          description: Plan display name
          type: string
        status:
          description: Plan availability — new plans are created as draft and must be activated before a subscription can reference them
          enum:
          - draft
          - active
          - archived
          type: string
        trial_period_days:
          description: Free trial length in days (0 = no trial)
          format: int64
          type: integer
        updated_at:
          description: Last update timestamp
          format: date-time
          type: string
        version:
          description: Optimistic-concurrency version
          format: int64
          type: integer
      required:
      - id
      - account_id
      - name
      - amount
      - currency
      - billing_period
      - status
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: API Key
      description: 'API key authentication: sk_live_* (legacy) or rk_live_* (scoped)'
      scheme: bearer
      type: http
    SessionAuth:
      description: Session-based authentication for dashboard access
      in: cookie
      name: session_id
      type: apiKey