API reference

ZeroHost API Documentation

One REST endpoint to create an expiring share, three ways to read it back. JSON in, JSON out.

Base URL
https://api.zerohost.net
Auth
X-API-Key: zh_…
Format
application/json

Quick start

Create an API key on your account page (Pro plan), then send some text. The response gives you a link that deletes itself when it expires.

curl https://api.zerohost.net/v1/share \
  -H "X-API-Key: $ZEROHOST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello from the API", "expires_in": "24h"}'
201 Created
{
  "id": "9b042e2b144afeb6421592fc7f5c0d94",
  "url": "https://zerohost.net/share/9b042e2b144afeb6421592fc7f5c0d94",
  "expires_at": "2026-11-22T09:42:00.000Z",
  "expires_in": 86400,
  "plan": "pro",
  "usage": { "current": 1, "limit": -1 }
}

Prefer the terminal? The CLI wraps this same endpoint: echo "hi" | zerohost --expires 24h.

Authentication

Send your key in the X-API-Key header on every request that creates a share or checks usage. Keys start with zh_.

  1. Subscribe to Pro and sign in.
  2. On your account page, choose Generate API key.
  3. Copy it straight away. It is shown once; generating a new one replaces it.

Reading a share needs no key: anyone holding the link can read it, which is the point of a share link.

A bad key is not rejected. A missing, mistyped or lapsed key quietly drops the request to free-tier limits instead of returning 401. If a Pro feature unexpectedly returns 403, check the plan field in the response.
Keep the key out of code. Read it from an environment variable or your CI secret store, and never ship it to a browser.

Plans and limits

Pro keyNo valid key
Shares per dayUnlimited (5,000 API requests a day)10, per IP address
Longest expiry30 days24 hours
PasswordYesYes
Burn after readingYesNo (403)

Daily counts reset at 00:00 UTC. Share creation responses carry these headers:

HeaderMeaning
X-RateLimit-LimitShares allowed today. -1 means no daily cap.
X-RateLimit-RemainingShares left today
X-RateLimit-ResetWhen the count resets, in Unix seconds
Retry-AfterOn 429 only: seconds until you can try again

POST/v1/share

Create a share. Returns 201 Created with the link.

Body

FieldTypeDescription
textrequiredstringThe content, up to 1 MB.
expires_instringOne of 1h 6h 24h 3d 7d 30d. Default 24h. Any other value is treated as 24h. expiry is accepted as an alias.
passwordstringReaders must send this password to open the share.
burn_after_readingbooleanDelete the share on its first read. Pro only. Default false.
referencestringYour own label, such as a ticket key. Letters, numbers, - _ .; cut to 32 characters. Shows in your account’s list of active shares.
{
  "text": "DB_PASSWORD=hunter2",
  "expires_in": "1h",
  "password": "correct-horse",
  "burn_after_reading": true,
  "reference": "INC-4211"
}
201 Created
{
  "id": "9b042e2b144afeb6421592fc7f5c0d94",
  "url": "https://zerohost.net/share/9b042e2b144afeb6421592fc7f5c0d94",
  "expires_at": "2026-11-21T10:42:00.000Z",
  "expires_in": 3600,
  "plan": "pro",
  "usage": { "current": 42, "limit": -1 }
}

expires_in in the response is in seconds. usage.limit is -1 on Pro (no daily cap).

GET/v1/share/{id}

Read a share. {id} is the 32-character hex ID at the end of the share URL. No key needed.

This read counts. If the share was created with burn_after_reading, this request deletes it. Use ?meta=1 to look without opening it.
curl https://api.zerohost.net/v1/share/9b042e2b144afeb6421592fc7f5c0d94
200 OK
{
  "id": "9b042e2b144afeb6421592fc7f5c0d94",
  "text": "Hello from the API",
  "created_at": "2026-11-21T09:42:00.000Z",
  "expires_at": "2026-11-22T09:42:00.000Z",
  "expires_in": 86312,
  "has_password": false,
  "burn_after_reading": false,
  "view_count": 1
}

A password-protected share returns 401 with "requires_password": true; read it with the POST below instead. view_count is always 1 and kept for compatibility.

POST/v1/share/{id}

Read a password-protected share. Send the password in the JSON body; the response matches the GET above. Like the GET, this counts as the read for burn after reading.

curl -X POST https://api.zerohost.net/v1/share/9b042e2b144afeb6421592fc7f5c0d94 \
  -H "Content-Type: application/json" \
  -d '{"password": "correct-horse"}'
401 Unauthorized
{ "error": "Invalid password" }

GET/v1/share/{id}?meta=1

Check a share without opening it: its expiry and whether it needs a password or will burn. Never returns the text and never consumes the share.

curl "https://api.zerohost.net/v1/share/9b042e2b144afeb6421592fc7f5c0d94?meta=1"
200 OK
{
  "id": "9b042e2b144afeb6421592fc7f5c0d94",
  "expires_at": "2026-11-21T10:42:00.000Z",
  "expires_in": 3412,
  "has_password": true,
  "burn_after_reading": true
}

GET/v1/usage

Today’s share count for your key. Checking does not count as a share.

curl https://api.zerohost.net/v1/usage -H "X-API-Key: $ZEROHOST_API_KEY"
200 OK
{
  "current": 42,
  "limit": -1,
  "plan": "pro",
  "resetTime": 1795305600000
}

resetTime is in Unix milliseconds (next 00:00 UTC). limit is -1 when there is no daily cap.

Errors

Errors return JSON with an error string. Some add more fields, shown below.

StatusWhen
400Missing text, text over 1 MB, or an invalid reference
401The share needs a password (requires_password: true), or the password is wrong
403A Pro feature without a valid Pro key (error: "Upgrade required"), or content blocked by the acceptable use policy
404The share doesn’t exist, has expired, or was already burned
429The daily share limit is used up; see Retry-After
500Something failed on our side; safe to retry
{
  "error": "Upgrade required",
  "message": "Burn after reading requires a Pro subscription. …",
  "feature": "burn_after_reading",
  "current_plan": "free",
  "upgrade_url": "https://zerohost.net/#pricing"
}

feature is one of password_protection, burn_after_reading or extended_expiry.