--- name: file-viewer description: Share or upload files to share.hisflat.com for public access --- # File Viewer Upload files to https://share.hisflat.com when a user needs a public link to an artifact. Links are non-guessable but public to anyone who has one, and expire 14 days after upload. ## Authentication Read the API key from `FILE_VIEWER_API_KEY`. Never print, commit, or embed the key in output. ## Upload a file Only HTML, Markdown, PNG, TXT, and CSV are accepted. Send the original bytes and include the filename: ```bash curl --fail-with-body --silent --show-error \ -X POST \ -H "Authorization: Bearer $FILE_VIEWER_API_KEY" \ -H "X-Filename: $(basename "$FILE")" \ -H "Content-Type: application/octet-stream" \ --data-binary "@$FILE" \ https://share.hisflat.com/api/files ``` The JSON response contains `url`, `raw_url`, and `expires_at`. Return the `url` to the user. You may instead send multipart form data with a field named `file`: ```bash curl --fail-with-body --silent --show-error \ -H "Authorization: Bearer $FILE_VIEWER_API_KEY" \ -F "file=@$FILE" \ https://share.hisflat.com/api/files ``` ## Manage uploads List files created by this key: ```bash curl --fail-with-body --silent --show-error \ -H "Authorization: Bearer $FILE_VIEWER_API_KEY" \ https://share.hisflat.com/api/files ``` Extend a file to 14 days from now: ```bash curl --fail-with-body --silent --show-error -X POST \ -H "Authorization: Bearer $FILE_VIEWER_API_KEY" \ https://share.hisflat.com/api/files/FILE_ID/extend ``` Delete a file immediately: ```bash curl --fail-with-body --silent --show-error -X DELETE \ -H "Authorization: Bearer $FILE_VIEWER_API_KEY" \ https://share.hisflat.com/api/files/FILE_ID ``` ## Safety - Treat every returned URL as public. Do not upload secrets, credentials, or private personal data. - Do not upload unsupported file types disguised with another extension. - Tell the user the link expires after 14 days.