Skip to main content
Files are attached to an existing record. Upload with uploadFile(), keep the returned file id, and call getFileUrl() with that id whenever you need a download link.
requestFileUpload() is deprecated. The endpoint it called never existed, so it never succeeded; it now rejects with a HaspSDKError without sending a request. Use uploadFile().

uploadFile(entityKey, recordId, file, signal?)

Uploads a File (or Blob) and attaches it to the record. The SDK sends it to the Data API as multipart/form-data; the file is scanned for malware before it is stored.
The record must already exist — create it first with createRecord(), then upload. Nothing links the file to a particular field, so store file.id on the record yourself if you need to find the file again:

Upload errors

All are HTTP 422 except NOT_FOUND (404). See Error Handling.

getFileUrl(fileId, signal?)

Returns a presigned download URL for a file, plus the file’s metadata.
Opening the file in a new tab:
Triggering a download:
The presigned URL is valid for one hour (expiresAt). Do not cache it long-term — call getFileUrl again if you need a fresh URL.

Limits

The maximum single-file size and total attachment storage depend on your plan — see Limits.