mahastrategies-com Self-service API Keys API

Instant starter-key provisioning and prepaid credit checkout.

Operations 5

POST /api/v1/keys/generate Generate a one-time starter API key with 20,000 free credits #
POST /api/v1/keys/checkout Create a hosted Stripe Checkout session for a prepaid API credit pack #
GET /api/v1/keys/balance Get the balance for the current API key #
POST /api/v1/keys/rotate Rotate the current API key without changing its balance or key ID #
POST /api/v1/keys/revoke Permanently revoke the current API key #

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/mahastrategies-com:mahastrategies-com-self-service-api-keys-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

mahastrategies-com-self-service-api-keys-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Maha Strategies MPS Self-service API Keys API
  version: '0.1'
  description: 'The Maha Provenance Standard (MPS) API runs claim-level provenance audits over prose. Every factual claim in a passage is excerpted, tagged (VERIFIED, SOURCED, BOUNDARY, ILLUSTRATIVE, UNVERIFIED), and returned with a rationale and a recommended action — so agents and editors can verify before they publish.


    ## Local bridge (CLI)


    Install the open-source local bridge and point Claude Code, Cursor, or any MCP client at it:


    ```sh

    npm install -g @mahastrategies/maha-mcp-bridge

    maha login # verify and store your credential

    maha serve # start the stdio MCP server

    ```


    Raw rows and credentials stay local; only locally-redacted context reaches the agent''s cloud model.


    ## Authentication


    Commercial endpoints use bearer credentials:


    ```

    Authorization: Bearer mhaic_your_credential_here

    ```


    Credentials are shown **exactly once** at purchase. Store them in a secret manager; never commit them, log them, or place them in URLs. Each credential is scoped to the MPS audit capability only — it cannot touch any other service. Lost credentials cannot be recovered, only replaced.


    The free preflight endpoint (`POST /api/audit`) needs no credential and is limited per visitor per day.


    ## The credit system


    Paid audits are prepaid. Each successful audit consumes one `mps_audit_invocation` credit; failed audits are refunded automatically in the same ledger.


    When a credential runs out of credits, the API responds with **`402 Payment Required`**:


    ```json

    {

    "error": { "code": "payment_required", "message": "This prepaid credential has no audit credits remaining." },

    "purchase": { "href": "/mps/audit-access", "checkoutEndpoint": "/api/mps-credits/checkout", "unit": "mps_audit_invocation" }

    }

    ```


    Treat `402` as a routine signal, not an error: follow `purchase.href` to buy another pack, or call the checkout endpoint programmatically. Balances live in an append-only double-entry ledger — every grant, consumption, refund, and manual correction is a permanent, hash-chained row.


    ## Idempotency and webhook resilience


    **Requests**: every audit takes a `clientRequestId` you choose (8–120 characters). Retrying with the same id and the same text returns the original result with `idempotentReplay: true` — never a duplicate charge. The same id with *different* text returns `409 Conflict`. Safe retry loop: keep the same id until you get a terminal status.


    **Payments**: Stripe webhooks are processed exactly once. Each event id is claimed atomically in the same database transaction that moves credits, so a redelivered webhook can never double-credit a balance — duplicates get `200 OK` with `"duplicate": true` and change nothing. A crash between claim and grant rolls both back together. You never need to reconcile double-grants; the ledger cannot express them.'
  contact:
    name: Maha Strategies
    url: https://www.mahastrategies.com/contact
servers:
- url: https://www.mahastrategies.com
tags:
- name: Self-service API Keys
  description: Instant starter-key provisioning and prepaid credit checkout.
