- Directory
  - get Find all folders by content container
  - post Create new directory
  - get Get directory by id
  - put Update directory by id
  - del Deletes a directory by id
- File
  - get Find all files by content container
  - post Upload files
  - get Get file info by id
  - del Deletes a file by id
- Items Management
  - patch Make items public
  - patch Make items private
  - post Move items to another folder
  - del Delete items from folder

API docs by Redocly

# HumHub - cFiles API (1.0.0)

Download OpenAPI specification:

E-mail: info@humhub.com License: AGPLv2

Welcome to the HumHub cFiles module API reference.

## Directory

## Find all folders by content container

##### path Parameters

id required | integer The id of content container

##### query Parameters

page | integer >= 0 The number of page of the result set.
limit | integer [ 1 .. 50 ] Default: 20 The numbers of items to return per page.

### Responses

/api/v1/cfiles/folders/container/{id}

### Response samples

- 200

Content type
application/json
`
{

- "total": 76,
- "page": 1,
- "results":
  [
  - {
    - "id": 4,
    - "title": "API directory",
    - "description": "API directory description",
    - "parent_folder_id": 1,
    - "type": null,
    - "created_at": "2019-03-05 15:35:02",
    - "created_by":
      {
      - "id": 14,
      - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
      - "display_name": "John Doe",
      - "url": "http://localhost/p/humhub/master/u/j.doe/"
      },
    - "content":
      {
      - "metadata":
        {
        - "id": 14,
        - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
        - "object_model": "humhub\\modules\\post\\models\\Post",
        - "object_id": 12,
        - "visibility": 1,
        - "state": 1,
        - "archived": true,
        - "hidden": true,
        - "pinned": false,
        - "locked_comments": false,
        - "scheduled_at": "2023-09-14 05:15:00",
        - "created_by":
          {
          - "id": 14,
          - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
          - "display_name": "John Doe",
          - "url": "http://localhost/p/humhub/master/u/j.doe/"
          },
        - "created_at": "2022-04-13 05:15:43",
        - "updated_by":
          {
          - "id": 14,
          - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
          - "display_name": "John Doe",
          - "url": "http://localhost/p/humhub/master/u/j.doe/"
          },
        - "updated_at": "2022-05-21 06:20:18",
        - "url": "http://localhost/p/humhub/master/content/perma?id=109",
        - "contentcontainer_id": 5,
        - "stream_channel": "default"
        },
      - "comments":
        {
        - "total": 55,
        - "latestComments":
          [
          - {
            - "id": 14,
            - "message": "Calvin Klein – Between love and madness lies obsession.",
            - "objectModel": "humhub\\modules\\post\\models\\Post",
            - "objectId": 123,
            - "createdBy":
              {
              - "id": 14,
              - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
              - "display_name": "John Doe",
              - "url": "http://localhost/p/humhub/master/u/j.doe/"
              },
            - "createdAt": "2018-08-09 14:22:03",
            - "commentsCount": 5,
            - "comments":
              [
              - { }
              ]
            }
          ]
        },
      - "likes":
        {
        - "total": 35
        },
      - "files":
        {
        - "id": 14,
        - "guid": "bded6dc7-e6f4-417e-a638-b653525529ca",
        - "mime_type": "text/plain",
        - "size": 14353,
        - "file_name": "image.jpg",
        - "url": "http://localhost/p/humhub/master/file/file/download?guid=bded6dc7-e6f4-417e-a638-b653525529ca"
        },
      - "topics":
        [
        - {
          - "id": 135,
          - "name": "News"
          }
        ]
      }
    }
  ]

}`

## Create new directory

##### path Parameters

id required | integer The id of content container

##### Request Body schema: application/json

Directory information

target_id required | integer <int64>
required | object

### Responses

/api/v1/cfiles/folders/container/{id}

### Request samples

- Payload

Content type
application/json
`
{

- "target_id": 1,
- "Folder":
  {
  - "title": "API folder",
  - "description": "API folder description",
  - "visibility": 1
  }

}`

### Response samples

- 200
- 500

