> For the complete documentation index, see [llms.txt](https://api-docs.devhub.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api-docs.devhub.com/content-resources/files.md).

# Files

Covered in this doc:

* [List files](/content-resources/files.md#list-files)
* [Upload a new files (via base64)](/content-resources/files.md#upload-a-new-files-via-base64)

## List files

List all files uploaded within a Site

```
GET /api/v2/files/
```

### Response

```javascript
{
  "meta": {
    "limit": 20,
    "next": "/api/v2/files/?limit=20&offset=20",
    "offset": 0,
    "previous": null,
    "total_count": 5
  },
  "objects": [
    {
      "added": "2014-07-18T12:05:44",
      "checksum": "c8aaa5d3656fd6967b4826a14d3c86ef",
      "filename": "chart-copy.pdf",
      "filesize": 54226,
      "id": 13,
      "mimetype": "application/pdf",
      "modified": "2014-07-18T12:05:44",
      "path": null,
      "resource_uri": "/api/v2/files/13/",
      "site_id": 1556341,
      "upload_source": "builder",
      "user_id": 322,
      "whitelabel_id": 10
    },
    ...
  ]
}
```

### Full URI of files

Any files file is available publicly using the `filename` parameter from the response and prefixing it with the frontend hostname of your API instance or path to a hosted site

**Example:**

```
http://yourprivatelabel.cloudfrontend.net/files/chart-copy.pdf
```

## Upload a new file (via base64)

```
POST /api/v2/files/
```

### Parameters

| Name     | Type     | Description  |
| -------- | -------- | ------------ |
| `upload` | `object` | **required** |

#### Example

```javascript
{
  "upload": {
    "name": "chart-copy.pdf",
    "file": "iVBORw0KGgoAAAANSUhEUgAAASAAAABsCAIAAABFDPh0AAAAGXRFWHRTb2Z0d2F..."
  }
}
```

### Response

A status code of `201 created` is returned on a successful creation and contains the created files object as JSON.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://api-docs.devhub.com/content-resources/files.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