paths:
  /api/v1/keys/generate:
    post:
      tags:
      - Self-service API Keys
      operationId: generateStarterApiKey
      summary: Generate a one-time starter API key with 20,000 free credits
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - email
              properties:
                email:
                  type: string
                  format: email
      responses:
        '201':
          description: The API key is disclosed exactly once.
          content:
            application/json:
              schema:
                type: object
                required:
                - apiKey
                - apiKeyId
                - balanceCredits
                - tier
                properties:
                  apiKey:
                    type: string
                    description: Secret shown once; store it securely.
                  apiKeyId:
                    type: string
                  balanceCredits:
                    type: integer
                    const: 20000
                  tier:
                    const: starter
        '400':
          description: Invalid email.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '429':
          description: Starter-key provisioning rate limit reached.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '503':
          description: Key provisioning unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
  /api/v1/keys/checkout:
    post:
      tags:
      - Self-service API Keys
      operationId: createApiCreditCheckout
      summary: Create a hosted Stripe Checkout session for a prepaid API credit pack
      security:
      - credential: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - pack
              - clientRequestId
              properties:
                pack:
                  type: string
                  enum:
                  - starter
                  - builder
                  - scale
                  - pro
                  - enterprise
                clientRequestId:
                  type: string
                  minLength: 8
                  maxLength: 120
                  pattern: ^[A-Za-z0-9_-]+$
                  description: Stable idempotency key. Reuse it only while retrying this exact pack purchase.
      responses:
        '200':
          description: Hosted checkout URL.
          content:
            application/json:
              schema:
                type: object
                required:
                - checkoutUrl
                - pack
                - idempotentReplay
                properties:
                  checkoutUrl:
                    type: string
                    format: uri
                  pack:
                    type: string
                  idempotentReplay:
                    type: boolean
        '400':
          description: Invalid pack or idempotency key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '401':
          description: Invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '409':
          description: A reused request ID conflicts with another purchase or has already completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '503':
          description: Checkout unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
  /api/v1/keys/balance:
    get:
      tags:
      - Self-service API Keys
      operationId: getApiKeyBalance
      summary: Get the balance for the current API key
      security:
      - credential: []
      responses:
        '200':
          description: Current prepaid API-key balance and non-secret key identifier.
          content:
            application/json:
              schema:
                type: object
                required:
                - api_key_id
                - balance_credits
                - tier
                properties:
                  api_key_id:
                    type: string
                    description: Non-secret identifier for this authenticated API key.
                  balance_credits:
                    type: integer
                    minimum: 0
                  tier:
                    type: string
                    enum:
                    - starter
                    - builder
                    - scale
                    - enterprise
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '503':
          description: API-key service unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
  /api/v1/keys/rotate:
    post:
      tags:
      - Self-service API Keys
      operationId: rotateCurrentApiKey
      summary: Rotate the current API key without changing its balance or key ID
      security:
      - credential: []
      responses:
        '201':
          description: Replacement API key disclosed exactly once. The prior raw key is immediately revoked.
          content:
            application/json:
              schema:
                type: object
                required:
                - apiKey
                - apiKeyId
                - balanceCredits
                - tier
                - disclosure
                properties:
                  apiKey:
                    type: string
                    description: Replacement secret shown once; store it securely.
                  apiKeyId:
                    type: string
                  balanceCredits:
                    type: integer
                    minimum: 0
                  tier:
                    type: string
                    enum:
                    - starter
                    - builder
                    - scale
                    - enterprise
                  disclosure:
                    type: string
        '401':
          description: Missing, invalid, or inactive API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '503':
          description: Key rotation unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
  /api/v1/keys/revoke:
    post:
      tags:
      - Self-service API Keys
      operationId: revokeCurrentApiKey
      summary: Permanently revoke the current API key
      security:
      - credential: []
      responses:
        '200':
          description: Key permanently revoked.
          content:
            application/json:
              schema:
                type: object
                required:
                - revoked
                properties:
                  revoked:
                    const: true
        '401':
          description: Missing, invalid, or inactive API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '503':
          description: Key revocation unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
components:
  schemas:
    ErrorEnvelope:
      type: object
      required:
      - error
      properties:
        error:
          type: object
          required:
          - code
          - message
          properties:
            code:
              type: string
              description: Stable machine-readable error code.
            message:
              type: string
              description: Human-readable explanation.
  securitySchemes:
    credential:
      type: http
      scheme: bearer
      description: MPS client credential (`mhaic_…`), issued once at purchase.