Skip to navigation

Upload a file or a new version of it

View as Markdown

Upload a file of up to 5 MB. Give text in content or binary data in contentBase64 (one of them is required). A new file goes to the General folder unless you give a folderId. To upload a new version of a file, pass its fileId. Basement then replaces only the content and ignores name, kind, tags and folderId. To change only a part of a text file, use edit_file. Requires write access.

Authentication

AuthorizationBearer

A Basement key (bsmt_...), from Agents, Connect in the app.

Request

This endpoint expects an object.
namestringRequired
File name with extension
contentstringOptional
Text content
contentBase64stringOptional

Binary content, base64-encoded

mimeTypestringOptional

MIME type (default text/plain for content, application/octet-stream for contentBase64)

kindenumOptional

File kind (default asset)

Allowed values:
tagslist of stringsOptional
Optional tags
fileIdstringOptional
Optional existing file ID to update
folderIdstringOptional

Optional folder for a new file, from list_folders. You must have write access to it

Response

The tool's answer.
idstringOptional

The new file's ID (when a file was created)

versionCountintegerOptional

The file's new version (when a file was replaced)

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
429
Too Many Requests Error
500
Internal Server Error