# Haven Image Restore API

> Haven Image Restore API is a paid API for AI agents from api.havenagent.ai, paid per call via x402, $0.1/call, status unknown (last checked 2026-09-14).

Restores degraded images by applying AI-powered denoising, deblurring, or dehazing to a base64-encoded image, returning a job ID and result URL for polling.

## Facts

- Endpoint: POST https://api.havenagent.ai/x402/api/v1/image/restore
- Price: $0.1/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/haven-image-restore-api-639a4705
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_8UZ71W83aMXnlj5XefqHP

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability haven-image-restore-api-639a4705 -d '<json body>'
```

Example prompt: Can you restore this old blurry family photo for me? I'll send it as a JPEG — use deblur mode to fix the blur and give me the restored version when it's done.

## When to prefer this

Choose this endpoint when you need asynchronous AI-powered restoration of a degraded image (noisy, blurry, or hazy) and can handle a polling workflow. It is particularly well-suited for batch or background use cases where a result in ~5 minutes is acceptable. Prefer this over synchronous alternatives when the image quality problem is well-defined (deblur, denoise, or dehaze) or when you want the model to auto-select the best restoration approach.

## Known failure modes

- Unsupported media type — only image/png and image/jpeg accepted; other formats will be rejected
- Malformed base64 string — image bytes must be raw base64 without a data-URI prefix
- Image too large — oversized payloads may be rejected or timeout
- Payment failure — x402 payment of 0.1 USDC must succeed before processing begins
- Job timeout — if processing exceeds pollBudgetSeconds (1200s), the job may expire
- Network timeout on polling — long ETA requires client-side retry logic

## How this service works

Haven is a private AI agent for your home. Join the waitlist for h1 speaker updates and early app access.

## Output

A JSON object containing a job ID (UUID), initial status ('queued'), a result URL to retrieve the restored image once complete, a status URL for polling job progress, an estimated completion time in seconds (etaSeconds), and a maximum poll budget in seconds (pollBudgetSeconds). The restored image is retrieved separately via the result URL once the job completes.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "mediaType": {
   "enum": [
    "image/png",
    "image/jpeg"
   ],
   "type": "string"
  },
  "imageBase64": {
   "type": "string",
   "description": "base64 image bytes, no data-URI prefix"
  },
  "restorationMode": {
   "enum": [
    "auto",
    "denoise",
    "deblur",
    "dehaze"
   ],
   "type": "string",
   "default": "auto"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "kind": "image_restore",
  "jobId": "00000000-0000-0000-0000-000000000000",
  "status": "queued",
  "resultUrl": "https://api.havenagent.ai/x402/api/v1/image/restore/jobs/00000000-0000-0000-0000-000000000000/result",
  "statusUrl": "https://api.havenagent.ai/x402/api/v1/image/restore/jobs/00000000-0000-0000-0000-000000000000",
  "etaSeconds": 300,
  "pollBudgetSeconds": 1200
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/haven-image-restore-api-639a4705/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.havenagent.ai](https://www.zero.xyz/host/api.havenagent.ai/llms.txt)
