| Méthode | Chemin | Résumé |
|---|---|---|
| GET | …/files | List files attached to the workspace |
| GET | …/files/search | Search workspace files by attributes |
| POST | …/files/move | Move a workspace file to a different folder or location |
| GET | …/files/{fileId}/download | Generate a time-limited download URL for a workspace file |
Les chemins commencent par /workspaces/{workspaceId}. Les endpoints GET demandent workspace-files:read, les autres workspace-files:write.
L’objet WorkspaceFile
firestoreIdstringobligatoirecreationobjectobligatoireWhen and by whom the resource was created.
Afficher les 2 champs enfants
creationDateTimestringdate-timeobligatoireDate and time when the resource was created.
createdBystringID of the user who created the resource, when recorded.
workspaceIdstringobligatoireID of the workspace.
sizeintegerobligatoiremimeTypestringobligatoirefilenamestringobligatoiregcsPathstringobligatoireAfficher les 14 champsMasquer la liste des champs
extensionstringobligatoirechecksumMd5stringchecksumCrc32cstringcustomMetadataRecord<string, string | boolean | number | null>obligatoirescopestringobligatoireValeursworkspace_attachmentbank_account_attachmentbank_transaction_attachmentbank_transaction_importbank_transaction_exportdraft_payment_attachmentinitiated_payment_attachmentinvoice_attachment
targetDocumentPathstringtargetDocumentIdstring{
"firestoreId": "string",
"creation": {
"creationDateTime": "2026-03-02T09:15:00.000Z",
"createdBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
},
"workspaceId": "Wk7fQ2xR9bLm4tZp8sNv",
"size": 0,
"mimeType": "string",
"filename": "string",
"gcsPath": "string",
"extension": "string",
"checksumMd5": "string",
"checksumCrc32c": "string",
"customMetadata": {
"key": "string"
},
"scope": "workspace_attachment",
"targetDocumentPath": "string",
"targetDocumentId": "Hk2xNq8vR4tYw6ZbPj3c"
}/workspaces/{workspaceId}/filesList files attached to the workspace
Portéeworkspace-files:read
Paramètres de chemin
workspaceIdstringobligatoireID of the workspace.
Paramètres de requête
limitintegerMaximum number of items to return, from 1 to 100. A missing, invalid or non-positive value falls back to 20, and a larger value to 100.
Par défaut20
startAfterstringCursor of the page to return: the nextCursor of the previous page.
fieldsstringComma-separated property paths to include in the response, or in each item of a list. Use dots for nested paths.
idsstring[]Comma-separated IDs of the items to return, up to 30. When set, limit, startAfter and the filters are ignored.
Renvoie
List of items
Items of the page, in list order.
limitintegerobligatoirePage size of the request, or the number of requested ids.
nextCursorstringCursor of the next page, to pass as startAfter. Absent when the page holds fewer items than limit; a full last page still has one, and the page it points to is empty.
curl 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/files' \
-H "Authorization: Bearer $SWAY_API_KEY"const response = await fetch('https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/files', {
headers: {
Authorization: `Bearer ${process.env.SWAY_API_KEY}`,
},
});
console.log(await response.json());import os
import requests
response = requests.get(
"https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/files",
headers={"Authorization": f"Bearer {os.environ['SWAY_API_KEY']}"},
)
print(response.json()){
"data": [
{
"firestoreId": "string",
"creation": {
"creationDateTime": "2026-03-02T09:15:00.000Z",
"createdBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
},
"workspaceId": "Wk7fQ2xR9bLm4tZp8sNv",
"size": 0,
"mimeType": "string",
"filename": "string",
"gcsPath": "string",
"extension": "string",
"checksumMd5": "string",
"checksumCrc32c": "string",
"customMetadata": {
"key": "string"
},
"scope": "workspace_attachment",
"targetDocumentPath": "string",
"targetDocumentId": "Hk2xNq8vR4tYw6ZbPj3c"
}
],
"limit": 0,
"nextCursor": "string"
}{
"error": {
"code": "invalid-argument",
"message": "Invalid request"
}
}{
"error": {
"code": "unauthenticated",
"message": "Invalid or expired credentials"
}
}{
"error": {
"code": "permission-denied",
"message": "Missing required scope: invoices:read"
}
}{
"error": {
"code": "not-found",
"message": "Resource not found"
}
}{
"error": {
"code": "internal",
"message": "An internal error occurred"
}
}/workspaces/{workspaceId}/files/searchSearch workspace files by attributes
Portéeworkspace-files:read
Paramètres de chemin
workspaceIdstringobligatoireID of the workspace.
Paramètres de requête
fieldsstringComma-separated property paths to include in the response, or in each item of a list. Use dots for nested paths.
querystringobligatoirepageintegerPar défaut0
sizeintegerPar défaut20
Renvoie
Successful response
curl 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/files/search?query=string' \
-H "Authorization: Bearer $SWAY_API_KEY"const response = await fetch('https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/files/search?query=string', {
headers: {
Authorization: `Bearer ${process.env.SWAY_API_KEY}`,
},
});
console.log(await response.json());import os
import requests
response = requests.get(
"https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/files/search?query=string",
headers={"Authorization": f"Bearer {os.environ['SWAY_API_KEY']}"},
)
print(response.json()){
"data": [
{
"firestoreId": "string",
"creation": {
"creationDateTime": "2026-03-02T09:15:00.000Z",
"createdBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
},
"workspaceId": "Wk7fQ2xR9bLm4tZp8sNv",
"size": 0,
"mimeType": "string",
"filename": "string",
"gcsPath": "string",
"extension": "string",
"checksumMd5": "string",
"checksumCrc32c": "string",
"customMetadata": {
"key": "string"
},
"scope": "workspace_attachment",
"targetDocumentPath": "string",
"targetDocumentId": "Hk2xNq8vR4tYw6ZbPj3c"
}
]
}{
"error": {
"code": "invalid-argument",
"message": "Invalid request"
}
}{
"error": {
"code": "unauthenticated",
"message": "Invalid or expired credentials"
}
}{
"error": {
"code": "permission-denied",
"message": "Missing required scope: invoices:read"
}
}{
"error": {
"code": "not-found",
"message": "Resource not found"
}
}{
"error": {
"code": "internal",
"message": "An internal error occurred"
}
}/workspaces/{workspaceId}/files/moveMove a workspace file to a different folder or location
Portéeworkspace-files:write
Paramètres de chemin
workspaceIdstringobligatoireID of the workspace.
Corps de la requête
oldPathstringobligatoirenewPathstringobligatoireRenvoie
No content
curl -X POST 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/files/move' \
-H "Authorization: Bearer $SWAY_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"oldPath": "string",
"newPath": "string"
}'const response = await fetch('https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/files/move', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.SWAY_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"oldPath": "string",
"newPath": "string"
}),
});
console.log(response.status);import os
import requests
response = requests.post(
"https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/files/move",
headers={"Authorization": f"Bearer {os.environ['SWAY_API_KEY']}"},
json={
"oldPath": "string",
"newPath": "string",
},
)
print(response.status_code){
"error": {
"code": "invalid-argument",
"message": "Invalid request"
}
}{
"error": {
"code": "unauthenticated",
"message": "Invalid or expired credentials"
}
}{
"error": {
"code": "permission-denied",
"message": "Missing required scope: invoices:read"
}
}{
"error": {
"code": "not-found",
"message": "Resource not found"
}
}{
"error": {
"code": "internal",
"message": "An internal error occurred"
}
}/workspaces/{workspaceId}/files/{fileId}/downloadGenerate a time-limited download URL for a workspace file
Portéeworkspace-files:read
Paramètres de chemin
workspaceIdstringobligatoireID of the workspace.
fileIdstringobligatoireID of the workspace file.
Paramètres de requête
fieldsstringComma-separated property paths to include in the response, or in each item of a list. Use dots for nested paths.
Renvoie
Successful response
dataFileDownloadUrlobligatoireAfficher les 2 champs enfants
downloadUrlstringobligatoireTime-limited URL to download the file.
expiresAtstringobligatoireInstant after which downloadUrl stops working.
curl 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/files/Fl1qS6hV3nTx8mPc5wZr/download' \
-H "Authorization: Bearer $SWAY_API_KEY"const response = await fetch('https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/files/Fl1qS6hV3nTx8mPc5wZr/download', {
headers: {
Authorization: `Bearer ${process.env.SWAY_API_KEY}`,
},
});
console.log(await response.json());import os
import requests
response = requests.get(
"https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/files/Fl1qS6hV3nTx8mPc5wZr/download",
headers={"Authorization": f"Bearer {os.environ['SWAY_API_KEY']}"},
)
print(response.json()){
"data": {
"downloadUrl": "string",
"expiresAt": "2026-03-02T09:30:00.000Z"
}
}{
"error": {
"code": "invalid-argument",
"message": "Invalid request"
}
}{
"error": {
"code": "unauthenticated",
"message": "Invalid or expired credentials"
}
}{
"error": {
"code": "permission-denied",
"message": "Missing required scope: invoices:read"
}
}{
"error": {
"code": "not-found",
"message": "Resource not found"
}
}{
"error": {
"code": "internal",
"message": "An internal error occurred"
}
}