---
title: "Hash a text or a file (md5, sha1, sha256, sha512)"
method: POST
path: "/hash"
tags: ["Data"]
---

# Hash a text or a file (md5, sha1, sha256, sha512)

`POST /hash`

## Request

- Base URL: `https://api.cofferdock.com`
- URL: `https://api.cofferdock.com/hash`
- Auth: API key in header `x-api-key`

Returns the hash of a text (JSON) or of a file (raw bytes, max 25 MB). Useful for checksums and deduplication.

Costs 1 credit per call.

## Request body

- object
  - `text` string, required: The text to hash.
  - `algorithm` 'md5' | 'sha1' | 'sha256' | 'sha512': Hash algorithm: "md5", "sha1", "sha256" (default) or "sha512".
  - `encoding` 'hex' | 'base64': How to write the result: "hex" (default) or "base64".

## Response `200`

Result.

- object
  - `success` boolean
  - `hash` string
  - `algorithm` string
  - `meta` object
    - `input_mode` string
    - `input_bytes` integer
    - `used` integer: Credits used this month, after this call.
    - `remaining` integer, nullable: Credits left this month (null = unlimited).
    - `unlimited` boolean

## Other responses

- `400`: Invalid input (nothing is charged).
- `401`: Missing or invalid API key.
- `403`: Email not verified.
- `429`: Monthly credit limit reached, or too many requests per minute for this key (see Retry-After).
- `503`: Server busy (queue full). Retry after the seconds in the Retry-After header.

---

[API](https://skmtc.dev/cofferdock/apis/cofferdock-api.md) · [All operations](https://skmtc.dev/cofferdock/apis/cofferdock-api/llms.txt) · [OpenAPI document](https://skmtc.dev/cofferdock/apis/cofferdock-api/revisions/b57aa000d33a?raw)
