curl --request POST \
--url https://api.studio.prisme.ai/v2/workspaces/{workspaceId}/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file'const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.studio.prisme.ai/v2/workspaces/{workspaceId}/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.studio.prisme.ai/v2/workspaces/{workspaceId}/files"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, files=files, headers=headers)
print(response.text)[
{
"name": "<string>",
"url": "<string>",
"mimetype": "<string>",
"size": 123,
"workspaceId": "<string>",
"path": "<string>",
"id": "<string>",
"expiresAt": "<string>",
"expiresAfter": 123,
"metadata": {},
"public": true,
"shareToken": "<string>",
"orgSlug": "<string>"
}
]{
"error": "BadParameters",
"message": "<string>",
"details": "<unknown>"
}{
"error": "AuthenticationError",
"message": "Unauthenticated"
}{
"error": "ForbiddenError",
"message": "Forbidden"
}Upload File
Upload one or more file(s)
curl --request POST \
--url https://api.studio.prisme.ai/v2/workspaces/{workspaceId}/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file'const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.studio.prisme.ai/v2/workspaces/{workspaceId}/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.studio.prisme.ai/v2/workspaces/{workspaceId}/files"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, files=files, headers=headers)
print(response.text)[
{
"name": "<string>",
"url": "<string>",
"mimetype": "<string>",
"size": 123,
"workspaceId": "<string>",
"path": "<string>",
"id": "<string>",
"expiresAt": "<string>",
"expiresAfter": 123,
"metadata": {},
"public": true,
"shareToken": "<string>",
"orgSlug": "<string>"
}
]{
"error": "BadParameters",
"message": "<string>",
"details": "<unknown>"
}{
"error": "AuthenticationError",
"message": "Unauthenticated"
}{
"error": "ForbiddenError",
"message": "Forbidden"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Workspace id
Body
Accepts both binary data or dataURI (i.e data:...,base64:...)
File expiration time in seconds. This is currently a best effort expiration as it will be deleted only upon the next restart after expiration
Set to true to make uploaded file publicly available
If enabled, return a share token that will allow anybody access the file
Optional custom file ID(s). Can be a single string (applied to first file) or an array (one per uploaded file). Files without a custom ID get a random one.
Optional storage subpath(s), scoped under the workspace prefix. A single string applies to the first file, an array maps one per uploaded file. Yields a clean object key <workspaceId>/<path> (sanitized, no traversal) instead of the default opaque id-based key — e.g. to publish prerendered pages at CDN-served URLs.
Arbitrary JSON metadata attached to the uploaded file(s). Send as a JSON object (application/json) or a JSON string (multipart). Applies to every uploaded file. Per-key metadata.<key> form fields override/extend these values and may be repeated to map one value per file. Filterable on list via GET /files?metadata.<key>=<value>.
Response
Success Response
Number of seconds after which the file will be automatically removed. This is currently a best effort expiration as it will be deleted only upon the next restart after expiration date.
Reflects whether the file has public-read ACL at storage provider. True by default
A share token to append as a ?token query parameter to grant read access with given url
Organization slug set at creation time
Was this page helpful?