Greptile Query API

Ask natural-language questions over indexed repositories.

Operations 1

POST /query Query repositories in natural language #

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/greptile-query-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

greptile-query-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Greptile Query API
  description: Specification of the Greptile API. Greptile indexes Git repositories into a graph plus embeddings, then answers natural-language questions and searches over that indexed code. Authentication requires a Greptile API key as a Bearer token plus a Git provider token (for GitHub, a GitHub personal access token) supplied in the X-GitHub-Token header so Greptile can read the source.
  termsOfService: https://www.greptile.com/legal/terms
  contact:
    name: Greptile Support
    url: https://docs.greptile.com
    email: support@greptile.com
  version: '2.0'
servers:
- url: https://api.greptile.com/v2
  description: Greptile API v2
security:
- bearerAuth: []
  gitHubToken: []
tags:
- name: Query
  description: Ask natural-language questions over indexed repositories.
paths:
  /query:
    post:
      operationId: queryRepositories
      tags:
      - Query
      summary: Query repositories in natural language
      description: Submits a natural-language question against one or more indexed repositories and returns a synthesized answer plus the source files, functions, and classes used to construct it. Set stream to true to receive the answer incrementally as Server-Sent Events. Set genius to true to use a larger, more accurate model better suited to complex bug diagnosis (billed at a higher per-query rate).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QueryRequest'
      responses:
        '200':
          description: A synthesized answer and supporting sources. When stream is true the response is a text/event-stream of incremental message and source chunks instead of a single JSON object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueryResponse'
            text/event-stream:
              schema:
                type: string
                description: Server-Sent Events stream of message and sources chunks.
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    Source:
      type: object
      description: A relevant source location returned by query or search.
      properties:
        repository:
          type: string
          example: greptileai/greptile
        remote:
          type: string
          example: github
        branch:
          type: string
          example: main
        filepath:
          type: string
          example: src/auth/middleware.ts
        linestart:
          type:
          - integer
          - 'null'
          example: 42
        lineend:
          type:
          - integer
          - 'null'
          example: 88
        summary:
          type: string
          description: Summary of the file's contents and relevance.
    QueryRequest:
      type: object
      required:
      - messages
      - repositories
      properties:
        messages:
          type: array
          description: Conversation history. For a single question this can contain one user message.
          items:
            $ref: '#/components/schemas/Message'
        repositories:
          type: array
          description: One or more indexed repositories to query against.
          items:
            $ref: '#/components/schemas/RepositoryRef'
        sessionId:
          type: string
          description: Opaque session identifier to maintain conversational context across multiple queries.
          example: session-abc-123
        stream:
          type: boolean
          description: Stream the answer as Server-Sent Events.
          default: false
        genius:
          type: boolean
          description: Use a larger, higher-accuracy model. Improves complex reasoning and bug diagnosis at a higher per-query cost.
          default: false
    Error:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
    RepositoryRef:
      type: object
      description: Reference to a specific repository and branch on a Git remote.
      required:
      - remote
      - repository
      properties:
        remote:
          type: string
          description: The Git host the repository lives on.
          enum:
          - github
          - gitlab
          example: github
        repository:
          type: string
          description: Repository in owner/name form.
          example: greptileai/greptile
        branch:
          type: string
          description: Branch to index or query. Defaults to the repository default branch.
          example: main
    Message:
      type: object
      required:
      - role
      - content
      properties:
        id:
          type: string
        role:
          type: string
          enum:
          - user
          - assistant
          - system
          example: user
        content:
          type: string
          example: How is authentication handled in this codebase?
    QueryResponse:
      type: object
      properties:
        message:
          type: string
          description: The synthesized natural-language answer.
        sources:
          type: array
          items:
            $ref: '#/components/schemas/Source'
  responses:
    Unauthorized:
      description: Missing or invalid Greptile API key or Git provider token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Greptile API key supplied as `Authorization: Bearer <GREPTILE_API_KEY>`.'
    gitHubToken:
      type: apiKey
      in: header
      name: X-GitHub-Token
      description: Git provider access token (a GitHub personal access token for GitHub remotes) Greptile uses to read repository source code.