POST
/
query
curl --request POST \
  --url https://api.greptile.com/v2/query \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-GitHub-Token: <api-key>' \
  --data '{
  "messages": [
    {
      "id": "<string>",
      "content": "<string>",
      "role": "<string>"
    }
  ],
  "repositories": [
    {
      "remote": "<string>",
      "branch": "<string>",
      "repository": "<string>"
    }
  ],
  "sessionId": "<string>",
  "stream": true,
  "genius": true
}'
{
  "message": "<string>",
  "sources": [
    {
      "repository": "<string>",
      "remote": "<string>",
      "branch": "<string>",
      "filepath": "<string>",
      "linestart": 123,
      "lineend": 123,
      "summary": "<string>"
    }
  ]
}

Submit a natural language query about the codebase, get a natural language answer with a list of relevant code references (filepaths, line numbers, etc)

  1. “How does auth work in this codebase?”
  2. “Generate a description for the JIRA ticket with codebase context”
  3. “Rewrite this code snippet using relevant abstractions already in the repo”

Note: Before Greptile can query a repo, it must be indexed. See Index Repository for more information.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

X-GitHub-Token
string
header
required

Body

application/json

Response

200 - application/json

Query executed successfully. Response may be streamed.

The response is of type object.