---
title: Replace files
url: https://www.tines.com/stories/docs/api/apps/replace-files/
updated: 2026-09-23T13:07:55+00:00
description: Replace all draft files in an app.
---

*[tines.com](https://www.tines.com/llms.txt) › [Docs](https://www.tines.com/stories/docs/llms.txt) › [Tines API](https://www.tines.com/stories/docs/api/llms.txt) › [Apps](https://www.tines.com/llm/stories/docs/api/apps.md)*

# Replace files

*[View on tines.com](https://www.tines.com/stories/docs/api/apps/replace-files/)*

## Description

Replace all draft files in an app.

See the [Get Apps API](/api/apps/get) to learn more about apps.

## Request

HTTP Method: **PUT**

Endpoint: `/api/v1/apps/{id}/files`

| Parameter        | Description                                                                          |
| ---------------- | ------------------------------------------------------------------------------------ |
| id               | The ID of the app whose draft files should be replaced.                              |
| files            | The complete set of draft files. Existing files omitted from this array are deleted. |
| files[].path     | The file path. One file must have the path `App.tsx`.                                |
| files[].contents | **Optional** The file contents. Defaults to an empty string.                         |

### Sample request

```bash
curl --proto '=https' --tlsv1.2 -X PUT \
  https://<tenant-domain>/api/v1/apps/42/files \
  -H 'content-type: application/json' \
  -H 'Authorization: Bearer <<CREDENTIAL.tines_api_key>>' \
  -d '{
        "files": [
          {
            "path": "App.tsx",
            "contents": "export default function App() { return <h1>Hello</h1>; }"
          }
        ]
      }'
```

## Response

A successful request returns a `200` status and the app's complete set of draft files.

### Field description

| Parameter        | Description                            |
| ---------------- | -------------------------------------- |
| files            | The app's complete set of draft files. |
| files[].path     | The file path.                         |
| files[].contents | The file contents.                     |

### Sample response

```json
{
  "files": [
    {
      "path": "App.tsx",
      "contents": "export default function App() { return <h1>Hello</h1>; }"
    }
  ]
}
```
