MetricDuck Billing API

The billing API from MetricDuck — 6 operation(s) for billing.

GitHub OpenAPI

Operations 6

POST /api/v1/billing/create-checkout-session Create Checkout Session #
POST /api/v1/billing/billing-portal Create Billing Portal Session #
POST /api/v1/billing/stripe-webhook Stripe Webhook #
GET /api/v1/billing/subscription-status Get Subscription Status #
GET /api/v1/billing/verify-checkout-session Verify Checkout Session #
GET /api/v1/billing/pricing-tiers Get Pricing Tiers #

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/metricduck-com:metricduck-com-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

metricduck-com-billing-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Metric Duck Billing API
  description: 'SEC filing data API: equity fundamentals updated daily from SEC EDGAR'
  version: 2.0.0
tags:
- name: Billing
paths:
  /api/v1/billing/create-checkout-session:
    post:
      tags:
      - Billing
      summary: Create Checkout Session
      description: 'Create a Stripe Checkout session for subscription


        Args:

        request: Checkout session parameters

        current_user: Authenticated user


        Returns:

        Checkout URL and session ID'
      operationId: create_checkout_session_api_v1_billing_create_checkout_session_post
      security:
      - HTTPBearer: []
      - APIKeyHeader: []
      parameters:
      - name: api_key
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Api Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckoutSessionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Checkout Session Api V1 Billing Create Checkout Session Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/billing/billing-portal:
    post:
      tags:
      - Billing
      summary: Create Billing Portal Session
      description: 'Create a Stripe Customer Portal session for subscription management


        Args:

        request: Portal session parameters

        current_user: Authenticated user


        Returns:

        Portal URL'
      operationId: create_billing_portal_session_api_v1_billing_billing_portal_post
      security:
      - HTTPBearer: []
      - APIKeyHeader: []
      parameters:
      - name: api_key
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Api Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BillingPortalRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
                title: Response Create Billing Portal Session Api V1 Billing Billing Portal Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/billing/stripe-webhook:
    post:
      tags:
      - Billing
      summary: Stripe Webhook
      description: 'Handle Stripe webhook events


        An event id is recorded only AFTER it is processed. A processing error returns 500 so

        Stripe retries the event; a recorded id is acknowledged without reprocessing.'
      operationId: stripe_webhook_api_v1_billing_stripe_webhook_post
      parameters:
      - name: stripe-signature
        in: header
        required: false
        schema:
          type: string
          title: Stripe-Signature
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/billing/subscription-status:
    get:
      tags:
      - Billing
      summary: Get Subscription Status
      description: 'Get current user''s subscription status


        Fetches fresh from database to avoid stale cache after webhook updates.


        For a paying (or canceling) subscriber, the price and the period end are read live

        from Stripe (nothing stores them). That read fails soft: on any error or after

        STRIPE_CALL_TIMEOUT_SECONDS the Stripe fields are null and the response is still

        200, so the billing page always renders.


        Returns:

        tier, status, subscription_end_date (from the users row); plan_name and

        allowance_label (from PRICING_TIERS); amount (minor units, null unless it is

        exactly what is charged), currency, interval, current_period_end and cancel_at

        (ISO UTC) and cancel_at_period_end (from Stripe, else null); manage_billing (the

        Stripe read succeeded, so the billing portal can open).'
      operationId: get_subscription_status_api_v1_billing_subscription_status_get
      security:
      - HTTPBearer: []
      - APIKeyHeader: []
      parameters:
      - name: api_key
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Api Key
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Subscription Status Api V1 Billing Subscription Status Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/billing/verify-checkout-session:
    get:
      tags:
      - Billing
      summary: Verify Checkout Session
      description: 'Verify a completed checkout session and return updated subscription info.


        Called by frontend after Stripe redirects back with session_id.'
      operationId: verify_checkout_session_api_v1_billing_verify_checkout_session_get
      security:
      - HTTPBearer: []
      - APIKeyHeader: []
      parameters:
      - name: session_id
        in: query
        required: true
        schema:
          type: string
          title: Session Id
      - name: api_key
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Api Key
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Verify Checkout Session Api V1 Billing Verify Checkout Session Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/billing/pricing-tiers:
    get:
      tags:
      - Billing
      summary: Get Pricing Tiers
      description: 'Get all available pricing tiers and their configurations.


        Returns:

        Dictionary of all tiers with their features, prices, and Stripe Price IDs'
      operationId: get_pricing_tiers_api_v1_billing_pricing_tiers_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Pricing Tiers Api V1 Billing Pricing Tiers Get
components:
  schemas:
    CheckoutSessionRequest:
      properties:
        tier:
          type: string
          title: Tier
        billing_interval:
          type: string
          title: Billing Interval
          default: monthly
        success_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Success Url
        cancel_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Cancel Url
        utm_source:
          anyOf:
          - type: string
            maxLength: 255
          - type: 'null'
          title: Utm Source
        utm_medium:
          anyOf:
          - type: string
            maxLength: 255
          - type: 'null'
          title: Utm Medium
        utm_campaign:
          anyOf:
          - type: string
            maxLength: 255
          - type: 'null'
          title: Utm Campaign
      type: object
      required:
      - tier
      title: CheckoutSessionRequest
      description: Request model for creating checkout session
    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
    BillingPortalRequest:
      properties:
        return_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Return Url
      type: object
      title: BillingPortalRequest
      description: Request model for creating billing portal session
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key