---
topic: previews
connector: "Not yet: use the HTTP calls with the Embarko key"
api: "POST https://ship.embarko.ai/apps with X-Preview: {preview-name}"
needs_human: "Someone with Can edit puts it live (in Embarko, or by asking their own AI)."
requires: [claim]
---

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

# Work on a preview

**On this page:** Over HTTP, Examples, Limits, 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).

A preview is a second running copy of an app with your change in it, at {app-name}--{preview-name}.embarko.app. The live app does not change. Someone with Can edit looks at it and puts it live: the exact version that ran in the preview goes live, nothing is rebuilt. Use a preview when the person can contribute to the app (Can contribute), or when someone who can edit asks to try a change first.

**Connector:** Not yet: use the HTTP calls with the Embarko key

**Done when:** The person has the preview's link; or, after Put it live, the live app runs the preview's version.

**Over HTTP**

1. Get the latest code first (see source.md): GET https://ship.embarko.ai/api/apps/{app-name}/source, download the url within 10 minutes and unpack it.
2. Make the change on that code.
3. Deploy it exactly like the app itself, with the live app's name in X-App-Name and one more header, X-Preview: {preview-name} (lowercase letters, numbers and single dashes, up to 20; name it after the change, for example new-look). The Embarko key is required.
4. If the deploy reply already says live, it is ready. Otherwise poll links.status until it says live; on failed or crashed, read its logs and fix the change before sharing it. The reply has app.preview {id, name, of} and its own address; for server apps, app.preview.data says what its data started as (copy of live, kept, or empty and why).
5. Give the person the preview's address from the reply (links.app).
6. To change it again, deploy again with the same X-Preview. It updates the same preview and keeps its data.
7. To put it live (Can edit only): POST https://ship.embarko.ai/api/apps/{app-name}/previews/{preview-name}/ship. If the answer is confirm_schedule_changes, tell the person what changes (scheduleChanges) and only with their yes send it again with {"confirmSchedules": true}. Resolve statusUrl against https://ship.embarko.ai and poll until terminal is true. Only status success means it is live; on failed, read errorDetail and check the live app before retrying.

**Example: Deploy a preview**

```bash
curl -sS -X POST 'https://ship.embarko.ai/apps' --oauth2-bearer "$DEPLOY_TOKEN" -H 'X-App-Name: my-app' -H 'X-Preview: new-look' -F 'source=@app.tar.gz'
```

Reply 202:

```json
{"success":true,"status":"building","app":{"name":"my-app--new-look","kind":"service","claimed":true,"preview":{"id":"cmh1q2w3e0009abcdpreview","name":"new-look","of":"my-app","data":{"action":"copy"}}},"links":{"app":"https://my-app--new-look.embarko.app","status":"https://ship.embarko.ai/apps/my-app--new-look/status"}}
```

**Example: List previews**

```bash
curl -sS 'https://ship.embarko.ai/api/apps/my-app/previews' --oauth2-bearer "$DEPLOY_TOKEN"
```

Reply 200:

```json
{"previews":[{"id":"cmh1q2w3e0009abcdpreview","name":"new-look","slug":"my-app--new-look","url":"https://my-app--new-look.embarko.app","status":"live","createdBy":"user_123","lastActiveAt":"2026-11-23T10:00:00.000Z","shippedAt":null}]}
```

**Example: Put it live**

```bash
curl -sS -X POST 'https://ship.embarko.ai/api/apps/my-app/previews/new-look/ship' --oauth2-bearer "$DEPLOY_TOKEN" -H 'Content-Type: application/json' -d '{}'
```

Reply 202:

```json
{"accepted":true,"deploymentId":"cmh1q2w3e0010abcddeploy","version":"v7","shippedFrom":{"previewId":"cmh1q2w3e0009abcdpreview","name":"new-look","version":"new-look.2"},"scheduleChanges":null,"statusUrl":"/api/apps/my-app/deployments/cmh1q2w3e0010abcddeploy","terminal":false}
```

**Example: Delete a preview**

```bash
curl -sS -X DELETE 'https://ship.embarko.ai/api/apps/my-app/previews/cmh1q2w3e0009abcdpreview' --oauth2-bearer "$DEPLOY_TOKEN"
```

Reply 200:

```json
{"deleted":true,"id":"cmh1q2w3e0009abcdpreview"}
```

**Limits**

