> **Note**: This section is still under construction. For the purposes of
> implementation, if any details below differ from the described request flows
> above, the section below should be corrected. When they match, this note
> should be removed.
The behavior of the endpoints are covered in detail in this section, organized
by route and entity. All aspects of the request and responses are covered,
including headers, parameters and body formats. Examples of requests and their
corresponding responses, with success and failure, are enumerated.
> **Note**: The sections on endpoint detail are arranged with an example
> request, a description of the request, followed by information about that
> request.
A list of methods and URIs are covered in the table below:
|Method|Path|Entity|Description|
-------|----|------|------------
| GET | `/v2/` | Base | Check that the endpoint implements Docker Registry API V2. |
| GET | `/v2/<name>/tags/list` | Tags | Fetch the tags under the repository identified by `name`. |
| GET | `/v2/<name>/manifests/<tag>` | Manifest | Fetch the manifest identified by `name` and `tag`. |
| PUT | `/v2/<name>/manifests/<tag>` | Manifest | Put the manifest identified by `name` and `tag`. |
| DELETE | `/v2/<name>/manifests/<tag>` | Manifest | Delete the manifest identified by `name` and `tag`. |
| GET | `/v2/<name>/blobs/<digest>` | Blob | Retrieve the blob from the registry identified by `digest`. |
| HEAD | `/v2/<name>/blobs/<digest>` | Blob | Check if the blob is known to the registry. |
| POST | `/v2/<name>/blobs/uploads/` | Intiate Blob Upload | Initiate a resumable blob upload. If successful, an upload location will be provided to complete the upload. Optionally, if the `digest` parameter is present, the request body will be used to complete the upload in a single request. |
| GET | `/v2/<name>/blobs/uploads/<uuid>` | Blob Upload | Retrieve status of upload identified by `uuid`. The primary purpose of this endpoint is to resolve the current status of a resumable upload. |
| HEAD | `/v2/<name>/blobs/uploads/<uuid>` | Blob Upload | Retrieve status of upload identified by `uuid`. This is identical to the GET request. |
| PATCH | `/v2/<name>/blobs/uploads/<uuid>` | Blob Upload | Upload a chunk of data for the specified upload. |
| PUT | `/v2/<name>/blobs/uploads/<uuid>` | Blob Upload | Complete the upload specified by `uuid`, optionally appending the body as the final chunk. |
| DELETE | `/v2/<name>/blobs/uploads/<uuid>` | Blob Upload | Cancel outstanding upload processes, releasing associated resources. If this is not called, the unfinished uploads will eventually timeout. |
The detail for each endpoint is covered in the following sections.
### Errors
The error codes encountered via the API are enumerated in the following table:
|Code|Message|Description|
-------|----|------|------------
`UNKNOWN` | unknown error | Generic error returned when the error does not have an API classification.
`UNAUTHORIZED` | access to the requested resource is not authorized | The access controller denied access for the operation on a resource. Often this will be accompanied by a 401 Unauthorized response status.
`DIGEST_INVALID` | provided digest did not match uploaded content | When a blob is uploaded, the registry will check that the content matches the digest provided by the client. The error may include a detail structure with the key "digest", including the invalid digest string. This error may also be returned when a manifest includes an invalid layer digest.
`SIZE_INVALID` | provided length did not match content length | When a layer is uploaded, the provided size will be checked against the uploaded content. If they do not match, this error will be returned.
`NAME_INVALID` | manifest name did not match URI | During a manifest upload, if the name in the manifest does not match the uri name, this error will be returned.
`TAG_INVALID` | manifest tag did not match URI | During a manifest upload, if the tag in the manifest does not match the uri tag, this error will be returned.
`NAME_UNKNOWN` | repository name not known to registry | This is returned if the name used during an operation is unknown to the registry.
`MANIFEST_UNKNOWN` | manifest unknown | This error is returned when the manifest, identified by name and tag is unknown to the repository.
`MANIFEST_INVALID` | manifest invalid | During upload, manifests undergo several checks ensuring validity. If those checks fail, this error may be returned, unless a more specific error is included. The detail will contain information the failed validation.
`MANIFEST_UNVERIFIED` | manifest failed signature verification | During manifest upload, if the manifest fails signature verification, this error will be returned.
`BLOB_UNKNOWN` | blob unknown to registry | This error may be returned when a blob is unknown to the registry in a specified repository. This can be returned with a standard get or if a manifest references an unknown layer during upload.
`BLOB_UPLOAD_UNKNOWN` | blob upload unknown to registry | If a blob upload has been cancelled or was never started, this error code may be returned.
### Base
Base V2 API route. Typically, this can be used for lightweight version checks and to validate registry authorization.
#### GET Base
Check that the endpoint implements Docker Registry API V2.
#####
```
GET /v2/
Authorization: <scheme><token>
```
The following parameters should be specified on the request:
Fetch the tags under the repository identified by `name`.
#####
```
GET /v2/<name>/tags/list
```
The following parameters should be specified on the request:
|Name|Kind|Description|
|----|----|-----------|
|`name`|path|Name of the target repository.|
###### On Success: OK
```
200 OK
Content-Type: application/json
{
"name": <name>,
"tags": [
<tag>,
...
]
}
```
A list of tags for the named repository.
###### On Failure: Not Found
```
404 Not Found
```
The repository is not known to the registry.
###### On Failure: Unauthorized
```
401 Unauthorized
```
The client doesn't have access to repository.
### Manifest
Create, update and retrieve manifests.
#### GET Manifest
Fetch the manifest identified by `name` and `tag`.
#####
```
GET /v2/<name>/manifests/<tag>
```
The following parameters should be specified on the request:
|Name|Kind|Description|
|----|----|-----------|
|`name`|path|Name of the target repository.|
|`tag`|path|Tag of the target manifiest.|
###### On Success: OK
```
200 OK
Content-Type: application/json
{
"name": <name>,
"tag": <tag>,
"fsLayers": [
{
"blobSum": <tarsum>
},
...
]
],
"history": <v1images>,
"signature": <JWS>
}
```
The manifest idenfied by `name` and `tag`.
###### On Failure: Bad Request
```
400 Bad Request
Content-Type: application/json
{
"errors:" [{
"code": <errorcode>,
"message": "<errormessage>",
"detail": ...
},
...
]
}
```
The name or tag was invalid.
The error codes that may be included in the response body are enumerated below:
|Code|Message|Description|
-------|----|------|------------
| `NAME_INVALID` | manifest name did not match URI | During a manifest upload, if the name in the manifest does not match the uri name, this error will be returned. |
| `TAG_INVALID` | manifest tag did not match URI | During a manifest upload, if the tag in the manifest does not match the uri tag, this error will be returned. |
###### On Failure: Not Found
```
404 Not Found
Content-Type: application/json
{
"errors:" [{
"code": <errorcode>,
"message": "<errormessage>",
"detail": ...
},
...
]
}
```
The named manifest is not known to the registry.
The error codes that may be included in the response body are enumerated below:
|Code|Message|Description|
-------|----|------|------------
| `NAME_UNKNOWN` | repository name not known to registry | This is returned if the name used during an operation is unknown to the registry. |
| `MANIFEST_UNKNOWN` | manifest unknown | This error is returned when the manifest, identified by name and tag is unknown to the repository. |
#### PUT Manifest
Put the manifest identified by `name` and `tag`.
#####
```
PUT /v2/<name>/manifests/<tag>
Authorization: <scheme><token>
Content-Type: application/json
{
"name": <name>,
"tag": <tag>,
"fsLayers": [
{
"blobSum": <tarsum>
},
...
]
],
"history": <v1images>,
"signature": <JWS>
}
```
The following parameters should be specified on the request:
The error codes that may be included in the response body are enumerated below:
|Code|Message|Description|
-------|----|------|------------
| `NAME_INVALID` | manifest name did not match URI | During a manifest upload, if the name in the manifest does not match the uri name, this error will be returned. |
| `TAG_INVALID` | manifest tag did not match URI | During a manifest upload, if the tag in the manifest does not match the uri tag, this error will be returned. |
| `MANIFEST_INVALID` | manifest invalid | During upload, manifests undergo several checks ensuring validity. If those checks fail, this error may be returned, unless a more specific error is included. The detail will contain information the failed validation. |
| `MANIFEST_UNVERIFIED` | manifest failed signature verification | During manifest upload, if the manifest fails signature verification, this error will be returned. |
| `BLOB_UNKNOWN` | blob unknown to registry | This error may be returned when a blob is unknown to the registry in a specified repository. This can be returned with a standard get or if a manifest references an unknown layer during upload. |
###### On Failure: Bad Request
```
400 Bad Request
Content-Type: application/json
{
"errors:" [{
"code": "BLOB_UNKNOWN",
"message": "blob unknown to registry",
"detail": {
"digest": <tarsum>
}
},
...
]
}
```
One or more layers may be missing during a manifest upload. If so, the missing layers will be enumerated in the error response.
The error codes that may be included in the response body are enumerated below:
|Code|Message|Description|
-------|----|------|------------
| `BLOB_UNKNOWN` | blob unknown to registry | This error may be returned when a blob is unknown to the registry in a specified repository. This can be returned with a standard get or if a manifest references an unknown layer during upload. |
###### On Failure: Unauthorized
```
401 Unauthorized
WWW-Authenticate: <scheme> realm="<realm>", ..."
```
The following headers will be returned on the response:
The error codes that may be included in the response body are enumerated below:
|Code|Message|Description|
-------|----|------|------------
| `NAME_INVALID` | manifest name did not match URI | During a manifest upload, if the name in the manifest does not match the uri name, this error will be returned. |
| `TAG_INVALID` | manifest tag did not match URI | During a manifest upload, if the tag in the manifest does not match the uri tag, this error will be returned. |
###### On Failure: Unauthorized
```
401 Unauthorized
WWW-Authenticate: <scheme> realm="<realm>", ..."
```
The following headers will be returned on the response:
The error codes that may be included in the response body are enumerated below:
|Code|Message|Description|
-------|----|------|------------
| `NAME_UNKNOWN` | repository name not known to registry | This is returned if the name used during an operation is unknown to the registry. |
| `MANIFEST_UNKNOWN` | manifest unknown | This error is returned when the manifest, identified by name and tag is unknown to the repository. |
### Blob
Fetch the blob identified by `name` and `digest`. Used to fetch layers by tarsum digest.
#### GET Blob
Retrieve the blob from the registry identified by `digest`.
#####
```
GET /v2/<name>/blobs/<digest>
```
The following parameters should be specified on the request:
|Name|Kind|Description|
|----|----|-----------|
|`name`|path|Name of the target repository.|
|`digest`|path|Digest of desired blob.|
###### On Success: OK
```
200 OK
Content-Type: application/octet-stream
<blobbinarydata>
```
The blob identified by `digest` is available. The blob content will be present in the body of the request.
###### On Success: Temporary Redirect
```
307 Temporary Redirect
Location: <bloblocation>
```
The blob identified by `digest` is available at the provided location.
The following headers will be returned on the response:
|Name|Description|
|----|-----------|
|`Location`|The location where the layer should be accessible.|
###### On Failure: Bad Request
```
400 Bad Request
```
The error codes that may be included in the response body are enumerated below:
|Code|Message|Description|
-------|----|------|------------
| `NAME_INVALID` | manifest name did not match URI | During a manifest upload, if the name in the manifest does not match the uri name, this error will be returned. |
| `DIGEST_INVALID` | provided digest did not match uploaded content | When a blob is uploaded, the registry will check that the content matches the digest provided by the client. The error may include a detail structure with the key "digest", including the invalid digest string. This error may also be returned when a manifest includes an invalid layer digest. |
###### On Failure: Unauthorized
```
401 Unauthorized
```
###### On Failure: Not Found
```
404 Not Found
```
The error codes that may be included in the response body are enumerated below:
|Code|Message|Description|
-------|----|------|------------
| `NAME_UNKNOWN` | repository name not known to registry | This is returned if the name used during an operation is unknown to the registry. |
| `BLOB_UNKNOWN` | blob unknown to registry | This error may be returned when a blob is unknown to the registry in a specified repository. This can be returned with a standard get or if a manifest references an unknown layer during upload. |
#### HEAD Blob
Check if the blob is known to the registry.
#####
```
HEAD /v2/<name>/blobs/<digest>
```
The following parameters should be specified on the request:
|Name|Kind|Description|
|----|----|-----------|
|`name`|path|Name of the target repository.|
|`digest`|path|Digest of desired blob.|
### Intiate Blob Upload
Initiate a blob upload. This endpoint can be used to create resumable uploads or monolithic uploads.
#### POST Intiate Blob Upload
Initiate a resumable blob upload. If successful, an upload location will be provided to complete the upload. Optionally, if the `digest` parameter is present, the request body will be used to complete the upload in a single request.
##### Initiate Monolithic Blob Upload
```
POST /v2/<name>/blobs/uploads/?digest=<tarsum>
Authorization: <scheme><token>
Content-Length: <lengthofblob>
Content-Type: application/octect-stream
<binarydata>
```
Upload a blob identified by the `digest` parameter in single request. This upload will not be resumable unless a recoverable error is returned.
The following parameters should be specified on the request:
|`digest`|query|Digest of uploaded blob. If present, the upload will be completed, in a single request, with contents of the request body as the resulting blob.|
###### On Success: Created
```
201 Created
Location: <bloblocation>
Content-Length: 0
```
The following headers will be returned on the response:
|Name|Description|
|----|-----------|
|`Location`||
|`Content-Length`|The `Content-Length` header must be zero and the body must be empty.|
###### On Failure: Invalid Name or Digest
```
400 Bad Request
```
The error codes that may be included in the response body are enumerated below:
|Code|Message|Description|
-------|----|------|------------
| `DIGEST_INVALID` | provided digest did not match uploaded content | When a blob is uploaded, the registry will check that the content matches the digest provided by the client. The error may include a detail structure with the key "digest", including the invalid digest string. This error may also be returned when a manifest includes an invalid layer digest. |
| `NAME_INVALID` | manifest name did not match URI | During a manifest upload, if the name in the manifest does not match the uri name, this error will be returned. |
###### On Failure: Unauthorized
```
401 Unauthorized
WWW-Authenticate: <scheme> realm="<realm>", ..."
```
The following headers will be returned on the response:
The error codes that may be included in the response body are enumerated below:
|Code|Message|Description|
-------|----|------|------------
| `DIGEST_INVALID` | provided digest did not match uploaded content | When a blob is uploaded, the registry will check that the content matches the digest provided by the client. The error may include a detail structure with the key "digest", including the invalid digest string. This error may also be returned when a manifest includes an invalid layer digest. |
| `NAME_INVALID` | manifest name did not match URI | During a manifest upload, if the name in the manifest does not match the uri name, this error will be returned. |
##### Initiate Resumable Blob Upload
```
POST /v2/<name>/blobs/uploads/
Authorization: <scheme><token>
Content-Length: 0
```
Initiate a resumable blob upload with an empty request body.
The following parameters should be specified on the request:
|`Content-Length`|header|The `Content-Length` header must be zero and the body must be empty.|
|`name`|path|Name of the target repository.|
###### On Success: Accepted
```
202 Accepted
Content-Length: 0
Location: /v2/<name>/blobs/uploads/<uuid>
Range: 0-0
```
The upload has been created. The `Location` header must be used to complete the upload. The response should identical to a `GET` request on the contents of the returned `Location` header.
The following headers will be returned on the response:
|Name|Description|
|----|-----------|
|`Content-Length`|The `Content-Length` header must be zero and the body must be empty.|
|`Location`|The location of the created upload. Clients should use the contents verbatim to complete the upload, adding parameters where required.|
|`Range`|Range header indicating the progress of the upload. When starting an upload, it will return an empty range, since no content has been received.|
### Blob Upload
Interact with blob uploads. Clients should never assemble URLs for this endpoint and should only take it through the `Location` header on related API requests.
#### GET Blob Upload
Retrieve status of upload identified by `uuid`. The primary purpose of this endpoint is to resolve the current status of a resumable upload.
#####
```
GET /v2/<name>/blobs/uploads/<uuid>
```
Retrieve the progress of the current upload, as reported by the `Range` header.
The following parameters should be specified on the request:
|Name|Kind|Description|
|----|----|-----------|
|`name`|path|Name of the target repository.|
|`uuid`|path|A uuid identifying the upload. This field can accept almost anything.|
###### On Success: No Content
```
204 No Content
Range: 0-<offset>
```
The following headers will be returned on the response:
|Name|Description|
|----|-----------|
|`Range`|Range indicating the current progress of the upload.|
#### HEAD Blob Upload
Retrieve status of upload identified by `uuid`. This is identical to the GET request.
#####
```
HEAD /v2/<name>/blobs/uploads/<uuid>
```
Retrieve the progress of the current upload, as reported by the `Range` header.
The following parameters should be specified on the request:
|Name|Kind|Description|
|----|----|-----------|
|`name`|path|Name of the target repository.|
|`uuid`|path|A uuid identifying the upload. This field can accept almost anything.|
###### On Success: No Content
```
204 No Content
Range: 0-<offset>
```
The following headers will be returned on the response:
|Name|Description|
|----|-----------|
|`Range`|Range indicating the current progress of the upload.|
Upload a chunk of data to specified upload without completing the upload.
The following parameters should be specified on the request:
|Name|Kind|Description|
|----|----|-----------|
|`Content-Range`|header|Range of bytes identifying the desired block of content represented by the body. Start must the end offset retrieved via status check plus one. Note that this is a non-standard use of the `Content-Range` header.|
|`Content-Length`|header|Length of the chunk being uploaded, corresponding the length of the request body.|
|`name`|path|Name of the target repository.|
|`uuid`|path|A uuid identifying the upload. This field can accept almost anything.|
###### On Success: No Content
```
204 No Content
Range: 0-<offset>
Content-Length: 0
```
The following headers will be returned on the response:
|Name|Description|
|----|-----------|
|`Range`|Range indicating the current progress of the upload.|
|`Content-Length`|The `Content-Length` header must be zero and the body must be empty.|
#### PUT Blob Upload
Complete the upload specified by `uuid`, optionally appending the body as the final chunk.
#####
```
PUT /v2/<name>/blobs/uploads/<uuid>?digest=<tarsum>
```
Upload the _final_ chunk of data.
The following parameters should be specified on the request:
|Name|Kind|Description|
|----|----|-----------|
|`name`|path|Name of the target repository.|
|`uuid`|path|A uuid identifying the upload. This field can accept almost anything.|
The following headers will be returned on the response:
|Name|Description|
|----|-----------|
|`Content-Range`|Range of bytes identifying the desired block of content represented by the body. Start must match the end of offset retrieved via status check. Note that this is a non-standard use of the `Content-Range` header.|
|`Content-Length`|Length of the chunk being uploaded, corresponding the length of the request body.|
#### DELETE Blob Upload
Cancel outstanding upload processes, releasing associated resources. If this is not called, the unfinished uploads will eventually timeout.
#####
```
DELETE /v2/<name>/blobs/uploads/<uuid>
```
Cancel the upload specified by `uuid`.
The following parameters should be specified on the request:
|Name|Kind|Description|
|----|----|-----------|
|`name`|path|Name of the target repository.|
|`uuid`|path|A uuid identifying the upload. This field can accept almost anything.|