# Integrate DurableFile

Follow these steps in order.
Storage costs $1 per 1 GiB, and purchases stack.
Accepted files are PDF, UTF-8 plain text, Markdown, CSV, and valid JSON.
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 and public_url.
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.

For an expiry, set one of these values:

- unpublish_after_hours: a positive number no greater than 8760.
- unpublish_at: future epoch seconds or an ISO 8601 time.

An unpublish keeps the bytes and quota use.
A publish restores the same URL.
A delete frees the account quota.

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

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