Granite knowledge base API

Retrieval for AI tools (Pro and Business). Granite has no built-in assistant: tools search the knowledge base and get ranked passages with citations, then answer with their own model. Only vaults the caller may read are searched.

GitHub OpenAPI

Operations 5

GET /v1/vaults/{vault_id}/kb/settings Whether the vault and which folders are in the knowledge base #
PUT /v1/vaults/{vault_id}/kb/settings Choose whether the vault and which folders are in the knowledge base #
GET /v1/vaults/{vault_id}/kb/status How far the vault's indexing has got #
POST /v1/vaults/{vault_id}/kb/reindex Index the vault again #
POST /v1/kb/search Search the knowledge base #

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/granite-md:granite-md-knowledge-base-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. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

granite-md-knowledge-base-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Granite knowledge base API
  version: 1.0.0
  summary: REST API for Granite clients, bots, and integrations.
  description: 'Conventions (apply to every operation; see PLAN.md 3.2 and 3.6):


    - **Base URL** `https://api.granite.md`. All public operations live under `/v1`.

    After Phase 6 ships, `/v1` changes are additive only.

    - **Errors** use RFC 9457 problem details (`application/problem+json`, schema `Problem`).

    The `type` URI is `https://granite.md/problems/`; `code` refines it for programmatic handling.

    Every response carries `X-Request-ID`, also echoed as `request_id` in problems.

    - **Pagination** is cursor based. List operations accept `cursor` and `limit` and return

    `{ "items": [...], "next_cursor": "..." }`. `next_cursor` is absent on the last page.

    Cursors are opaque; clients must not parse or build them.

    - **Idempotency**: non-idempotent `POST` operations accept an `Idempotency-Key` header

    (1-255 printable ASCII). Repeating a request with the same key and body within 24 hours

    returns the original response; the same key with a different body returns `409` with

    code `idempotency_key_reused`.

    - **IDs** are UUIDv7 strings. **Timestamps** are RFC 3339 in UTC.

    - **Authentication**: `Authorization: Bearer ` with a session access token,

    a personal API token (`gr_pat_...`), or an OAuth access token. Scopes are listed per operation.

    - **Rate limits**: each personal API token may make 600 requests a minute. Over the limit

    the API answers `429` with code `token_rate_limited` and a `Retry-After` header (seconds).'
  license:
    name: Proprietary
    identifier: LicenseRef-Proprietary
servers:
- url: https://api.granite.md
  description: Production
- url: http://localhost:8080
  description: Local development
security:
- bearerAuth: []
tags:
- name: knowledge base
  description: 'Retrieval for AI tools (Pro and Business). Granite has no built-in assistant: tools

    search the knowledge base and get ranked passages with citations, then answer with

    their own model. Only vaults the caller may read are searched.'
paths:
  /v1/vaults/{vault_id}/kb/settings:
    parameters:
    - $ref: '#/components/parameters/VaultID'
    get:
      operationId: getKBSettings
      tags:
      - knowledge base
      summary: Whether the vault and which folders are in the knowledge base
      description: Vault admins.
      responses:
        '200':
          description: The settings.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KBSettings'
        default:
          $ref: '#/components/responses/Error'
    put:
      operationId: setKBSettings
      tags:
      - knowledge base
      summary: Choose whether the vault and which folders are in the knowledge base
      description: 'Vault admins. Applies at once: an excluded folder''s passages are removed from the index

        in this request, and files that come back in are queued for indexing.'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KBSettings'
      responses:
        '200':
          description: The settings.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KBSettings'
        default:
          $ref: '#/components/responses/Error'
  /v1/vaults/{vault_id}/kb/status:
    parameters:
    - $ref: '#/components/parameters/VaultID'
    get:
      operationId: getKBStatus
      tags:
      - knowledge base
      summary: How far the vault's indexing has got
      description: Vault admins.
      responses:
        '200':
          description: The status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KBStatus'
        default:
          $ref: '#/components/responses/Error'
  /v1/vaults/{vault_id}/kb/reindex:
    parameters:
    - $ref: '#/components/parameters/VaultID'
    post:
      operationId: reindexKB
      tags:
      - knowledge base
      summary: Index the vault again
      description: Vault admins. Queues every file; unchanged files are skipped quickly, failed ones are tried again.
      responses:
        '202':
          description: Queued.
          content:
            application/json:
              schema:
                type: object
                required:
                - queued
                properties:
                  queued:
                    type: integer
        default:
          $ref: '#/components/responses/Error'
  /v1/kb/search:
    post:
      operationId: searchKnowledgeBase
      tags:
      - knowledge base
      summary: Search the knowledge base
      description: 'Ranks note and document passages (chunks split by headings, pages of PDFs) by full-text

        relevance and, when semantic search is enabled, meaning, fused by reciprocal rank.

        Searches every vault the caller may read, or only `vault_ids`. Needs a plan with the

        knowledge base (403 `plan_limit_knowledge_base`); tokens need the `kb:query` scope.

        60 searches a minute per caller (429 `kb_rate_limited`). Files are indexed within a

        minute of a change; `pending` counts files waiting.'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KBSearchRequest'
      responses:
        '200':
          description: Passages, best first.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KBSearchResults'
        default:
          $ref: '#/components/responses/Error'