- Only how the app works goes live. Anything typed into a preview stays there.
- A new preview starts with a copy of the live app's data (up to 2 GB; bigger, or switched off by the owner, and it starts empty). Later deploys keep the preview's own data.
- A preview gets the live app's settings and secret keys, plus EMBARKO_PREVIEW={preview-name}. It does not get the live app's file storage, so uploading files from a preview fails.
- Scheduled tasks never run in a preview. Those declared in embarko.json are offered when it is put live.
- A private app’s previews need the same Embarko sign-in and app access as live. Sign in at each preview address separately (see lock.md).
- Signing in with Google or GitHub, and services that call the app back (webhooks), may not work at the preview's address.
- It sleeps after 15-25 minutes without a visit and wakes on the next one. It is deleted after 7 days with no visit or deploy. Shipped previews keep running under the same limits.
- A preview has up to 256 MB of memory, even if live has more.
- Emails, payments and other external services can still run using the inherited secret keys. Use test credentials before trying actions with real effects.
- Up to 3 previews per app (5 on a paid plan). No custom domains.
- Put it live keeps the live app's settings, secret keys, address and data, and can be undone like any version (see rollback.md).
- Delete: your own preview with Can contribute, anyone's with Can edit: DELETE .../previews/{id}.

**Errors**

| Code | Status | Retry | What to do |
| --- | --- | --- | --- |
| `preview_needs_key` | 401 | No | Previews need the Embarko key. Deploy with it. |
| `invalid_preview_name` | 400 | After a fix | Use lowercase letters, numbers and single dashes, 1-20 characters. |
| `preview_name_too_long` | 400 | After a fix | {app-name}--{preview-name} must fit in 63 characters. Use a shorter name. |
| `previews_off` | 403 | No | The owner switched previews off for this app. Tell the person to ask someone with Can edit. |
| `app_in_trash` | 409 | After restoring | This app is in the Trash. Ask the person whether to restore it, then retry. Preview creation and putting a preview live are blocked until then. |
| `permission_denied` | 403 | No | With canPreview: true in the reply, the person can only contribute: deploy again with X-Preview instead of to the live app. Without it, they need more access; tell them. |
| `preview_limit` | 409 | No | The app has as many previews as it may. Deploy to one of the names in previews, or delete one first (ask the person which). |
| `preview_name_taken` | 409 | After a fix | That address belongs to another app. Pick a different preview name. |
| `app_on_other_cell` | 409 | Yes, after a few seconds | Send the same deploy again. |
| `preview_no_space` | 507 | Later | The server has no room for a new preview right now. Deploy to an existing preview, or try again later. |
| `confirm_schedule_changes` | 409 | After the person agrees | Put it live would change the app's scheduled tasks (scheduleChanges). Tell the person; with their yes, send again with {"confirmSchedules": true}. |
| `preview_behind_live` | 409 | After a fix | The live app's code changed since the preview started. Get the latest code, make the same change on it, deploy under a new preview name, check it, then put it live. Redeploying the old preview keeps its original starting point. Leave the old preview unless the person asks to delete it. |
| `nothing_to_ship` | 409 | No | The live app already runs this version of the preview. |
| `preview_not_ready` | 409 | After a fix | The preview has no working version yet. Fix it and deploy it again. |
| `preview_deploy_in_progress` | 409 | Yes, once that deploy finishes | The preview is being deployed. Wait for links.status, then try again. |
| `deploy_in_progress` | 409 | Yes, once it finishes | The live app is being changed right now. |
| `preview_kind_differs` | 409 | No | The preview and the live app are different kinds (a static site and a server app). Deploy the change to the live app directly, with the person's go-ahead. |
| `preview_image_unavailable` | 422 | After a fix | Deploy the preview again, then put it live. |
| `preview_not_found` | 404 | No | No preview by that id or name. List them with GET .../previews. |
| `ship_failed` | 502 | Yes, once after a minute | Check the live app and deployment history before retrying. |
| `preview_delete_failed` | 502 | Yes, once after a minute | The preview could not be removed. List previews and check its address before retrying. |
| `rename_in_progress` | 409 | After it finishes | The app is changing address. Wait, then get its current name and try again. |

**What to tell the person**

- done: "Your change is ready to look at: {preview-link}. The live app is unchanged until someone who can edit puts it live."
- shipped: "It's live: {app-link} now runs the version you looked at."

**Next:** Give the person the preview's link. Someone with Can edit puts it live.

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

---

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