Search labels

GET {{baseUrl}}/search/labels?repository_id=<integer>&q=<string>&sort=<string>&order=desc

Find labels in a repository with names or descriptions that match search keywords. Returns up to 100 results per page.

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.

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.

Request Params

KeyDatatypeRequiredDescription
repository_idstring(Required) The id of the repository.
qstring(Required) The search keywords. This endpoint does not accept qualifiers in the query. To learn more about the format of the query, see Constructing a search query.
sortstringSorts the results of your query by when the label was created or updated. Default: best match
orderstringDetermines whether the first search result returned is the highest number of matches (desc) or lowest number of matches (asc). This parameter is ignored unless you provide sort.

RESPONSES

status: OK

{&quot;total_count&quot;:2,&quot;incomplete_results&quot;:false,&quot;items&quot;:[{&quot;id&quot;:418327088,&quot;node_id&quot;:&quot;MDU6TGFiZWw0MTgzMjcwODg=&quot;,&quot;url&quot;:&quot;https://api.github.com/repos/octocat/linguist/labels/enhancement&quot;,&quot;name&quot;:&quot;enhancement&quot;,&quot;color&quot;:&quot;84b6eb&quot;,&quot;default&quot;:true,&quot;description&quot;:&quot;New feature or request.&quot;,&quot;score&quot;:1},{&quot;id&quot;:418327086,&quot;node_id&quot;:&quot;MDU6TGFiZWw0MTgzMjcwODY=&quot;,&quot;url&quot;:&quot;https://api.github.com/repos/octocat/linguist/labels/bug&quot;,&quot;name&quot;:&quot;bug&quot;,&quot;color&quot;:&quot;ee0701&quot;,&quot;default&quot;:true,&quot;description&quot;:&quot;Something isn&#39;t working.&quot;,&quot;score&quot;:1}]}