- “How does auth work in this codebase?”
- “Generate a comment for this PR with codebase context”
- “How would I add pagination to the
/retrieve
endpoint?”
- Integrate with Slack to answer codebase questions.
- Integrate with Sentry to enrich alerts with codebase context, diagnoses, and resolution steps.
- Integrate with GitHub to review PRs and comment on new issues.
Order of Operations
1
Index repo(s)
Use
POST /repositories
to submit a repo to get indexed.2
Query repos
Use
POST /query
to query the repo or repos in natural language and get back an answer and a list of relevant files, functions, classes etc.3
Search repos
Optionally, use
POST /search
to search the repo or repos in natural language and get back just the list of relevant files, functions, classes etc., not the answer.Base URL
The base URL for all API requests ishttps://api.greptile.com/v2/
.
Authentication
Two tokens are required: Greptile API key: Include the API key in the request header:Authorization: Bearer <API_KEY>
.
You can get your API key here.
GitHub Token:
Include this header with your GitHub/Gitlab access token for operations requiring GitHub access:
X-GitHub-Token: <GITHUB_TOKEN>
.
Note: The read permissions on the GitHub/GitLab token determine which repos Greptile can reference in its answers.