Working with the API
Upload and retrieve Library files
To upload a Library file, request an upload URL, send the file there with PUT and confirm completion. Retrieve a ready file by ID to get its download and preview links.
How do I upload a file with the API?
Request an upload URL
Say the file’s name and its size in bytes. The answer holds the file and where to send its bytes.
POST /library/filescurl -H "Authorization: Bearer $HYPERMAKE_KEY" -H "Content-Type: application/json" \ -d '{"name":"hero.png","sizeBytes":482113}' \ "https://0a2d5g5qtj.execute-api.eu-north-1.amazonaws.com/v1/organizations/$HYPERMAKE_ORG/library/files"The answer { "file": { "id": "file_01jd…", "status": "uploading" }, "upload": { "url": "https://…", "headers": { … }, "expiresAt": "…" } }Send the bytes
Send them to upload.url with PUT and exactly the headers in upload.headers. The link takes this file and nothing else.
PUT upload.url curl -X PUT -H "Content-Type: image/png" --data-binary @hero.png "$UPLOAD_URL"Confirm the upload
Say the bytes were sent. The file is then read and becomes ready, or fails with a reason.
POST /library/files/{file}/completecurl -H "Authorization: Bearer $HYPERMAKE_KEY" -X POST "https://0a2d5g5qtj.execute-api.eu-north-1.amazonaws.com/v1/organizations/$HYPERMAKE_ORG/library/files/$FILE/complete"
Get file details and download links
A file says its name, its kind (image, video, audio, 3d or document), where it came from, and how it stands: uploading, processing, ready or failed. A ready file carries links to itself and to its previews.
curl -H "Authorization: Bearer $HYPERMAKE_KEY" "https://0a2d5g5qtj.execute-api.eu-north-1.amazonaws.com/v1/organizations/$HYPERMAKE_ORG/library/files/$FILE"Download links expire. Save the file ID and request the file again when you need a fresh link.
Find, rename and organize files
- GET /library/files finds files by words, kind, tag, folder or the space they came from.
- PATCH /library/files/{file} gives a file another name.
- POST /library/files/move puts files into a folder, or out of every folder.
- POST /library/files/trash moves files to the trash, where they stay for thirty days.