> For the complete documentation index, see [llms.txt](https://wiki.gen6.life/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.gen6.life/technology-core/developer-resources/sdk-and-tooling/real-seal-iot-api.md).

# Real Seal IoT - API

This API lets you **anchor data integrity on-chain** by submitting a cryptographic hash. You can either submit a hash you already have, or upload a file and let the service hash it for you. Successful requests return a **transaction ID** you can store as proof of anchoring.

### Authentication

All requests require an API key:

* Header: `API-Secret: <your key>`

Requests without a valid key are rejected.

### Rate limits

The API enforces request limits to protect availability. If you exceed the limit you’ll receive **HTTP 429** and should retry later.

### Endpoints

#### 1) Anchor an existing hash

**POST** `/make_it_immutable`\
Use this when you already computed a hash on your side.

**Headers**

* `API-Secret: ...`
* `Content-Type: application/json`

**Body**

```json
{
  "project_id": "your-project-id",
  "hash_value": "0x..."
}
```

**Response**

```json
{ "result": "0x<transaction_id>" }
```

#### 2) Upload a file and anchor it

**POST** `/immutable_file`\
Upload a file; the service computes the hash and anchors it.

**Headers**

* `API-Secret: ...`
* `Content-Type: multipart/form-data`

**Form fields**

* `project_id` (text)
* `file` (binary)

**Response**

```json
{
  "result": "0x<transaction_id>",
  "hash": "0x<file_hash>",
  "filename": "stored_filename.ext"
}
```

**Limits**

* Max file size: **50 MB**

#### 3) Download a previously uploaded file

**GET** `/download_file/<filename>`

**Headers**

* `API-Secret: ...`

**Response**

* File download (attachment)

### Common errors

* **400** Bad Request — missing required fields
* **403** Forbidden — missing/invalid `API-Secret`
* **404** Not Found — file doesn’t exist (download only)
* **413** Payload Too Large — file exceeds 50 MB
* **429** Too Many Requests — rate limit hit
* **500** Server Error — unexpected failure

### Quick examples (curl)

Anchor a hash:

```bash
curl -X POST https://<your-host>/make_it_immutable \
  -H "API-Secret: <key>" \
  -H "Content-Type: application/json" \
  -d '{"project_id":"demo","hash_value":"0x..."}'
```

Upload a file:

```bash
curl -X POST https://<your-host>/immutable_file \
  -H "API-Secret: <key>" \
  -F "project_id=demo" \
  -F "file=@./document.pdf"
```

Download:

```bash
curl -L https://<your-host>/download_file/<filename> \
  -H "API-Secret: <key>" \
  -o downloaded.bin
```
