Skip to Content
InstaHost

API

The HTTP upload protocol, routes and error reference.

API: general rules

  • Base URL: https://instahost.dev/v1. The OpenAPI 3.1 description lists every route and schema.
  • Requests with a body need Content-Type: application/json (an optional charset=utf-8 is accepted); anything else is 415 unsupported_media_type. Bodies above 1 MiB are 413 payload_too_large. Unknown fields are refused with 400 invalid_request, and details.field names the field.
  • Every response is JSON with Cache-Control: no-store and X-Content-Type-Options: nosniff. No response sets a cookie or sends Access-Control-Allow-*, so browsers block cross-origin reads, and preflighted requests fail (OPTIONS is 405).
  • A POST or DELETE whose Sec-Fetch-Site is cross-site or same-site (a request made by a web page on another site) is refused with 403 cross_site_request. Agents, scripts and the CLI send no such header.
  • HEAD works wherever GET does. A wrong method is 405 method_not_allowed with an Allow header; an unknown /v1 path is 404 not_found.
  • Timestamps are RFC 3339 UTC strings, such as 2026-11-21T10:00:00Z.
  • Rate limits, checked first on every /v1 request: 30 requests per minute per client IP without an API key (IPv6 clients are grouped by /64 prefix); with an API key, 300 requests per minute per IP and 300 requests per minute per key. Over the limit: 429 rate_limited with Retry-After: 60. Daily quotas are separate (429 quota_exceeded; see Limits).
  • Errors always use one envelope:
    {"error": {"code": "ttl_too_long", "message": "Anonymous artifacts may live at most 604800 seconds.", "details": {"max_ttl_seconds": 604800}}}
    code is stable and listed under Error codes; message is for humans; details is present only when there is something to add.

The artifact object

{"id": "k3tq...", "type": "site", "access": "unlisted", "status": "published",
 "url": "https://<id>.instahost.cloud/",
 "created_at": "2026-11-21T10:00:00Z", "expires_at": "2026-11-22T10:00:00Z", "published_at": "2026-11-21T10:00:04Z",
 "file_count": 12, "total_bytes": 482113}

status is the effective status (expired once expires_at has passed). expires_at is null for persistent artifacts; published_at is null until published. The authorized view, returned to the artifact's delete token or owner key, adds owner: the owning API key's id, or null for anonymous artifacts.

Create an artifact: POST /v1/artifacts

Anonymous, or with an API key as owner. Any other credential is 401 invalid_api_key.

{"type": "file",                 // "file" or "site"
 "access": "unlisted",           // optional: "public", "unlisted" (default) or "private" (files only)
 "ttl_seconds": 86400,           // optional; default 1 day
 "persistent": false,            // optional; true needs an API key and excludes ttl_seconds
 "files": [{"path": "report.pdf", "size": 48213, "md5": "9e107d9d372bb6826bd81d3542a419d6",
            "content_type": "application/pdf"}]}  // content_type: optional, type=file only
files[].path
For a file: its name, without /. For a site: the path relative to the site root, with / separators. At most 512 bytes of UTF-8 and 255 bytes per segment, in Unicode NFC, with no empty, . or .. segment, no leading or trailing /, no backslash, no control, line-separator or invisible formatting character, and no duplicate. Names that look like credentials or VCS data are refused (sensitive_file): .env and .env.*, .dev.vars, .envrc, .npmrc, .netrc, .pypirc, .htpasswd, .git-credentials, .pgpass, SSH private keys (id_rsa, id_ed25519, …), *.pem, *.key, *.p12, *.pfx, *.jks, *.keystore, *.ppk, Terraform state and variables, backup copies of those, and anything inside .git, .svn, .hg, .ssh, .aws, .gnupg, .kube or .docker. Detection is by name only.
files[].size
Exact size in bytes. Checked again against the stored object at complete.
files[].md5
Required: the MD5 of the bytes, 32 hexadecimal characters. It is signed into the upload URL, so storage refuses any other bytes.
files[].content_type
Files only: overrides the type derived from the extension (lowercase type/subtype, at most 127 characters). It does not change whether the file opens inline or downloads.

A site needs a root index.html (400 missing_index). Checks run in this order: rate limit, credential, body and schema, file count, paths, sensitive names, sizes, private sites, lifetime, then the daily quota. A refused create writes nothing.

Response 201:

{"artifact": { ... status "pending"; url and expires_at are already final; owner ... },
 "delete_token": "ihd_...",
 "access_token": "iha_...",                       // private files only
 "access_url": "https://files.instahost.cloud/<id>/report.pdf?token=iha_...",  // private files only
 "upload": {"expires_at": "...", "batch_size": 50, "remaining": 0,
            "uploads_url": "https://instahost.dev/v1/artifacts/<id>/uploads",
            "complete_url": "https://instahost.dev/v1/artifacts/<id>/complete",
            "files": [{"path": "report.pdf", "method": "PUT", "url": "https://...",
                       "headers": {"if-none-match": "*", "content-md5": "nhB9nTcrtoJr2B01QqQZ1g==",
                                   "x-amz-storage-class": "STANDARD"}}]}}

