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:
- Identify the organization name (for a standard installation, this is typically
defaultorcoder). Send a
POSTrequest to the following endpoint:https://dev.coder.com/api/v2/organizations/{org_name}/groups- 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.