Files
Files (Beta)
Upload file
POST /files
Headers
Content-Type: application/json
Parameters
namestring- Required
datastring- Required
- Must be: base64 encoded file content
permissionsarraypermissions.*.typestring- Can be one of the following:
companygroupteam
- Can be one of the following:
permission.*.valueinteger
publicboolean
Payload
{
"name": "picture.png",
"data": "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAMFBMVEUAp20CqG4IqnIJqnIKqnMMq3QntIMotYRCvZNZxqBcx6Jdx6Jnyqh60bN70bN80rR3KfJRAAAARElEQVQoz2NgoBEIBQNFhMB/MPi7DE3g//8p6AJ/HNAE/k9AF/iOLvAbXeCfAJrAfwN0gQDqCaSlpfWjCABBPl0EaAwAtbGwzk78EowAAAAASUVORK5CYII=",
"permissions": [
{
"type": "group",
"value": 1
}
],
"public": false
}
Response
Status code 201
{
"id": "277d9d23-4303-4b99-8fd0-d704cfe66069",
"name": "picture.png",
"type": "png",
"size": 185,
"public": false,
"created_at": "2017-12-12 09:42:18",
"updated_at": "2017-12-12 09:42:18",
"user_id": 1,
"download_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
Update file
PUT /files/:file_id
Headers
Content-Type: application/json
- Supports the same parameters as Upload file excluding the
dataparameter
Response
Status code 200
{
"id": "41ec1790-2a37-4bf2-ba12-038797bb5d5e",
"name": "picture.png",
"type": "png",
"size": 185,
"public": false,
"created_at": "2017-12-12 00:23:26",
"updated_at": "2017-12-12 00:23:26",
"user_id": 1,
"download_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
Replace file
PUT /files/:file_id/replace
Headers
Content-Type: application/json
Parameters
datastring- Required
- Must be: base64 encoded file content
Parameters
{
"data": "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAMFBMVEUAp20CqG4IqnIJqnIKqnMMq3QntIMotYRCvZNZxqBcx6Jdx6Jnyqh60bN70bN80rR3KfJRAAAARElEQVQoz2NgoBEIBQNFhMB/MPi7DE3g//8p6AJ/HNAE/k9AF/iOLvAbXeCfAJrAfwN0gQDqCaSlpfWjCABBPl0EaAwAtbGwzk78EowAAAAASUVORK5CYII="
}
Response
Status code 200
{
"id": "41ec1790-2a37-4bf2-ba12-038797bb5d5e",
"name": "picture.png",
"type": "png",
"size": 185,
"public": false,
"created_at": "2017-12-12 00:23:26",
"updated_at": "2017-12-12 00:23:26",
"user_id": 1,
"download_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
Get public file
GET /files/:file_id/public
Response
Status code 303
Must follow redirects, see location header for url.
Download file by token
GET /files/download/:download_token
Can be used to download file by token. Tokens are issued for requesting user but anyone who has token can download file. Tokens are valid for 24 hours.
Query string parameters
download_tokenstring - previously recieved download token to the file.
Response
Status code 303
Must follow redirects, see location header for url.
Attachments - (Beta)
Create attachment
POST /:entity_type/:entity_id/files
Headers
Content-Type: application/json
Query string parameters
entity_typestring- Can be one of the following:
accountscasesfoldersleads
- Can be one of the following:
Parameters
file_idsarray- Required
file_ids.*string- Must be: Valid File id
Payload
{
"file_ids": [
"cffa32c2-42a6-4a41-8f0d-2cc418b8049b"
]
}
Response
Status code 204
Get entity attachment files
GET /:entity_type/:entity_id/files
Query string parameters
entity_typestring- Can be one of the following:
accountscasesfoldersleads
- Can be one of the following:
- Supports Pagination
Response
Status code 200
{
"data": [
{
"id": "277d9d23-4303-4b99-8fd0-d704cfe66069",
"name": "picture.png",
"type": "png",
"size": 185,
"public": false,
"created_at": "2017-12-12 09:42:18",
"updated_at": "2017-12-12 09:42:18",
"user_id": 1,
"attached_by": 1,
"attached_at": "2017-12-12 09:42:18",
"download_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
],
"pagination": {
"page": 1,
"per_page": 50,
"total": 1
}
}
Detach files from attachment
DELETE /:entity_type/:entity_id/files
Headers
Content-Type: application/json
Query string parameters
entity_typestring- Can be one of the following:
accountscasesfoldersleads
- Can be one of the following:
- Supports the same parameters as Create attachment excluding
Pagination
Response
Status code 204
Get entity file
GET /:entity_type/:entity_id/files/:file_id
Query string parameters
entity_typestring- Can be one of the following:
accountscasesfoldersleads
- Can be one of the following:
Response
Status code 200
{
"id": "277d9d23-4303-4b99-8fd0-d704cfe66069",
"name": "picture.png",
"type": "png",
"size": 185,
"public": false,
"created_at": "2017-12-12 09:42:18",
"updated_at": "2017-12-12 09:42:18",
"user_id": 1,
"attached_by": 1,
"attached_at": "2017-12-12 09:42:18",
"download_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
Download entity file
GET /:entity_type/:entity_id/files/:file_id/download
Query string parameters
entity_typestring- Can be one of the following:
accountscasesfoldersleads
- Can be one of the following:
Response
Status code 303
Must follow redirects, see location header for url.
Create contacts attachment
POST /accounts/:account_id/contacts/:contact_id/files
- Supports the same parameters as Create attachment
Response
Status code 204
Get contacts attachment files
GET /accounts/:account_id/contacts/:contact_id/files
- Supports the same parameters as Get entity attachment files
- Supports Pagination
Response
Status code 200
{
"data": [
{
"id": "277d9d23-4303-4b99-8fd0-d704cfe66069",
"name": "picture.png",
"type": "png",
"size": 185,
"public": false,
"created_at": "2017-12-12 09:42:18",
"updated_at": "2017-12-12 09:42:18",
"user_id": 1,
"attached_by": 1,
"attached_at": "2017-12-12 09:42:18",
"download_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
],
"pagination": {
"page": 1,
"per_page": 50,
"total": 1
}
}
Detach contacts attachment files
DELETE /accounts/:account_id/contacts/:contact_id/files
- Supports the same parameters as Create attachment excluding
Pagination
Response
Status code 204
Get contacts file
GET /accounts/:account_id/contacts/:contact_id/files/:file_id
Response
Status code 200
{
"id": "277d9d23-4303-4b99-8fd0-d704cfe66069",
"name": "picture.png",
"type": "png",
"size": 185,
"public": false,
"created_at": "2017-12-12 09:42:18",
"updated_at": "2017-12-12 09:42:18",
"user_id": 1,
"attached_by": 1,
"attached_at": "2017-12-12 09:42:18",
"download_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
Download contacts file
GET /accounts/:account_id/contacts/:contact_id/files/:file_id/download
Response
Status code 303
Must follow redirects, see location header for url.
Attach files to file manager root folders
POST /folders/:entity_id/files
Query string parameters
entity_idstring- Can be one of the following:
company:company_idgroup:group_iduser:user_idteam:team_id- Example:
company:1
- Can be one of the following:
Parameters
- Supports the same parameters as Create attachment
Response
Status code 204
Get file manager root folder files
GET /folders/:entity_id/files
Query string parameters
entity_idstring- Can be one of the following:
company:company_idgroup:group_iduser:user_idteam:team_id- Example:
company:1
- Can be one of the following:
Parameters
- Supports the same parameters as Get entity attachment files
Response
Status code 200
{
"data": [
{
"id": "277d9d23-4303-4b99-8fd0-d704cfe66069",
"name": "picture.png",
"type": "png",
"size": 185,
"public": false,
"created_at": "2017-12-12 09:42:18",
"updated_at": "2017-12-12 09:42:18",
"user_id": 1,
"attached_by": 1,
"attached_at": "2017-12-12 09:42:18",
"download_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
],
"pagination": {
"page": 1,
"per_page": 50,
"total": 1
}
}
Detach file manager root folder files
DELETE /folders/:entity_id/files
Query string parameters
-
entity_idstring- Can be one of the following:
company:company_idgroup:group_iduser:user_idteam:team_id- Example:
company:1
- Can be one of the following:
-
Supports the same parameters as Create attachment excluding
Pagination
Response
Status code 204
Get file manager root folder file
GET /folders/:entity_id/files/:file_id
Query string parameters
entity_idstring- Can be one of the following:
company:company_idgroup:group_iduser:user_idteam:team_id- Example:
company:1
- Can be one of the following:
Response Status code 200
{
"id": "277d9d23-4303-4b99-8fd0-d704cfe66069",
"name": "picture.png",
"type": "png",
"size": 185,
"public": false,
"created_at": "2017-12-12 09:42:18",
"updated_at": "2017-12-12 09:42:18",
"user_id": 1,
"attached_by": 1,
"attached_at": "2017-12-12 09:42:18",
"download_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
Download file manager root folder file
GET /folders/:entity_id/files/:file_id/download
Query string parameters
entity_idstring- Can be one of the following:
company:company_idgroup:group_iduser:user_idteam:team_id- Example:
company:1
- Can be one of the following:
Response
Status code 303
Must follow redirects, see location header for url.
Attach files to file manager folder
POST /folders/:folder_id/files
Query string parameters
folder_idstring- Must be: Valid
folder
- Must be: Valid
Parameters
- Supports the same parameters as Create attachment
Response
Status code 204
Get file manager folder files
GET /folders/:folder_id/files
Query string parameters
folder_idstring- Must be: Valid
folder
- Must be: Valid
Parameters
- Supports the same parameters as Get entity attachment files
Response
Status code 200
{
"data": [
{
"id": "277d9d23-4303-4b99-8fd0-d704cfe66069",
"name": "picture.png",
"type": "png",
"size": 185,
"public": false,
"created_at": "2017-12-12 09:42:18",
"updated_at": "2017-12-12 09:42:18",
"user_id": 1,
"attached_by": 1,
"attached_at": "2017-12-12 09:42:18",
"download_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
],
"pagination": {
"page": 1,
"per_page": 50,
"total": 1
}
}
Detach file manager folder files
DELETE /folders/:folder_id/files
Query string parameters
-
folder_idstring- Must be: Valid
folder
- Must be: Valid
-
Supports the same parameters as Create attachment excluding
Pagination
Response
Status code 204
Get file manager folder file
GET /folders/:folder_id/files/:file_id
Query string parameters
folder_idstring- Must be: Valid
folder
- Must be: Valid
Response Status code 200
{
"id": "277d9d23-4303-4b99-8fd0-d704cfe66069",
"name": "picture.png",
"type": "png",
"size": 185,
"public": false,
"created_at": "2017-12-12 09:42:18",
"updated_at": "2017-12-12 09:42:18",
"user_id": 1,
"attached_by": 1,
"attached_at": "2017-12-12 09:42:18",
"download_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
Download file manager folder file
GET /folders/:folder_id/files/:file_id/download
Query string parameters
folder_idstring- Must be: Valid
folder
- Must be: Valid
Response
Status code 303
Must follow redirects, see location header for url.