Using the API to create Groups

Last updated: June 25, 2026

Summary

A user was unable to create new groups in Coder via the API and received a 405 Client Error when attempting to POST to /api/v2/groups. The issue was resolved with a configuration change.

 

Solution: Find the Correct API Endpoint

If you receive a 405 Client Error when attempting to create a group using /api/v2/groups, ensure that you are targeting the correct organization-scoped endpoint.

To create a new group via the API:

  1. Identify the organization name (for a standard installation, this is typically default or coder).
  2. Send a POST request to the following endpoint:

    https://dev.coder.com/api/v2/organizations/{org_name}/groups
  3. Include the required authentication headers (for example, an API token) and the necessary JSON payload in the request body.

Using the organization-specific endpoint resolves the 405 Client Error and allows successful group creation.