upload.files holds upload URLs for the first batch_size files in manifest order; remaining counts the files still without a URL (ask for them with /uploads). Keep the delete token: it is the only way to delete an anonymous artifact.

Upload the bytes: PUT to each presigned URL

Send each file's exact bytes with PUT to its url, and replay every header in headers exactly as returned: they are all signed, and storage refuses the request if one differs or is missing. The signed headers are if-none-match: * (an object can be written once, so a URL can never overwrite bytes), content-md5 (storage rejects other bytes with 400 BadDigest), x-amz-storage-class: STANDARD and content-length (storage refuses a body of another length; /v1/limits reports upload.signs_content_length: yes). Do not add a Content-Type: the stored metadata is never served, and the served type comes from the extension.

  • 200: stored. 412: the object already exists (an earlier attempt succeeded), which counts as done.
  • 403: the URL expired or a header was changed; get a new URL from /uploads.
  • With curl, add -H 'Expect:' so it does not send Expect: 100-continue.

Upload URLs live 5 minutes for anonymous artifacts and 15 minutes with an API key, and never beyond the artifact's upload window: 15 minutes after create for anonymous artifacts, 1 hour with an API key. There is no multipart upload: each file is one PUT, up to the file size limit.

More upload URLs: POST /v1/artifacts/{id}/uploads

Delete token or owner key. Request: {"paths": ["a.js", "img/b.png"]}, 1 to 50 distinct manifest paths. Response 200: {"upload": {"expires_at": "...", "files": [...]}}, in the same form as create. Use it for the files beyond the first batch and to replace URLs that expired.

  • Each file can get at most 3 URLs in total, counting the one from create; beyond that, 409 upload_url_limit. A request is all or nothing: if any path is refused, none is counted.
  • 400 unknown_path for a path that is not in the manifest (details.paths).
  • 410 gone from the end of the upload window on (at upload_until itself, when a new URL would have no life left), and for deleted, blocked or expired artifacts. 409 artifact_not_pending once the artifact is published or failed.
  • 403 forbidden with details.reason: "owner_key_revoked" when the API key that created the artifact has been revoked, whatever credential is presented.

Complete (publish): POST /v1/artifacts/{id}/complete

Delete token or owner key; no request body. The service lists the stored objects and compares each with the manifest. Response 200: {"artifact": { ... "status": "published" ... }} (the authorized view). The delete token is not repeated.

OutcomeAnswer
Every object present with the declared size (and MD5, where storage reports it)200, published.
Some objects missing409 upload_incomplete with details.missing (the first 100 paths) and details.missing_count. The artifact stays pending: upload the missing files and call complete again.
An object differs (size, MD5, storage class, or a customer-supplied encryption key)422 upload_mismatch with details.files (path, expected_size, actual_size, reason: size, md5, storage_class or sse_c). The artifact is now failed and its objects are deleted.
Already published200 with the same body (idempotent).
Already failed409 artifact_failed: create a new artifact.
Called after the upload window ended (later than upload_until), or deleted, blocked or expired410 gone.
More than 4 calls on a pending artifact409 complete_attempt_limit.
The owner API key was revoked403 forbidden, details.reason: "owner_key_revoked".

Note the boundary: /uploads answers 410 from upload_until on, while complete still works at upload_until itself and answers 410 only after it. An artifact never completed by the end of its window is marked failed and its objects are purged.

Read an artifact: GET /v1/artifacts/{id}

  • With the delete token or the owner key: 200 and the authorized view in any status, until the tombstone is removed. ?include=files adds files (path, size, content_type), 100 per page in path order, and files_next: pass it as &files_after= for the next page; it is null on the last page.
  • Anyone else (no credential, or one that cannot manage this artifact): 200 and the public view only for a published, unexpired artifact that is not private; 410 gone when it expired or was deleted or blocked; 404 not_found otherwise (pending, failed, private, unknown). A wrong token therefore never reveals that a private artifact exists.
  • A malformed, unknown or revoked API key is still 401 invalid_api_key.

Delete an artifact: DELETE /v1/artifacts/{id}

Delete token or owner key. Response 200: {"artifact": {"id": "...", "status": "deleted", "deleted_at": "..."}}, or {"artifact": {"id": "...", "status": "blocked"}} if the operator had taken it down. Every URL of the artifact answers 410 from the next request on, and its bytes are deleted at once (best effort) and again by a later cleanup pass.

  • Works on pending, published, failed and expired artifacts. Idempotent: repeating it returns the same 200 while the tombstone exists, then 404.
  • No credential: 401 unauthorized. A credential for another artifact: 403 forbidden.
  • Deletion keeps working when uploads are refused because no rate limiter or secret is available, and when anonymous uploads are switched off.

GET /v1/limits

