# Check existence of blob


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

API version: 2



`HEAD /v2/{name}/blobs/{digest}`

Check whether a blob (layer or config) exists in the registry.

This is useful before uploading a blob to avoid duplicates.

If the blob is present, the registry returns a `200 OK` response with headers like `Content-Length` and `Docker-Content-Digest`.

If the blob does not exist, the response will be `404 Not Found`.


## Connection and access

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


Server: `https://registry-1.docker.io`

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

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

Replace placeholders and provide the required credentials or request body.

```console
curl \
  --head \
  --header "Authorization: Bearer ${REGISTRY_TOKEN}" \
  --header 'Accept: application/octet-stream' \
  'https://registry-1.docker.io/v2/library%2Fubuntu/blobs/sha256:abc123def4567890...'
```

## Parameters

### name

Location: path. Required: yes.

Name of the Repository

```json
{
  "description": "Name of the Repository",
  "example": "library/ubuntu",
  "in": "path",
  "name": "name",
  "pointer": "/paths/~1v2~1{name}~1blobs~1{digest}/head/parameters/0",
  "required": true,
  "schema": {
    "type": "string"
  }
}
```

### digest

Location: path. Required: yes.

Digest of the blob

```json
{
  "description": "Digest of the blob",
  "example": "sha256:abc123def4567890...",
  "in": "path",
  "name": "digest",
  "pointer": "/paths/~1v2~1{name}~1blobs~1{digest}/head/parameters/1",
  "required": true,
  "schema": {
    "type": "string"
  }
}
```

## Request and responses

### Response 200 

Blob exists

No response content is declared.




Headers:

```json
{
  "Content-Length": {
    "description": "Size of the blob in bytes",
    "example": 32654,
    "schema": {
      "type": "integer"
    }
  },
  "Content-Type": {
    "description": "MIME type of the blob content",
    "example": "application/octet-stream",
    "schema": {
      "type": "string"
    }
  },
  "Docker-Content-Digest": {
    "description": "Digest of the blob",
    "example": "sha256:abc123def4567890...",
    "schema": {
      "type": "string"
    }
  }
}
```



### Response 401 

Authentication required

No response content is declared.






### Response 403 

Access denied

No response content is declared.






### Response 404 

Blob not found

No response content is declared.






### Response 429 

Too many requests

No response content is declared.






## Complete operation contract

```json
{
  "description": "Check whether a blob (layer or config) exists in the registry.\n\nThis is useful before uploading a blob to avoid duplicates.\n\nIf the blob is present, the registry returns a `200 OK` response with headers like `Content-Length` and `Docker-Content-Digest`.\n\nIf the blob does not exist, the response will be `404 Not Found`.\n",
  "operationId": "CheckBlobExists",
  "parameters": [
    {
      "description": "Name of the Repository",
      "example": "library/ubuntu",
      "in": "path",
      "name": "name",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "Digest of the blob",
      "example": "sha256:abc123def4567890...",
      "in": "path",
      "name": "digest",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Blob exists",
      "headers": {
        "Content-Length": {
          "description": "Size of the blob in bytes",
          "example": 32654,
          "schema": {
            "type": "integer"
          }
        },
        "Content-Type": {
          "description": "MIME type of the blob content",
          "example": "application/octet-stream",
          "schema": {
            "type": "string"
          }
        },
        "Docker-Content-Digest": {
          "description": "Digest of the blob",
          "example": "sha256:abc123def4567890...",
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "401": {
      "description": "Authentication required"
    },
    "403": {
      "description": "Access denied"
    },
    "404": {
      "description": "Blob not found"
    },
    "429": {
      "description": "Too many requests"
    }
  },
  "summary": "Check existence of blob",
  "tags": [
    "Blobs"
  ],
  "x-codeSamples": [
    {
      "label": "cURL",
      "lang": "Bash",
      "source": "# HEAD to check if a blob exists\ncurl -I \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  https://registry-1.docker.io/v2/library/ubuntu/blobs/sha256:abc123...\n"
    }
  ]
}
```

## Referenced schemas




