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

# Resources

Resources are uploaded media and files, such as images, PDFs, and videos, that CMS items can reference. They live in resource folders configured in the Online Editor.

### `GET /cms/resources`

List entries in a resource folder.

| Field | Value            |
| ----- | ---------------- |
| Auth  | Required         |
| Role  | Any API key user |

Query string:

| Name      | Type   | Description                             |
| --------- | ------ | --------------------------------------- |
| `folder`  | int    | Resource folder index. Defaults to `0`. |
| `subpath` | string | Optional subfolder to list.             |

Response:

```json
{
  "folder": { "index": 0, "label": "Uploads" },
  "subpath": "",
  "dirs": [
    { "name": "blog", "type": "dir" }
  ],
  "files": [
    {
      "name": "hero.jpg",
      "size": 120938,
      "url": "/assets/hero.jpg",
      "modified": 1714000000,
      "is_image": true
    }
  ],
  "license": { "valid": true }
}
```

### `POST /cms/resources`

Upload a file with `multipart/form-data`.

| Field | Value            |
| ----- | ---------------- |
| Auth  | Required         |
| Role  | Any API key user |

Form fields:

| Name      | Type   | Description                             |
| --------- | ------ | --------------------------------------- |
| `file`    | file   | Required uploaded file bytes.           |
| `folder`  | int    | Resource folder index. Defaults to `0`. |
| `subpath` | string | Optional destination subfolder.         |

The JSON API does not accept base64 resource uploads. See [Uploads](https://github.com/realmacsoftware/rapidweaver-elements-docs-cms/blob/main/json-api/guides/uploads.md) for worked examples.

Response:

```json
{
  "name": "hero-662d8c981a65c.jpg",
  "url": "/assets/blog/hero-662d8c981a65c.jpg",
  "size": 120938,
  "modified": 1714000000,
  "is_image": true
}
```

### `PATCH /cms/resources`

Rename or move a file.

| Field | Value            |
| ----- | ---------------- |
| Auth  | Required         |
| Role  | Any API key user |

Rename body:

```json
{
  "folder": 0,
  "subpath": "blog",
  "file": "hero.jpg",
  "newName": "hero-v2"
}
```

Move body:

```json
{
  "op": "move",
  "folder": 0,
  "subpath": "blog",
  "file": "hero.jpg",
  "dest_subpath": "archive",
  "new_filename": "hero-v2.jpg"
}
```

### `DELETE /cms/resources`

Delete a file.

| Field | Value            |
| ----- | ---------------- |
| Auth  | Required         |
| Role  | Any API key user |

Body:

```json
{ "folder": 0, "subpath": "blog", "file": "hero.jpg" }
```

### `POST /cms/resources/folders`

Create a subfolder inside a resource folder.

| Field | Value            |
| ----- | ---------------- |
| Auth  | Required         |
| Role  | Any API key user |

Body:

```json
{ "folder": 0, "subpath": "blog", "name": "2026" }
```


---

# 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://docs.realmacsoftware.com/elements-docs/cms/json-rest-api/reference/resources.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.
