---
title: API reference: Repositories
description: List, create, read, and update repositories with the GitLite REST API.
url: https://pr-1-12825562dfc9.thally.app/api/repositories
lastVerified: 2026-09-15T00:00:00.000Z
verifiedVersion: GitLite 1.27.3
---

# API reference: Repositories

List, create, read, and update repositories with the GitLite REST API.

All endpoints on this page are relative to `http://localhost:3000/api/v1` and
require an access token in the `Authorization` header, set up as `GITLITE_AUTH` in
[Authentication](/authentication).

| Method | Path | Operation | Scope |
| --- | --- | --- | --- |
| `GET` | `/user/repos` | List your repositories | `read:user` and `read:repository` |
| `POST` | `/user/repos` | Create a repository | `read:user` and `write:repository` |
| `GET` | `/repos/{owner}/{repo}` | Get a repository | `read:repository` |
| `PATCH` | `/repos/{owner}/{repo}` | Edit a repository | `write:repository` |
| `DELETE` | `/repos/{owner}/{repo}` | Delete a repository | `write:repository` |

The examples use a repository named `hello-gitlite` owned by the user in
`GITLITE_USER`.

## List your repositories

`GET /user/repos`

| Query parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `page` | integer | `1` | Page number. |
| `limit` | integer | server default | Page size, capped at the server maximum. See [Pagination](/pagination) for both values. |

Returns `200` with an array of `Repository` objects. The response carries
`X-Total-Count` and, when there is more than one page, `Link`.

#### curl

    ```bash
    curl -s "http://localhost:3000/api/v1/user/repos?limit=5" \
      -H "Authorization: $GITLITE_AUTH"
    ```

#### JavaScript

    ```js
    const res = await fetch('http://localhost:3000/api/v1/user/repos?limit=5', {
      headers: { Authorization: process.env.GITLITE_AUTH },
    })
    const repos = await res.json()
    console.log(res.headers.get('x-total-count'), repos.map((r) => r.full_name))
    ```

## Create a repository

`POST /user/repos`

| Body field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes | Repository name, unique for the owner. |
| `description` | string | no | Short description. |
| `private` | boolean | no | Whether the repository is private. Defaults to `false`. |
| `auto_init` | boolean | no | Create an initial commit with a README. |
| `default_branch` | string | no | Default branch name when `auto_init` is `true`. |

| Status | Meaning |
| --- | --- |
| `201` | Repository created. |
| `409` | A repository with the same name already exists. |
| `422` | Validation failed, for example an invalid name. |

#### curl

    ```bash
    curl -s -X POST http://localhost:3000/api/v1/user/repos \
      -H "Authorization: $GITLITE_AUTH" \
      -H "Content-Type: application/json" \
      -d '{"name": "reference-repo", "description": "Created from the API reference", "private": true}'
    ```

#### JavaScript

    ```js
    const res = await fetch('http://localhost:3000/api/v1/user/repos', {
      method: 'POST',
      headers: {
        Authorization: process.env.GITLITE_AUTH,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({ name: 'reference-repo-js', private: true }),
    })
    console.log(res.status, (await res.json()).full_name)
    ```

## Get a repository

`GET /repos/{owner}/{repo}`

Returns `200` with a `Repository` object, or `404` when the repository does not
exist or your token cannot see it.

#### curl

    ```bash
    curl -s "http://localhost:3000/api/v1/repos/$GITLITE_USER/hello-gitlite" \
      -H "Authorization: $GITLITE_AUTH"
    ```

#### JavaScript

    ```js
    const owner = process.env.GITLITE_USER
    const res = await fetch(`http://localhost:3000/api/v1/repos/${owner}/hello-gitlite`, {
      headers: { Authorization: process.env.GITLITE_AUTH },
    })
    const repo = await res.json()
    console.log(res.status, repo.full_name, repo.default_branch)
    ```

## Edit a repository

`PATCH /repos/{owner}/{repo}`

Send only the fields you want to change, such as `description`, `private`,
`website`, `default_branch`, `has_issues`, or `archived`. Returns `200` with the
updated `Repository`.

#### curl

    ```bash
    curl -s -X PATCH "http://localhost:3000/api/v1/repos/$GITLITE_USER/hello-gitlite" \
      -H "Authorization: $GITLITE_AUTH" \
      -H "Content-Type: application/json" \
      -d '{"description": "Updated from the API"}'
    ```

#### JavaScript

    ```js
    const owner = process.env.GITLITE_USER
    const res = await fetch(`http://localhost:3000/api/v1/repos/${owner}/hello-gitlite`, {
      method: 'PATCH',
      headers: {
        Authorization: process.env.GITLITE_AUTH,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({ website: 'https://example.com' }),
    })
    console.log(res.status, (await res.json()).website)
    ```

## Delete a repository

`DELETE /repos/{owner}/{repo}` returns `204` with an empty body. Deletion is
permanent and removes the Git data, issues, and wiki.

#### curl

    ```bash
    curl -s -o /dev/null -w "%{http_code}\n" -X DELETE \
      "http://localhost:3000/api/v1/repos/$GITLITE_USER/reference-repo" \
      -H "Authorization: $GITLITE_AUTH"
    ```

#### JavaScript

    ```js
    const owner = process.env.GITLITE_USER
    const res = await fetch(`http://localhost:3000/api/v1/repos/${owner}/reference-repo-js`, {
      method: 'DELETE',
      headers: { Authorization: process.env.GITLITE_AUTH },
    })
    console.log(res.status)
    ```