# Pontos de extremidade da API REST para gitignore

Use a API REST para obter modelos .gitignore que podem ser usados para ignorar arquivos e diretórios.

## Sobre o gitignore

Quando você cria um novo repositório no GitHub por meio da API, você pode especificar um [modelo .gitignore](/pt/enterprise-server@3.22/get-started/git-basics/ignoring-files) para aplicá-lo ao repositório após a criação. É possível usar a API REST para acessar modelos .gitignore no [repositório .gitignore](https://github.com/github/gitignore) do GitHub.

> \[!NOTE]
> Most endpoints use `Authorization: Bearer <YOUR-TOKEN>` and `Accept: application/vnd.github+json` headers, plus `X-GitHub-Api-Version: 2026-03-10`. Curl examples below omit these standard headers for brevity.

## Get all gitignore templates

```
GET /gitignore/templates
```

List all templates available to pass as an option when creating a repository.

### HTTP response status codes

* **200** - OK

* **304** - Not modified

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X GET \
  http(s)://HOSTNAME/api/v3/gitignore/templates
```

**Response schema (Status: 200):**

Array of string

## Get a gitignore template

```
GET /gitignore/templates/{name}
```

Get the content of a gitignore template.
This endpoint supports the following custom media types. For more information, see "Media types."

application/vnd.github.raw+json: Returns the raw .gitignore contents.

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and query parameters

* **`name`** (string) (required)

### HTTP response status codes

* **200** - OK

* **304** - Not modified

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X GET \
  http(s)://HOSTNAME/api/v3/gitignore/templates/NAME
```

**Response schema (Status: 200):**

* `name`: required, string
* `source`: required, string