Update access token Run in API Explorer

PATCH /v2/orgs/{org_name}/access-tokens/{access_token_id}

Update a specific access token for an organization.

Path parameters

  • org_name string Required

    Name of the organization (namespace).

  • access_token_id string Required

    The ID of the access token to retrieve

application/json

Body Required

  • label string

    Label for the access token

  • description string

    Description of the access token

  • resources array[object]

    Resources this token has access to

    Hide resources attributes Show resources attributes object
    • type string

      The type of resource

      Values are TYPE_REPO or TYPE_ORG.

    • path string

      The path of the resource. The format of this will change depending on the type of resource.

    • scopes array[string]

      The scopes this token has access to

  • is_active boolean

    Whether the token is active

Responses

  • 200 application/json

    OK

    Hide response attributes Show response attributes object
    • id string
    • label string
    • created_by string
    • is_active boolean
    • created_at string(date-time)
    • expires_at string(date-time) | null
    • last_used_at string(date-time) | null
    • resources array[object]

      Resources this token has access to

      Hide resources attributes Show resources attributes object
      • type string

        The type of resource

        Values are TYPE_REPO or TYPE_ORG.

      • path string

        The path of the resource. The format of this will change depending on the type of resource.

      • scopes array[string]

        The scopes this token has access to

  • 401 application/json

    Unauthorized

    Hide response attributes Show response attributes object
    • detail string
    • message string
  • 403 application/json

    Forbidden

    Hide response attributes Show response attributes object
    • detail string
    • message string
  • 404 application/json

    Not Found

    Hide response attributes Show response attributes object
    • detail string
    • message string
PATCH /v2/orgs/{org_name}/access-tokens/{access_token_id}
curl \
 --request PATCH 'https://hub.docker.com/v2/orgs/myorganization/access-tokens/a7a5ef25-8889-43a0-8cc7-f2a94268e861' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{"label":"My organization token","description":"Token for CI/CD pipeline","resources":[{"type":"TYPE_REPO","path":"myorg/myrepo","scopes":["repo-pull"]}],"is_active":true}'
Request examples
{
  "label": "My organization token",
  "description": "Token for CI/CD pipeline",
  "resources": [
    {
      "type": "TYPE_REPO",
      "path": "myorg/myrepo",
      "scopes": [
        "repo-pull"
      ]
    }
  ],
  "is_active": true
}
Response examples (200)
{
  "id": "a7a5ef25-8889-43a0-8cc7-f2a94268e861",
  "label": "My organization token",
  "created_by": "johndoe",
  "is_active": true,
  "created_at": "2022-05-20T00:54:18Z",
  "expires_at": "2023-05-20T00:54:18Z",
  "last_used_at": "2022-06-15T12:30:45Z",
  "resources": [
    {
      "type": "TYPE_REPO",
      "path": "myorg/myrepo",
      "scopes": [
        "repo-pull"
      ]
    }
  ]
}
Response examples (401)
{
  "detail": "string",
  "message": "string"
}
Response examples (403)
{
  "detail": "string",
  "message": "string"
}
Response examples (404)
{
  "detail": "string",
  "message": "string"
}