components:
  headers:
    RequestID:
      description: Identifier of this request, for support and log correlation.
      schema:
        type: string
  schemas:
    KBStatus:
      type: object
      required:
      - available
      - indexed
      - documents
      - chunks
      - pending
      - failures
      properties:
        available:
          type: boolean
          description: The owner's plan and workspace policy include the knowledge base.
        indexed:
          type: boolean
          description: The vault is in the index now.
        documents:
          type: integer
          format: int64
        chunks:
          type: integer
          format: int64
        pending:
          type: integer
          format: int64
          description: Files waiting to be indexed.
        last_indexed_at:
          type: string
          format: date-time
        failures:
          type: array
          description: Up to 20 files missing from the index, and why.
          items:
            type: object
            required:
            - path
            - error
            properties:
              path:
                type: string
              error:
                type: string
    Problem:
      type: object
      description: RFC 9457 problem details.
      required:
      - type
      - title
      - status
      properties:
        type:
          type: string
          format: uri
          examples:
          - https://granite.md/problems/conflict
        title:
          type: string
        status:
          type: integer
          format: int32
        detail:
          type: string
        instance:
          type: string
        code:
          type: string
          description: Machine-readable refinement of `type`, for example `version_conflict`.
        request_id:
          type: string
        errors:
          type: array
          description: Per-field validation errors.
          items:
            $ref: '#/components/schemas/FieldError'
    KBPassage:
      type: object
      required:
      - chunk_id
      - vault_id
      - file_id
      - path
      - title
      - heading_path
      - text
      - score
      properties:
        chunk_id:
          type: string
          format: uuid
        vault_id:
          type: string
          format: uuid
        file_id:
          type: string
          format: uuid
        path:
          type: string
        title:
          type: string
        type:
          type: string
          description: The note's frontmatter type (for example shopify_product), when it has one.
        heading_path:
          type: array
          items:
            type: string
          description: The headings above the passage, outermost first.
        start_line:
          type: integer
          description: First line of the passage in the note (1-based).
        end_line:
          type: integer
        page:
          type: integer
          description: Page of a PDF (1-based).
        text:
          type: string
        score:
          type: number
          format: double
          description: Fused rank score; only the order is meaningful.
    KBSearchRequest:
      type: object
      required:
      - query
      properties:
        query:
          type: string
          minLength: 1
          maxLength: 2000
        vault_ids:
          type: array
          maxItems: 100
          items:
            type: string
            format: uuid
        limit:
          type: integer
          minimum: 1
          maximum: 50
          default: 10
    KBSearchResults:
      type: object
      required:
      - passages
      - pending
      properties:
        passages:
          type: array
          items:
            $ref: '#/components/schemas/KBPassage'
        pending:
          type: integer
          format: int64
          description: Files in the searched vaults waiting to be (re)indexed.
    FieldError:
      type: object
      required:
      - field
      - detail
      properties:
        field:
          type: string
          description: JSON path of the invalid field, for example `ops[2].path`.
        detail:
          type: string
    KBSettings:
      type: object
      required:
      - included
      - excluded_folders
      - exclude_drive
      properties:
        included:
          type: boolean
          description: The vault is in the knowledge base (when the plan includes it).
        excluded_folders:
          type: array
          maxItems: 100
          items:
            type: string
          description: Folders (with everything inside) left out of the knowledge base.
        exclude_drive:
          type: boolean
          description: Leave Google Drive references out.
  parameters:
    VaultID:
      name: vault_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
  responses:
    Error:
      description: Error response.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/RequestID'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Session access token, personal API token, or OAuth access token.