Skip to content

Upload Files

Uploads one or more validated files to the server storage manager. Uploads are HTTP multipart requests; TCP/API-token upload is unavailable. The server validates the complete batch before writing any file, and stores the files atomically.

POST

https://{some_domain}/upload

Authorization

Send an ordinary authenticated session JWT in Authorization. Guest sessions and manager API-token sessions cannot upload. Purpose-specific authorization applies: account avatars belong to the authenticated account; customer avatars require the customer's own session or an authorized staff session; KYC documents require a customer session; brand assets require a SuperAdmin. Private document uploads are associated with their uploading actor.

Request

Content-Type: multipart/form-data

Field Type Required Description
purpose string Yes One of account_avatar, customer_avatar, brand_logo, brand_favicon, pwa_icon, brand_pwa_icon, document, kyc_document, or http.upload.
file file Yes Repeat the file field for multiple files; at most 10 files and 20 MiB combined.
customer_id integer Conditional Target customer for a staff customer_avatar upload; staff scope and write permission are checked. Customer sessions can upload only for themselves.

Per-file maximums are 5 MiB for avatars, 10 MiB for brand assets, and 20 MiB for documents. Supported avatar extensions are png, jpg, jpeg, webp, and gif. Brand assets also support ico. Documents support raster images and pdf, txt, csv, doc, docx, xls, and xlsx. New SVG uploads are rejected. The declared MIME type and detected file signature must match the extension.

curl -X POST "https://{some_domain}/upload" \
  -H "Authorization: <JWT_TOKEN>" \
  -F "purpose=account_avatar" \
  -F "[email protected]"

Success Response

The response contains the final uploaded file's name and UUID in file_name and file_id, plus every created record in files.

{
  "file_name": "8e68414e-0e3f-48dd-b7b8-f5be9e26d4f7.png",
  "file_id": "8e68414e-0e3f-48dd-b7b8-f5be9e26d4f7",
  "files": [
    {
      "id": 42,
      "uuid": "8e68414e-0e3f-48dd-b7b8-f5be9e26d4f7",
      "storage_name": "8e68414e-0e3f-48dd-b7b8-f5be9e26d4f7.png",
      "original_name": "avatar.png",
      "extension": "png",
      "signature": "image/png",
      "content_type": "image/png",
      "file_size": 18425,
      "checksum": "d5f92b8a1f0a6a3e4a57e6f25f11c98c3e4c3d6c5b7a8e9f0123456789abcdef",
      "scope": 3,
      "status": 0
    }
  ]
}

files[] fields are id (integer), uuid, storage_name, original_name, extension, signature, content_type, checksum (strings), file_size (bytes), scope (integer: 0 private or 3 public), and status (integer: 0 uploaded). Public scope is forced only for avatars and brand image purposes; documents are private. Use the returned UUID as the profile avatar reference, or use file_name to download an authorized file through Get Storage File.

Errors

HTTP Error Description
400 INVALID_UPLOAD_PURPOSE Missing or unsupported purpose.
400 INVALID_UPLOAD_FILES No files supplied or more than 10 supplied.
400 INVALID_UPLOAD_FILE Invalid file data, type, signature, per-file/total size, or batch validation failed. No file in the batch is committed.
400 INVALID_UPLOAD_SCOPE A caller supplied a scope that differs from the purpose's server-controlled scope.
403 PERMISSION_DENIED Session is not allowed to upload, or lacks access to the requested customer/brand.
503 UPLOAD_STORE_FAILED Atomic storage write failed.

Transport parsing can also return INVALID_MULTIPART_BOUNDARY or PERMISSION_DENIED before the upload handler runs.