> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pdf.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Get MD5 Hash of File by URL

> Calculate and return MD5 hash of file by url. Commonly used to control if the source document has been changed or not because every little change will cause hash string to differ as well.

## `POST /v1/file/hash`

## Attributes

<Note>Attributes are case-sensitive and should be inside JSON for POST request. for example: `{ "url": "https://example.com/file1.pdf" }`</Note>

| Attribute | Type   | Required | Default | Description                                                                                                  |
| --------- | ------ | -------- | ------- | ------------------------------------------------------------------------------------------------------------ |
| `url`     | string | *Yes*    | -       | URL to the source file [`url` attribute](/api-reference/url-input-and-request-limits#supported-file-sources) |

## Query parameters

*No query parameters accepted.*

## Responses

| Parameter          | Type    | Description                                  |
| ------------------ | ------- | -------------------------------------------- |
| `hash`             | string  | Hash of the final PDF file stored in S3.     |
| `credits`          | integer | Number of credits consumed by the request    |
| `remainingCredits` | integer | Number of credits remaining in the account   |
| `duration`         | integer | Time taken for the operation in milliseconds |

## `Example` Payload

<Note>To see the request size limits, please refer to the [Request Size Limits](/api-reference/url-input-and-request-limits#pdf-co-request-size).</Note>

```json theme={null}
{
  "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/document-parser/sample-invoice.pdf"
}
```

## `Example` Response

<Note>To see the main response codes, please refer to the [Response Codes](/api-reference/response-codes) page.</Note>

```json theme={null}
{
  "hash": "d942e5becdcb0386598cce15e9e56deb1ca9d893b8578a88eca4a62f02c4000b",
  "remainingCredits": 98143
}
```

<Note>
  **Inconsistent URL Encoding in cURL Output:** When using cURL to make API requests, the output JSON may show URL characters encoded as Unicode escape sequences. For example, the ampersand character (`&`) may appear as `\u0026` in the cURL output. This is normal JSON encoding behavior and does not affect the validity of the URL. The URL will function correctly when used, as JSON parsers automatically decode these escape sequences. If you're parsing the response programmatically, your JSON parser will handle this conversion automatically.
</Note>

## Code Samples

<Tabs>
  <Tab title="CURL">
    ```bash theme={null}
    curl --location --request POST 'https://api.pdf.co/v1/file/hash'
    --header 'x-api-key: *******************'
    --data-raw '{
        "url": "pdfco-test-files.s3.us-west-2.amazonaws.compdf-split/sample.pdf"
    }'
    ```
  </Tab>
</Tabs>
