File Manager

  • Files and folders belong to either company, group, team or user.
  • Files belonging to user can only be downloaded and modified by the user.
  • Files and folders with folder_id as null lie in the root.
  • This method is not recursive; only the first level is returned.

  • Admins can create folders and upload files to the company folder. Everyone in the company can download files.
  • Group admins can create folders and upload files to the group folder. Everyone in the group can download files.
  • Team admins can create folders and upload files to the team folder. Everyone in the team can download files.
  • Users can create folders and upload files to the user folder. Only the user can download files.

Get root

GET /filemanager

Query string parameters

  • belongs_to string - Filter the owner type
    • Can be company, group, team, user

Response
Status code 200

{
  "data": {
    "folders": [
      {
        "id": "a3141131-bc9f-431c-8752-bf0c55c8482e",
        "name": "Voluptatem",
        "created_at": "2015-11-20 13:37:00",
        "updated_at": "2015-11-20 13:37:00",
        "company_id": "1",
        "user_id": "1",
        "folder_id": null,
        "belongs_to": "company"
      }
    ],
    "files": [
      {
        "id": "4fc8fa05-56aa-475d-bcf7-40fa949ff06e",
        "name": "modi sint.xdf",
        "type": "xdf",
        "size": 479909,
        "created_at": "2015-11-20 13:37:00",
        "updated_at": "2015-11-20 13:37:00",
        "company_id": "1",
        "belongs_to": "company",
        "folder_id": "a3141131-bc9f-431c-8752-bf0c55c8482e",
        "user_id": "1"
      }
    ]
  }
}

Get specific folder

GET /filemanager/folders/:folder_id

Response
Status code 200

{
  "id": "a3141131-bc9f-431c-8752-bf0c55c8482e",
  "name": "Voluptatem",
  "created_at": "2015-02-24 14:34:48",
  "updated_at": "2015-02-24 14:34:48",
  "company_id": "1",
  "user_id": "1",
  "folder_id": null,
  "belongs_to": "company",
  "folders": [
    {
      "id": "a8ec1d5c-02c4-41db-9585-df85cb068fb8",
      "name": "Iusto vitae numquam",
      "created_at": "2015-02-24 14:34:48",
      "updated_at": "2015-02-24 14:34:48",
      "company_id": "1",
      "user_id": "1",
      "belongs_to": "company"
    }
  ],
  "files": [
    {
      "id": "4fc8fa05-56aa-475d-bcf7-40fa949ff06e",
      "name": "modi sint.xdf",
      "type": "xdf",
      "size": 479909,
      "created_at": "2015-02-24 14:34:48",
      "updated_at": "2015-02-24 14:34:48",
      "company_id": "1",
      "belongs_to": "company",
      "folder_id": "a3141131-bc9f-431c-8752-bf0c55c8482e",
      "user_id": "1"
    },
    {
      "id": "747508a6-5a5a-43f8-8742-db4312b52830",
      "name": "eum.xaml",
      "type": "xaml",
      "size": 543912,
      "created_at": "2015-02-24 14:34:48",
      "updated_at": "2015-02-24 14:34:48",
      "company_id": "1",
      "belongs_to": "company",
      "folder_id": "a3141131-bc9f-431c-8752-bf0c55c8482e",
      "user_id": "1"
    }
  ]
}

Download file

GET /filemanager/files/:file_id

Response
Status code 200

This will redirect to a download link that is valid for 5 minutes.

Create folder

POST /filemanager/folders

Parameters

  • name string
    • Required
    • Maximum 60 characters
  • folder_id UUID - Can be left out or null if creating a folder in the root.
  • belongs_to string
    • Required
    • Can be company, user, team or group

Payload

{
  "name": "Folder name",
  "belongs_to": "company",
  "folder_id": null
}

Response
Status code 200

Update folder

PUT /filemanager/folders/:folder_id

Change parent folder, folder name and belonging.

Belonging must match with the belonging of the parent folder.

Parameters

  • name string
    • Required
    • Maximum 60 characters
  • folder_id UUID
  • belongs_to string
    • Required
    • Can be company, user, team or group

Payload

{
  "name": "New folder name",
  "belongs_to": "company",
  "folder_id": "5753290b-9c05-40ef-87f2-726117689b1b"
}

Response
Status code 200

Update file

PUT /filemanager/files/:file_id

Change parent folder, file name and belonging.

Belonging must match with the belonging of the parent folder.

Parameters

  • name string
    • Required
    • Maximum 60 characters
  • folder_id UUID
    • Required
  • belongs_to string
    • Required
    • Can be company, user, team or group

Payload

{
  "name": "New file name",
  "belongs_to": "company",
  "folder_id": "5313b429-b4e9-4437-89ca-978fafa7f310"
}

Response
Status code 200

Upload file

POST /filemanager/files/:belongs_to/:folder_id

POST /filemanager/files/:belongs_to

Headers

Content-Type: multipart/form-data

Parameters

  • file file
    • Required
    • Maximum file size is 10 megabytes

Note that files can be uploaded directly to the user/company/team, etc. root folders.

Response
Status code 201

{
  "id": "343fafcd-86e4-443e-9098-d3ce9072124c",
  "name": "Company Plan 2015.pdf",
  "type": "pdf",
  "size": 92618,
  "created_at": "2015-02-25 10:16:43",
  "updated_at": "2015-02-25 10:16:43",
  "company_id": "1",
  "belongs_to": "user",
  "folder_id": "d4679a95-a082-4dc4-bea8-36213061a09c",
  "user_id": "1"
}

Delete folder

DELETE /filemanager/folders/:folder_id

Response
Status code 204

Delete file

DELETE /filemanager/files/:file_id

Response
Status code 204

Batch delete files

DELETE /filemanager/files/batch

Delete multiple files with one request. Does not accept folders.

Payload

{
  "files": [
    "5313b429-b4e9-4437-89ca-978fafa7f310"
  ]
}

Response
Status code 204

Create public picture

POST /filemanager/pictures

Used for campaigns or email signatures, this endpoint accepts a file ID and returns a public URL.

At the moment, this can only be used for images of the following types:

  • jpeg, jpg
  • gif
  • png
  • svg

Parameters

  • file_id UUID
    • Required

Payload

{
  "file_id": "343fafcd-86e4-443e-9098-d3ce9072124c"
}

Response
Status code 201

{
  "file_id": "343fafcd-86e4-443e-9098-d3ce9072124c",
  "url": "http://example.com/picture/view"
}