Flikk
API

Files

Upload or import files, get links to them, and download them as a zip.

Upload a file

An upload takes three calls. Start it with the file's name, mime type and size in bytes, at most 100 MB, and the response gives you a fileId and an uploadUrl. PUT the bytes to uploadUrl within 15 minutes, then activate the file. The CLI makes all three calls for you.

curl -X POST https://api.flikk.dev/api/files \
  -H "Authorization: Bearer flk_your_api_key" \
  -H "x-org-slug: your-org" \
  -H "Content-Type: application/json" \
  -d '{ "name": "logo.png", "mime": "image/png", "size": 48213 }'
curl -X PUT "your-upload-url" \
  -H "Content-Type: image/png" \
  --data-binary @logo.png
curl -X POST https://api.flikk.dev/api/files/your-file-id/activate \
  -H "Authorization: Bearer flk_your_api_key" \
  -H "x-org-slug: your-org"
flikk files put logo.png -o your-org

Activating answers 409 while the bytes haven't all arrived. Only the person who started the upload can activate it. To swap out an older file, pass its id as replaces when you activate, and Flikk deletes the old file once the new one is ready.

Send a public http or https link, and Flikk downloads it and stores it as a ready file in one call, with no activate step. The response holds the file as { id, name, mime, size } and a url to read it. public and resource work as they do for an upload.

curl -X POST https://api.flikk.dev/api/files/import \
  -H "Authorization: Bearer flk_your_api_key" \
  -H "x-org-slug: your-org" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://example.com/logo.png" }'
flikk files put https://example.com/logo.png -o your-org

A link to a private address or one that can't be downloaded answers 400, and a file over 100 MB answers 413.

Public files and owners

A file is private unless you set public to true when you start the upload. Links to public files last hours, and links to private files last five minutes.

To attach a file to a form or a table, pass it as resource, like { "type": "table", "slug": "customers" }. The file then takes that form's or table's access, so whoever can read the table can read the file. In the CLI, --form attaches the file to a form and --public makes it public.

Send up to 100 file ids, and the response maps each id you can read to a fresh link. Ids you can't read are left out.

curl -X POST https://api.flikk.dev/api/files/links \
  -H "Authorization: Bearer flk_your_api_key" \
  -H "x-org-slug: your-org" \
  -H "Content-Type: application/json" \
  -d '{ "ids": ["your-file-id"] }'

To download one file with the CLI, run flikk files get --id your-file-id, and add -O to choose where it's saved.

Download files as a zip

Send up to 500 file ids, adding up to at most 2 GB. The response holds a url that lasts 5 minutes and a plan. POST the plan to the url as a form field, and the zip streams back. A missing id or a file you can't read answers 404.

curl -X POST https://api.flikk.dev/api/files/zip \
  -H "Authorization: Bearer flk_your_api_key" \
  -H "x-org-slug: your-org" \
  -H "Content-Type: application/json" \
  -d '{ "ids": ["your-file-id", "another-file-id"] }'
curl -X POST "your-zip-url" \
  --data-urlencode "plan=your-plan" \
  -o files.zip
flikk files zip your-file-id,another-file-id -O files.zip -o your-org

On this page