# Tag an image


[API catalog](/reference/api/) · [Docker Engine overview](/reference/api/engine/version/v1.57/) · [Product manual](https://docs.docker.com/engine/) · [OpenAPI specification](/reference/api/engine/version/v1.57.yaml)

API version: 1.57





`POST /images/{name}/tag`

Create a tag that refers to a source image.

This creates an additional reference (tag) to the source image. The tag
can include a different repository name and/or tag. If the repository
or tag already exists, it will be overwritten.


## Connection and access

[API connection and authentication guidance](/reference/api/engine/version/v1.57/#connection)


Server: `/v1.57`

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

```json
null
```

## Example request

Replace placeholders and provide the required credentials or request body.

```console
curl \
  --request POST \
  --unix-socket "${DOCKER_SOCKET:-/var/run/docker.sock}" \
  --header 'Accept: application/json' \
  'http://localhost/v1.57/images/<NAME>/tag'
```



## Parameters

### name

Location: path. Required: yes.

Image name or ID to tag.

```json
{
  "description": "Image name or ID to tag.",
  "in": "path",
  "name": "name",
  "pointer": "/paths/~1images~1{name}~1tag/post/parameters/0",
  "required": true,
  "schema": {
    "type": "string"
  }
}
```

### repo

Location: query. Required: no.

The repository to tag in. For example, `someuser/someimage`.

```json
{
  "description": "The repository to tag in. For example, `someuser/someimage`.",
  "in": "query",
  "name": "repo",
  "pointer": "/paths/~1images~1{name}~1tag/post/parameters/1",
  "schema": {
    "type": "string"
  }
}
```

### tag

Location: query. Required: no.

The name of the new tag.

```json
{
  "description": "The name of the new tag.",
  "in": "query",
  "name": "tag",
  "pointer": "/paths/~1images~1{name}~1tag/post/parameters/2",
  "schema": {
    "type": "string"
  }
}
```

## Request and responses

### Response 201 application/json

No error











### Response 201 text/plain

No error











### Response 400 application/json

Bad parameter


Schema:

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









Schema example:
```json
{
  "message": "Something went wrong."
}
```


### Response 404 application/json

No such image


Schema:

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









Schema example:
```json
{
  "message": "Something went wrong."
}
```


### Response 409 application/json

Conflict


Schema:

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









Schema example:
```json
{
  "message": "Something went wrong."
}
```


### Response 500 application/json

Server error


Schema:

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









Schema example:
```json
{
  "message": "Something went wrong."
}
```


## Complete operation contract

```json
{
  "description": "Create a tag that refers to a source image.\n\nThis creates an additional reference (tag) to the source image. The tag\ncan include a different repository name and/or tag. If the repository\nor tag already exists, it will be overwritten.\n",
  "operationId": "ImageTag",
  "parameters": [
    {
      "description": "Image name or ID to tag.",
      "in": "path",
      "name": "name",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "The repository to tag in. For example, `someuser/someimage`.",
      "in": "query",
      "name": "repo",
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "The name of the new tag.",
      "in": "query",
      "name": "tag",
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "201": {
      "content": {
        "application/json": {},
        "text/plain": {}
      },
      "description": "No error"
    },
    "400": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "Bad parameter"
    },
    "404": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "No such image"
    },
    "409": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "Conflict"
    },
    "500": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "Server error"
    }
  },
  "summary": "Tag an image",
  "tags": [
    "Image"
  ]
}
```

## Referenced schemas

- [#/components/schemas/ErrorResponse](/reference/api/engine/version/v1.57/schemas/ErrorResponse/)




