Skip to main content

Files

Tags: files, storage

File upload and management

In the product: Files

Resources​

Request and response models used by the endpoints on this page.

ConvertedFileResponse​

FieldTypeRequiredDescription
contentString✓
filenameString✓
formatLiteral['text', 'markdown', 'pdf']✓
messageString✓

Example:

{
"content": "string",
"format": "text",
"filename": "string",
"message": "string"
}

CreateFileRequest​

FieldTypeRequiredDescription
accessStringDefault: private
cdnUrlString
databytes
dataBase64String
descriptionString
externalIdString
fileSizeInteger
filenameString✓
folderIdInteger
labelIdsArray
mimeTypeString✓
oauthCredentialUuidString
overwriteBooleanDefault: False
s3KeyString
siteIdInteger
subjectMemberIdInteger
titleString

Example:

{
"filename": "string",
"mimeType": "string",
"access": "private",
"overwrite": false
}

FileFolderResponse​

FieldTypeRequiredDescription
accessStringDefault: private
ancestorsArray<FolderPathSegment>Default: []
childCountIntegerDefault: 0
createdAtDateTime✓
descriptionString
fileCountIntegerDefault: 0
idInteger✓
indexBooleanDefault: False
indexingCompletedAtDateTime
indexingStartedAtDateTime
nameString✓
ownerIdInteger
ownerNameString
parentIdInteger
pathString
shareableBooleanDefault: False
updatedAtDateTime✓
uuidString✓

Example:

{
"id": 0,
"name": "string",
"uuid": "string",
"childCount": 0,
"fileCount": 0,
"access": "private",
"shareable": false,
"index": false,
"createdAt": "2024-01-01T00:00:00Z",
"updatedAt": "2024-01-01T00:00:00Z",
"ancestors": []
}

FileLabelResponse​

FieldTypeRequiredDescription
colorString✓
descriptionString✓
idInteger✓
nameString✓
uuidString✓

Example:

{
"id": 0,
"uuid": "string",
"name": "string",
"color": "string",
"description": "string"
}

FileResponse​

FieldTypeRequiredDescription
accessStringDefault: private
accessModeInteger
cdnUrlString✓
choicePromptString
createdAtDateTime✓
currentVersionNumberIntegerDefault: 0
dataString✓
descriptionString✓
externalIdString✓
fileSizeInteger✓
filenameString✓
folderFileFolderResponse | null✓
folderAncestorIdsArrayDefault: []
folderIdInteger✓
idInteger✓
isS3StoredBooleanDefault: False
labelsArray<FileLabelResponse> | null
lastEditedByMemberIdInteger
mimeTypeString✓
ownerIdInteger
ownerNameString
permissionsIntegerDefault: 0
shareCountIntegerDefault: 0
siteIdInteger✓
subjectMemberIdInteger
titleString✓
updatedAtDateTime✓
uuidString✓

Example:

{
"id": 0,
"uuid": "string",
"title": "string",
"description": "string",
"filename": "string",
"mimeType": "string",
"folderId": 0,
"folderAncestorIds": [],
"siteId": 0,
"externalId": "string",
"access": "private",
"folder": null,
"createdAt": "2024-01-01T00:00:00Z",
"updatedAt": "2024-01-01T00:00:00Z",
"data": "string",
"cdnUrl": "string",
"fileSize": 0,
"isS3Stored": false,
"permissions": 0,
"shareCount": 0,
"currentVersionNumber": 0
}

FileUploadRequest​

FieldTypeRequiredDescription
contentTypeString✓
fileExtensionString✓

Example:

{
"contentType": "string",
"fileExtension": "string"
}

FileUploadResponse​

FieldTypeRequiredDescription
fieldsDict[str, str]✓
fileUrlString✓
uploadUrlString✓

Example:

{
"uploadUrl": "string",
"fields": {},
"fileUrl": "string"
}

FolderPathSegment​

FieldTypeRequiredDescription
idInteger✓
nameString✓

Example:

{
"id": 0,
"name": "string"
}

PaginatedResponse[FileResponse]​

FieldTypeRequiredDescription
itemsArray<FileResponse>✓
pageInteger✓
pageSizeInteger✓
totalInteger✓
totalPagesInteger✓

Example:

{
"items": [],
"total": 0,
"page": 0,
"pageSize": 0,
"totalPages": 0
}

UpdateFileRequest​

FieldTypeRequiredDescription
accessString
baseVersionNumberInteger
databytes
descriptionString
externalIdString
filenameString
folderIdInteger
labelIdsArray
mimeTypeString
oauthCredentialUuidInteger
siteIdInteger
subjectMemberIdInteger
titleString

Example:

{}

Endpoints​

List​

GET /api/v2/w/{workspace_uuid}/files

Description:

List all files for the authenticated user.

Authorization: Requires files:read scope

Parameters:

  • folder_id (Integer)
  • page (Integer) — min: 1
  • pageSize (Integer) — min: 1, max: 100
  • sortBy (FileSortField)
  • sortOrder (SortOrder)
  • search (String)

Response: See PaginatedResponse[FileResponse]


Create​

POST /api/v2/w/{workspace_uuid}/files

Description:

Create a new file.

Authorization: Requires files:write scope

Parameters:

  • file (CreateFileRequest)

Response: FileResponse


Resolve Path​

GET /api/v2/w/{workspace_uuid}/files/resolve-path

Description:

Resolve a wiki-style relative path to a file.

Powers relative markdown links/images in the file browser: path is resolved against folderId (the linking document's folder; omit for the workspace root), with ../. segments and an optional .md extension fallback handled server-side. A /gr/workspace/… or /gr/home/… path resolves from that root instead, with a read check on the root, every folder below it and the file; .. is refused there and there is no .md fallback.

Authorization: Requires files:read scope

Parameters:

  • path (String)
  • folderId (Integer)

Response: FileResponse


Upload Url​

POST /api/v2/w/{workspace_uuid}/files/upload-url

Description:

Generate a presigned URL for uploading a file.

Authorization: Requires files:write scope

Parameters:

  • file_request (FileUploadRequest)

Response: See FileUploadResponse


Delete File Id​

DELETE /api/v2/w/{workspace_uuid}/files/{file_id}

Description:

Delete a file (tombstone-preserving; version history survives).

Authorization: Requires scopes: files:write, files:admin

Parameters:

  • file_id (Integer)

Response: dict[str, str]


Get File Id​

GET /api/v2/w/{workspace_uuid}/files/{file_id}

Description:

Get a specific file by ID.

Authorization: Requires files:read scope

Parameters:

  • file_id (Integer)

Response: FileResponse


Update File Id​

PUT /api/v2/w/{workspace_uuid}/files/{file_id}

Description:

Update an existing file.

Authorization: Requires files:write scope

Parameters:

  • file_id (Integer)
  • file (UpdateFileRequest)

Response: FileResponse


Convert​

POST /api/v2/w/{workspace_uuid}/files/{file_id}/convert

Description:

Convert a file to various formats.

Returns: A ConvertedFileResponse containing the converted content and file metadata.

Authorization: Requires files:read scope

Parameters:

  • file_id (Integer)
  • format (Literal['text', 'markdown', 'pdf'])

Response: See ConvertedFileResponse