> Docs index: https://movekit.com/llms.txt. HTML version: https://movekit.com/docs/api/check-a-delivered-file

# Check a delivered file

Checks a download link and returns headers only.

- Method and path: `HEAD /media/{grantId}`
- URL: `{DELIVERY_WORKER_URL}/media/{grantId}`
- Requires: Owned or sample content
- Authentication: No API key. The URL from the API response is the authorization; never send the key to it.
- Operation id: `headMedia`

Uses one request from the link.

## Path parameters

| Name | Type | Required | Default | Allowed | Example | Description |
| --- | --- | --- | --- | --- | --- | --- |
| `grantId` | string | yes |  | pattern ^grant_ | `grant_69e604c7-2f38-485c-89b3-24d61ab2af0e` | The download link id in the delivery URL. |

## Query parameters

| Name | Type | Required | Default | Allowed | Example | Description |
| --- | --- | --- | --- | --- | --- | --- |
| `t` | string | yes |  |  | `eyJnIjoiZ3JhbnRfNjllNjA0YzcifQ.Lqvtn5kUEJG22znYCC-jXAWyPJMsAP1Po2eNG279Yp` | The signed token from the delivery URL. Treat the whole URL as opaque. |

## Response 200

Headers only.

## Errors

| Status | Codes | Meaning |
| --- | --- | --- |
| 400 | `delivery_invalid` | The token failed verification, or the request was malformed. |
| 401 | `invalid_api_key` | The key that issued the download link was revoked. |
| 404 | `asset_not_available`, `not_found` | Unknown route, or the asset is not available. |
| 405 | `method_not_allowed` | Only GET, HEAD and OPTIONS. |
| 409 | `asset_mismatch` | The stored object does not match the download link; request a fresh download link. |
| 410 | `delivery_expired` | Download links work for 300 seconds. Request a fresh download link afterwards. |
| 429 | `sync_limit_exceeded`, `delivery_limit_exceeded`, `daily_request_limit`, `sample_busy` | A download link allows 16 requests. Each file version can be downloaded 20 times a month, then gets sync_limit_exceeded until the count starts again at 00:00 UTC on the 1st of each month; new versions start again. An account that reached its media requests for the day gets daily_request_limit until 00:00 UTC; a keyless sample link gets sample_busy when the sample is used up for the day. |
| 503 | `delivery_disabled`, `delivery_paused_global`, `delivery_unavailable` | Media delivery is disabled, paused or not configured. Retryable; nothing is charged. |

## Example request

cURL:

```bash
# DOWNLOAD_URL is a download link from Create deliveries. No API key: the URL is the authorization.
curl -sS -I --max-redirs 0 "$DOWNLOAD_URL"
```

JavaScript:

```javascript
// Node 20 or newer: save as request.mjs and run node request.mjs
// DOWNLOAD_URL is a download link from Create deliveries. No API key: the URL is the authorization.
const response = await fetch(process.env.DOWNLOAD_URL, {
  method: "HEAD",
  redirect: "error",
})
console.log(response.status, Object.fromEntries(response.headers))
```

Python:

```python
import os
import urllib.request

# DOWNLOAD_URL is a download link from Create deliveries. No API key: the URL is the authorization.
request = urllib.request.Request(os.environ["DOWNLOAD_URL"], method="HEAD", headers={"User-Agent": "movekit-docs-example/1"})
with urllib.request.urlopen(request) as response:
    print(response.status, dict(response.headers))
```

## Example response 200

```http
HTTP/1.1 200
Accept-Ranges: bytes
ETag: "d74cedbbfbc4d6d93afd73cbbf4ca7e6d4ef1d876d12be14913c617974ba8109"
```

## Example response 400

```json
{
  "error": {
    "code": "delivery_invalid",
    "message": "The delivery token is invalid.",
    "requestId": "6f1d2c3b-8a9e-4f70-b5c4-2d1e0f9a8b7c",
    "retryable": false,
    "nextAction": "Request a fresh delivery from the MoveKit API with an authorized key."
  }
}
```

## Example response 401

```json
{
  "error": {
    "code": "invalid_api_key",
    "message": "The issuing key was revoked.",
    "requestId": "6f1d2c3b-8a9e-4f70-b5c4-2d1e0f9a8b7c",
    "retryable": false,
    "nextAction": "Use a valid key to request a fresh delivery."
  }
}
```

## Example response 404

```json
{
  "error": {
    "code": "asset_not_available",
    "message": "The asset is not available for delivery.",
    "requestId": "6f1d2c3b-8a9e-4f70-b5c4-2d1e0f9a8b7c",
    "retryable": false,
    "nextAction": "Request a fresh delivery; if the problem persists contact MoveKit support."
  }
}
```

## Example response 405

```json
{
  "error": {
    "code": "method_not_allowed",
    "message": "This method is not supported for this route.",
    "requestId": "6f1d2c3b-8a9e-4f70-b5c4-2d1e0f9a8b7c",
    "retryable": false,
    "nextAction": "Use GET or HEAD for media."
  }
}
```

## Example response 409

