Share feedback
Answers are generated based on the documentation.

Assign a group (Team) to a repository for access

POST/v2/repositories/{namespace}/{repository}/groups

Assigns an organization group (team) to a repository with a specified permission level.

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

https://hub.docker.com — Docker HUB API

Use one of these alternatives. Requirements within an alternative apply together.

  • bearerAuth

Parameters

namespace path Required

Namespace of the repository, such as a user or organization name.

Type: string

All schema constraints and annotations
{
  "type": "string"
}

repository path Required

Name of the repository within the namespace.

Type: string

All schema constraints and annotations
{
  "type": "string"
}

Request and responses

Request

application/json

Schema: RepositoryGroupCreationRequest

Example

{
  "group_id": 12345,
  "permission": "write"
}

Response 200

Repository group permission created successfully

application/json

Schema: RepositoryGroup

Example

{
  "group_id": 12345,
  "group_name": "developers",
  "permission": "write"
}

Response 400

Bad Request - Invalid request parameters

application/json

Schema: error

error

{
  "errinfo": null,
  "message": "bad request"
}

Response 401

Unauthorized

application/json

Schema: error

error

{
  "errinfo": null,
  "message": "unauthorized"
}

Response 403

Forbidden

application/json

Schema: error

error

{
  "errinfo": null,
  "message": "permission denied"
}

Response 404

Not Found

application/json

Schema: error

error

{
  "errinfo": null,
  "message": "not found"
}

Referenced schemas

#/components/schemas/RepositoryGroup

#/components/schemas/RepositoryGroupCreationRequest

#/components/schemas/error

Complete operation contract
{
  "description": "Assigns an organization group (team) to a repository with a specified permission level.\n\nThis operation accepts bearer tokens issued from organization access tokens (OATs). The token must have the required resource access and scopes.\n",
  "operationId": "CreateRepositoryGroup",
  "requestBody": {
    "content": {
      "application/json": {
        "example": {
          "group_id": 12345,
          "permission": "write"
        },
        "schema": {
          "$ref": "#/components/schemas/RepositoryGroupCreationRequest"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "example": {
            "group_id": 12345,
            "group_name": "developers",
            "permission": "write"
          },
          "schema": {
            "$ref": "#/components/schemas/RepositoryGroup"
          }
        }
      },
      "description": "Repository group permission created successfully"
    },
    "400": {
      "content": {
        "application/json": {
          "examples": {
            "error": {
              "summary": "Example error response",
              "value": {
                "errinfo": null,
                "message": "bad request"
              }
            }
          },
          "schema": {
            "$ref": "#/components/schemas/error"
          }
        }
      },
      "description": "Bad Request - Invalid request parameters"
    },
    "401": {
      "$ref": "#/components/responses/unauthorized"
    },
    "403": {
      "$ref": "#/components/responses/forbidden"
    },
    "404": {
      "$ref": "#/components/responses/NotFound"
    }
  },
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "summary": "Assign a group (Team) to a repository for access",
  "tags": [
    "repositories"
  ]
}