---
topic: trash
connector: "Not in the connector yet: use the HTTP calls, or send the person to the app's menu (Move to Trash) or Settings, Trash"
api: "POST https://ship.embarko.ai/api/apps/{app-name}/trash · POST https://ship.embarko.ai/api/apps/{app-name}/restore"
needs_human: "A yes to move it to the Trash, naming the app. A yes to restore it."
requires: [claim]
---

[← Guide home](https://embarko.ai/docs)

# Move an app to the Trash, or restore it

**On this page:** Over HTTP, Good to know, Errors, What to tell the person

> Plain words unless the person is a developer. Never invent a link, name or code. [Rules](https://embarko.ai/docs/prerequisites) Needs first: [claim](https://embarko.ai/docs/claim) (over HTTP only).

Moving an app to the Trash takes it offline and off the workspace's list, and keeps everything: its data, files, secrets, address and custom domain. Anyone with Can edit can restore it for 30 days. After 30 days it is deleted forever. Use this, not delete, when the person asks you to remove an app.

**Connector:** Not in the connector yet: use the HTTP calls, or send the person to the app's menu (Move to Trash) or Settings, Trash

**Done when:** Trash: the call answered 200 with trashedAt and purgeAt, and you told the person the date in purgeAt. Restore: the call answered 200 with trashedAt null, and the app's link opens.

**Over HTTP**

1. Move to the Trash: confirm with the person, naming the app. POST https://ship.embarko.ai/api/apps/{app-name}/trash with the token and no body.
2. Read purgeAt in the reply and tell the person: it is in the Trash until that date, then deleted forever.
3. Restore: POST https://ship.embarko.ai/api/apps/{app-name}/restore with the token and no body. Wait up to 45 seconds for the reply: the app is being started.
4. Check: GET https://ship.embarko.ai/api/apps/{app-name} shows trashedAt (null when it is not in the Trash) and purgeAt.

**Good to know**

- The app goes offline about 15 seconds after the call. Until then offline is false in the reply. A restore inside those 15 seconds changes nothing for visitors.
- Visitors see a page that says the app is in the Trash. It names nothing about the app.
- While it is in the Trash nothing about the app can be changed: every change answers 409 app_in_trash. Reading still works.
- A successful deploy to an app in the Trash restores it. The deploy reply then carries a notice with code app_in_trash. Tell the person it is back.
- Its previews are stopped with it and come back with it. Its schedules do not run while it is there.
- A static site (pages, decks, reports) goes to the Trash like any app: visitors see the same page, and its files are kept.
- To delete it forever before the 30 days, use delete. That works on an app in the Trash.

**Errors**

| Code | Status | Retry | What to do |
| --- | --- | --- | --- |
| `app_in_trash` | 409 | No | The app is in the Trash, so nothing about it can be changed. Ask the person whether to bring it back. On a yes, restore it, then send the request again. |
| `trash_expired` | 410 / 409 | No | It was in the Trash for more than 30 days and is being deleted. It cannot be restored or deployed to. To start again, deploy under a new name, or under this name a day later. |
| `deploy_in_progress / rename_in_progress` | 409 | Later | A deploy or an address change of this app is running. Wait for it to finish, then send the request once more. A deploy that succeeds restores the app by itself. |
| `deploy_unreachable / restore_failed` | 503 / 502 | Once | The app could not be started. It is still in the Trash and nothing changed. Wait a minute and restore once more. If it repeats, tell the person and report it. |
| `permission_denied` | 403 | No | The person who made this token is not allowed to do this. The reply names the permission and their access to the app (or their role). Nothing changed. Tell the person (say_to_user.no_permission); do not try another way round it. |

**What to tell the person**

- confirm: "Move {app} to the Trash? It goes offline and leaves your list. Nothing is lost, and you can restore it for 30 days."
- done: "{app} is in the Trash until {date}. You can restore it any time before then."
- restored: "{app} is back and online."

**Next:** Only on a yes. Then tell them the date it is deleted forever.

**Related:** [delete](https://embarko.ai/docs/delete) · [rollback](https://embarko.ai/docs/rollback)

---

[Guide home](https://embarko.ai/docs) · JSON: add .json