# Create a new group


[API catalog](/reference/api/) · [Docker Hub overview](/reference/api/hub/latest/) · [Product manual](https://docs.docker.com/docker-hub/) · [OpenAPI specification](/reference/api/hub/latest.yaml)

API version: 2-beta



`POST /v2/orgs/{org_name}/groups`

Create a new group within an organization.

This operation accepts bearer tokens issued from organization access tokens (OATs). The token must have the required resource access and scopes.


## Connection and access

[API connection and authentication guidance](/reference/api/hub/latest/#authentication)


Server: `https://hub.docker.com`

Effective security: alternatives are OR; schemes within an alternative are AND. An empty array declares no HTTP authentication requirement.

```json
[
  {
    "bearerAuth": []
  }
]
```
## Example request

Replace placeholders and provide the required credentials or request body.

```console
curl \
  --request POST \
  --header "Authorization: Bearer ${TOKEN}" \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "description": "Development team",
  "name": "developers"
}' \
  'https://hub.docker.com/v2/orgs/myorganization/groups'
```

## Parameters

### org_name

Location: path. Required: yes.

Name of the organization (namespace).

```json
{
  "description": "Name of the organization (namespace).",
  "example": "myorganization",
  "in": "path",
  "name": "org_name",
  "pointer": "/paths/~1v2~1orgs~1{org_name}~1groups/parameters/0",
  "required": true,
  "schema": {
    "type": "string"
  }
}
```

## Request and responses

### Request  application/json




Schema:

```json
{
  "examples": [
    {
      "description": "Development team",
      "name": "developers"
    }
  ],
  "properties": {
    "description": {
      "type": "string"
    },
    "name": {
      "type": "string"
    }
  },
  "required": [
    "name"
  ]
}
```




Schema example:
```json
{
  "description": "Development team",
  "name": "developers"
}
```


### Response 201 application/json

Group created successfully


Schema:

```json
{
  "$ref": "#/components/schemas/org_group"
}
```




Schema example:
```json
{
  "description": "Development team",
  "id": 10,
  "member_count": 1,
  "name": "developers",
  "role": "member",
  "uuid": "e36eca69-4cc8-4f17-9845-ae8c2b832691"
}
```


### Response 400 application/json

Bad Request


Schema:

```json
{
  "$ref": "#/components/schemas/error"
}
```




error:
```json
{
  "errinfo": null,
  "message": "bad request"
}
```


### Response 401 application/json

Unauthorized


Schema:

```json
{
  "$ref": "#/components/schemas/error"
}
```




error:
```json
{
  "errinfo": null,
  "message": "unauthorized"
}
```


### Response 403 application/json

Forbidden


Schema:

```json
{
  "$ref": "#/components/schemas/error"
}
```




error:
```json
{
  "errinfo": null,
  "message": "permission denied"
}
```


## Complete operation contract

```json
{
  "description": "Create a new group within an organization.\n\nThis operation accepts bearer tokens issued from organization access tokens (OATs). The token must have the required resource access and scopes.\n",
  "operationId": "postV2OrgsByOrgNameGroups",
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "examples": [
            {
              "description": "Development team",
              "name": "developers"
            }
          ],
          "properties": {
            "description": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "name"
          ]
        }
      }
    }
  },
  "responses": {
    "201": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/org_group"
          }
        }
      },
      "description": "Group created successfully"
    },
    "400": {
      "$ref": "#/components/responses/bad_request"
    },
    "401": {
      "$ref": "#/components/responses/unauthorized"
    },
    "403": {
      "$ref": "#/components/responses/forbidden"
    }
  },
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "summary": "Create a new group",
  "tags": [
    "groups"
  ]
}
```

## Referenced schemas

- `#/components/responses/bad_request`

- `#/components/responses/forbidden`

- `#/components/responses/unauthorized`

- [#/components/schemas/org_group](/reference/api/hub/latest/schemas/org_group/)