Content type
application/json
`
{

- "id": 4,
- "title": "API directory",
- "description": "API directory description",
- "parent_folder_id": 1,
- "type": null,
- "created_at": "2019-03-05 15:35:02",
- "created_by":
  {
  - "id": 14,
  - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
  - "display_name": "John Doe",
  - "url": "http://localhost/p/humhub/master/u/j.doe/"
  },
- "content":
  {
  - "metadata":
    {
    - "id": 14,
    - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
    - "object_model": "humhub\\modules\\post\\models\\Post",
    - "object_id": 12,
    - "visibility": 1,
    - "state": 1,
    - "archived": true,
    - "hidden": true,
    - "pinned": false,
    - "locked_comments": false,
    - "scheduled_at": "2023-09-14 05:15:00",
    - "created_by":
      {
      - "id": 14,
      - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
      - "display_name": "John Doe",
      - "url": "http://localhost/p/humhub/master/u/j.doe/"
      },
    - "created_at": "2022-04-13 05:15:43",
    - "updated_by":
      {
      - "id": 14,
      - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
      - "display_name": "John Doe",
      - "url": "http://localhost/p/humhub/master/u/j.doe/"
      },
    - "updated_at": "2022-05-21 06:20:18",
    - "url": "http://localhost/p/humhub/master/content/perma?id=109",
    - "contentcontainer_id": 5,
    - "stream_channel": "default"
    },
  - "comments":
    {
    - "total": 55,
    - "latestComments":
      [
      - {
        - "id": 14,
        - "message": "Calvin Klein – Between love and madness lies obsession.",
        - "objectModel": "humhub\\modules\\post\\models\\Post",
        - "objectId": 123,
        - "createdBy":
          {
          - "id": 14,
          - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
          - "display_name": "John Doe",
          - "url": "http://localhost/p/humhub/master/u/j.doe/"
          },
        - "createdAt": "2018-08-09 14:22:03",
        - "commentsCount": 5,
        - "comments":
          [
          - { }
          ]
        }
      ]
    },
  - "likes":
    {
    - "total": 35
    },
  - "files":
    {
    - "id": 14,
    - "guid": "bded6dc7-e6f4-417e-a638-b653525529ca",
    - "mime_type": "text/plain",
    - "size": 14353,
    - "file_name": "image.jpg",
    - "url": "http://localhost/p/humhub/master/file/file/download?guid=bded6dc7-e6f4-417e-a638-b653525529ca"
    },
  - "topics":
    [
    - {
      - "id": 135,
      - "name": "News"
      }
    ]
  }

}`

## Get directory by id

##### path Parameters

id required | integer The id of directory

### Responses

/api/v1/cfiles/folder/{id}

### Response samples

- 200
- 404

Content type
application/json
`
{

- "id": 4,
- "title": "API directory",
- "description": "API directory description",
- "parent_folder_id": 1,
- "type": null,
- "created_at": "2019-03-05 15:35:02",
- "created_by":
  {
  - "id": 14,
  - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
  - "display_name": "John Doe",
  - "url": "http://localhost/p/humhub/master/u/j.doe/"
  },
- "content":
  {
  - "metadata":
    {
    - "id": 14,
    - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
    - "object_model": "humhub\\modules\\post\\models\\Post",
    - "object_id": 12,
    - "visibility": 1,
    - "state": 1,
    - "archived": true,
    - "hidden": true,
    - "pinned": false,
    - "locked_comments": false,
    - "scheduled_at": "2023-09-14 05:15:00",
    - "created_by":
      {
      - "id": 14,
      - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
      - "display_name": "John Doe",
      - "url": "http://localhost/p/humhub/master/u/j.doe/"
      },
    - "created_at": "2022-04-13 05:15:43",
    - "updated_by":
      {
      - "id": 14,
      - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
      - "display_name": "John Doe",
      - "url": "http://localhost/p/humhub/master/u/j.doe/"
      },
    - "updated_at": "2022-05-21 06:20:18",
    - "url": "http://localhost/p/humhub/master/content/perma?id=109",
    - "contentcontainer_id": 5,
    - "stream_channel": "default"
    },
  - "comments":
    {
    - "total": 55,
    - "latestComments":
      [
      - {
        - "id": 14,
        - "message": "Calvin Klein – Between love and madness lies obsession.",
        - "objectModel": "humhub\\modules\\post\\models\\Post",
        - "objectId": 123,
        - "createdBy":
          {
          - "id": 14,
          - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
          - "display_name": "John Doe",
          - "url": "http://localhost/p/humhub/master/u/j.doe/"
          },
        - "createdAt": "2018-08-09 14:22:03",
        - "commentsCount": 5,
        - "comments":
          [
          - { }
          ]
        }
      ]
    },
  - "likes":
    {
    - "total": 35
    },
  - "files":
    {
    - "id": 14,
    - "guid": "bded6dc7-e6f4-417e-a638-b653525529ca",
    - "mime_type": "text/plain",
    - "size": 14353,
    - "file_name": "image.jpg",
    - "url": "http://localhost/p/humhub/master/file/file/download?guid=bded6dc7-e6f4-417e-a638-b653525529ca"
    },
  - "topics":
    [
    - {
      - "id": 135,
      - "name": "News"
      }
    ]
  }

}`

