Detecting GitLab plan through the API?

We have a GitLab integration which depends on Group Webhooks, a Premium feature. When installed on a GitLab free plan, the Group Webhooks endpoints behave as expected but events are not being sent, which creates a lot of confusion for our users.

Is there a way with the API to determine whether a GitLab instance is on the Premium plan? This would allow us to fail early rather than give an illusion of success.

Thank you!

Hi,

Well the only thing I managed to find while looking at the Gitlab API docs is this: License | GitLab unfortunately you cannot use that on Gitlab.com but only on self-hosted installations. I guess better than nothing.

There is also this: Namespaces API | GitLab which hints at showing the Gitlab plan for example:

  {
    "id": 1,
    "name": "user1",
    "path": "user1",
    "kind": "user",
    "full_path": "user1",
    "parent_id": null,
    "avatar_url": "https://secure.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
    "web_url": "https://gitlab.example.com/user1",
    "billable_members_count": 1,
    "plan": "default",
    "trial_ends_on": null,
    "trial": false
  },

as you can see plan shows default, so you might want to run that on a few namespaces and compare the results to see if it changes and shows pro/ultimate or whatever.

Your only issue then if that does solve it, is you may need to use the license one for self-hosted, and namespace for Gitlab.com. Eg: if host == gitlab.com use namespace API endpoint, else use license one.

1 Like

Thank you! I didn’t notice the Namespaces API before but this seems to be perfect for this use case.

1 Like