List group plan gitlab api

Viewed 31

I'm allowing GitLab users to add my integration to their Groups.

My service need to subscribe to the Groups webhooks, but on a free tier Groups webhooks are not enable so I want to subscribe to Project hooks in that case.

My question: Is there any way to look at a group plan? To know if he is on a free or a paid/trial tier?

So far I've looked at the Licence API (which is only for self managed) and the Group api. I'm surprised this endpoint: GET /groups/:id isn't providing this information.

Any pointers would be appreciated.

1 Answers

With administrator credentials (self-managed only) you can use the license endpoint to get the default plan for the instance, as you mentioned in your question.

Without an admin token, this is somewhat harder.

On gitlab.com, you can also use the namespaces API to get plan information for a particular namespace. You'll see a plan field in the response. For example:

[
  {
    "id": 123,
    "name": "mynamespace",
    "plan": "silver",
    ...
  }
]

There are several values that can possibly come back for plan. If it says default, that means no subscription is applied to the namespace and has the default plan for the instance -- this will likely be the case for all namespaces in a self-managed gitlab instance.

If you don't have admin API access and need to figure out the subscription level of a self-managed instance, the next-best way you can handle this is to just try to use API endpoints that are exclusive to particular subscription levels to determine what features are available.

Related