openapi: 3.2.0 info: title: 'GTM API public contract: gtm.service.id Billing…' description: 'Identity, access and money: users, teams and members, API keys, OAuth clients and authorizations, billing products, subscriptions, transactions and payment methods, notifications, TLS certificates and support requests.' version: '1.0' contact: name: GTM API url: https://gtm-api.com email: support@gtm-api.com license: name: Proprietary url: https://gtm-api.com/license servers: - url: https://app.gtm-api.com/id/v4 description: Production, through the app.gtm-api.com gateway security: - BearerJwt: [] TeamSid: [] tags: - name: billing_transactions description: Registry package `mcp.id/billing_transactions`, served on MCP mount `id.billing`. paths: /api/billing-transactions/metrics: post: operationId: get_billing_transactions_metrics summary: Billing transaction metrics description: 'Period-bound money sums over the caller''s transactions. Requires period {from,to}. Money never crosses currencies; every sum lives inside a per-currency by_currency entry keyed by ISO 4217. Answers ''how much did I pay / tax this quarter''. Sums are GROSS (refunds not modeled in v1). Filter is the same object as search and every axis is applied; billed_at / created_at operators are dropped from the period-bound sums (period is the one window there) but they DO scope the counts block, which carries no period of its own. Requires billing.view. Contract: - MCP tool `get_billing_transactions_metrics`, registry package `mcp.id/billing_transactions`, mount `id.billing`. - Operation `metrics`, response envelope `metrics`. - Flags: read only.' tags: - billing_transactions requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/GetBillingTransactionsMetricsRequest' responses: '200': description: '`metrics` success envelope.' content: application/json: schema: $ref: '#/components/schemas/GetBillingTransactionsMetricsResponse' 4XX: $ref: '#/components/responses/McpClientError' 5XX: $ref: '#/components/responses/McpServerError' x-gtm-mcp-tool: get_billing_transactions_metrics x-gtm-mcp-mount: id.billing x-gtm-entity: billing_transactions x-gtm-operation: metrics x-gtm-envelope: metrics x-gtm-availability: ga x-gtm-dangerous: false x-gtm-mass-action: false x-gtm-step-eligible: false x-gtm-schedule-required: false x-gtm-tool-class: typical /api/billing-transactions/search: post: operationId: search_billing_transactions summary: Search billing transactions description: 'List billing transactions (invoices / charges) for the caller: one row per Paddle transaction, newest first. Filter by status / origin / collection_mode / currency / billed_at window, or locate one by invoice_number. include subscription / owner / team to hydrate context. Read-only, append-only ledger; page_size:0 returns counts only. Requires billing.view. Contract: - MCP tool `search_billing_transactions`, registry package `mcp.id/billing_transactions`, mount `id.billing`. - Operation `search`, response envelope `search`. - Flags: read only.' tags: - billing_transactions requestBody: required: false content: application/json: schema: $ref: '#/components/schemas/SearchBillingTransactionsRequest' responses: '200': description: '`search` success envelope.' content: application/json: schema: $ref: '#/components/schemas/SearchBillingTransactionsResponse' 4XX: $ref: '#/components/responses/McpClientError' 5XX: $ref: '#/components/responses/McpServerError' x-gtm-mcp-tool: search_billing_transactions x-gtm-mcp-mount: id.billing x-gtm-entity: billing_transactions x-gtm-operation: search x-gtm-envelope: search x-gtm-availability: ga x-gtm-dangerous: false x-gtm-mass-action: false x-gtm-step-eligible: false x-gtm-schedule-required: false x-gtm-tool-class: typical /api/billing-transactions/{sid}: get: operationId: get_billing_transaction summary: Get billing transaction description: 'Fetch a single billing transaction by sid, with optional subscription / owner / team includes. Returns the frozen items[] charge snapshot inline. Contract: - MCP tool `get_billing_transaction`, registry package `mcp.id/billing_transactions`, mount `id.billing`. - Operation `get`, response envelope `get`. - Flags: read only.' tags: - billing_transactions parameters: - name: sid in: path required: true description: Path segment `{sid}`. schema: type: string minLength: 18 maxLength: 18 pattern: ^bl_tx_ - name: include[] in: query required: false description: Query parameter `include`. style: form explode: true schema: type: array items: type: string responses: '200': description: '`get` success envelope.' content: application/json: schema: $ref: '#/components/schemas/GetBillingTransactionResponse' 4XX: $ref: '#/components/responses/McpClientError' 5XX: $ref: '#/components/responses/McpServerError' x-gtm-mcp-tool: get_billing_transaction x-gtm-mcp-mount: id.billing x-gtm-entity: billing_transactions x-gtm-operation: get x-gtm-envelope: get x-gtm-availability: ga x-gtm-dangerous: false x-gtm-mass-action: false x-gtm-step-eligible: false x-gtm-schedule-required: false x-gtm-tool-class: trivial /api/billing-transactions/{sid}/get-invoice: post: operationId: get_billing_transaction_invoice summary: Get transaction invoice description: 'Fetch a temporary, time-limited URL for this transaction''s invoice PDF from Paddle (never stored here; expires ~1h, opens inline). Works for self-serve card charges and sales-issued manual invoices. Returns invoice_not_ready before the transaction is billed, and invoice_not_available when Paddle issued no invoice for it (a $0 payment-method-change charge, a canceled checkout): the rows with a PDF are the ones carrying invoice_number. Read-only, mutates nothing. Requires billing.view. Contract: - MCP tool `get_billing_transaction_invoice`, registry package `mcp.id/billing_transactions`, mount `id.billing`. - Operation `action`, response envelope `action`. - Flags: read only.' tags: - billing_transactions parameters: - name: sid in: path required: true description: Billing transaction sid (bl_tx_…). schema: type: string minLength: 18 maxLength: 18 pattern: ^bl_tx_ description: Billing transaction sid (bl_tx_…). responses: '200': description: '`action` success envelope.' content: application/json: schema: $ref: '#/components/schemas/GetBillingTransactionInvoiceResponse' 4XX: $ref: '#/components/responses/McpClientError' 5XX: $ref: '#/components/responses/McpServerError' x-gtm-mcp-tool: get_billing_transaction_invoice x-gtm-mcp-mount: id.billing x-gtm-entity: billing_transactions x-gtm-operation: action x-gtm-envelope: action x-gtm-availability: ga x-gtm-dangerous: false x-gtm-mass-action: false x-gtm-step-eligible: false x-gtm-schedule-required: false x-gtm-tool-class: typical components: schemas: McpError: type: object properties: success: type: boolean enum: - false error: type: object properties: code: type: string enum: - validation_failed - nothing_to_update - not_found - relation_not_found - invalid_transition - limit_exceeded - payment_required - duplicate_rejected - conflict - delete_blocked - unauthorized - forbidden - rate_limited - internal_error - service_unavailable - not_implemented message: type: string recoverable: type: boolean suggestion: type: string field_errors: type: object additionalProperties: type: array items: type: object properties: rule: type: string message: type: string required: - rule - message blockers: type: array items: type: object properties: type: type: string description: Machine-readable blocker type (active_flow, pending_tasks, …). severity: type: string enum: - hard - soft description: hard = external action required; soft = acknowledge is enough. description: type: string entity_sid: type: - string - 'null' count: type: integer resolution: type: string description: 'Hard: tool name to call. Soft: code for acknowledge[].' resolution_hint: type: string required: - type - severity - description - entity_sid - resolution - resolution_hint context: type: object additionalProperties: {} required: - code - message - recoverable meta: type: object properties: trace_id: type: string description: UUID v7; same 128-bit value as the X-Trace-Id header. span_id: type: string pattern: ^[0-9a-f]{16}$ description: 16 hex chars, root span of this request. timestamp: type: string description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time. duration_ms: type: integer minimum: 0 description: Server-side wall clock. team_sid: type: - string - 'null' description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends. actor_type: type: - string - 'null' description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends. required: - trace_id - span_id - timestamp - duration_ms required: - success - error GetBillingTransactionInvoiceResponse: type: object properties: success: type: boolean enum: - true operation: type: string enum: - action action: type: string description: kebab-case verb; matches the route segment. item: type: - object - 'null' properties: sid: type: string owner_user_sid: type: string team_sid: type: - string - 'null' subscription_sid: type: - string - 'null' paddle_transaction_id: type: string status: type: string enum: - billed - paid - completed - past_due - canceled origin: type: string enum: - subscription_charge - subscription_update - one_time collection_mode: type: string enum: - automatic - manual invoice_number: type: - string - 'null' total: type: string tax: type: - string - 'null' currency: type: string items: type: array items: type: object properties: price_sid: type: - string - 'null' product_sid: type: - string - 'null' product_type: type: string enum: - plan - addon quantity: type: number unit_amount: type: string paddle_price_id: type: - string - 'null' required: - price_sid - product_sid - product_type - quantity - unit_amount - paddle_price_id billed_at: type: - string - 'null' created_at: type: string updated_at: type: string required: - sid - owner_user_sid - team_sid - subscription_sid - paddle_transaction_id - status - origin - collection_mode - invoice_number - total - tax - currency - items - billed_at - created_at - updated_at result: type: object additionalProperties: {} meta: type: object properties: trace_id: type: string description: UUID v7; same 128-bit value as the X-Trace-Id header. span_id: type: string pattern: ^[0-9a-f]{16}$ description: 16 hex chars, root span of this request. timestamp: type: string description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time. duration_ms: type: integer minimum: 0 description: Server-side wall clock. team_sid: type: - string - 'null' description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends. actor_type: type: - string - 'null' description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends. required: - trace_id - span_id - timestamp - duration_ms required: - success - operation - action - item - result - meta SearchBillingTransactionsRequest: type: object description: Request body of `search_billing_transactions`. properties: filter: type: object properties: sid: type: object properties: eq: type: string in: type: array items: type: string additionalProperties: false owner_user_sid: type: object properties: eq: type: string in: type: array items: type: string additionalProperties: false team_sid: type: object properties: eq: type: string in: type: array items: type: string is_null: type: boolean additionalProperties: false subscription_sid: type: object properties: eq: type: string in: type: array items: type: string is_null: type: boolean additionalProperties: false paddle_transaction_id: type: object properties: eq: type: string in: type: array items: type: string additionalProperties: false invoice_number: type: object properties: eq: type: string in: type: array items: type: string is_null: type: boolean additionalProperties: false status: type: object properties: eq: type: string enum: - billed - paid - completed - past_due - canceled ne: type: string enum: - billed - paid - completed - past_due - canceled in: type: array items: type: string enum: - billed - paid - completed - past_due - canceled nin: type: array items: type: string enum: - billed - paid - completed - past_due - canceled additionalProperties: false origin: type: object properties: eq: type: string enum: - subscription_charge - subscription_update - one_time ne: type: string enum: - subscription_charge - subscription_update - one_time in: type: array items: type: string enum: - subscription_charge - subscription_update - one_time nin: type: array items: type: string enum: - subscription_charge - subscription_update - one_time additionalProperties: false collection_mode: type: object properties: eq: type: string enum: - automatic - manual ne: type: string enum: - automatic - manual in: type: array items: type: string enum: - automatic - manual additionalProperties: false currency: type: object properties: eq: type: string in: type: array items: type: string additionalProperties: false billed_at: type: object properties: gte: type: string lte: type: string gt: type: string lt: type: string is_null: type: boolean additionalProperties: false created_at: type: object properties: gte: type: string lte: type: string gt: type: string lt: type: string additionalProperties: false include: type: array items: type: string enum: - subscription - owner - team description: Relations to eager-load (see entity Includes). sort: type: object properties: field: type: string enum: - billed_at - created_at - total direction: type: string enum: - asc - desc description: Default desc. required: - field page_size: type: integer minimum: 0 maximum: 500 description: 0..500, default 50. page_size=0 = count-only, page_size=1 = getFirst. cursor: type: - string - 'null' description: Opaque forward cursor from a previous response pagination.next_cursor. GetBillingTransactionsMetricsResponse: type: object properties: success: type: boolean enum: - true operation: type: string enum: - metrics metrics: type: object properties: filter: type: object additionalProperties: {} period: type: object properties: from: type: string to: type: string required: - from - to aggregated: type: object properties: counts: type: object additionalProperties: {} metrics: type: object properties: {} metrics: type: object properties: {} applied_filters: type: object additionalProperties: {} meta: type: object properties: trace_id: type: string description: UUID v7; same 128-bit value as the X-Trace-Id header. span_id: type: string pattern: ^[0-9a-f]{16}$ description: 16 hex chars, root span of this request. timestamp: type: string description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time. duration_ms: type: integer minimum: 0 description: Server-side wall clock. team_sid: type: - string - 'null' description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends. actor_type: type: - string - 'null' description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends. required: - trace_id - span_id - timestamp - duration_ms required: - success - operation - metrics - meta SearchBillingTransactionsResponse: type: object properties: success: type: boolean enum: - true operation: type: string enum: - search items: type: array items: type: object properties: item: type: object properties: sid: type: string owner_user_sid: type: string team_sid: type: - string - 'null' subscription_sid: type: - string - 'null' paddle_transaction_id: type: string status: type: string enum: - billed - paid - completed - past_due - canceled origin: type: string enum: - subscription_charge - subscription_update - one_time collection_mode: type: string enum: - automatic - manual invoice_number: type: - string - 'null' total: type: string tax: type: - string - 'null' currency: type: string items: type: array items: type: object properties: price_sid: type: - string - 'null' product_sid: type: - string - 'null' product_type: type: string enum: - plan - addon quantity: type: number unit_amount: type: string paddle_price_id: type: - string - 'null' required: - price_sid - product_sid - product_type - quantity - unit_amount - paddle_price_id billed_at: type: - string - 'null' created_at: type: string updated_at: type: string required: - sid - owner_user_sid - team_sid - subscription_sid - paddle_transaction_id - status - origin - collection_mode - invoice_number - total - tax - currency - items - billed_at - created_at - updated_at included: type: object additionalProperties: {} required: - item - included pagination: type: object properties: next_cursor: type: - string - 'null' has_more: type: boolean total_count: type: - integer - 'null' required: - next_cursor - has_more - total_count applied_filters: type: object additionalProperties: {} includes: type: array items: type: string meta: type: object properties: trace_id: type: string description: UUID v7; same 128-bit value as the X-Trace-Id header. span_id: type: string pattern: ^[0-9a-f]{16}$ description: 16 hex chars, root span of this request. timestamp: type: string description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time. duration_ms: type: integer minimum: 0 description: Server-side wall clock. team_sid: type: - string - 'null' description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends. actor_type: type: - string - 'null' description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends. required: - trace_id - span_id - timestamp - duration_ms counts: type: object properties: {} required: - success - operation - items - pagination - applied_filters - includes - meta GetBillingTransactionResponse: type: object properties: success: type: boolean enum: - true operation: type: string enum: - get item: type: object properties: sid: type: string owner_user_sid: type: string team_sid: type: - string - 'null' subscription_sid: type: - string - 'null' paddle_transaction_id: type: string status: type: string enum: - billed - paid - completed - past_due - canceled origin: type: string enum: - subscription_charge - subscription_update - one_time collection_mode: type: string enum: - automatic - manual invoice_number: type: - string - 'null' total: type: string tax: type: - string - 'null' currency: type: string items: type: array items: type: object properties: price_sid: type: - string - 'null' product_sid: type: - string - 'null' product_type: type: string enum: - plan - addon quantity: type: number unit_amount: type: string paddle_price_id: type: - string - 'null' required: - price_sid - product_sid - product_type - quantity - unit_amount - paddle_price_id billed_at: type: - string - 'null' created_at: type: string updated_at: type: string required: - sid - owner_user_sid - team_sid - subscription_sid - paddle_transaction_id - status - origin - collection_mode - invoice_number - total - tax - currency - items - billed_at - created_at - updated_at included: type: object additionalProperties: {} includes: type: array items: type: string meta: type: object properties: trace_id: type: string description: UUID v7; same 128-bit value as the X-Trace-Id header. span_id: type: string pattern: ^[0-9a-f]{16}$ description: 16 hex chars, root span of this request. timestamp: type: string description: ISO 8601 UTC (Y-m-dTH:i:sZ), response time. duration_ms: type: integer minimum: 0 description: Server-side wall clock. team_sid: type: - string - 'null' description: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends. actor_type: type: - string - 'null' description: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends. required: - trace_id - span_id - timestamp - duration_ms required: - success - operation - item - included - includes - meta GetBillingTransactionsMetricsRequest: type: object description: Request body of `get_billing_transactions_metrics`. properties: filter: type: object properties: sid: type: object properties: eq: type: string in: type: array items: type: string additionalProperties: false owner_user_sid: type: object properties: eq: type: string in: type: array items: type: string additionalProperties: false team_sid: type: object properties: eq: type: string in: type: array items: type: string is_null: type: boolean additionalProperties: false subscription_sid: type: object properties: eq: type: string in: type: array items: type: string is_null: type: boolean additionalProperties: false paddle_transaction_id: type: object properties: eq: type: string in: type: array items: type: string additionalProperties: false invoice_number: type: object properties: eq: type: string in: type: array items: type: string is_null: type: boolean additionalProperties: false status: type: object properties: eq: type: string enum: - billed - paid - completed - past_due - canceled ne: type: string enum: - billed - paid - completed - past_due - canceled in: type: array items: type: string enum: - billed - paid - completed - past_due - canceled nin: type: array items: type: string enum: - billed - paid - completed - past_due - canceled additionalProperties: false origin: type: object properties: eq: type: string enum: - subscription_charge - subscription_update - one_time ne: type: string enum: - subscription_charge - subscription_update - one_time in: type: array items: type: string enum: - subscription_charge - subscription_update - one_time nin: type: array items: type: string enum: - subscription_charge - subscription_update - one_time additionalProperties: false collection_mode: type: object properties: eq: type: string enum: - automatic - manual ne: type: string enum: - automatic - manual in: type: array items: type: string enum: - automatic - manual additionalProperties: false currency: type: object properties: eq: type: string in: type: array items: type: string additionalProperties: false billed_at: type: object properties: gte: type: string lte: type: string gt: type: string lt: type: string is_null: type: boolean additionalProperties: false created_at: type: object properties: gte: type: string lte: type: string gt: type: string lt: type: string additionalProperties: false period: type: object properties: from: type: string description: ISO 8601 UTC window start (inclusive). to: type: string description: ISO 8601 UTC window end; must be ≥ from. required: - from - to description: Required metrics window [from, to]. required: - period responses: McpServerError: description: MCP error envelope with `error.code` internal_error or service_unavailable. content: application/json: schema: $ref: '#/components/schemas/McpError' McpClientError: description: MCP error envelope. `error.code` is one of validation_failed, nothing_to_update, not_found, relation_not_found, invalid_transition, limit_exceeded, payment_required, duplicate_rejected, conflict, delete_blocked, unauthorized, forbidden, rate_limited, not_implemented. content: application/json: schema: $ref: '#/components/schemas/McpError' securitySchemes: BearerJwt: type: http scheme: bearer bearerFormat: JWT description: Access token issued by gtm.service.id. Its `access_identity` claim carries `team_sid`, `actor_sid` and `actor_type`, and that team scope is authoritative. TeamSid: type: apiKey in: header name: Team-SID description: Team scope for tokens that do not carry one. Ignored when the token already names a team.