Docs

HTTP API

Create, update and delete links with plain HTTP. No account needed; an optional API key keeps links in your account.

View as Markdown

Base URL: https://anyshare.ai/api/v1. Creating, updating and deleting links works without an account. Creating a link returns a secret token that authorizes updating and deleting it.

A link created without an account expires 1 hour after upload unless someone keeps it with the claimUrl in the response. Send an account API key and it belongs to that account from the start, with the free plan's 30 days:

curl -H "Authorization: Bearer $ANYSHARE_API_KEY" -F file=@report.pdf https://anyshare.ai/api/v1/sites

Get a key with npx @anyshare/cli login (it's saved in ~/.config/anyshare/auth.json). A key that's wrong or revoked is a 401, never a silent anonymous upload.

POST /sites

Send the file as multipart/form-data in a field named file:

curl -F file=@report.pdf https://anyshare.ai/api/v1/sites

Several files#

Repeat the file field. A filename may carry a relative path, and the path is kept. curl sends only the base name by default, so set filename= for files in subfolders:

curl -F file=@index.html \
     -F "file=@assets/app.js;filename=assets/app.js" \
     -F "file=@assets/style.css;filename=assets/style.css" \
     https://anyshare.ai/api/v1/sites

A folder#

Upload a .zip; it is unpacked on our side. If everything sits inside one wrapping folder, that folder is removed, and __MACOSX and .DS_Store are dropped.

(cd dist && zip -qrD - . -x '.env*' '*/.env*' 'node_modules/*') \
  | curl -F "file=@-;filename=site.zip" https://anyshare.ai/api/v1/sites

The CLI does this for you and skips secrets automatically.

A raw body#

curl --data-binary @notes.md -H "X-Filename: notes.md" https://anyshare.ai/api/v1/sites

Options#

Field (or header)Meaning
slugCustom subdomain, e.g. q3-report → https://q3-report.anyshare.site. 3–63 characters: lowercase letters, digits and single hyphens. Random if omitted.
titleTitle shown in the viewer and in link previews. Defaults to the HTML <title> or the filename.

Send values that come from users with --form-string, which never reads files:

curl -F file=@index.html --form-string slug=q3-report --form-string "title=Q3 report" \
  https://anyshare.ai/api/v1/sites

Response#

201 Created:

{
  "slug": "sunny-otter-4821",
  "url": "https://sunny-otter-4821.anyshare.site",
  "title": "Q3 report",
  "mode": "site",
  "kind": "html",
  "files": 3,
  "bytes": 48213,
  "plan": "free",
  "expiresAt": "2026-11-25T11:00:00.000Z",
  "createdAt": "2026-11-25T10:00:00.000Z",
  "updatedAt": "2026-11-25T10:00:00.000Z",
  "version": 1,
  "claimed": false,
  "notes": ["Unpacked site.zip."],
  "token": "as_tok_…",
  "manageUrl": "https://anyshare.ai/…",
  "claimUrl": "https://anyshare.ai/claim/sunny-otter-4821#token=as_tok_…"
}
  • url: the public link.
  • mode: site (has an HTML entry point), file (one non-HTML file, shown in its viewer) or folder (several files, shown as a file list).
  • kind: the type of the main file, e.g. html, pdf, markdown, react.
  • version: 1 when created, plus one for every update.
  • expiresAt: when the link goes away. 1 hour after upload while unclaimed; 30 days after upload once it's in a free account.
  • claimed: true once the link belongs to an account.
  • notes: present when the upload needed interpreting, e.g. a zip was unpacked, a wrapping folder or build folder was used, or a single-page app was detected. Also when visitors will see a safety warning before the page opens, because it asks for a password or card details or forwards them to another site (see Limits and expiry). Agents should pass relevant notes on to the user.
  • token: shown only once and stored hashed. Keep it private.
  • manageUrl: a browser link for the owner to manage the link. It contains the token, so treat it like one.
  • claimUrl: only for links created without an account. A browser link where a person signs in or creates a free account to keep the link. It contains the token too. Agents should show it to the user next to the URL, with the deadline.

With Accept: text/plain, the response is just the URL and a newline, which is handy in scripts. An unclaimed link's claim link comes in the X-Anyshare-Claim-Url header:

URL=$(curl -sS -H "Accept: text/plain" -F file=@report.html https://anyshare.ai/api/v1/sites)

GET /sites/{slug} returns the same fields without token and manageUrl.

curl https://anyshare.ai/api/v1/sites/sunny-otter-4821

PUT /sites/{slug} replaces all of the content and keeps the URL. It takes the same body as POST. Authorize it with the link's token, or, for a link in your account, with your API key.

curl -X PUT -H "Authorization: Bearer $TOKEN" -F file=@report.html \
  https://anyshare.ai/api/v1/sites/sunny-otter-4821
curl -X DELETE -H "Authorization: Bearer $TOKEN" https://anyshare.ai/api/v1/sites/sunny-otter-4821

POST /sites/{slug}/claim moves a link created without an account into yours, the same as opening its claimUrl. Send the link's token in a JSON body and your API key:

curl -X POST -H "Authorization: Bearer $ANYSHARE_API_KEY" -H "Content-Type: application/json" \
  -d '{"token":"as_tok_…"}' https://anyshare.ai/api/v1/sites/sunny-otter-4821/claim

It returns the link's details with claimed: true and the new expiresAt. Keeping a link that's already yours is a no-op; a link in someone else's account is already_claimed, and an expired one is not_found.

Your account#

With Authorization: Bearer <api key>:

  • GET /account: the signed-in account, { "email", "createdAt" }.
  • GET /account/sites: { "sites": [...] }, your live links, newest first.
  • POST /auth/logout: revokes the key.
  • GET /billing: { "plan": "free" | "pro", "subscription", "pricing" }.
  • POST /billing/checkout with JSON { "interval": "month" | "year" }: { "url" }, a Stripe Checkout link that starts Pro. Agents show it to the person, who pays there; uploads switch to Pro within seconds of payment. 409 already_subscribed if the account is already on Pro.
  • POST /billing/portal: { "url" }, a Stripe page to change the card, see invoices or cancel.

Getting a key#

API keys come from a device login, the flow anyshare login uses:

  1. POST /auth/device returns device_code, user_code (e.g. WDJB-MJHT), verification_uri_complete, expires_in and interval.
  2. The person opens verification_uri_complete, signs in or creates a free account, and approves the code.
  3. Poll POST /auth/device/token with JSON { "device_code": "…" } every interval seconds. It answers 400 with authorization_pending until the person approves, then once with { "api_key": "as_key_…", "email": "…" }. access_denied means they said no; expired_token means the code ran out (10 minutes) or was already used.

Errors#

Errors use a stable code and a message written for people:

{ "error": { "code": "too_large", "message": "This upload is 63 MB; free uploads are limited to 50 MB." } }
CodeWhat to do
bad_requestCheck that the upload has a file field (or a raw body with X-Filename).
too_largeFree uploads are limited to 50 MB. Share a smaller build or compress media.
too_many_filesFree uploads are limited to 1,000 files. Share the build output, not the project.
unsupportedThis content can't be hosted, or it looks like a phishing page (status 422). The message lists what was found; for a prototype, remove the form action or code that sends the fields to another site and upload again.
slug_takenPick another slug, or leave it out.
invalid_slugUse 3–63 lowercase letters, digits and single hyphens.
unauthorizedThe token is missing or doesn't match the slug, or the API key is wrong or revoked.
not_foundThe link doesn't exist, or it expired or was deleted.
already_claimedThe link already belongs to another account. Sign in to that account to manage it.
authorization_pending, expired_token, access_deniedDevice login states; see Getting a key.
rate_limitedToo many uploads in a short time. Wait and retry.
already_subscribed, no_subscriptionThe account is already on Pro, or has nothing to manage yet.
billing_unavailableBilling isn't available right now. Try again later.
internalSomething broke on our side. Retry with the same Idempotency-Key.

Retrying safely#

Send an Idempotency-Key header with a random UUID when you create a link. If the request fails halfway and you retry with the same key, you get the original link back instead of a second one.

curl -H "Idempotency-Key: $(uuidgen)" -F file=@report.html https://anyshare.ai/api/v1/sites

Retry network errors, 429 and 5xx responses with backoff, and reuse the key each time.

Telling us who you are (optional)#

These headers help us show "Published by Claude Code" and spot problems by client:

  • X-Anyshare-Source: api, cli or mcp
  • X-Anyshare-Client: the agent or tool, e.g. claude-code, codex, cursor
  • User-Agent: e.g. my-tool/1.2

Every link is its own subdomain. On any file URL, ?raw returns the original bytes and ?download downloads the file. Video and audio support range requests, so seeking works.