---
title: "Get a CodeQL database for a repository"
method: GET
path: "/repos/{owner}/{repo}/code-scanning/codeql/databases/{language}"
tags: ["code-scanning"]
---

# Get a CodeQL database for a repository

`GET /repos/{owner}/{repo}/code-scanning/codeql/databases/{language}`

Gets a CodeQL database for a language in a repository.

By default this endpoint returns JSON metadata about the CodeQL database. To
download the CodeQL database binary content, set the `Accept` header of the request
to [`application/zip`](https://docs.github.com/enterprise-cloud@latest/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types), and make sure
your HTTP client is configured to follow redirects or use the `Location` header
to make a second request to get the redirect URL.

OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with private or public repositories, or the `public_repo` scope to use this endpoint with only public repositories.

## Path parameters

- `owner` string, required
- `repo` string, required
- `language` string, required

## Response `200`

Response

- CodeScanningCodeqlDatabase — A CodeQL database.
  - `id` integer, required — The ID of the CodeQL database.
  - `name` string, required — The name of the CodeQL database.
  - `language` string, required — The language of the CodeQL database.
  - `uploader` SimpleUser, required — A GitHub user.
    - `name` string, nullable
    - `email` string, nullable
    - `login` string, required
    - `id` integer, required
    - `node_id` string, required
    - `avatar_url` string, uri, required
    - `gravatar_id` string, nullable, required
    - `url` string, uri, required
    - `html_url` string, uri, required
    - `followers_url` string, uri, required
    - `following_url` string, required
    - `gists_url` string, required
    - `starred_url` string, required
    - `subscriptions_url` string, uri, required
    - `organizations_url` string, uri, required
    - `repos_url` string, uri, required
    - `events_url` string, required
    - `received_events_url` string, uri, required
    - `type` string, required
    - `site_admin` boolean, required
    - `starred_at` string
    - `user_view_type` string
  - `content_type` string, required — The MIME type of the CodeQL database file.
  - `size` integer, required — The size of the CodeQL database file in bytes.
  - `created_at` string, date-time, required — The date and time at which the CodeQL database was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ.
  - `updated_at` string, date-time, required — The date and time at which the CodeQL database was last updated, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ.
  - `url` string, uri, required — The URL at which to download the CodeQL database. The `Accept` header must be set to the value of the `content_type` property.
  - `commit_oid` string, nullable — The commit SHA of the repository at the time the CodeQL database was created.

## Other responses

- `302` — Found
- `403` — Response if GitHub Advanced Security is not enabled for this repository
- `404` — Resource not found
- `503` — Service unavailable

---

[API](https://skmtc.net/github/apis/github-v3-rest-api-3.md) · [All operations](https://skmtc.net/github/apis/github-v3-rest-api-3/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/github-v3-rest-api-3/versions/dc0584ac4e13/schema)
