---
title: "Search labels"
method: GET
path: "/search/labels"
tags: ["search"]
---

# Search labels

`GET /search/labels`

Find labels in a repository with names or descriptions that match search keywords. Returns up to 100 results [per page](https://docs.github.com/enterprise-server@3.8/rest/guides/using-pagination-in-the-rest-api).

When searching for labels, you can get text match metadata for the label **name** and **description** fields when you pass the `text-match` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/enterprise-server@3.8/rest/search/search#text-match-metadata).

For example, if you want to find labels in the `linguist` repository that match `bug`, `defect`, or `enhancement`. Your query might look like this:

`q=bug+defect+enhancement&repository_id=64778136`

The labels that best match the query appear first in the search results.

## Query parameters

- `repository_id` integer, required
- `q` string, required
- `sort` 'created' | 'updated'
- `order` 'desc' | 'asc'
- `per_page` integer
- `page` integer

## Response `200`

Response

- object
  - `total_count` integer, required
  - `incomplete_results` boolean, required
  - `items` LabelSearchResultItem[], required
    - `id` integer, required
    - `node_id` string, required
    - `url` string, uri, required
    - `name` string, required
    - `color` string, required
    - `default` boolean, required
    - `description` string, nullable, required
    - `score` number, required
    - `text_matches` object[]
      - `object_url` string
      - `object_type` string, nullable
      - `property` string
      - `fragment` string
      - `matches` object[]
        - `text` string
        - `indices` integer[]

## Other responses

- `304` — Not modified
- `403` — Forbidden
- `404` — Resource not found
- `422` — Validation failed, or the endpoint has been spammed.

---

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