How to get total label count with GitLab API

My team has a big project with over 100 labels, so
I’m trying to show a progress bar for fetching labels from a GitLab repo via the API
The problem is, that I don’t know how to fetch the total label count, before fetching
all the labels.

I checked the API docs, but I found only how to get the issues connected to a label.
If anyone has a link or an idea, please share.

You can fetch the labels associated with a project which are paginated.

However, I don’t think there’s a way to get the number of labels without also fetching the labels themselves.

1 Like

I would try with /labels?per_page=1

and then in the first read header:
x-total: ZZZ
x-total-pages: ZZZ
these two fields should give total number of labels