Public. Returns the limits in force: anonymous (with enabled) and api_key, each with max_ttl_seconds, allow_persistent, max_file_bytes, max_artifact_bytes, max_files, daily (artifacts, files, bytes) and upload (url_ttl_seconds, pending_ttl_seconds); anonymous_global_daily; default_ttl_seconds; min_ttl_seconds; upload (batch_size, max_url_issues_per_file, max_complete_attempts, signs_content_length); sites (url_mode, private_supported); max_path_bytes; max_manifest_bytes; and rate_limit, the rate limiter in use (binding, or none when no limiter is available; anonymous uploads then answer 503 service_misconfigured).

Admin routes

For the operator, with Authorization: Bearer <admin secret>. Without the admin secret, every admin route answers 404 not_found, exactly like an unknown path. Admin bodies are at most 8 KiB.

RouteRequestResponse
POST /v1/admin/keys{"label": "ci-bot"} (1 to 64 characters of printable text)201 {"key": {"id", "label", "created_at"}, "api_key": "ihk_..."}. The key is shown once.
DELETE /v1/admin/keys/{key_id}
?block_artifacts=1 optional
none200 {"key": {"id", "revoked_at"}}. Idempotent; the first revocation time is kept. The key is refused from the next request on. With block_artifacts=1, also blocks up to 200 of the key's artifacts per call and adds blocked_artifacts and has_more: repeat while has_more is true. Without it, the key's published artifacts stay online, and its pending ones can no longer be completed.
POST /v1/admin/artifacts/{id}/block{"reason": "..."} (1 to 500 characters of printable text)200 {"artifact": {"id", "type", "access", "status": "blocked", "block_reason", "blocked_at", "owner", "created_at", "expires_at", "purged"}}. Takedown: every URL answers 410 from the next request on; the bytes are deleted. Idempotent; the first reason is kept.

Error codes

The HTTP status follows from the code. Only upload_incomplete is meant to be retried as such (after uploading the missing files); rate_limited can be retried after Retry-After.

CodeHTTPMeaning and details
invalid_json400The body is not valid UTF-8 JSON.
invalid_request400The body or a parameter breaks the schema, or has an unknown field. details.field names it.
invalid_path400Paths break the path rules. details.paths: [{path, reason}] (first 100); details.count.
sensitive_file400Paths look like credentials or VCS data. details.paths: [{path, rule}]; details.count.
missing_index400A site has no index.html at its root.
unknown_path400/uploads named paths that are not in the manifest. details.paths.
unauthorized401The route needs the delete token or the owner's API key, or Authorization is not Bearer <token>.
invalid_api_key401The ihk_ key is malformed, unknown or revoked (also when it was revoked while the create was in flight), or create received a credential that is not an API key.
forbidden403The credential cannot manage this artifact; persistence is switched off; or, with details.reason: "owner_key_revoked", the owning key was revoked (/uploads, /complete).
anonymous_disabled403Anonymous uploads are switched off (create, and /uploads and /complete of anonymous artifacts). Use an API key.
persistent_requires_api_key403persistent: true without an API key.
cross_site_request403A POST or DELETE sent by a web page on another site (Sec-Fetch-Site is cross-site or same-site).
not_found404Unknown path or artifact; also pending, failed and private artifacts for callers who cannot manage them, and admin routes without the admin secret.
method_not_allowed405Wrong method; the Allow header lists the right ones.
upload_incomplete409Some files are not uploaded yet. details.missing (first 100), details.missing_count. Upload them and retry.
artifact_not_pending409/uploads on an artifact that is already published or failed.
artifact_failed409complete on a failed artifact. Create a new one.
upload_url_limit409A file already received its 3 upload URLs. details.paths, details.limit.
complete_attempt_limit409The artifact used its 4 complete attempts.
gone410Expired, deleted or blocked, or the upload window has closed.
payload_too_large413The request body is too large. details.limit.
file_too_large413A file is above the size limit. details.limit, details.paths.
artifact_too_large413The files add up to more than the artifact limit. details.limit.
too_many_files413More files than allowed. details.limit.
unsupported_media_type415The body is not sent as application/json.
upload_mismatch422Stored objects differ from the manifest; the artifact has failed. details.files (first 20): [{path, expected_size, actual_size, reason}]; details.count.
private_sites_unsupported422Sites cannot be private. Use unlisted, or share files privately.
ttl_too_short422Below the minimum lifetime. details.min_ttl_seconds.
ttl_too_long422Above the maximum lifetime for this identity. details.max_ttl_seconds.
rate_limited429Too many requests. Retry-After: 60.
quota_exceeded429A daily quota is used up. details.scope: client, global (all anonymous traffic) or api_key; details.resets_at (next UTC midnight); Retry-After in seconds.
internal_error500Unexpected server error.
service_misconfigured503The service cannot accept uploads right now (for example no rate limiter: details.reason: "rate_limiter_unavailable"). Deletion still works.

Abuse

Report abuse or illegal content to abuse@instahost.dev, with the URL. The operator can take any artifact down; it then answers 410 everywhere.