```json
{
  "error": {
    "code": "asset_mismatch",
    "message": "The stored asset does not match the download link.",
    "requestId": "6f1d2c3b-8a9e-4f70-b5c4-2d1e0f9a8b7c",
    "retryable": false,
    "nextAction": "Request a fresh delivery; if the problem persists contact MoveKit support."
  }
}
```

## Example response 410

```json
{
  "error": {
    "code": "delivery_expired",
    "message": "The delivery token expired.",
    "requestId": "6f1d2c3b-8a9e-4f70-b5c4-2d1e0f9a8b7c",
    "retryable": false,
    "nextAction": "Request a fresh delivery from the MoveKit API."
  }
}
```

## Example response 429

```json
{
  "error": {
    "code": "sync_limit_exceeded",
    "message": "This version of the file reached its download limit for this month.",
    "requestId": "6f1d2c3b-8a9e-4f70-b5c4-2d1e0f9a8b7c",
    "retryable": false,
    "nextAction": "Use the copy you already imported until 00:00 UTC on the 1st of next month, when the limit starts again, or ask MoveKit for a reviewed reset."
  }
}
```

## Example response 503

```json
{
  "error": {
    "code": "delivery_disabled",
    "message": "Media delivery is temporarily disabled.",
    "requestId": "6f1d2c3b-8a9e-4f70-b5c4-2d1e0f9a8b7c",
    "retryable": true,
    "nextAction": "Retry later. No usage is charged for refused requests."
  }
}
```

## OpenAPI

The operation and every component it references, from the OpenAPI document.

