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

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

Examples

  1. “Code to provision new API keys”
  2. “Functions that use recursion”
  3. “Code that touches session management in any way”

Authorizations

Authorization
string
headerrequired

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

X-GitHub-Token
string
headerrequired

Body

application/json
query
string

Natural language search query to find the right code in the repo.

repositories
object[]

List of repos that Greptile should reference while answering your question.

sessionId
string

Optional, defaults to a new session. You only need this if you want to retrieve this query/response later.

stream
boolean

Optional, default false.

Response

200 - application/json
repository
string

The name of the repository where the file resides.

remote
string

The remote service or platform where the repository is hosted.

branch
string

The branch of the repository where the file is found.

filepath
string

The relative path to the file within the repository.

linestart
integer | null

The starting line number of the code that is relevant, if applicable.

lineend
integer | null

The ending line number of the code that is relevant, if applicable.

summary
string

A summary or description of the contents and functionalities of the file.