# Integrate DurableFile

Follow these steps in order.
Storage costs $1 per 1 GiB, purchases stack, and purchases never expire.
Any file type is accepted up to 25 MiB.
Files are public. Do not upload secrets or sensitive personal data.

1. Call POST https://durablefile.com/v1/accounts.
2. Store api_key outside version control. The key is not recoverable.
3. Call POST https://durablefile.com/v1/credit with {"gb":1}.
4. Complete one returned payment option.
5. Poll GET https://durablefile.com/v1/me until storage_quota_bytes is non-zero.
6. Upload with multipart field file, or raw bytes with Content-Type and X-Filename.
7. Save the returned hash, public_url, and expires_at.
8. Fetch public_url and verify Content-Disposition is attachment.

Do not grant quota from a browser return page.
Only signed payment webhooks grant quota.

Retention rules:

- Every file expires. Omitting the expiry fields gives 14 days.
- expires_after_hours: an integer from 1 through 4320 (180 days).
- expires_at: future epoch seconds or an ISO 8601 time within 180 days.
- Send one of them, never both, never null.

Renewal:

- Re-upload the same bytes before expiry; the new request sets the window.
- POST /v1/files/:hash/publish starts a fresh window at any time.

An expired claim stops serving and frees its quota automatically.
A manual unpublish keeps the bytes until their expires_at.
A delete frees the account quota immediately.

Every actionable 4xx response has a fix field.
Show that field without a paraphrase.

Full contract: https://durablefile.com/openapi.json
