{"meta":{"title":"REST API endpoints for gitignore","intro":"Use the REST API to get .gitignore templates that can be used to ignore files and directories.","product":"REST API","breadcrumbs":[{"href":"/en/rest","title":"REST API"},{"href":"/en/rest/gitignore","title":"Gitignore"},{"href":"/en/rest/gitignore/gitignore","title":"Gitignore"}],"documentType":"article"},"body":"# REST API endpoints for gitignore\n\nUse the REST API to get .gitignore templates that can be used to ignore files and directories.\n\n## About gitignore\n\nWhen you create a new repository on GitHub via the API, you can specify a [.gitignore template](/en/get-started/git-basics/ignoring-files) to apply to the repository upon creation. You can use the REST API to get .gitignore templates from the GitHub [.gitignore repository](https://github.com/github/gitignore).\n\n> \\[!NOTE]\n> 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.\n\n## Get all gitignore templates\n\n```\nGET /gitignore/templates\n```\n\nList all templates available to pass as an option when creating a repository.\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **304** - Not modified\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/gitignore/templates\n```\n\n**Response schema (Status: 200):**\n\nArray of string\n\n## Get a gitignore template\n\n```\nGET /gitignore/templates/{name}\n```\n\nGet the content of a gitignore template.\nThis endpoint supports the following custom media types. For more information, see \"Media types.\"\n\napplication/vnd.github.raw+json: Returns the raw .gitignore contents.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`name`** (string) (required)\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **304** - Not modified\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/gitignore/templates/NAME\n```\n\n**Response schema (Status: 200):**\n\n* `name`: required, string\n* `source`: required, string"}