## Update directory by id

##### path Parameters

id required | integer The id of the directory

##### Request Body schema: application/json

Directory information

target_id required | integer <int64>
required | object

### Responses

/api/v1/cfiles/folder/{id}

### Request samples

- Payload

Content type
application/json
`
{

- "target_id": 1,
- "Folder":
  {
  - "title": "API folder",
  - "description": "API folder description",
  - "visibility": 1
  }

}`

### Response samples

- 200
- 404
- 500

Content type
application/json
`
{

- "id": 4,
- "title": "API directory",
- "description": "API directory description",
- "parent_folder_id": 1,
- "type": null,
- "created_at": "2019-03-05 15:35:02",
- "created_by":
  {
  - "id": 14,
  - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
  - "display_name": "John Doe",
  - "url": "http://localhost/p/humhub/master/u/j.doe/"
  },
- "content":
  {
  - "metadata":
    {
    - "id": 14,
    - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
    - "object_model": "humhub\\modules\\post\\models\\Post",
    - "object_id": 12,
    - "visibility": 1,
    - "state": 1,
    - "archived": true,
    - "hidden": true,
    - "pinned": false,
    - "locked_comments": false,
    - "scheduled_at": "2023-09-14 05:15:00",
    - "created_by":
      {
      - "id": 14,
      - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
      - "display_name": "John Doe",
      - "url": "http://localhost/p/humhub/master/u/j.doe/"
      },
    - "created_at": "2022-04-13 05:15:43",
    - "updated_by":
      {
      - "id": 14,
      - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
      - "display_name": "John Doe",
      - "url": "http://localhost/p/humhub/master/u/j.doe/"
      },
    - "updated_at": "2022-05-21 06:20:18",
    - "url": "http://localhost/p/humhub/master/content/perma?id=109",
    - "contentcontainer_id": 5,
    - "stream_channel": "default"
    },
  - "comments":
    {
    - "total": 55,
    - "latestComments":
      [
      - {
        - "id": 14,
        - "message": "Calvin Klein – Between love and madness lies obsession.",
        - "objectModel": "humhub\\modules\\post\\models\\Post",
        - "objectId": 123,
        - "createdBy":
          {
          - "id": 14,
          - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
          - "display_name": "John Doe",
          - "url": "http://localhost/p/humhub/master/u/j.doe/"
          },
        - "createdAt": "2018-08-09 14:22:03",
        - "commentsCount": 5,
        - "comments":
          [
          - { }
          ]
        }
      ]
    },
  - "likes":
    {
    - "total": 35
    },
  - "files":
    {
    - "id": 14,
    - "guid": "bded6dc7-e6f4-417e-a638-b653525529ca",
    - "mime_type": "text/plain",
    - "size": 14353,
    - "file_name": "image.jpg",
    - "url": "http://localhost/p/humhub/master/file/file/download?guid=bded6dc7-e6f4-417e-a638-b653525529ca"
    },
  - "topics":
    [
    - {
      - "id": 135,
      - "name": "News"
      }
    ]
  }

}`

## Deletes a directory by id

##### path Parameters

id required | integer The id of directory

### Responses

/api/v1/cfiles/folder/{id}

### Response samples

- 200
- 404

Content type
application/json
`
{

- "code": 200,
- "message": "Selected items are successfully deleted!"

}`

## File

## Find all files by content container

##### path Parameters

id required | integer The id of content container

##### query Parameters

