Benji Pays Billing API

Finalized billing data for invoicing (locked/completed months only)

Operations 1

GET /v2/billing Get finalized billing data for a month #

Specifications

Schemas & Data

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

benjipays-com-billing-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Benji Pays Partner Billing API
  description: 'The Benji Pays Partner API is a JSON over HTTPS API. All endpoints live under `/v2`. Errors follow RFC 7807 and are served as `application/problem+json`. This overview describes the cross-cutting behavior shared by every partner endpoint. Endpoint-specific schemas live with each operation. ## Authentication


    Partner endpoints authenticate with an Auth0 M2M access token in the `Authorization` header:


    ```

    Authorization: Bearer

    ```


    Tokens are obtained from Auth0 with the OAuth 2.0 client-credentials grant against the `https://api.benjipays.com` audience. The token''s actor claim (`distributor`, `partner`, or `organization`) and OAuth scopes determine which routes the caller can reach. Failures return `401 Unauthorized` (missing/expired/invalid credentials) or `403 Forbidden` (wrong actor type or missing scope). ## Request and Correlation IDs


    Two header pairs help with tracing:


    | Header | Direction | Purpose |

    | --- | --- | --- |

    | `X-Request-ID` | request (optional) / response (always) | Unique identifier for one request. Generated as a UUID v4 when the client omits it. |

    | `X-Correlation-ID` | request (optional) / response (always) | Identifier that flows across service boundaries for distributed tracing. Generated as a UUID v4 when omitted. |


    Both IDs are echoed on success and included as `requestId` / `correlationId` extensions on `application/problem+json` error responses. These headers are auto-injected on every operation in this spec — do not redeclare them per route. ## Idempotency


    POST, PATCH, and PUT endpoints accept an `Idempotency-Key` header to make retries safe. - Format: 1–255 characters, alphanumeric only (`[a-zA-Z0-9]+`). - Scope: keys are scoped per actor (no cross-tenant collisions). - Cache: the first response for a given key is cached for 24 hours. - Replay: a duplicate request with the same key and the same body returns the cached response with `X-Idempotency-Replayed: true` only after credentials were resolved by the global authenticate middleware (API key or Auth0 JWT signature check) before the idempotency cache lookup. - Conflict: same key with a different body returns `409 Conflict`. - In-flight: a second request with the same key while the first is still being processed returns `429 Too Many Requests` with `Retry-After` and problem `type` `https://api.benjipays.com/problems/idempotency-processing` (distinct from rate-limit `…/rate-limit-exceeded`). `Idempotency-Key` is auto-injected on every POST/PATCH/PUT operation in this spec — do not redeclare it per route. Routes that intentionally opt out set `x-bp-skip-idempotency: true`. The middleware fails open: if the cache layer is unavailable the request proceeds without idempotency protection. ## Pagination


    List endpoints use offset-based pagination with two query parameters:


    | Parameter | Type | Default | Bounds |

    | --- | --- | --- | --- |

    | `limit` | integer | `20` | `1`–`1000` |

    | `offset` | integer | `0` | `≥ 0` |


    Some endpoints use different bounds (for example usage/billing and autoprocessing forecast). Check the per-operation schema. Responses follow this envelope:


    ```json

    {

    "data": [ /* items */ ],

    "pagination": {

    "limit": 20,

    "offset": 0,

    "hasMore": true,

    "nextOffset": 20,

    "prevOffset": null

    }

    }

    ```


    Many list endpoints also include `pagination.total` (count of matching items across all pages). Per-operation response schemas are authoritative. Use `hasMore` to decide whether to fetch another page and `nextOffset` for the next request rather than computing it on the client. ## Dates and Times


    All **response** timestamps are ISO-8601 strings in UTC (for example `2024-01-01T12:00:00.000Z`). Date-range **query** parameters support two input modes where the endpoint accepts them:


    | Input format | Interpretation |

    | --- | --- |

    | `YYYY-MM-DD` (calendar day) | Full day in **UTC**. Start = `00:00:00.000Z`, end = `23:59:59.999Z` on that date. Same start and end day returns the full UTC day. |

    | ISO-8601 UTC timestamp (e.g.'
  version: 2.0.0
  contact:
    name: Benji Pays API Support
    email: benji@benjipays.com
servers:
- url: https://api.benjipays.com
  description: Development server
security:
- BearerAuth: []
tags:
- name: Billing
  description: Finalized billing data for invoicing (locked/completed months only)
paths:
  /v2/billing:
    get:
      summary: Get finalized billing data for a month
      description: '**Access:** Requires DISTRIBUTOR actor type


        Returns finalized billing data for a completed month. Used by distributors for invoicing and reconciliation. Data is locked and should match what was actually billed.


        **Key Differences from Usage API:**

        - Usage API: Real-time calculation for dashboard visibility (can query current month)

        - Billing API: Finalized/locked data for invoicing (only completed months)


        **Availability:**

        - Period must be a completed month (not current or future month)

        - Data available after billing runs on 1st of month (~2-3am)

        - Returns 404 if billing not yet run for period


        **Implementation:**

        - Queries billingInvoices collection by apiParent.distributorExternalId and period

        - Optional filters: partnerId (apiParent.partnerId), organizationId (userId)

        - Offset-based pagination (limit, offset)

        - Returns finalized pricing (unitPrice, total) with apiParent (type, distributorExternalId, partnerExternalId, partnerId)


        **Note:** NFR plans are represented as $0 plans (unitPrice: 0), no separate flag.


        Requires JWT authentication and ''partners:billing:read'' scope.'
      tags:
      - Billing
      security:
      - BearerAuth: []
      parameters:
      - $ref: '#/components/parameters/RequestIdHeader'
      - $ref: '#/components/parameters/CorrelationIdHeader'
      - in: query
        name: period
        schema:
          type: string
          description: Month in YYYY-MM format (must be a completed month)
          example: 2026-01
        required: true
        description: Month in YYYY-MM format (must be a completed month)
      - in: query
        name: partnerId
        schema:
          description: Optional filter by partner ID
          example: 6022f98854f2c41d7ef2b1fe
          type: string
          pattern: ^[0-9a-fA-F]{24}$
        description: Optional filter by partner ID
      - in: query
        name: organizationId
        schema:
          description: Optional filter by organization ID
          example: 7033a09965b3d52e8fc3c2af
          type: string
          pattern: ^[0-9a-fA-F]{24}$
        description: Optional filter by organization ID
      - in: query
        name: limit
        schema:
          description: 'Number of organizations per page (default: 50, max: 100). Each org produces 1 base plan row plus one row per overage tier.'
          example: 50
          type: integer
          minimum: 1
          maximum: 100
        description: 'Number of organizations per page (default: 50, max: 100). Each org produces 1 base plan row plus one row per overage tier.'
      - in: query
        name: offset
        schema:
          description: 'Number of organizations to skip for pagination (default: 0)'
          example: 0
          type: integer
          minimum: 0
          maximum: 9007199254740991
        description: 'Number of organizations to skip for pagination (default: 0)'
      responses:
        '200':
          description: Successful response with finalized billing data
          content:
            application/json:
              example:
                data:
                - organizationId: 7033a09965b3d52e8fc3c2af
                  apiParent:
                    type: partner
                    distributorExternalId: sherweb
                    partnerExternalId: acme-msp
                    partnerId: 6022f98854f2c41d7ef2b1fe
                  name: Acme Corp
                  externalId: ext_org_67890
                  sku: BENJI-PRO
                  quantity: 1
                  unitPrice: 119
                  total: 119
                  trial: false
                  planName: pro
                  period: 2026-01
                - organizationId: 7033a09965b3d52e8fc3c2af
                  apiParent:
                    type: partner
                    distributorExternalId: sherweb
                    partnerExternalId: acme-msp
                    partnerId: 6022f98854f2c41d7ef2b1fe
                  name: Acme Corp
                  externalId: ext_org_67890
                  sku: BENJI-PRO-OVERAGE-TIER1
                  quantity: 100
                  unitPrice: 0.8
                  total: 80
                  trial: false
                  period: 2026-01
                - organizationId: 7033a09965b3d52e8fc3c2af
                  apiParent:
                    type: partner
                    distributorExternalId: sherweb
                    partnerExternalId: acme-msp
                    partnerId: 6022f98854f2c41d7ef2b1fe
                  name: Acme Corp
                  externalId: ext_org_67890
                  sku: BENJI-PRO-OVERAGE-TIER2
                  quantity: 45
                  unitPrice: 0.6
                  total: 27
                  trial: false
                  period: 2026-01
                pagination:
                  nextOffset: null
                  prevOffset: null
                  limit: 50
                  offset: 0
                  hasMore: false
              schema:
                $ref: '#/components/schemas/BillingResponse'
        '400':
          description: Bad Request - Invalid period format or period is not completed
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    description: Problem type URI
                    example: https://api.benjipays.com/problems/not-found
                  title:
                    type: string
                    description: Error title
                    example: Not Found
                  status:
                    type: number
                    description: HTTP status code
                    example: 404
                  detail:
                    type: string
                    description: Error detail message
                    example: Billing data not yet available for period 2026-01
                  instance:
                    description: Instance URI
                    example: /v2/billing
                    type: string
                required:
                - type
                - title
                - status
                - detail
                additionalProperties: false
                description: Error response (RFC 7807 Problem Details)
                example:
                  type: https://api.benjipays.com/problems/bad-request
                  title: Bad Request
                  status: 400
                  detail: Period must be a completed month (not current or future month)
                  instance: /v2/billing
        '401':
          description: Unauthorized - Invalid or missing authentication token
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    description: Problem type URI
                    example: https://api.benjipays.com/problems/not-found
                  title:
                    type: string
                    description: Error title
                    example: Not Found
                  status:
                    type: number
                    description: HTTP status code
                    example: 404
                  detail:
                    type: string
                    description: Error detail message
                    example: Billing data not yet available for period 2026-01
                  instance:
                    description: Instance URI
                    example: /v2/billing
                    type: string
                required:
                - type
                - title
                - status
                - detail
                additionalProperties: false
                description: Error response (RFC 7807 Problem Details)
                example:
                  type: https://api.benjipays.com/problems/unauthorized
                  title: Unauthorized
                  status: 401
                  detail: Invalid or missing authentication token
                  instance: /v2/billing
        '403':
          description: Forbidden - Distributor actor type required
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    description: Problem type URI
                    example: https://api.benjipays.com/problems/not-found
                  title:
                    type: string
                    description: Error title
                    example: Not Found
                  status:
                    type: number
                    description: HTTP status code
                    example: 404
                  detail:
                    type: string
                    description: Error detail message
                    example: Billing data not yet available for period 2026-01
                  instance:
                    description: Instance URI
                    example: /v2/billing
                    type: string
                required:
                - type
                - title
                - status
                - detail
                additionalProperties: false
                description: Error response (RFC 7807 Problem Details)
                example:
                  type: https://api.benjipays.com/problems/forbidden
                  title: Forbidden
                  status: 403
                  detail: Access requires distributor tier
                  instance: /v2/billing
        '404':
          description: Not Found - Billing data not yet available for this period
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    description: Problem type URI
                    example: https://api.benjipays.com/problems/not-found
                  title:
                    type: string
                    description: Error title
                    example: Not Found
                  status:
                    type: number
                    description: HTTP status code
                    example: 404
                  detail:
                    type: string
                    description: Error detail message
                    example: Billing data not yet available for period 2026-01
                  instance:
                    description: Instance URI
                    example: /v2/billing
                    type: string
                required:
                - type
                - title
                - status
                - detail
                additionalProperties: false
                description: Error response (RFC 7807 Problem Details)
                example:
                  type: https://api.benjipays.com/problems/not-found
                  title: Not Found
                  status: 404
                  detail: Billing data not yet available for period 2026-01. Billing runs on the 1st of each month (~2-3am).
                  instance: /v2/billing
        '429':
          description: Too Many Requests - Rate limit exceeded
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    description: Problem type URI
                    example: https://api.benjipays.com/problems/not-found
                  title:
                    type: string
                    description: Error title
                    example: Not Found
                  status:
                    type: number
                    description: HTTP status code
                    example: 404
                  detail:
                    type: string
                    description: Error detail message
                    example: Billing data not yet available for period 2026-01
                  instance:
                    description: Instance URI
                    example: /v2/billing
                    type: string
                required:
                - type
                - title
                - status
                - detail
                additionalProperties: false
                description: Error response (RFC 7807 Problem Details)
                example:
                  type: https://api.benjipays.com/problems/rate-limit-exceeded
                  title: Too Many Requests
                  status: 429
                  detail: Rate limit exceeded. Please retry after the specified time.
                  instance: /v2/billing
                  retryAfterSeconds: 1
                  limit: 5
      operationId: getV2Billing
      x-operation-id-source: derived
components:
  parameters:
    CorrelationIdHeader:
      name: X-Correlation-ID
      in: header
      required: false
      description: Optional ID that flows across service boundaries for distributed tracing. The server generates a UUID v4 if omitted and always echoes the value in the response.
      schema:
        type: string
        format: uuid
    RequestIdHeader:
      name: X-Request-ID
      in: header
      required: false
      description: Optional client-supplied unique ID for one request. The server generates a UUID v4 if omitted and always echoes the value in the response.
      schema:
        type: string
        format: uuid
  schemas:
    BillingItem:
      type: object
      properties:
        organizationId:
          type: string
          description: MongoDB ObjectId of the organization
          example: 7033a09965b3d52e8fc3c2af
        apiParent:
          type: object
          properties:
            type:
              type: string
              enum:
              - distributor
              - partner
              description: Parent type — distributor or partner
              example: partner
            distributorExternalId:
              type: string
              description: Distributor external ID
              example: sherweb
            partnerExternalId:
              description: Partner external ID (present when type is partner)
              example: acme-msp
              type: string
            partnerId:
              description: Partner MongoDB ObjectId (present when type is partner)
              example: 6022f98854f2c41d7ef2b1fe
              type: string
          required:
          - type
          - distributorExternalId
          additionalProperties: false
          description: API parent — distributor and optional partner
        name:
          type: string
          description: Organization name
          example: Acme Corp
        externalId:
          description: External ID from distributor's system
          example: ext_org_67890
          type: string
        sku:
          type: string
          description: SKU identifier — plan SKU (e.g., BENJI-PRO) for base plan, or BENJI-{PLAN}-OVERAGE-TIER{n} (e.g., BENJI-PRO-OVERAGE-TIER1) for each overage tier
          example: BENJI-PRO
        quantity:
          type: number
          description: Quantity for this SKU
          example: 1
        unitPrice:
          type: number
          description: Price per unit
          example: 119
        total:
          type: number
          description: Total price (quantity × unitPrice)
          example: 119
        trial:
          type: boolean
          description: Whether organization is on trial
          example: false
        planName:
          description: Plan name (e.g., pro, starter)
          example: pro
          type: string
        period:
          type: string
          description: Billing period (YYYY-MM)
          example: 2026-01
      required:
      - organizationId
      - apiParent
      - name
      - sku
      - quantity
      - unitPrice
      - total
      - trial
      - period
      additionalProperties: false
      description: Billing line item for an organization + SKU combination
    BillingResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/BillingItem'
          description: Array of billing items grouped by organization and SKU
        pagination:
          type: object
          properties:
            nextOffset:
              anyOf:
              - type: number
              - type: 'null'
              description: Offset for next page (null if no more pages)
              example: 50
            prevOffset:
              anyOf:
              - type: number
              - type: 'null'
              description: Offset for previous page (null if first page)
              example: null
            limit:
              type: number
              description: Number of items per page
              example: 50
            offset:
              type: number
              description: Current offset
              example: 0
            hasMore:
              type: boolean
              description: Whether more results are available
              example: false
          required:
          - nextOffset
          - prevOffset
          - limit
          - offset
          - hasMore
          additionalProperties: false
          description: Offset-based pagination metadata
      required:
      - data
      - pagination
      additionalProperties: false
      description: Billing response with finalized billing data
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Auth0 JWT token obtained via OAuth2 client credentials flow. Include the token in the Authorization header as: Bearer <token>'
x-speakeasy-retries:
  strategy: backoff
  backoff:
    initialInterval: 500
    maxInterval: 60000
    maxElapsedTime: 3600000
    exponent: 1.5
  statusCodes:
  - 5XX
  retryConnectionErrors: true
x-provenance:
  method: searched
  source: https://developer.benjipays.com/reference
  harvested: '2026-11-02'
  tool: harvest-readme-openapi.py
  note: Assembled verbatim from the OpenAPI definition ReadMe embeds in each operation page of the provider's developer portal; paths and components merged by API title, nothing authored.
  assembled_from:
  - https://developer.benjipays.com/reference/get_v2-billing.md
  - https://developer.benjipays.com/reference/get_v2-organizations-organizationid.md
  - https://developer.benjipays.com/reference/get_v2-organizations.md
  - https://developer.benjipays.com/reference/get_v2-partners-partnerid.md
  - https://developer.benjipays.com/reference/get_v2-partners.md
  - https://developer.benjipays.com/reference/get_v2-plans-planid.md
  - https://developer.benjipays.com/reference/get_v2-plans.md
  - https://developer.benjipays.com/reference/get_v2-usage.md
  - https://developer.benjipays.com/reference/get_v2-whoami.md
  - https://developer.benjipays.com/reference/patch_v2-organizations-organizationid-plan.md
  - https://developer.benjipays.com/reference/post_v2-organizations-organizationid-activate.md
  - https://developer.benjipays.com/reference/post_v2-organizations-organizationid-close.md
  - https://developer.benjipays.com/reference/post_v2-organizations-organizationid-resend-invite.md
  - https://developer.benjipays.com/reference/post_v2-organizations-organizationid-suspend.md
  - https://developer.benjipays.com/reference/post_v2-organizations.md
  - https://developer.benjipays.com/reference/post_v2-partners.md
  - https://developer.benjipays.com/reference/post_v2-whoami-echo.md
  merge:
    pages: 17
    deduped: 61
    conflicts_kept_first: 0