Skip to content
Pickcell
Menu

Files API

Store and serve files from your own code

Store files in Pickcell Files from your own systems, list them, hand out download links and delete them, and hear about every file stored or deleted through signed webhooks.

Key concepts

Document
One stored file. You register it first, then upload the bytes straight to storage. Files are capped at 25 MiB.
Hash
The SHA-256 of the file's bytes, hex encoded. The upload is checked against it before the file counts as stored.
Visibility
PRIVATE by default: its downloadUrl is short-lived, so read the document again for a fresh one. A PUBLIC file has a stable address that does not expire.
Type
One of PDF, JPG, PNG, DOC, DOCX, XLS, XLSX, CSV, TXT, ZIP or OTHER.
Key roles
Give the key the SHARE role OWNER. Sharing folders with people is done in the console.

Every call below needs a bearer token from your API key - see the quickstart. Uploading a file answers 402 if your plan does not include Files. File events carry details only, never a link to the file; ask for a download link under your own token.

Each task shows curl, fetch and the SDK (npm i @pickcell/sdk). The SDK examples use one client, made with your API key and account address; it exchanges the key for a token itself:

import { FileShare } from '@pickcell/sdk/fileshare';

const files = new FileShare({
  baseUrl: 'https://api.pickcell.io',
  apiKey: process.env.PICKCELL_API_KEY,
  accountIdentifier: process.env.PICKCELL_ACCOUNT_ADDRESS,
});

Upload a file

Register the document with its hash and type. The response carries an uploadUrl and uploadFields: post every field unchanged, then the bytes as file, as a multipart form straight to storage.

HASH=$(shasum -a 256 invoice-1042.pdf | cut -d' ' -f1)
curl -X POST https://api.pickcell.io/v1/files/documents \
  -H "Authorization: Bearer $PICKCELL_TOKEN" \
  -H "content-type: application/json" \
  -d "{ \"description\": \"Invoice 1042\", \"hash\": \"$HASH\", \"type\": \"PDF\" }"
# Then post to documents.uploadUrl: one -F name=value per uploadFields entry, and -F file=@invoice-1042.pdf last.
import { createHash } from 'node:crypto';
import { readFile } from 'node:fs/promises';

const bytes = await readFile('invoice-1042.pdf');
const hash = createHash('sha256').update(bytes).digest('hex');

const res = await fetch('https://api.pickcell.io/v1/files/documents', {
  method: 'POST',
  headers: { Authorization: `Bearer ${accessToken}`, 'content-type': 'application/json' },
  body: JSON.stringify({ description: 'Invoice 1042', hash, type: 'PDF' }),
});
const { documents: document } = await res.json();

const form = new FormData();
for (const [name, value] of Object.entries(document.uploadFields)) form.append(name, value);
form.append('file', new Blob([bytes]));
await fetch(document.uploadUrl, { method: 'POST', body: form });
import { createHash } from 'node:crypto';
import { readFile } from 'node:fs/promises';

const bytes = await readFile('invoice-1042.pdf');
const hash = createHash('sha256').update(bytes).digest('hex');

const { document, uploadUrl, uploadFields } = await files.documents.create({
  description: 'Invoice 1042',
  hash,
  type: 'PDF',
});

const form = new FormData();
for (const [name, value] of Object.entries(uploadFields!)) form.append(name, value);
form.append('file', new Blob([bytes]));
await fetch(uploadUrl!, { method: 'POST', body: form });

Registering answers 201 with the document under documents. Once the upload is checked against the hash, uploadVerified becomes true and file.stored is sent. A file over 25 MiB is refused by storage.

List your files

curl "https://api.pickcell.io/v1/files/documents?page=1&limit=20" \
  -H "Authorization: Bearer $PICKCELL_TOKEN"
const res = await fetch('https://api.pickcell.io/v1/files/documents?page=1&limit=20', {
  headers: { Authorization: `Bearer ${accessToken}` },
});
const { documents, pagination } = await res.json();
const { documents, pagination } = await files.documents.list({ page: 1, limit: 20 });
curl https://api.pickcell.io/v1/files/documents/<document id> \
  -H "Authorization: Bearer $PICKCELL_TOKEN"
const res = await fetch(`https://api.pickcell.io/v1/files/documents/${documentId}`, {
  headers: { Authorization: `Bearer ${accessToken}` },
});
const { documents: document } = await res.json();
const document = await files.documents.get(documentId);

A verified document carries a downloadUrl. For a private file it expires, so read the document again whenever you need one rather than storing it.

Delete a file

curl -X DELETE https://api.pickcell.io/v1/files/documents/<document id> \
  -H "Authorization: Bearer $PICKCELL_TOKEN"
await fetch(`https://api.pickcell.io/v1/files/documents/${documentId}`, {
  method: 'DELETE',
  headers: { Authorization: `Bearer ${accessToken}` },
});
await files.documents.delete(documentId);

The answer is always 204, even for a file that is already gone, so a retried delete is safe.

Events

Delivered to the endpoints on your Pickcell events application, wrapped in the delivery envelope. The webhooks guide covers filters, signatures and retries.

  • file.storedA file was stored, by any product, in any folder. app names the product it belongs to.
    Example data
    {
      "documentId": "<document id>",
      "app": "SHARE",
      "folder": "",
      "scopeId": null,
      "name": "invoice-1042.pdf",
      "fileType": "PDF",
      "sizeBytes": 48213,
      "visibility": "PRIVATE",
      "createdAt": "2026-11-23T01:02:03.000Z",
      "occurredAt": "2026-11-23T01:02:05.000Z"
    }
  • file.deletedA file was deleted.
    Example data
    {
      "documentId": "<document id>",
      "app": "SHARE",
      "folder": "",
      "scopeId": null,
      "name": "invoice-1042.pdf",
      "fileType": "PDF",
      "sizeBytes": 48213,
      "visibility": "PRIVATE",
      "createdAt": "2026-11-23T01:02:03.000Z",
      "occurredAt": "2026-11-24T08:00:00.000Z"
    }

Ready to build?

Create an account, then make your first API key in the console.