page | integer >= 0 The number of page of the result set.
limit | integer [ 1 .. 50 ] Default: 20 The numbers of items to return per page.

### Responses

/api/v1/cfiles/files/container/{id}

### Response samples

- 200

Content type
application/json
`
{

- "total": 76,
- "page": 1,
- "results":
  [
  - {
    - "id": 4,
    - "description": "API directory description",
    - "parent_folder":
      {
      - "id": 4,
      - "title": "API directory",
      - "description": "API directory description"
      },
    - "created_at": "2019-03-05 15:35:02",
    - "created_by":
      {
      - "id": 14,
      - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
      - "display_name": "John Doe",
      - "url": "http://localhost/p/humhub/master/u/j.doe/"
      },
    - "content":
      {
      - "metadata":
        {
        - "id": 14,
        - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
        - "object_model": "humhub\\modules\\post\\models\\Post",
        - "object_id": 12,
        - "visibility": 1,
        - "state": 1,
        - "archived": true,
        - "hidden": true,
        - "pinned": false,
        - "locked_comments": false,
        - "scheduled_at": "2023-09-14 05:15:00",
        - "created_by":
          {
          - "id": 14,
          - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
          - "display_name": "John Doe",
          - "url": "http://localhost/p/humhub/master/u/j.doe/"
          },
        - "created_at": "2022-04-13 05:15:43",
        - "updated_by":
          {
          - "id": 14,
          - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
          - "display_name": "John Doe",
          - "url": "http://localhost/p/humhub/master/u/j.doe/"
          },
        - "updated_at": "2022-05-21 06:20:18",
        - "url": "http://localhost/p/humhub/master/content/perma?id=109",
        - "contentcontainer_id": 5,
        - "stream_channel": "default"
        },
      - "comments":
        {
        - "total": 55,
        - "latestComments":
          [
          - {
            - "id": 14,
            - "message": "Calvin Klein – Between love and madness lies obsession.",
            - "objectModel": "humhub\\modules\\post\\models\\Post",
            - "objectId": 123,
            - "createdBy":
              {
              - "id": 14,
              - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
              - "display_name": "John Doe",
              - "url": "http://localhost/p/humhub/master/u/j.doe/"
              },
            - "createdAt": "2018-08-09 14:22:03",
            - "commentsCount": 5,
            - "comments":
              [
              - { }
              ]
            }
          ]
        },
      - "likes":
        {
        - "total": 35
        },
      - "files":
        {
        - "id": 14,
        - "guid": "bded6dc7-e6f4-417e-a638-b653525529ca",
        - "mime_type": "text/plain",
        - "size": 14353,
        - "file_name": "image.jpg",
        - "url": "http://localhost/p/humhub/master/file/file/download?guid=bded6dc7-e6f4-417e-a638-b653525529ca"
        },
      - "topics":
        [
        - {
          - "id": 135,
          - "name": "News"
          }
        ]
      }
    }
  ]

}`

## Upload files

##### path Parameters

id required | integer The id of content container

##### Request Body schema: application/x-www-form-urlencoded
required

folder_id required | integer <int64> Id of directory
files required | Array of file The files to upload.

### Responses

/api/v1/cfiles/files/container/{id}

### Response samples

- 200
- 500

Content type
application/json
`
{

- "code": 200,
- "message": "Files successfully uploaded!"

}`

## Get file info by id

##### path Parameters

id required | integer The id of file

### Responses

/api/v1/cfiles/file/{id}

### Response samples

- 200
- 404

