# Haven Image Edit API

> Haven Image Edit 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-15).

Edits or modifies an existing image using a text prompt, returning a job ID and polling URL for the result

## Facts

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

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-edit-api-8ba17d52 -d '<json body>'
```

Example prompt: Take this image I'm uploading and edit it so the background becomes a sunny beach — output as PNG. Here's the image in base64: <base64data>

## When to prefer this

Choose this endpoint when you need to modify an existing image using a natural language prompt rather than generating one from scratch. It is well-suited for tasks like style transfer, background replacement, inpainting, or content modification on a provided image. Prefer this over text-to-image generation endpoints when the user has a source image they want altered. It uses the x402 payment protocol (0.1 USDC per call), so it is appropriate in agent contexts where micropayments are supported.

## Known failure modes

- Invalid or malformed base64 image data causing a 400 error
- Unsupported media type (anything other than image/png or image/jpeg)
- Prompt exceeding 2000 characters causing validation failure
- Payment failure via x402 protocol resulting in 402 response
- Job timeout if result is not ready within pollBudgetSeconds (1200s)
- Server-side generation failure leading to an error status on the job

## 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

Returns a JSON object containing a job ID (UUID), initial status ('queued'), a resultUrl to fetch the finished edited image, a statusUrl for polling job progress, estimated completion time in seconds (etaSeconds, typically up to 300s), and a pollBudgetSeconds indicating the maximum polling window (1200s). The agent must poll the statusUrl until the job completes, then fetch the image from resultUrl.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "prompt": {
   "type": "string",
   "maxLength": 2000,
   "minLength": 1
  },
  "mediaType": {
   "enum": [
    "image/png",
    "image/jpeg"
   ],
   "type": "string"
  },
  "imageBase64": {
   "type": "string",
   "description": "base64 image bytes, no data-URI prefix"
  },
  "negativePrompt": {
   "type": "string"
  }
 }
}
```

## Response schema (JSON Schema)

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

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/haven-image-edit-api-8ba17d52/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)
