> ## Documentation Index
> Fetch the complete documentation index at: https://docs.launchmystore.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Theme Assets

> Manage theme assets

# Theme Assets

Manage files within a theme including templates, sections, snippets, and static assets.

All endpoints use the standard response envelope (`status`, `state`, `message`,
`data`).

## List Assets

Returns a list of all asset files in a theme. Assets are returned as metadata
only — the file body is not included in this response.

### Request

```bash theme={null}
curl -X GET "https://api.launchmystore.io/api/v1/themes/1f2e3d4c-5b6a-7980-a1b2-c3d4e5f60718/assets.json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
```

### Path Parameters

<ParamField path="theme_id" type="string" required>
  The theme ID
</ParamField>

### Response

The asset array is nested under `data.assets`. Each asset object describes one
file.

<ResponseField name="data.assets" type="array">
  Array of asset objects

  <Expandable title="Asset Object">
    <ResponseField name="name" type="string">
      File name (e.g., `theme.css`)
    </ResponseField>

    <ResponseField name="path" type="string">
      Path within the theme (e.g., `assets/theme.css`)
    </ResponseField>

    <ResponseField name="directory" type="string">
      Directory the file lives in (e.g., `assets`, `sections`, `snippets`, `layout`, `templates`)
    </ResponseField>

    <ResponseField name="size" type="integer">
      File size in bytes
    </ResponseField>

    <ResponseField name="type" type="string">
      File category: `image`, `style`, `script`, `font`, `template`, or `other`
    </ResponseField>

    <ResponseField name="extension" type="string">
      File extension (e.g., `.css`, `.aqua`, `.png`)
    </ResponseField>

    <ResponseField name="modified" type="string">
      Last modified timestamp (ISO 8601)
    </ResponseField>

    <ResponseField name="url" type="string">
      Public URL to the asset
    </ResponseField>

    <ResponseField name="thumbnail" type="string">
      Thumbnail URL for image assets, otherwise `null`
    </ResponseField>
  </Expandable>
</ResponseField>

```json theme={null}
{
  "status": 200,
  "state": "success",
  "message": null,
  "data": {
    "assets": [
      {
        "name": "theme.css",
        "path": "assets/theme.css",
        "directory": "assets",
        "size": 45678,
        "type": "style",
        "extension": ".css",
        "modified": "2024-03-12T11:30:00.000Z",
        "url": "https://assets.launchmystore.io/themes/1f2e3d4c-5b6a-7980-a1b2-c3d4e5f60718/assets/theme.css",
        "thumbnail": null
      },
      {
        "name": "header.aqua",
        "path": "sections/header.aqua",
        "directory": "sections",
        "size": 8192,
        "type": "template",
        "extension": ".aqua",
        "modified": "2024-03-10T09:00:00.000Z",
        "url": "https://assets.launchmystore.io/themes/1f2e3d4c-5b6a-7980-a1b2-c3d4e5f60718/sections/header.aqua",
        "thumbnail": null
      }
    ]
  },
  "count": null,
  "pagination": null
}
```

***

## Create/Update Asset

Create a new asset or update an existing one by writing its text content.

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT "https://api.launchmystore.io/api/v1/themes/1f2e3d4c-5b6a-7980-a1b2-c3d4e5f60718/assets.json" \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "key": "snippets/custom-banner.aqua",
      "value": "<div class=\"custom-banner\">\n  {{ section.settings.text }}\n</div>"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.launchmystore.io/api/v1/themes/1f2e3d4c-5b6a-7980-a1b2-c3d4e5f60718/assets.json', {
    method: 'PUT',
    headers: {
      'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      key: 'snippets/custom-banner.aqua',
      value: '<div class="custom-banner">\n  {{ section.settings.text }}\n</div>'
    })
  });
  ```
</CodeGroup>

### Body Parameters

<ParamField body="key" type="string" required>
  Asset path (e.g., `snippets/custom-banner.aqua`, `assets/custom.css`)
</ParamField>

<ParamField body="value" type="string" required>
  Asset text content
</ParamField>

### Response

The created/updated asset is nested under `data.asset`.

```json theme={null}
{
  "status": 200,
  "state": "success",
  "message": null,
  "data": {
    "asset": {
      "key": "snippets/custom-banner.aqua",
      "value": "<div class=\"custom-banner\">\n  {{ section.settings.text }}\n</div>"
    }
  },
  "count": null,
  "pagination": null
}
```

***

## Delete Asset

Delete an asset file from the theme.

### Request

```bash theme={null}
curl -X DELETE "https://api.launchmystore.io/api/v1/themes/1f2e3d4c-5b6a-7980-a1b2-c3d4e5f60718/assets.json?key=snippets/custom-banner.aqua" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
```

### Query Parameters

<ParamField query="key" type="string" required>
  The asset key/path to delete
</ParamField>

### Response

Delete returns a message envelope (no `data` payload).

```json theme={null}
{
  "status": 200,
  "state": "success",
  "message": "Asset deleted successfully",
  "data": null
}
```

***

## Asset Paths

Common asset paths:

| Path Pattern                  | Description                    |
| ----------------------------- | ------------------------------ |
| `layout/*.aqua`               | Layout templates               |
| `templates/*.json`            | Page templates                 |
| `sections/*.aqua`             | Section files                  |
| `snippets/*.aqua`             | Snippet files                  |
| `assets/*`                    | Static files (CSS, JS, images) |
| `config/settings_schema.json` | Theme settings schema          |
| `config/settings_data.json`   | Theme settings values          |
| `locales/*.json`              | Translation files              |

## Error Response

```json theme={null}
{
  "status": 400,
  "state": "error",
  "message": "Invalid asset key",
  "data": null
}
```

| Status | Description                                                        |
| ------ | ------------------------------------------------------------------ |
| `401`  | Invalid or missing access token                                    |
| `403`  | App doesn't have the required `read_themes` / `write_themes` scope |
| `404`  | Theme does not exist                                               |
| `400`  | Invalid asset key or content                                       |
