# Custom Apps

Source: https://docs.autessa.com/docs/api/poweruser/custom-apps

> Poweruser endpoints for creating custom apps, editing their source files, publishing builds, and controlling sharing and hosting.

# Custom Apps

Manage App Builder apps end to end: create and clone apps, read and write their draft source files, publish versions and track builds, control code sharing and end-user hosting, and read the history of Vibecode AI coding sessions.

> All paths on this page are relative to `https://api.autessa.com/autessa_poweruser/custom-apps-v2`. Every request is a POST with a JSON body, and every ID is an opaque string. See the [Poweruser API overview](/docs/api/poweruser.md) for authentication and conventions.

---

## The app object

- `appId` (string) — Unique app identifier.
- `companyId` (string) — The company that owns the app.
- `ownerId` (string) — User ID of the app's owner.
- `appName` (string) — Display name.
- `description` (string) — What the app does.
- `sharingLevel` (string) — Who can see and edit the source code: `PRIVATE`, `SPECIFIC_MEMBER`, or `COMPANY`.
- `companyPermissionLevel` (string) — Access level every company member gets when `sharingLevel` is `COMPANY`: `READ`, `WRITE`, `PUBLISH`, or `ADMIN`.
- `createdAt` (string) — ISO-8601 creation timestamp.
- `updatedAt` (string) — ISO-8601 timestamp of the last update.
- `latestVersion` (integer) — Highest version number created by [`/publish`](#publish-an-app), or absent if never published.
- `publishedVersion` (integer) — The currently live published version, or absent if no build has succeeded yet.
- `userAccessLevel` (string) — The calling user's effective access level on the app: `READ`, `WRITE`, `PUBLISH`, or `ADMIN`.
- `hostingMode` (string) — How end users access the deployed app — orthogonal to `sharingLevel`: `DEFAULT` (Autessa login required), `PUBLIC` (anyone with the URL), `AUTH_CODE` (shared access code), `CUSTOM_AUTH` (app-specific accounts backed by an AutessaDB table), or `TOKEN` (a private access link per person).
- `publicSlug` (string) — URL slug for non-default hosting modes.
- `publicUrl` (string) — Full end-user URL derived from the slug, when one is set.
- `hasAuthCode` (boolean) — Whether an `AUTH_CODE` access code is stored. The code itself is hashed and never returned.
- `authTableId` (string) — The AutessaDB table backing `CUSTOM_AUTH` signups, when provisioned.
- `authPageConfig` (string) — JSON string with auth page theming for `CUSTOM_AUTH` hosting.
- `requireEmailVerification` (boolean) — Whether `CUSTOM_AUTH` signups must confirm an emailed code before the account is created. Absent for apps not using `CUSTOM_AUTH`.
- `enabledProviders` (array<string>) — The sign-in methods a `CUSTOM_AUTH` app offers: any of `PASSWORD`, `GOOGLE`, and `MICROSOFT`. Absent for apps not using `CUSTOM_AUTH`.
- `hostingPermissions` (string) — JSON string describing which company resources the hosted app may call (tables, agents, tools, managers, poweruser endpoints, e-sign envelopes, and whether Payments is on). Set as a structured object via [`/share`](#share-an-app); returned here as the stored JSON string.
- `permissionsGrantedBy` (object) — `{ userId, name }` of the person who last saved the app's permissions (hosting permissions, table security, or envelopes). Visitors of a public or sign-in app are limited to what this person can access. See [Who an app acts as](#who-an-app-acts-as).
- `permissionsNeedResave` (boolean) — `true` when the person in `permissionsGrantedBy` can no longer give visitors everything the app's permissions list, for example because they lost access to a table. The affected parts of the app return nothing to visitors until someone with enough access saves the permissions again.
- `permissionsIssues` (array<string>) — One plain-language message per affected table, tool, or agent when `permissionsNeedResave` is `true`.

```json title="App object"
{
  "appId": "V1StGXR8Z5",
  "companyId": "cP2mK7dX4v",
  "ownerId": "uB7nT2wQ9k",
  "appName": "Field Inspection Portal",
  "description": "Logs site inspections against the Inspections table.",
  "sharingLevel": "SPECIFIC_MEMBER",
  "createdAt": "2026-05-12T09:30:00",
  "updatedAt": "2026-06-28T17:42:10",
  "latestVersion": 5,
  "publishedVersion": 4,
  "userAccessLevel": "ADMIN",
  "hostingMode": "AUTH_CODE",
  "publicSlug": "field-inspections",
  "publicUrl": "https://builder.autessa.com/app/field-inspections",
  "hasAuthCode": true,
  "hostingPermissions": "{\"tables\":[{\"tableId\":\"tQ6bF3jN8s\",\"canRead\":true,\"canWrite\":true,\"canDelete\":false}],\"esignatureActsAsUser\":false}"
}
```

---

## Build lifecycle and access levels

Every app has a single **draft** workspace of source files, edited through
the [file endpoints](#list-files) (and the Vibecode assistant in the UI).
[`/publish`](#publish-an-app) snapshots the draft as a new numbered version and
triggers an **asynchronous build** — the publish response returns
immediately with `buildStatus: "BUILDING"`. Poll
[`/build-status`](#get-build-status) until the build reaches `SUCCESS` or
`FAILED`; on the first successful check the version is marked `PUBLISHED`
and the CDN cache is invalidated, so [`/build-url`](#get-a-preview-url) and the
app's public slug serve the new build.

Endpoints enforce the caller's access level on the app (the poweruser key
acts as its linked user):

| Operation | Required access |
|-----------|-----------------|
| `get`, `all`, `clone` (source app), `build-status`, `versions`, `build-files`, `build-url`, `files/list`, `files/get`, `files/get-batch`, `refresh-libraries`, `get-sharing-details`, `vibecode/*` | Any access (READ or higher) |
| `update`, `files/create`, `files/update`, `files/delete`, `files/rename`, `files/save-batch` | WRITE, PUBLISH, or ADMIN |
| `publish` | PUBLISH or ADMIN |
| `delete`, `share`, `transfer-ownership` | ADMIN |

`check-slug` performs no per-app access check — it only validates the slug.

---

## Who an app acts as

What a running app can read and do depends on its hosting mode:

| Hosting mode | The app acts as |
|---|---|
| `DEFAULT` (Autessa sign-in) | Exactly the teammate using it. The app sees the tables, rows, and columns that person sees and runs only the tools and agents they can run. App roles don't apply. |
| `PUBLIC`, `AUTH_CODE`, `CUSTOM_AUTH`, `TOKEN` | The visitor, limited to the app's `hostingPermissions` **and** to what the person in `permissionsGrantedBy` can access right now. AutessaDB roles assigned to the app decide which rows and columns each visitor sees. |

For public and sign-in apps:

- **You can only give visitors what you can reach.** Saving hosting
  permissions checks every table, operation, tool, agent, multi-agent, and
  envelope against your own access, and refuses anything beyond it with a
  message naming the resource.
- **To give visitors a table, you must see every row and every column of
  it.** If your own access to a table is limited by row rules or hidden or
  masked columns, saving is refused with, for example, "You only see some
  rows of “Tickets”, so visitors can't be given it — ask a table admin, or
  give the app a role." A table admin can save it instead, or assign the app
  an AutessaDB role that shows visitors only the rows they should see.
- **The limit is checked on every request.** If the person who saved the
  permissions later loses access, the affected tables, tools, or agents stop
  working for visitors and the app reports `permissionsNeedResave`. Someone
  with enough access fixes it by saving the permissions again.
- **Admin endpoints run as the visitor.** Poweruser endpoints listed in
  `allowedPoweruserEndpoints` act as the visitor, limited to the app's
  permissions and the saver's access; they never act as the app's owner.
  Only endpoints from the [allowlist](#list-poweruser-endpoint-options) can
  be listed.

---

## Create an app

**POST** `/custom-apps-v2/create`

Creates a new app owned by the linked user and bootstraps its draft
workspace with the chosen starter template, including the read-only
Autessa library files. The response lists every bootstrapped file path.

### Request parameters

- `appName` (string, required) — Display name.
- `description` (string) — What the app does.
- `templateType` (string) — Starter template for the new app. One of `BOOTSTRAP` (minimal starter), `LANDING_PAGE` (marketing site with hero, features, pricing, and FAQ sections), `SAAS_APP` (product-app shell with a built-in UI component kit and sample pages), `DASHBOARD` (analytics starter with KPI tiles, charts, and data tables), or `PHONE_CONSENT` (texting consent site: sign-up page, privacy policy, texting terms, and call script, set up and published for your company's texting registration). Defaults to `BOOTSTRAP` when omitted, matching the previous behavior.

### Response

- `app` (App) — The newly created [app object](#the-app-object).
- `files` (array<string>) — Paths of the bootstrapped template files.
- `errors` (array<string>) — Error messages, if any occurred.

**cURL:**

```bash
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/create \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "appName": "Field Inspection Portal",
    "description": "Logs site inspections against the Inspections table.",
    "templateType": "SAAS_APP"
  }'
```

**JavaScript:**

```javascript
const response = await fetch(
  'https://api.autessa.com/autessa_poweruser/custom-apps-v2/create',
  {
    method: 'POST',
    headers: {
      'Authorization': process.env.POWERUSER_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      appName: 'Field Inspection Portal',
      description: 'Logs site inspections against the Inspections table.',
      templateType: 'SAAS_APP'
    })
  }
);

const { app, files } = await response.json();
console.log(app.appId, files.length);
```

**Python:**

```python
import os
import requests

response = requests.post(
    'https://api.autessa.com/autessa_poweruser/custom-apps-v2/create',
    headers={'Authorization': os.environ['POWERUSER_KEY']},
    json={
        'appName': 'Field Inspection Portal',
        'description': 'Logs site inspections against the Inspections table.',
        'templateType': 'SAAS_APP'
    }
)

app = response.json()['app']
```

```json title="Response (truncated)"
{
  "app": {
    "appId": "V1StGXR8Z5",
    "companyId": "cP2mK7dX4v",
    "ownerId": "uB7nT2wQ9k",
    "appName": "Field Inspection Portal",
    "description": "Logs site inspections against the Inspections table.",
    "sharingLevel": "PRIVATE",
    "userAccessLevel": "ADMIN",
    "hostingMode": "DEFAULT",
    "hasAuthCode": false
  },
  "files": [
    "index.html",
    "src/App.jsx",
    "src/main.jsx",
    "src/autessa/autessa-client.js",
    "package.json"
  ],
  "errors": []
}
```

---

## Get an app

**POST** `/custom-apps-v2/get`

Retrieves an app and the file paths in its draft workspace. Calling this
also refreshes the app's `src/autessa/` library files to the current
platform version (same effect as [`/refresh-libraries`](#refresh-libraries)).

### Request parameters

- `appId` (string, required) — The app to fetch.

### Response

- `app` (App) — The [app object](#the-app-object).
- `files` (array<string>) — Paths of every file in the draft workspace.
- `errors` (array<string>) — Error messages, if any occurred.

**cURL:**

```bash
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/get \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "appId": "V1StGXR8Z5" }'
```

**JavaScript:**

```javascript
const response = await fetch(
  'https://api.autessa.com/autessa_poweruser/custom-apps-v2/get',
  {
    method: 'POST',
    headers: {
      'Authorization': process.env.POWERUSER_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ appId: 'V1StGXR8Z5' })
  }
);

const { app, files } = await response.json();
```

**Python:**

```python
import os
import requests

response = requests.post(
    'https://api.autessa.com/autessa_poweruser/custom-apps-v2/get',
    headers={'Authorization': os.environ['POWERUSER_KEY']},
    json={'appId': 'V1StGXR8Z5'}
)

data = response.json()
```

```json title="Response (truncated)"
{
  "app": {
    "appId": "V1StGXR8Z5",
    "appName": "Field Inspection Portal",
    "latestVersion": 5,
    "publishedVersion": 4,
    "userAccessLevel": "ADMIN"
  },
  "files": [
    "index.html",
    "src/App.jsx",
    "src/components/InspectionForm.jsx",
    "src/autessa/autessa-client.js"
  ],
  "errors": []
}
```

---

## List all apps

**POST** `/custom-apps-v2/all`

Lists every app the linked user can access — owned, shared with them
directly, or shared with the company. Each entry is a full
[app object](#the-app-object) with `userAccessLevel` set to the caller's
access on that app.

### Request parameters

None — send an empty object `{}`.

### Response

- `apps` (array<App>) — The accessible apps.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/all \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

```json title="Response (truncated)"
{
  "apps": [
    {
      "appId": "V1StGXR8Z5",
      "appName": "Field Inspection Portal",
      "sharingLevel": "SPECIFIC_MEMBER",
      "publishedVersion": 4,
      "userAccessLevel": "ADMIN",
      "hostingMode": "AUTH_CODE"
    },
    {
      "appId": "aH5cJ1yD7q",
      "appName": "Quote Calculator",
      "sharingLevel": "COMPANY",
      "userAccessLevel": "READ",
      "hostingMode": "DEFAULT"
    }
  ],
  "errors": []
}
```

---

## Update an app

**POST** `/custom-apps-v2/update`

Updates the app's name and description. This endpoint only touches
metadata — edit source code with the [file endpoints](#list-files), and
change sharing or hosting with [`/share`](#share-an-app).

Requires WRITE, PUBLISH, or ADMIN access.

### Request parameters

- `appId` (string, required) — The app to update.
- `appName` (string) — New display name.
- `description` (string) — New description.

### Response

- `app` (App) — The updated [app object](#the-app-object).
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/update \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "appId": "V1StGXR8Z5",
    "appName": "Field Inspection Portal",
    "description": "Logs and reviews site inspections."
  }'
```

```json title="Response (truncated)"
{
  "app": {
    "appId": "V1StGXR8Z5",
    "appName": "Field Inspection Portal",
    "description": "Logs and reviews site inspections.",
    "updatedAt": "2026-07-02T10:15:00"
  },
  "errors": []
}
```

---

## Delete an app

**POST** `/custom-apps-v2/delete`

Permanently deletes the app — its draft workspace, version snapshots, and
build outputs are all removed. This cannot be undone.

Requires ADMIN access on the app.

### Request parameters

- `appId` (string, required) — The app to delete.

### Response

- `success` (boolean) — `true` when the app was deleted.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/delete \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "appId": "V1StGXR8Z5" }'
```

```json title="Response"
{
  "success": true,
  "errors": []
}
```

---

## Clone an app

**POST** `/custom-apps-v2/clone`

Creates a new private app owned by the calling user, copying the source
app's draft files. Version history, sharing settings, and hosting
configuration are **not** copied. Any access level on the source app is
sufficient.

### Request parameters

- `appId` (string, required) — The source app to clone.
- `appName` (string) — Name for the clone. Defaults to the source name with `" (Copy)"` appended.

### Response

Same shape as [`/create`](#create-an-app):

- `app` (App) — The new [app object](#the-app-object) (private, owned by the caller).
- `files` (array<string>) — Paths of the copied draft files.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/clone \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "appId": "V1StGXR8Z5",
    "appName": "Field Inspection Portal (Staging)"
  }'
```

```json title="Response (truncated)"
{
  "app": {
    "appId": "nW2yE9gK4t",
    "appName": "Field Inspection Portal (Staging)",
    "sharingLevel": "PRIVATE",
    "userAccessLevel": "ADMIN",
    "hostingMode": "DEFAULT"
  },
  "files": [
    "index.html",
    "src/App.jsx",
    "src/components/InspectionForm.jsx"
  ],
  "errors": []
}
```

---

## Publish an app

**POST** `/custom-apps-v2/publish`

Snapshots the draft workspace as a new numbered version and triggers an
asynchronous build. The response returns immediately with
`buildStatus: "BUILDING"` — poll [`/build-status`](#get-build-status) to follow
the build. The version only goes live once its build succeeds.

Requires PUBLISH or ADMIN access.

### Request parameters

- `appId` (string, required) — The app to publish.

### Response

- `app` (App) — The [app object](#the-app-object).
- `version` (integer) — The new version number.
- `buildId` (string) — Identifier of the triggered build.
- `buildStatus` (string) — Always `"BUILDING"` on a successful publish.
- `errors` (array<string>) — Error messages, if any occurred (for example a failed build trigger — the version is rolled back in that case).

**cURL:**

```bash
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/publish \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "appId": "V1StGXR8Z5" }'
```

**JavaScript:**

```javascript
const base = 'https://api.autessa.com/autessa_poweruser/custom-apps-v2';
const headers = {
  'Authorization': process.env.POWERUSER_KEY,
  'Content-Type': 'application/json'
};

const publish = await fetch(`${base}/publish`, {
  method: 'POST',
  headers,
  body: JSON.stringify({ appId: 'V1StGXR8Z5' })
});
const { version } = await publish.json();

// Poll until the build finishes
let status;
do {
  await new Promise((r) => setTimeout(r, 5000));
  const check = await fetch(`${base}/build-status`, {
    method: 'POST',
    headers,
    body: JSON.stringify({ appId: 'V1StGXR8Z5', version })
  });
  status = await check.json();
} while (status.status === 'BUILDING');

console.log(status.status, status.outputUrl);
```

**Python:**

```python
import os
import time
import requests

base = 'https://api.autessa.com/autessa_poweruser/custom-apps-v2'
headers = {'Authorization': os.environ['POWERUSER_KEY']}

version = requests.post(f'{base}/publish', headers=headers,
                        json={'appId': 'V1StGXR8Z5'}).json()['version']

while True:
    time.sleep(5)
    status = requests.post(f'{base}/build-status', headers=headers,
                           json={'appId': 'V1StGXR8Z5', 'version': version}).json()
    if status['status'] != 'BUILDING':
        break

print(status['status'])
```

```json title="Response (truncated)"
{
  "app": {
    "appId": "V1StGXR8Z5",
    "appName": "Field Inspection Portal",
    "latestVersion": 5,
    "publishedVersion": 4
  },
  "version": 6,
  "buildId": "3f6c1a9e-8b2d-4e07-9c41-5a12de88f0b3",
  "buildStatus": "BUILDING",
  "errors": []
}
```

---

## Get build status

**POST** `/custom-apps-v2/build-status`

Returns the build state of a version. Omit `version` to check the latest
one. When the latest version's build first reports `SUCCESS`, this call
also marks the version as `PUBLISHED` and invalidates the CDN cache so the
new build is served.

### Request parameters

- `appId` (string, required) — The app to check.
- `version` (integer) — Version to check. Defaults to the latest version.

### Response

- `version` (integer) — The version that was checked. Absent when the app has no versions yet.
- `buildId` (string) — Identifier of the build, when available.
- `status` (string) — `BUILDING`, `SUCCESS`, `FAILED`, or `NOT_STARTED`.
- `error` (string) — Build error output, when `status` is `FAILED`.
- `startedAt` (string) — When the build started.
- `completedAt` (string) — When the build finished.
- `outputUrl` (string) — URL of the published app, present when `status` is `SUCCESS`.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/build-status \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "appId": "V1StGXR8Z5", "version": 6 }'
```

```json title="Response"
{
  "version": 6,
  "status": "SUCCESS",
  "startedAt": "2026-07-02T10:20:04",
  "completedAt": "2026-07-02T10:21:37",
  "outputUrl": "https://apps.autessa.com/custom-apps-v2/.../published/index.html",
  "errors": []
}
```

---

## List versions

**POST** `/custom-apps-v2/versions`

Lists all versions of the app, newest first, with each version's state and
current build status.

### Request parameters

- `appId` (string, required) — The app to inspect.

### Response

- `versions` (array<Version>) — Version records, newest first.
- `versions[].versionId` (string) — Unique version identifier.
- `versions[].version` (integer) — The version number.
- `versions[].state` (string) — `DRAFT`, `PUBLISHED`, or `ARCHIVED`.
- `versions[].buildId` (string) — Identifier of the version's build.
- `versions[].buildStatus` (string) — `BUILDING`, `SUCCESS`, `FAILED`, or `NOT_STARTED`.
- `versions[].sourceS3Path` (string) — Storage path of the version's source snapshot.
- `versions[].buildS3Path` (string) — Storage path of the build output, when built.
- `versions[].createdAt` (string) — ISO-8601 creation timestamp.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/versions \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "appId": "V1StGXR8Z5" }'
```

```json title="Response (truncated)"
{
  "versions": [
    {
      "versionId": "vJ8pL4sB6m",
      "version": 6,
      "state": "PUBLISHED",
      "buildId": "3f6c1a9e-8b2d-4e07-9c41-5a12de88f0b3",
      "buildStatus": "SUCCESS",
      "sourceS3Path": "custom-apps-v2/.../versions/6/source/",
      "buildS3Path": "custom-apps-v2/.../versions/6/build/",
      "createdAt": "2026-07-02T10:19:58"
    },
    {
      "versionId": "vC3xR7hN1z",
      "version": 5,
      "state": "ARCHIVED",
      "buildStatus": "SUCCESS",
      "createdAt": "2026-06-28T17:40:12"
    }
  ],
  "errors": []
}
```

---

## Get build files

**POST** `/custom-apps-v2/build-files`

Lists the compiled output files of a build, each with a presigned download
URL. Omit `version` to read the latest published build; pass a `version` to
read a specific one (fails with an error if that version's build did not
succeed).

### Request parameters

- `appId` (string, required) — The app whose build to read.
- `version` (integer) — Version whose build output to list. Defaults to the latest published version.

### Response

- `version` (integer) — The version that was read.
- `files` (array<BuildFile>) — Build output files. Each has `path` (relative to the build root), `url` (a presigned download URL), `contentType`, and optionally `size` in bytes.
- `expiresInSeconds` (integer) — How long the presigned URLs stay valid (currently one hour).
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/build-files \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "appId": "V1StGXR8Z5" }'
```

```json title="Response (truncated)"
{
  "version": 6,
  "files": [
    {
      "path": "index.html",
      "url": "https://s3.amazonaws.com/...&X-Amz-Expires=3600",
      "contentType": "text/html"
    },
    {
      "path": "assets/index-Bx91k2.js",
      "url": "https://s3.amazonaws.com/...&X-Amz-Expires=3600",
      "contentType": "application/javascript"
    }
  ],
  "expiresInSeconds": 3600,
  "errors": []
}
```

---

## Get a preview URL

**POST** `/custom-apps-v2/build-url`

Returns a signed URL for opening the latest published build in a browser.
The URL carries a short-lived token that the CDN validates before serving
the app. Fails with an error if the app has no published version.

### Request parameters

- `appId` (string, required) — The app to open.

### Response

- `previewUrl` (string) — Signed URL that loads the published app.
- `expiresAt` (integer) — Unix epoch seconds when the URL stops being accepted.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/build-url \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "appId": "V1StGXR8Z5" }'
```

```json title="Response"
{
  "previewUrl": "https://apps.autessa.com/auth?token=...&redirect=/custom-apps-v2/.../published/index.html",
  "expiresAt": 1783420800,
  "errors": []
}
```

---

## List files

**POST** `/custom-apps-v2/files/list`

Lists every file path in the app's draft workspace, plus the paths of the
platform-managed Autessa library files (under `src/autessa/`). Library
files are refreshed to the current platform version by this call and are
read-only — writes to them are managed by the platform, not the file
endpoints.

### Request parameters

- `appId` (string, required) — The app whose files to list.

### Response

- `files` (array<string>) — All file paths in the draft workspace.
- `readOnlyFiles` (array<string>) — Paths of the platform-managed Autessa library files.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/files/list \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "appId": "V1StGXR8Z5" }'
```

```json title="Response"
{
  "files": [
    "index.html",
    "src/App.jsx",
    "src/components/InspectionForm.jsx",
    "src/autessa/autessa-client.js"
  ],
  "readOnlyFiles": [
    "src/autessa/autessa-client.js"
  ],
  "errors": []
}
```

---

## Get a file

**POST** `/custom-apps-v2/files/get`

Reads one file's content from the draft workspace.

### Request parameters

- `appId` (string, required) — The app the file belongs to.
- `filePath` (string, required) — Path of the file to read (as returned by [`/files/list`](#list-files)).

### Response

- `filePath` (string) — The requested path.
- `content` (string) — The file's content.
- `errors` (array<string>) — Error messages, if any occurred (for example `"File not found"`).

**cURL:**

```bash
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/files/get \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "appId": "V1StGXR8Z5",
    "filePath": "src/App.jsx"
  }'
```

**JavaScript:**

```javascript
const response = await fetch(
  'https://api.autessa.com/autessa_poweruser/custom-apps-v2/files/get',
  {
    method: 'POST',
    headers: {
      'Authorization': process.env.POWERUSER_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ appId: 'V1StGXR8Z5', filePath: 'src/App.jsx' })
  }
);

const { content } = await response.json();
```

**Python:**

```python
import os
import requests

response = requests.post(
    'https://api.autessa.com/autessa_poweruser/custom-apps-v2/files/get',
    headers={'Authorization': os.environ['POWERUSER_KEY']},
    json={'appId': 'V1StGXR8Z5', 'filePath': 'src/App.jsx'}
)

content = response.json()['content']
```

```json title="Response"
{
  "filePath": "src/App.jsx",
  "content": "import React from 'react';\n\nexport default function App() { ... }",
  "errors": []
}
```

---

## Get files in batch

**POST** `/custom-apps-v2/files/get-batch`

Reads several files in one call.

### Request parameters

- `appId` (string, required) — The app the files belong to.
- `filePaths` (array<string>, required) — Paths of the files to read.

### Response

- `files` (object) — Map of file path to content.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/files/get-batch \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "appId": "V1StGXR8Z5",
    "filePaths": ["src/App.jsx", "index.html"]
  }'
```

```json title="Response"
{
  "files": {
    "src/App.jsx": "import React from 'react'; ...",
    "index.html": "<!doctype html> ..."
  },
  "errors": []
}
```

---

## Create a file

**POST** `/custom-apps-v2/files/create`

Writes a new file into the draft workspace. If the path already exists its
content is replaced — `files/create` and [`/files/update`](#update-a-file)
behave identically.

Requires WRITE, PUBLISH, or ADMIN access.

### Request parameters

- `appId` (string, required) — The app to write into.
- `filePath` (string, required) — Path of the file to create.
- `content` (string, required) — The file's content.

### Response

- `success` (boolean) — `true` when the file was written.
- `filePath` (string) — The written path.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/files/create \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "appId": "V1StGXR8Z5",
    "filePath": "src/components/StatusBadge.jsx",
    "content": "export default function StatusBadge({ status }) { ... }"
  }'
```

```json title="Response"
{
  "success": true,
  "filePath": "src/components/StatusBadge.jsx",
  "errors": []
}
```

---

## Update a file

**POST** `/custom-apps-v2/files/update`

Replaces a file's content in the draft workspace. Draft edits never affect
published versions until you [`/publish`](#publish-an-app).

Requires WRITE, PUBLISH, or ADMIN access.

### Request parameters

- `appId` (string, required) — The app to write into.
- `filePath` (string, required) — Path of the file to update.
- `content` (string, required) — The new content.

### Response

- `success` (boolean) — `true` when the file was written.
- `filePath` (string) — The written path.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/files/update \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "appId": "V1StGXR8Z5",
    "filePath": "src/App.jsx",
    "content": "import React from 'react'; // updated ..."
  }'
```

```json title="Response"
{
  "success": true,
  "filePath": "src/App.jsx",
  "errors": []
}
```

---

## Delete a file

**POST** `/custom-apps-v2/files/delete`

Removes a file from the draft workspace.

Requires WRITE, PUBLISH, or ADMIN access.

### Request parameters

- `appId` (string, required) — The app the file belongs to.
- `filePath` (string, required) — Path of the file to delete.

### Response

- `success` (boolean) — `true` when the file was deleted.
- `filePath` (string) — The deleted path.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/files/delete \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "appId": "V1StGXR8Z5",
    "filePath": "src/components/StatusBadge.jsx"
  }'
```

```json title="Response"
{
  "success": true,
  "filePath": "src/components/StatusBadge.jsx",
  "errors": []
}
```

---

## Rename a file

**POST** `/custom-apps-v2/files/rename`

Moves a file to a new path in the draft workspace.

Requires WRITE, PUBLISH, or ADMIN access.

### Request parameters

- `appId` (string, required) — The app the file belongs to.
- `oldPath` (string, required) — Current path of the file.
- `newPath` (string, required) — New path for the file.

### Response

- `success` (boolean) — `true` when the file was renamed.
- `filePath` (string) — The file's new path.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/files/rename \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "appId": "V1StGXR8Z5",
    "oldPath": "src/Badge.jsx",
    "newPath": "src/components/Badge.jsx"
  }'
```

```json title="Response"
{
  "success": true,
  "filePath": "src/components/Badge.jsx",
  "errors": []
}
```

---

## Save files in batch

**POST** `/custom-apps-v2/files/save-batch`

Writes several files in one call — the batch equivalent of
[`/files/create`](#create-a-file) / [`/files/update`](#update-a-file). Existing
paths are overwritten, new paths are created.

Requires WRITE, PUBLISH, or ADMIN access.

### Request parameters

- `appId` (string, required) — The app to write into.
- `files` (object, required) — Map of file path to content.

### Response

- `savedPaths` (array<string>) — Paths that were written.
- `errors` (array<string>) — Error messages, if any occurred.

**cURL:**

```bash
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/files/save-batch \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "appId": "V1StGXR8Z5",
    "files": {
      "src/App.jsx": "import React from ...",
      "src/api.js": "export async function listInspections() { ... }"
    }
  }'
```

**JavaScript:**

```javascript
const response = await fetch(
  'https://api.autessa.com/autessa_poweruser/custom-apps-v2/files/save-batch',
  {
    method: 'POST',
    headers: {
      'Authorization': process.env.POWERUSER_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      appId: 'V1StGXR8Z5',
      files: {
        'src/App.jsx': 'import React from ...',
        'src/api.js': 'export async function listInspections() { ... }'
      }
    })
  }
);

const { savedPaths } = await response.json();
```

**Python:**

```python
import os
import requests

response = requests.post(
    'https://api.autessa.com/autessa_poweruser/custom-apps-v2/files/save-batch',
    headers={'Authorization': os.environ['POWERUSER_KEY']},
    json={
        'appId': 'V1StGXR8Z5',
        'files': {
            'src/App.jsx': 'import React from ...',
            'src/api.js': 'export async function listInspections() { ... }'
        }
    }
)

saved = response.json()['savedPaths']
```

```json title="Response"
{
  "savedPaths": ["src/App.jsx", "src/api.js"],
  "errors": []
}
```

---

## Refresh libraries

**POST** `/custom-apps-v2/refresh-libraries`

Rewrites the app's `src/autessa/` library files with the current platform
versions and removes legacy copies from old locations. This also happens
automatically on [`/get`](#get-an-app) and [`/files/list`](#list-files) — call
it explicitly when you want to force a refresh without another read.

### Request parameters

- `appId` (string, required) — The app whose libraries to refresh.

### Response

- `refreshedFiles` (array<string>) — Paths of the library files that were rewritten.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/refresh-libraries \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "appId": "V1StGXR8Z5" }'
```

```json title="Response"
{
  "refreshedFiles": [
    "src/autessa/autessa-client.js"
  ],
  "errors": []
}
```

---

## Share an app

**POST** `/custom-apps-v2/share`

Configures two independent things in one call: **code sharing** (which
company members can see and edit the source) and **hosting mode** (how end
users access the deployed app). Send only the parts you want to change —
fields left out are untouched.

Non-default hosting modes (`PUBLIC`, `AUTH_CODE`, `CUSTOM_AUTH`, `TOKEN`) require a
valid, available `publicSlug` — check it first with
[`/check-slug`](#check-slug-availability). Switching to `CUSTOM_AUTH` provisions an
AutessaDB auth table for the app's end users; this is idempotent, so
re-enabling `CUSTOM_AUTH` reuses the existing table and keeps signed-up
users. Set `requireEmailVerification` to make new signups confirm an emailed
code before the account is created, and `enabledProviders` to choose between
email and password, Google, and Microsoft sign-in. Switching to `TOKEN`
provisions a separate AutessaDB table for the people who get access links;
switching modes never deletes either table. Access links themselves are
managed in the App Builder. An `AUTH_CODE` code is stored hashed and never
returned.

Requires ADMIN access on the app.

> This endpoint changes the same sharing as the [Share dialog](/docs/guide/platform/sharing.md). Sharing with `COMPANY` adds a company-wide grant and keeps everyone already shared individually at their own level. People get the highest level from any grant that covers them.

### Request parameters

- `appId` (string, required) — The app to configure.
- `sharingLevel` (string) — Code sharing level: `PRIVATE`, `SPECIFIC_MEMBER`, or `COMPANY`.
- `companyPermissionLevel` (string) — When `sharingLevel` is `COMPANY`, the access level every member gets: `READ`, `WRITE`, `PUBLISH`, or `ADMIN`.
- `usersToAdd` (array<UserShare>) — When `sharingLevel` is `SPECIFIC_MEMBER`, users to grant access. Each entry: `userId` (string), optional `userEmail`, and `accessLevel`.
- `usersToRemove` (array<UserShare>) — Users whose access to revoke, same entry shape.
- `hostingMode` (string) — `DEFAULT`, `PUBLIC`, `AUTH_CODE`, `CUSTOM_AUTH`, or `TOKEN`.
- `authCode` (string) — The shared access code, when `hostingMode` is `AUTH_CODE`. Stored hashed.
- `publicSlug` (string) — URL slug for non-default hosting modes. Must be valid and available.
- `hostingPermissions` (object) — Which company resources the hosted app may call on behalf of end users: `tables` (array of `tableId` + `canRead`/`canWrite`/`canDelete`), `agentIds`, `toolIds`, `managerIds` (arrays of ID strings), `allowedPoweruserEndpoints` (array of values from the [endpoint allowlist](#list-poweruser-endpoint-options); anything else is refused with `400`), `envelopes` (array of `envelopeId` + `level`), `esignatureActsAsUser` (boolean), and `paymentsEnabled` (boolean, default `false`): lets end users subscribe and pay in the app through Autessa Payments. It's kept only when you have access to Payments and your company has set it up; otherwise it's dropped with "Set up Payments before turning it on for an app." Everything listed is checked against your own access, and saving makes you the app's `permissionsGrantedBy`. See [Who an app acts as](#who-an-app-acts-as).
- `authTableName` (string) — Name for the AutessaDB auth table provisioned for `CUSTOM_AUTH`.
- `authPageConfig` (string) — JSON string with auth page theming for `CUSTOM_AUTH`. May also be sent on its own, without a `hostingMode` change.
- `requireEmailVerification` (boolean) — For `CUSTOM_AUTH`: require new signups to confirm a code emailed to their address before the account is created. Defaults to `false`. May be sent on its own, without a `hostingMode` change. Omit to leave the current setting alone. Accounts that already exist are unaffected when this is switched on.
- `enabledProviders` (array<string>) — For `CUSTOM_AUTH`: the sign-in methods to offer, any of `PASSWORD`, `GOOGLE`, and `MICROSOFT`. Must name at least one. Omit to leave the current methods alone. New apps offer `PASSWORD` only.

### Response

- `sharingLevel` (string) — The resulting code sharing level.
- `companyPermissionLevel` (string) — The resulting company-wide access level, when shared with the company.
- `hostingMode` (string) — The resulting hosting mode.
- `sharedUsers` (array<UserShare>) — The resulting per-user grants: `userEmail`, `userId`, `accessLevel`.
- `errors` (array<string>) — Error messages, if any occurred (for example `"publicSlug is already taken"`).

**cURL:**

```bash
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/share \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "appId": "V1StGXR8Z5",
    "sharingLevel": "SPECIFIC_MEMBER",
    "usersToAdd": [
      { "userId": "uB7nT2wQ9k", "accessLevel": "WRITE" }
    ],
    "hostingMode": "AUTH_CODE",
    "authCode": "site-crew-2026",
    "publicSlug": "field-inspections",
    "hostingPermissions": {
      "tables": [
        { "tableId": "tQ6bF3jN8s", "canRead": true, "canWrite": true, "canDelete": false }
      ],
      "agentIds": ["gD4vM8kP1c"],
      "esignatureActsAsUser": false
    }
  }'
```

**JavaScript:**

```javascript
const response = await fetch(
  'https://api.autessa.com/autessa_poweruser/custom-apps-v2/share',
  {
    method: 'POST',
    headers: {
      'Authorization': process.env.POWERUSER_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      appId: 'V1StGXR8Z5',
      sharingLevel: 'SPECIFIC_MEMBER',
      usersToAdd: [{ userId: 'uB7nT2wQ9k', accessLevel: 'WRITE' }],
      hostingMode: 'AUTH_CODE',
      authCode: 'site-crew-2026',
      publicSlug: 'field-inspections'
    })
  }
);

const { hostingMode, sharedUsers } = await response.json();
```

**Python:**

```python
import os
import requests

response = requests.post(
    'https://api.autessa.com/autessa_poweruser/custom-apps-v2/share',
    headers={'Authorization': os.environ['POWERUSER_KEY']},
    json={
        'appId': 'V1StGXR8Z5',
        'sharingLevel': 'SPECIFIC_MEMBER',
        'usersToAdd': [{'userId': 'uB7nT2wQ9k', 'accessLevel': 'WRITE'}],
        'hostingMode': 'AUTH_CODE',
        'authCode': 'site-crew-2026',
        'publicSlug': 'field-inspections'
    }
)

data = response.json()
```

```json title="Response"
{
  "sharingLevel": "SPECIFIC_MEMBER",
  "hostingMode": "AUTH_CODE",
  "sharedUsers": [
    {
      "userEmail": "sam@acme.com",
      "userId": "uB7nT2wQ9k",
      "accessLevel": "WRITE"
    }
  ],
  "errors": []
}
```

---

## List poweruser endpoint options

**GET** `/custom-apps-v2/poweruser-endpoint-options`

Returns the poweruser endpoints a hosted app may be given in
`hostingPermissions.allowedPoweruserEndpoints`. Endpoints that manage keys,
sharing, roles, members, app permissions, or billing are never on the list.
This is a `GET` with no body.

Apps that were already given envelope creation (`ESIGNATURE_ENVELOPE_CREATE`)
or upload links (`ESIGNATURE_GENERATE_FILE_UPLOAD_LINK`) before this list
existed keep them; they can't be added to other apps.

### Response

- `options` (array<object>) — Each entry has `value` (what to put in `allowedPoweruserEndpoints`), `label`, and `description`.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/poweruser-endpoint-options \
  -H "Authorization: $POWERUSER_KEY"
```

---

## Check slug availability

**POST** `/custom-apps-v2/check-slug`

Checks whether a public slug is valid and free before you commit to it in
[`/share`](#share-an-app). Pass `appId` so the app's own current slug counts
as available. A race with another caller can still lose the slug between
check and share — [`/share`](#share-an-app) re-validates and returns
`"publicSlug is already taken"` in that case.

### Request parameters

- `publicSlug` (string, required) — The slug to check.
- `appId` (string) — The app the slug is intended for; excludes that app's existing slug from the availability check.

### Response

- `available` (boolean) — Whether the slug can be used.
- `reason` (string) — When `available` is `false`: `"empty"`, `"invalid_format"`, or `"taken"`.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/check-slug \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "appId": "V1StGXR8Z5",
    "publicSlug": "field-inspections"
  }'
```

```json title="Response"
{
  "available": true,
  "errors": []
}
```

---

## Transfer ownership

**POST** `/custom-apps-v2/transfer-ownership`

Transfers the app to another member of the company.

The app's permissions are checked against the new owner. If they cover
everything, the new owner becomes `permissionsGrantedBy`; if not, the app
is flagged `permissionsNeedResave` until someone with enough access saves
its permissions again.

Requires ADMIN access on the app.

### Request parameters

- `appId` (string, required) — The app to transfer.
- `newOwnerId` (string, required) — User ID of the new owner.

### Response

- `app` (App) — The updated [app object](#the-app-object) with the new `ownerId`.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/transfer-ownership \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "appId": "V1StGXR8Z5",
    "newOwnerId": "uB7nT2wQ9k"
  }'
```

```json title="Response (truncated)"
{
  "app": {
    "appId": "V1StGXR8Z5",
    "ownerId": "uB7nT2wQ9k",
    "appName": "Field Inspection Portal"
  },
  "errors": []
}
```

---

## Get sharing details

**POST** `/custom-apps-v2/get-sharing-details`

Returns the app's code sharing configuration, hosting mode, and the calling
user's own access level.

### Request parameters

- `appId` (string, required) — The app to inspect.

### Response

- `sharingLevel` (string) — `PRIVATE`, `SPECIFIC_MEMBER`, or `COMPANY`.
- `companyPermissionLevel` (string) — Access level granted company-wide, when `sharingLevel` is `COMPANY`.
- `hostingMode` (string) — `DEFAULT`, `PUBLIC`, `AUTH_CODE`, or `CUSTOM_AUTH`.
- `sharedWith` (array<UserShare>) — Per-user grants: `userEmail`, `userId`, `accessLevel`.
- `userAccessLevel` (string) — The calling user's effective access level.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/get-sharing-details \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "appId": "V1StGXR8Z5" }'
```

```json title="Response"
{
  "sharingLevel": "SPECIFIC_MEMBER",
  "hostingMode": "AUTH_CODE",
  "sharedWith": [
    {
      "userEmail": "sam@acme.com",
      "userId": "uB7nT2wQ9k",
      "accessLevel": "WRITE"
    }
  ],
  "userAccessLevel": "ADMIN",
  "errors": []
}
```

---

## List Vibecode sessions

**POST** `/custom-apps-v2/vibecode/sessions`

Lists the calling user's Vibecode AI assistant sessions for an app, newest
first, capped at the 10 most recent. The interactive Vibecode chat itself
is UI-only (a WebSocket in the App Builder) and is not exposed through the
Poweruser API — these endpoints are read-only session history.

By default only open sessions are returned; set `includeClosed` to also see
finished ones.

### Request parameters

- `appId` (string, required) — The app whose sessions to list.
- `includeClosed` (boolean) — Also include `CLOSED` sessions. Defaults to `false` (active sessions only).

### Response

- `sessions` (array<VibecodeSession>) — Session records, newest first (max 10).
- `sessions[].conversationId` (string) — Session identifier — pass to [`/vibecode/session`](#get-a-vibecode-session).
- `sessions[].appId` (string) — The app the session belongs to.
- `sessions[].state` (string) — `ACTIVE`, `PENDING_CONFIRMATION` (the AI proposed changes awaiting user confirmation), or `CLOSED`.
- `sessions[].createdAt` (string) — ISO-8601 creation timestamp.
- `sessions[].updatedAt` (string) — ISO-8601 timestamp of the last activity.
- `sessions[].closedAt` (string) — When the session was closed, if it was.
- `sessions[].summary` (string) — Short AI-generated summary, set when the session closes.
- `errors` (array<string>) — Error messages, if any occurred.

**cURL:**

```bash
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/vibecode/sessions \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "appId": "V1StGXR8Z5", "includeClosed": true }'
```

**JavaScript:**

```javascript
const response = await fetch(
  'https://api.autessa.com/autessa_poweruser/custom-apps-v2/vibecode/sessions',
  {
    method: 'POST',
    headers: {
      'Authorization': process.env.POWERUSER_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ appId: 'V1StGXR8Z5', includeClosed: true })
  }
);

const { sessions } = await response.json();
```

**Python:**

```python
import os
import requests

response = requests.post(
    'https://api.autessa.com/autessa_poweruser/custom-apps-v2/vibecode/sessions',
    headers={'Authorization': os.environ['POWERUSER_KEY']},
    json={'appId': 'V1StGXR8Z5', 'includeClosed': True}
)

sessions = response.json()['sessions']
```

```json title="Response"
{
  "sessions": [
    {
      "conversationId": "vibe_9f2c7a1d4e",
      "appId": "V1StGXR8Z5",
      "state": "CLOSED",
      "createdAt": "2026-06-30T14:02:11",
      "updatedAt": "2026-06-30T14:38:47",
      "closedAt": "2026-06-30T14:38:47",
      "summary": "Added inspection photo upload form"
    }
  ],
  "errors": []
}
```

---

## Get a Vibecode session

**POST** `/custom-apps-v2/vibecode/session`

Fetches one Vibecode session with its full conversation log — user
messages, assistant replies, and every tool call the assistant made against
the app's files. Sessions are personal: only the user who ran the session
can read it, even if others have access to the app.

### Request parameters

- `conversationId` (string, required) — The session to fetch (from [`/vibecode/sessions`](#list-vibecode-sessions)).

### Response

- `session` (VibecodeSession) — The session record, same shape as entries in [`/vibecode/sessions`](#list-vibecode-sessions).
- `logs` (array<VibecodeLog>) — The conversation log, in order.
- `logs[].logType` (string) — `USER_MESSAGE`, `ASSISTANT_MESSAGE`, `TOOL_CALL`, `TOOL_RESULT`, or `SYSTEM`.
- `logs[].content` (string) — Message text, for user and assistant entries.
- `logs[].toolName` (string) — Tool name, for `TOOL_CALL` and `TOOL_RESULT` entries.
- `logs[].toolCallId` (string) — Matches a `TOOL_CALL` to its `TOOL_RESULT`.
- `logs[].toolArguments` (string) — Tool arguments as a JSON string, for `TOOL_CALL` entries.
- `logs[].toolResult` (string) — The tool's result, for `TOOL_RESULT` entries.
- `logs[].timestamp` (string) — ISO-8601 timestamp of the entry.
- `errors` (array<string>) — Error messages, if any occurred (for example `"Conversation not found"` or `"Access denied"`).

**cURL:**

```bash
curl https://api.autessa.com/autessa_poweruser/custom-apps-v2/vibecode/session \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "conversationId": "vibe_9f2c7a1d4e" }'
```

**JavaScript:**

```javascript
const response = await fetch(
  'https://api.autessa.com/autessa_poweruser/custom-apps-v2/vibecode/session',
  {
    method: 'POST',
    headers: {
      'Authorization': process.env.POWERUSER_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ conversationId: 'vibe_9f2c7a1d4e' })
  }
);

const { session, logs } = await response.json();
```

**Python:**

```python
import os
import requests

response = requests.post(
    'https://api.autessa.com/autessa_poweruser/custom-apps-v2/vibecode/session',
    headers={'Authorization': os.environ['POWERUSER_KEY']},
    json={'conversationId': 'vibe_9f2c7a1d4e'}
)

logs = response.json()['logs']
```

```json title="Response (truncated)"
{
  "session": {
    "conversationId": "vibe_9f2c7a1d4e",
    "appId": "V1StGXR8Z5",
    "state": "CLOSED",
    "summary": "Added inspection photo upload form"
  },
  "logs": [
    {
      "logType": "USER_MESSAGE",
      "content": "Add a photo upload to the inspection form.",
      "timestamp": "2026-06-30T14:02:15"
    },
    {
      "logType": "TOOL_CALL",
      "toolName": "write_file",
      "toolCallId": "call_01",
      "toolArguments": "{\"filePath\":\"src/components/PhotoUpload.jsx\", ...}",
      "timestamp": "2026-06-30T14:02:44"
    },
    {
      "logType": "TOOL_RESULT",
      "toolName": "write_file",
      "toolCallId": "call_01",
      "toolResult": "File written",
      "timestamp": "2026-06-30T14:02:45"
    },
    {
      "logType": "ASSISTANT_MESSAGE",
      "content": "Done — I added a PhotoUpload component and wired it into the form.",
      "timestamp": "2026-06-30T14:03:02"
    }
  ],
  "errors": []
}
```

---

## Errors

| Status | When |
|--------|------|
| `200` | Success — check `errors` for validation and access messages (`"No access to this app"`, `"Only admin can delete apps"`, `"File not found"`, `"publicSlug is already taken"`, `"No published version available"`, `"Conversation not found"`). |
| `400` | Hosting permissions you can't give, named by resource (for example "You only see some rows of “Tickets”, so visitors can't be given it — ask a table admin, or give the app a role."), or an endpoint that isn't on the [allowlist](#list-poweruser-endpoint-options). |
| `401` | Invalid or missing poweruser key. |
| `403` | Scoped key without the endpoint in its allow-list. |
| `408` | Server-side error; `errors` contains the message. |

Access-level denials come back as messages in `errors` on a `200` response
rather than as HTTP-level failures — see the
[access table](#build-lifecycle-and-access-levels) for what each endpoint
requires.

---

## Related

- [Poweruser API overview](/docs/api/poweruser.md)
- [Agents (Poweruser API)](/docs/api/poweruser/agents.md)
- [App Builder guide](/docs/guide/platform/app-builder.md)
- [Vibecode guide](/docs/guide/autobots/vibecode.md)