```json
{
  "openapi": "3.1.2",
  "info": {
    "title": "MoveKit API",
    "version": "1.1.0"
  },
  "servers": [
    {
      "url": "https://api.movekit.com/v1",
      "description": "Control plane (MOVEKIT_API_BASE_URL). Paths below are relative to this URL."
    }
  ],
  "paths": {
    "/media/{grantId}": {
      "head": {
        "operationId": "headMedia",
        "tags": [
          "Deliveries"
        ],
        "summary": "Check a delivered file",
        "description": "Checks a download link and returns headers only. Uses one request from the link.",
        "x-movekit-requires": "owned-asset",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/GrantId"
          },
          {
            "$ref": "#/components/parameters/DeliveryToken"
          }
        ],
        "responses": {
          "200": {
            "description": "Headers only.",
            "headers": {
              "Accept-Ranges": {
                "$ref": "#/components/headers/Accept-Ranges"
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "400": {
            "description": "The token failed verification, or the request was malformed.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryError"
                },
                "example": {
                  "error": {
                    "code": "delivery_invalid",
                    "message": "The delivery token is invalid.",
                    "requestId": "6f1d2c3b-8a9e-4f70-b5c4-2d1e0f9a8b7c",
                    "retryable": false,
                    "nextAction": "Request a fresh delivery from the MoveKit API with an authorized key."
                  }
                }
              }
            },
            "x-movekit-codes": [
              "delivery_invalid"
            ]
          },
          "401": {
            "description": "The key that issued the download link was revoked.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryError"
                },
                "example": {
                  "error": {
                    "code": "invalid_api_key",
                    "message": "The issuing key was revoked.",
                    "requestId": "6f1d2c3b-8a9e-4f70-b5c4-2d1e0f9a8b7c",
                    "retryable": false,
                    "nextAction": "Use a valid key to request a fresh delivery."
                  }
                }
              }
            },
            "x-movekit-codes": [
              "invalid_api_key"
            ]
          },
          "404": {
            "description": "Unknown route, or the asset is not available.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryError"
                },
                "example": {
                  "error": {
                    "code": "asset_not_available",
                    "message": "The asset is not available for delivery.",
                    "requestId": "6f1d2c3b-8a9e-4f70-b5c4-2d1e0f9a8b7c",
                    "retryable": false,
                    "nextAction": "Request a fresh delivery; if the problem persists contact MoveKit support."
                  }
                }
              }
            },
            "x-movekit-codes": [
              "asset_not_available",
              "not_found"
            ]
          },
          "405": {
            "description": "Only GET, HEAD and OPTIONS.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryError"
                },
                "example": {
                  "error": {
                    "code": "method_not_allowed",
                    "message": "This method is not supported for this route.",
                    "requestId": "6f1d2c3b-8a9e-4f70-b5c4-2d1e0f9a8b7c",
                    "retryable": false,
                    "nextAction": "Use GET or HEAD for media."
                  }
                }
              }
            },
            "x-movekit-codes": [
              "method_not_allowed"
            ]
          },
          "409": {
            "description": "The stored object does not match the download link; request a fresh download link.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryError"
                },
                "example": {
                  "error": {
                    "code": "asset_mismatch",
                    "message": "The stored asset does not match the download link.",
                    "requestId": "6f1d2c3b-8a9e-4f70-b5c4-2d1e0f9a8b7c",
                    "retryable": false,
                    "nextAction": "Request a fresh delivery; if the problem persists contact MoveKit support."
                  }
                }
              }
            },
            "x-movekit-codes": [
              "asset_mismatch"
            ]
          },
          "410": {
            "description": "Download links work for 300 seconds. Request a fresh download link afterwards.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryError"
                },
                "example": {
                  "error": {
                    "code": "delivery_expired",
                    "message": "The delivery token expired.",
                    "requestId": "6f1d2c3b-8a9e-4f70-b5c4-2d1e0f9a8b7c",
                    "retryable": false,
                    "nextAction": "Request a fresh delivery from the MoveKit API."
                  }
                }
              }
            },
            "x-movekit-codes": [
              "delivery_expired"
            ]
          },
          "429": {
            "description": "A download link allows 16 requests. Each file version can be downloaded 20 times a month, then gets sync_limit_exceeded until the count starts again at 00:00 UTC on the 1st of each month; new versions start again. An account that reached its media requests for the day gets daily_request_limit until 00:00 UTC; a keyless sample link gets sample_busy when the sample is used up for the day.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryError"
                },
                "example": {
                  "error": {
                    "code": "sync_limit_exceeded",
                    "message": "This version of the file reached its download limit for this month.",
                    "requestId": "6f1d2c3b-8a9e-4f70-b5c4-2d1e0f9a8b7c",
                    "retryable": false,
                    "nextAction": "Use the copy you already imported until 00:00 UTC on the 1st of next month, when the limit starts again, or ask MoveKit for a reviewed reset."
                  }
                }
              }
            },
            "x-movekit-codes": [
              "sync_limit_exceeded",
              "delivery_limit_exceeded",
              "daily_request_limit",
              "sample_busy"
            ]
          },
          "503": {
            "description": "Media delivery is disabled, paused or not configured. Retryable; nothing is charged.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryError"
                },
                "example": {
                  "error": {
                    "code": "delivery_disabled",
                    "message": "Media delivery is temporarily disabled.",
                    "requestId": "6f1d2c3b-8a9e-4f70-b5c4-2d1e0f9a8b7c",
                    "retryable": true,
                    "nextAction": "Retry later. No usage is charged for refused requests."
                  }
                }
              }
            },
            "x-movekit-codes": [
              "delivery_disabled",
              "delivery_paused_global",
              "delivery_unavailable"
            ]
          }
        }
      },
      "x-plane": "delivery",
      "servers": [
        {
          "url": "{DELIVERY_WORKER_URL}",
          "description": "The delivery host. Use the full URL from createDeliveries.",
          "variables": {
            "DELIVERY_WORKER_URL": {
              "default": "https://delivery.example.invalid",
              "description": "Origin of the url returned by createDeliveries."
            }
          }
        }
      ]
    }
  },
  "components": {
    "headers": {
      "Accept-Ranges": {
        "description": "Always `bytes`.",
        "required": true,
        "schema": {
          "const": "bytes"
        },
        "example": "bytes"
      },
      "ETag": {
        "description": "Strong validator for If-Range: the quoted sha256 of the file.",
        "required": true,
        "schema": {
          "type": "string"
        },
        "example": "\"d74cedbbfbc4d6d93afd73cbbf4ca7e6d4ef1d876d12be14913c617974ba8109\""
      },
      "Retry-After": {
        "description": "Seconds to wait before retrying.",
        "schema": {
          "type": "integer"
        },
        "example": 30
      }
    },
    "parameters": {
      "DeliveryToken": {
        "name": "t",
        "in": "query",
        "required": true,
        "description": "The signed token from the delivery URL. Treat the whole URL as opaque.",
        "schema": {
          "type": "string"
        },
        "example": "eyJnIjoiZ3JhbnRfNjllNjA0YzcifQ.Lqvtn5kUEJG22znYCC-jXAWyPJMsAP1Po2eNG279Yp"
      },
      "GrantId": {
        "name": "grantId",
        "in": "path",
        "required": true,
        "description": "The download link id in the delivery URL.",
        "schema": {
          "type": "string",
          "pattern": "^grant_"
        },
        "example": "grant_69e604c7-2f38-485c-89b3-24d61ab2af0e"
      }
    },
    "schemas": {
      "DeliveryError": {
        "type": "object",
        "description": "The same envelope, returned by the delivery host on a media URL.",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "$ref": "#/components/schemas/DeliveryErrorCode"
              },
              "message": {
                "type": "string",
                "description": "What went wrong."
              },
              "requestId": {
                "type": "string",
                "description": "Correlation id of the delivery host."
              },
              "retryable": {
                "type": "boolean",
                "description": "True when the same request may succeed later."
              },
              "nextAction": {
                "type": "string",
                "description": "What to do next."
              }
            },
            "required": [
              "code",
              "message",
              "requestId",
              "retryable",
              "nextAction"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      },
      "DeliveryErrorCode": {
        "type": "string",
        "enum": [
          "invalid_request",
          "delivery_invalid",
          "delivery_expired",
          "invalid_api_key",
          "not_found",
          "method_not_allowed",
          "asset_not_available",
          "asset_mismatch",
          "range_not_satisfiable",
          "delivery_limit_exceeded",
          "sync_limit_exceeded",
          "daily_request_limit",
          "sample_busy",
          "delivery_disabled",
          "delivery_paused_global",
          "delivery_unavailable"
        ],
        "description": "Error code of a delivery URL."
      }
    }
  }
}
```