Content type
application/json
`
{

- "id": 4,
- "description": "API directory description",
- "parent_folder":
  {
  - "id": 4,
  - "title": "API directory",
  - "description": "API directory description"
  },
- "created_at": "2019-03-05 15:35:02",
- "created_by":
  {
  - "id": 14,
  - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
  - "display_name": "John Doe",
  - "url": "http://localhost/p/humhub/master/u/j.doe/"
  },
- "content":
  {
  - "metadata":
    {
    - "id": 14,
    - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
    - "object_model": "humhub\\modules\\post\\models\\Post",
    - "object_id": 12,
    - "visibility": 1,
    - "state": 1,
    - "archived": true,
    - "hidden": true,
    - "pinned": false,
    - "locked_comments": false,
    - "scheduled_at": "2023-09-14 05:15:00",
    - "created_by":
      {
      - "id": 14,
      - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
      - "display_name": "John Doe",
      - "url": "http://localhost/p/humhub/master/u/j.doe/"
      },
    - "created_at": "2022-04-13 05:15:43",
    - "updated_by":
      {
      - "id": 14,
      - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
      - "display_name": "John Doe",
      - "url": "http://localhost/p/humhub/master/u/j.doe/"
      },
    - "updated_at": "2022-05-21 06:20:18",
    - "url": "http://localhost/p/humhub/master/content/perma?id=109",
    - "contentcontainer_id": 5,
    - "stream_channel": "default"
    },
  - "comments":
    {
    - "total": 55,
    - "latestComments":
      [
      - {
        - "id": 14,
        - "message": "Calvin Klein – Between love and madness lies obsession.",
        - "objectModel": "humhub\\modules\\post\\models\\Post",
        - "objectId": 123,
        - "createdBy":
          {
          - "id": 14,
          - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
          - "display_name": "John Doe",
          - "url": "http://localhost/p/humhub/master/u/j.doe/"
          },
        - "createdAt": "2018-08-09 14:22:03",
        - "commentsCount": 5,
        - "comments":
          [
          - { }
          ]
        }
      ]
    },
  - "likes":
    {
    - "total": 35
    },
  - "files":
    {
    - "id": 14,
    - "guid": "bded6dc7-e6f4-417e-a638-b653525529ca",
    - "mime_type": "text/plain",
    - "size": 14353,
    - "file_name": "image.jpg",
    - "url": "http://localhost/p/humhub/master/file/file/download?guid=bded6dc7-e6f4-417e-a638-b653525529ca"
    },
  - "topics":
    [
    - {
      - "id": 135,
      - "name": "News"
      }
    ]
  }

}`

## Deletes a file by id

##### path Parameters

id required | integer The id of file

### Responses

/api/v1/cfiles/file/{id}

### Response samples

- 200
- 404

Content type
application/json
`
{

- "code": 200,
- "message": "Successfully deleted!"

}`

## Items Management

## Make items public

##### path Parameters

id required | integer The id of content container

##### Request Body schema: application/json
required

Array of items

selection required | Array of strings (Selection) Item id in format {type}_{id}

### Responses

/api/v1/cfiles/items/container/{id}/make-public

### Request samples

- Payload

Content type
application/json
`
{

- "selection":
  [
  - "folder_4",
  - "file_2"
  ]

}`

### Response samples

- 200
- 500

Content type
application/json
`
{

- "code": 200,
- "message": "Items successfully marked public!"

}`

## Make items private

##### path Parameters

id required | integer The id of content container

##### Request Body schema: application/json
required

Array of items

selection required | Array of strings (Selection) Item id in format {type}_{id}

### Responses

/api/v1/cfiles/items/container/{id}/make-private

### Request samples

- Payload

Content type
application/json
`
{

- "selection":
  [
  - "folder_4",
  - "file_2"
  ]

}`

### Response samples

- 200
- 500

Content type
application/json
`
{

- "code": 200,
- "message": "Items successfully marked private!"

}`

## Move items to another folder

##### path Parameters

id required | integer The id of content container

##### Request Body schema: application/json

Directory information

source_id required | integer <int64>
required | object
selection required | Array of strings (Selection) Item id in format {type}_{id}

### Responses

/api/v1/cfiles/items/container/{id}/move

### Request samples

- Payload

Content type
application/json
`
{

- "source_id": 14,
- "MoveForm":
  {
  - "destId": 3
  },
- "selection":
  [
  - "folder_4",
  - "file_2"
  ]

}`

### Response samples

- 200
- 500

Content type
application/json
`
{

- "code": 200,
- "message": "Items successfully moved."

}`

## Delete items from folder

##### path Parameters

id required | integer The id of content container

##### Request Body schema: application/json
required

Array of items

selection required | Array of strings (Selection) Item id in format {type}_{id}

### Responses

/api/v1/cfiles/items/container/{id}/delete

### Request samples

- Payload

Content type
application/json
`
{

- "selection":
  [
  - "folder_4",
  - "file_2"
  ]

}`

### Response samples

- 200
- 500

Content type
application/json
`
{

- "code": 200,
- "message": "Selected items are successfully deleted!"

}`