Files
The Files API has methods for managing files.
Create file
Creates a new file in the specified Files app.
POST /api/apps/{app}/files
Path parameters
appstringrequiredApp identifier (
idoruid)
Body parameters
blob_idintegerrequiredId of blob containing content and metadata for the file.
namestringFile name. When not specified the file will get the name of the underlying blob.
metadataobjectAdditional metadata properties, e.g.
{ "color": "blue", "size": "XL" }.
tagsarray of stringsA list of tags to associate with the file.
replacebooleantrueto force an existing file with the same name to be overwritten (otherwise a409 Conflictresponse will be produced).
Example request
curl {WEAVY-URL}/api/apps/acme-files/files
-H "Authorization: Bearer {ACCESS-TOKEN | API-KEY}"
--json "{ 'blob_id': 1 }"
Response codes
200 OK
201 Created
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
409 Conflict
422 Validation Failed
Response schema
{
"id": "integer",
"rev": "integer",
"app": {
"id": "integer",
"rev": "integer",
"type": "string",
"uid": "string",
"name": "string",
"description": "string",
"archive_url": "string",
"avatar_url": "string",
"metadata": "object",
"tags": [
"string"
],
"access": "string",
"directory_id": "integer",
"created_at": "string",
"updated_at": "string",
"is_pinned": "boolean",
"is_starred": "boolean",
"is_subscribed": "boolean",
"is_trashed": "boolean",
"is_unread": "boolean",
"permissions": [
"string"
]
},
"parent": {
"id": "integer",
"type": "string"
},
"name": "string",
"kind": "string",
"media_type": "string",
"width": "integer",
"height": "integer",
"size": "integer",
"metadata": "object",
"tags": [
"string"
],
"provider": "string",
"raw": "string",
"download_url": "string",
"application_url": "string",
"embed_url": "string",
"external_url": "string",
"preview_format": "string",
"preview_url": "string",
"thumbnail_url": "string",
"created_at": "string",
"created_by": {
"id": "integer",
"uid": "string",
"name": "string",
"given_name": "string",
"middle_name": "string",
"family_name": "string",
"nickname": "string",
"email": "string",
"phone_number": "string",
"avatar_url": "string",
"presence": "string",
"comment": "string",
"metadata": "object",
"tags": [
"string"
],
"created_at": "string",
"updated_at": "string",
"is_trashed": "boolean"
},
"updated_at": "string",
"updated_by": {
"id": "integer",
"uid": "string",
"name": "string",
"given_name": "string",
"middle_name": "string",
"family_name": "string",
"nickname": "string",
"email": "string",
"phone_number": "string",
"avatar_url": "string",
"presence": "string",
"comment": "string",
"metadata": "object",
"tags": [
"string"
],
"created_at": "string",
"updated_at": "string",
"is_trashed": "boolean"
},
"comments": {
"data": [
"object"
],
"start": "integer",
"end": "integer",
"count": "integer"
},
"is_starred": "boolean",
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
Get file
Get file metadata.
GET /api/files/{id}
Path parameters
idintegerrequiredFile id
Query parameters
trashedbooleantrueto return file even if trashed.
Example request
curl {WEAVY-URL}/api/files/1
-H "Authorization: Bearer {ACCESS-TOKEN | API-KEY}"
Response codes
200 OK
401 Unauthorized
404 Not Found
Response schema
{
"id": "integer",
"rev": "integer",
"app": {
"id": "integer",
"rev": "integer",
"type": "string",
"uid": "string",
"name": "string",
"description": "string",
"archive_url": "string",
"avatar_url": "string",
"metadata": "object",
"tags": [
"string"
],
"access": "string",
"directory_id": "integer",
"created_at": "string",
"updated_at": "string",
"is_pinned": "boolean",
"is_starred": "boolean",
"is_subscribed": "boolean",
"is_trashed": "boolean",
"is_unread": "boolean",
"permissions": [
"string"
]
},
"parent": {
"id": "integer",
"type": "string"
},
"name": "string",
"kind": "string",
"media_type": "string",
"width": "integer",
"height": "integer",
"size": "integer",
"metadata": "object",
"tags": [
"string"
],
"provider": "string",
"raw": "string",
"download_url": "string",
"application_url": "string",
"embed_url": "string",
"external_url": "string",
"preview_format": "string",
"preview_url": "string",
"thumbnail_url": "string",
"created_at": "string",
"created_by": {
"id": "integer",
"uid": "string",
"name": "string",
"given_name": "string",
"middle_name": "string",
"family_name": "string",
"nickname": "string",
"email": "string",
"phone_number": "string",
"avatar_url": "string",
"presence": "string",
"comment": "string",
"metadata": "object",
"tags": [
"string"
],
"created_at": "string",
"updated_at": "string",
"is_trashed": "boolean"
},
"updated_at": "string",
"updated_by": {
"id": "integer",
"uid": "string",
"name": "string",
"given_name": "string",
"middle_name": "string",
"family_name": "string",
"nickname": "string",
"email": "string",
"phone_number": "string",
"avatar_url": "string",
"presence": "string",
"comment": "string",
"metadata": "object",
"tags": [
"string"
],
"created_at": "string",
"updated_at": "string",
"is_trashed": "boolean"
},
"comments": {
"data": [
"object"
],
"start": "integer",
"end": "integer",
"count": "integer"
},
"is_starred": "boolean",
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
Get file revision
Get file revision.
GET /api/files/{id}/versions/{rev}
Path parameters
idintegerrequiredFile id.
revintegerrequiredRevision number.
Example request
curl {WEAVY-URL}/api/files/1/versions/2
-H "Authorization: Bearer {ACCESS-TOKEN | API-KEY}"
Response codes
200 OK
401 Unauthorized
404 Not Found
Response schema
{
"id": "integer",
"rev": "integer",
"app": {
"id": "integer",
"rev": "integer",
"type": "string",
"uid": "string",
"name": "string",
"description": "string",
"archive_url": "string",
"avatar_url": "string",
"metadata": "object",
"tags": [
"string"
],
"access": "string",
"directory_id": "integer",
"created_at": "string",
"updated_at": "string",
"is_pinned": "boolean",
"is_starred": "boolean",
"is_subscribed": "boolean",
"is_trashed": "boolean",
"is_unread": "boolean",
"permissions": [
"string"
]
},
"parent": {
"id": "integer",
"type": "string"
},
"name": "string",
"kind": "string",
"media_type": "string",
"width": "integer",
"height": "integer",
"size": "integer",
"metadata": "object",
"tags": [
"string"
],
"provider": "string",
"raw": "string",
"download_url": "string",
"application_url": "string",
"embed_url": "string",
"external_url": "string",
"preview_format": "string",
"preview_url": "string",
"thumbnail_url": "string",
"created_at": "string",
"created_by": {
"id": "integer",
"uid": "string",
"name": "string",
"given_name": "string",
"middle_name": "string",
"family_name": "string",
"nickname": "string",
"email": "string",
"phone_number": "string",
"avatar_url": "string",
"presence": "string",
"comment": "string",
"metadata": "object",
"tags": [
"string"
],
"created_at": "string",
"updated_at": "string",
"is_trashed": "boolean"
},
"updated_at": "string",
"updated_by": {
"id": "integer",
"uid": "string",
"name": "string",
"given_name": "string",
"middle_name": "string",
"family_name": "string",
"nickname": "string",
"email": "string",
"phone_number": "string",
"avatar_url": "string",
"presence": "string",
"comment": "string",
"metadata": "object",
"tags": [
"string"
],
"created_at": "string",
"updated_at": "string",
"is_trashed": "boolean"
},
"comments": {
"data": [
"object"
],
"start": "integer",
"end": "integer",
"count": "integer"
},
"is_starred": "boolean",
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
List file revisions
List revision history of a file.
GET /api/files/{id}/versions
Path parameters
idintegerrequiredFile id.
Example request
curl {WEAVY-URL}/api/files/1/versions
-H "Authorization: Bearer {ACCESS-TOKEN | API-KEY}"
Response codes
200 OK
401 Unauthorized
404 Not Found
Response schema
{
"data": [
{
"id": "integer",
"rev": "integer",
"name": "string",
"kind": "string",
"media_type": "string",
"width": "integer",
"height": "integer",
"size": "integer",
"metadata": "object",
"tags": [
"string"
],
"provider": "string",
"raw": "string",
"download_url": "string",
"application_url": "string",
"embed_url": "string",
"external_url": "string",
"preview_format": "string",
"preview_url": "string",
"thumbnail_url": "string",
"created_at": "string",
"updated_at": "string",
"is_starred": "boolean",
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
],
"start": "integer",
"end": "integer",
"count": "integer"
}
Update file
Update file metadata.
PATCH /api/files/{id}
Path parameters
idintegerrequiredId of file.
Body parameters
blob_idintegerId of blob containing content and metadata for the file.
namestringThe file name.
metadataobjectAdditional metadata properties, e.g.
{ "color": "blue", "size": "XL" }.
tagsarray of stringsA list of tags to associate with the file.
backupbooleantrueto add previous version to version history, otherwisefalse(default).
Example request
curl -X PATCH {WEAVY-URL}/api/files/1
-H "Authorization: Bearer {ACCESS-TOKEN | API-KEY}"
--json "{ 'name': 'filename.txt' }"
Response codes
200 OK
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
422 Validation Failed
Response schema
{
"id": "integer",
"rev": "integer",
"app": {
"id": "integer",
"rev": "integer",
"type": "string",
"uid": "string",
"name": "string",
"description": "string",
"archive_url": "string",
"avatar_url": "string",
"metadata": "object",
"tags": [
"string"
],
"access": "string",
"directory_id": "integer",
"created_at": "string",
"updated_at": "string",
"is_pinned": "boolean",
"is_starred": "boolean",
"is_subscribed": "boolean",
"is_trashed": "boolean",
"is_unread": "boolean",
"permissions": [
"string"
]
},
"parent": {
"id": "integer",
"type": "string"
},
"name": "string",
"kind": "string",
"media_type": "string",
"width": "integer",
"height": "integer",
"size": "integer",
"metadata": "object",
"tags": [
"string"
],
"provider": "string",
"raw": "string",
"download_url": "string",
"application_url": "string",
"embed_url": "string",
"external_url": "string",
"preview_format": "string",
"preview_url": "string",
"thumbnail_url": "string",
"created_at": "string",
"created_by": {
"id": "integer",
"uid": "string",
"name": "string",
"given_name": "string",
"middle_name": "string",
"family_name": "string",
"nickname": "string",
"email": "string",
"phone_number": "string",
"avatar_url": "string",
"presence": "string",
"comment": "string",
"metadata": "object",
"tags": [
"string"
],
"created_at": "string",
"updated_at": "string",
"is_trashed": "boolean"
},
"updated_at": "string",
"updated_by": {
"id": "integer",
"uid": "string",
"name": "string",
"given_name": "string",
"middle_name": "string",
"family_name": "string",
"nickname": "string",
"email": "string",
"phone_number": "string",
"avatar_url": "string",
"presence": "string",
"comment": "string",
"metadata": "object",
"tags": [
"string"
],
"created_at": "string",
"updated_at": "string",
"is_trashed": "boolean"
},
"comments": {
"data": [
"object"
],
"start": "integer",
"end": "integer",
"count": "integer"
},
"is_starred": "boolean",
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
List files
List files.
GET /api/files
Query parameters
aroundintegerA file id. Used to find results "around" a specific file.
qstringA string used to find matching items by name, e.g.
q=test.
tagstringList items with the specified tag.
trashedbooleanIndicates whether trashed items should be listed (default is
false). Specifynullto list both trashed and non-trashed items.
order_bystringSpecifies the sort order and direction for the listing, e.g.
order_by=idororder_by=id+desc.
skipintegerThe number of items to skip. Used together with
taketo return a specific range of items (for pagination).
takeintegerMaximum number of items to return in the listing. Should be a value between
1and100. Default is25.
count_onlybooleantrueto count the number of matching items instead of listing them; when specified the response will only contain thecountproperty.
Example request
curl {WEAVY-URL}/api/files
-H "Authorization: Bearer {ACCESS-TOKEN | API-KEY}"
Response codes
200 OK
401 Unauthorized
Response schema
{
"data": [
{
"id": "integer",
"rev": "integer",
"name": "string",
"kind": "string",
"media_type": "string",
"width": "integer",
"height": "integer",
"size": "integer",
"metadata": "object",
"tags": [
"string"
],
"provider": "string",
"raw": "string",
"download_url": "string",
"application_url": "string",
"embed_url": "string",
"external_url": "string",
"preview_format": "string",
"preview_url": "string",
"thumbnail_url": "string",
"created_at": "string",
"updated_at": "string",
"is_starred": "boolean",
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
],
"start": "integer",
"end": "integer",
"count": "integer"
}
List app files
List files in the specified Files app.
GET /api/apps/{app}/files
Path parameters
appstringrequiredApp identifier (
idoruid)
Query parameters
aroundintegerA file id. Used to find results "around" a specific file.
qstringA string used to find matching items by name, e.g.
q=test.
tagstringList items with the specified tag.
trashedbooleanIndicates whether trashed items should be listed (default is
false). Specifynullto list both trashed and non-trashed items.
order_bystringSpecifies the sort order and direction for the listing, e.g.
order_by=idororder_by=id+desc.
skipintegerThe number of items to skip. Used together with
taketo return a specific range of items (for pagination).
takeintegerMaximum number of items to return in the listing. Should be a value between
1and100. Default is25.
count_onlybooleantrueto count the number of matching items instead of listing them; when specified the response will only contain thecountproperty.
Example request
curl {WEAVY-URL}/api/apps/acme-files/files?take=25
-H "Authorization: Bearer {ACCESS-TOKEN | API-KEY}"
Response codes
200 OK
401 Unauthorized
404 Not Found
Response schema
{
"data": [
{
"id": "integer",
"rev": "integer",
"name": "string",
"kind": "string",
"media_type": "string",
"width": "integer",
"height": "integer",
"size": "integer",
"metadata": "object",
"tags": [
"string"
],
"provider": "string",
"raw": "string",
"download_url": "string",
"application_url": "string",
"embed_url": "string",
"external_url": "string",
"preview_format": "string",
"preview_url": "string",
"thumbnail_url": "string",
"created_at": "string",
"updated_at": "string",
"is_starred": "boolean",
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
],
"start": "integer",
"end": "integer",
"count": "integer"
}
List post attachments
List files attached to the specified post.
GET /api/posts/{id}/attachments
Path parameters
idintegerrequiredPost id.
Query parameters
aroundintegerA file id. Used to find results "around" a specific file.
qstringA string used to find matching items by name, e.g.
q=test.
tagstringList items with the specified tag.
trashedbooleanIndicates whether trashed items should be listed (default is
false). Specifynullto list both trashed and non-trashed items.
order_bystringSpecifies the sort order and direction for the listing, e.g.
order_by=idororder_by=id+desc.
skipintegerThe number of items to skip. Used together with
taketo return a specific range of items (for pagination).
takeintegerMaximum number of items to return in the listing. Should be a value between
1and100. Default is25.
count_onlybooleantrueto count the number of matching items instead of listing them; when specified the response will only contain thecountproperty.
Example request
curl {WEAVY-URL}/api/posts/1/attachments
-H "Authorization: Bearer {ACCESS-TOKEN | API-KEY}"
Response codes
200 OK
401 Unauthorized
404 Not Found
Response schema
{
"data": [
{
"id": "integer",
"rev": "integer",
"name": "string",
"kind": "string",
"media_type": "string",
"width": "integer",
"height": "integer",
"size": "integer",
"metadata": "object",
"tags": [
"string"
],
"provider": "string",
"raw": "string",
"download_url": "string",
"application_url": "string",
"embed_url": "string",
"external_url": "string",
"preview_format": "string",
"preview_url": "string",
"thumbnail_url": "string",
"created_at": "string",
"updated_at": "string",
"is_starred": "boolean",
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
],
"start": "integer",
"end": "integer",
"count": "integer"
}
List comment attachments
List files attached to the specified comment.
GET /api/comments/{id}/attachments
Path parameters
idintegerrequiredComment id.
Query parameters
aroundintegerA file id. Used to find results "around" a specific file.
qstringA string used to find matching items by name, e.g.
q=test.
tagstringList items with the specified tag.
trashedbooleanIndicates whether trashed items should be listed (default is
false). Specifynullto list both trashed and non-trashed items.
order_bystringSpecifies the sort order and direction for the listing, e.g.
order_by=idororder_by=id+desc.
skipintegerThe number of items to skip. Used together with
taketo return a specific range of items (for pagination).
takeintegerMaximum number of items to return in the listing. Should be a value between
1and100. Default is25.
count_onlybooleantrueto count the number of matching items instead of listing them; when specified the response will only contain thecountproperty.
Example request
curl {WEAVY-URL}/api/comments/1/attachments
-H "Authorization: Bearer {ACCESS-TOKEN | API-KEY}"
Response codes
200 OK
401 Unauthorized
404 Not Found
Response schema
{
"data": [
{
"id": "integer",
"rev": "integer",
"name": "string",
"kind": "string",
"media_type": "string",
"width": "integer",
"height": "integer",
"size": "integer",
"metadata": "object",
"tags": [
"string"
],
"provider": "string",
"raw": "string",
"download_url": "string",
"application_url": "string",
"embed_url": "string",
"external_url": "string",
"preview_format": "string",
"preview_url": "string",
"thumbnail_url": "string",
"created_at": "string",
"updated_at": "string",
"is_starred": "boolean",
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
],
"start": "integer",
"end": "integer",
"count": "integer"
}
List message attachments
List files attached to the specified message.
GET /api/messages/{id}/attachments
Path parameters
idintegerrequiredMessage id.
Query parameters
aroundintegerA file id. Used to find results "around" a specific file.
qstringA string used to find matching items by name, e.g.
q=test.
tagstringList items with the specified tag.
trashedbooleanIndicates whether trashed items should be listed (default is
false). Specifynullto list both trashed and non-trashed items.
order_bystringSpecifies the sort order and direction for the listing, e.g.
order_by=idororder_by=id+desc.
skipintegerThe number of items to skip. Used together with
taketo return a specific range of items (for pagination).
takeintegerMaximum number of items to return in the listing. Should be a value between
1and100. Default is25.
count_onlybooleantrueto count the number of matching items instead of listing them; when specified the response will only contain thecountproperty.
Example request
curl {WEAVY-URL}/api/messages/1/attachments
-H "Authorization: Bearer {ACCESS-TOKEN | API-KEY}"
Response codes
200 OK
401 Unauthorized
404 Not Found
Response schema
{
"data": [
{
"id": "integer",
"rev": "integer",
"name": "string",
"kind": "string",
"media_type": "string",
"width": "integer",
"height": "integer",
"size": "integer",
"metadata": "object",
"tags": [
"string"
],
"provider": "string",
"raw": "string",
"download_url": "string",
"application_url": "string",
"embed_url": "string",
"external_url": "string",
"preview_format": "string",
"preview_url": "string",
"thumbnail_url": "string",
"created_at": "string",
"updated_at": "string",
"is_starred": "boolean",
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
],
"start": "integer",
"end": "integer",
"count": "integer"
}
Trash file
Move a file to the trash.
POST /api/files/{id}/trash
Path parameters
idintegerrequiredId of the file to trash.
Example request
curl -X POST {WEAVY-URL}/api/files/1/trash
-H "Authorization: Bearer {ACCESS-TOKEN | API-KEY}"
Response codes
204 No Content
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
Restore file
Restore a file from the trash.
POST /api/files/{id}/restore
Path parameters
idintegerrequiredId of the file to restore.
Example request
curl -X POST {WEAVY-URL}/api/files/1/restore
-H "Authorization: Bearer {ACCESS-TOKEN | API-KEY}"
Response codes
204 No Content
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
Restore file version
Restore a previous revision of a file to be the current. This will create a new revision with the contents of the previous revision, but preserves all existing revisions.
POST /api/files/{id}/versions/{rev}/restore
Path parameters
idintegerrequiredFile id.
revintegerrequiredRevision number.
Example request
curl -X POST {WEAVY-URL}/api/files/1/versions/2/restore
-H "Authorization: Bearer {ACCESS-TOKEN | API-KEY}"
Response codes
204 No Content
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
Delete file
Delete a file.
DELETE /api/files/{id}
Path parameters
idintegerrequiredId of the file.
Example request
curl -X DELETE {WEAVY-URL}/api/files/1
-H "Authorization: Bearer {ACCESS-TOKEN | API-KEY}"
Response codes
204 No Content
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
Delete file revision
Delete file revision.
DELETE /api/files/{id}/versions/{rev}
Path parameters
idintegerrequiredFile id.
revintegerrequiredFile revision.
Example request
curl -X DELETE {WEAVY-URL}/api/files/1/versions/2
-H "Authorization: Bearer {ACCESS-TOKEN | API-KEY}"
Response codes
204 No Content
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found