# Apps

> Nexus Apps: an app you deploy from a folder, hosted on Vercel in Nexus's own team (Vercel for Platforms, one Vercel project per app). Nobody needs a Vercel account. Nexus pays Vercel for every app on its team, so an organization holds at most `NEXUS_APPS_MAX_PER_TENANT` apps (10 by default); a claim link moves an app's project to your own Vercel account, where it stops costing Nexus. Each app shows what Vercel billed for it, from Vercel's daily charges. An app is its deployer's, and the organization's owners and admins reach every app; to anyone else it does not exist. Off unless the Gateway sets `NEXUS_APPS_ENABLED=true`: then every route answers 404 `apps_off`, and these routes are left out of GET /v1/openapi.json. On, without `VERCEL_TOKEN` and `VERCEL_TEAM_ID`, every route answers 503 `apps_unavailable`.

## List apps

`GET /v1/apps`

Your apps, or every app of your organization for an owner or admin, by name, each with what Vercel billed for it.

Permission: `apps.use` (Every member).

### Responses

- `200` OK (application/json, AppList)
  - `apps` (array of App, required)
    - `id` (string, required): `app_…`
    - `name` (string, required) [max length 48; pattern ^[a-z0-9]+(-[a-z0-9]+)*$]
    - `userId` (string, required): The member who deployed it first.
    - `url` (string | null, required): The app's address: its production URL once Vercel assigned it, else its last deployment's own. Null before the first deployment.
    - `state` ("QUEUED" | "INITIALIZING" | "BUILDING" | "READY" | "ERROR" | "CANCELED" | "BLOCKED" | null, required): Vercel's state of the last deployment; null before the first.
    - `framework` (string | null, required): The Vercel framework preset it was deployed with; null for Vercel's own detection.
    - `projectName` (string, required): The Vercel project's name on Nexus's team (`nx-<8 hex>-<name>`).
    - `deployedAt` (string (date-time) | null, required): When the last deployment started.
    - `claimRequestedAt` (string (date-time) | null, required): When a member last asked for a claim link: the project may since be on their own Vercel account.
    - `createdAt` (string (date-time), required)
    - `updatedAt` (string (date-time), required)
    - `costToDate` (string | null, required): What Vercel billed Nexus for this app in all, in USD, as a decimal string (root rule 9); null until a cost pull saw a charge for it. [pattern ^-?[0-9]+\.[0-9]{6}$]
    - `cost30d` (string | null, required): What Vercel billed for it over the last 30 days, in USD, as a decimal string; null until a cost pull saw a charge for it. [pattern ^-?[0-9]+\.[0-9]{6}$]
    - `costUpdatedAt` (string (date-time) | null, required): When the costs were last read from Vercel's charges, which come a day late; null with no cost.
    - `billingError` (string | null, required): An outstanding payment, paused state, or provider correction awaiting credit. Transient errors never pause hosting.
    - `monthlyCapUsd` (string, required): Monthly hosting cap in USD. Defaults to $10.
    - `monthSpendUsd` (string, required): Current UTC month ListCost plus Nexus rate, in USD.
    - `pauseAt` (string | null, required): The earliest cap or payment grace deadline. Null while healthy.
    - `pausedReason` (string | null, required): Cap, card or debt while hosting is paused.
- `403` The caller is not a member of an organization (`member_required`), or the role may not use apps.
- `404` Nexus Apps is off on this Gateway (`apps_off`).
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `503` Nexus Apps has no Vercel token and team on this Gateway (`apps_unavailable`).

### Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 |  | Nexus Apps is off on this Gateway (`apps_off`). |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 503 |  | Nexus Apps has no Vercel token and team on this Gateway (`apps_unavailable`). |

### Example

```sh
curl "$NEXUS_URL/v1/apps" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fapps)

## Deploy app

`POST /v1/apps`

Deploy a folder as your app named `name`: a new app (201) or the next deployment of yours (200). Send every file of the folder, its path relative to the folder and its bytes as standard base64: at most 5000 files and 20 MB decoded (the body at most 30 MB). `framework` is a Vercel framework preset (`nextjs`, `vite`); absent, Vercel detects it. Gateway makes the app's Vercel project on Nexus's team the first time, then deploys the files to production; the answer's `state` is Vercel's (`QUEUED`, `BUILDING`, …) and GET /v1/apps/{id} follows it to `READY` or `ERROR`. A name is the organization's: another member's app of the same name is a 409.

Permission: `apps.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Request body (application/json, required)

- `name` (string, required): The app's name in your organization: lowercase words joined by single dashes. [max length 48; pattern ^[a-z0-9]+(-[a-z0-9]+)*$]
- `framework` (string | null): A Vercel framework preset, such as `nextjs` or `vite`; absent or null, Vercel detects it. [pattern ^[a-z0-9-]{1,40}$]
- `files` (array of object, required) [at most 5000 items]
  - `path` (string, required): The file's path in the app, relative, with `/` between folders. [max length 512]
  - `data` (string, required): The file's bytes, standard base64.

### Responses

- `200` The next deployment of your app (application/json, App)
  - `id` (string, required): `app_…`
  - `name` (string, required) [max length 48; pattern ^[a-z0-9]+(-[a-z0-9]+)*$]
  - `userId` (string, required): The member who deployed it first.
  - `url` (string | null, required): The app's address: its production URL once Vercel assigned it, else its last deployment's own. Null before the first deployment.
  - `state` ("QUEUED" | "INITIALIZING" | "BUILDING" | "READY" | "ERROR" | "CANCELED" | "BLOCKED" | null, required): Vercel's state of the last deployment; null before the first.
  - `framework` (string | null, required): The Vercel framework preset it was deployed with; null for Vercel's own detection.
  - `projectName` (string, required): The Vercel project's name on Nexus's team (`nx-<8 hex>-<name>`).
  - `deployedAt` (string (date-time) | null, required): When the last deployment started.
  - `claimRequestedAt` (string (date-time) | null, required): When a member last asked for a claim link: the project may since be on their own Vercel account.
  - `createdAt` (string (date-time), required)
  - `updatedAt` (string (date-time), required)
  - `costToDate` (string | null, required): What Vercel billed Nexus for this app in all, in USD, as a decimal string (root rule 9); null until a cost pull saw a charge for it. [pattern ^-?[0-9]+\.[0-9]{6}$]
  - `cost30d` (string | null, required): What Vercel billed for it over the last 30 days, in USD, as a decimal string; null until a cost pull saw a charge for it. [pattern ^-?[0-9]+\.[0-9]{6}$]
  - `costUpdatedAt` (string (date-time) | null, required): When the costs were last read from Vercel's charges, which come a day late; null with no cost.
  - `billingError` (string | null, required): An outstanding payment, paused state, or provider correction awaiting credit. Transient errors never pause hosting.
  - `monthlyCapUsd` (string, required): Monthly hosting cap in USD. Defaults to $10.
  - `monthSpendUsd` (string, required): Current UTC month ListCost plus Nexus rate, in USD.
  - `pauseAt` (string | null, required): The earliest cap or payment grace deadline. Null while healthy.
  - `pausedReason` (string | null, required): Cap, card or debt while hosting is paused.
- `201` Created: the app's first deployment is building (application/json, App)
  - `id` (string, required): `app_…`
  - `name` (string, required) [max length 48; pattern ^[a-z0-9]+(-[a-z0-9]+)*$]
  - `userId` (string, required): The member who deployed it first.
  - `url` (string | null, required): The app's address: its production URL once Vercel assigned it, else its last deployment's own. Null before the first deployment.
  - `state` ("QUEUED" | "INITIALIZING" | "BUILDING" | "READY" | "ERROR" | "CANCELED" | "BLOCKED" | null, required): Vercel's state of the last deployment; null before the first.
  - `framework` (string | null, required): The Vercel framework preset it was deployed with; null for Vercel's own detection.
  - `projectName` (string, required): The Vercel project's name on Nexus's team (`nx-<8 hex>-<name>`).
  - `deployedAt` (string (date-time) | null, required): When the last deployment started.
  - `claimRequestedAt` (string (date-time) | null, required): When a member last asked for a claim link: the project may since be on their own Vercel account.
  - `createdAt` (string (date-time), required)
  - `updatedAt` (string (date-time), required)
  - `costToDate` (string | null, required): What Vercel billed Nexus for this app in all, in USD, as a decimal string (root rule 9); null until a cost pull saw a charge for it. [pattern ^-?[0-9]+\.[0-9]{6}$]
  - `cost30d` (string | null, required): What Vercel billed for it over the last 30 days, in USD, as a decimal string; null until a cost pull saw a charge for it. [pattern ^-?[0-9]+\.[0-9]{6}$]
  - `costUpdatedAt` (string (date-time) | null, required): When the costs were last read from Vercel's charges, which come a day late; null with no cost.
  - `billingError` (string | null, required): An outstanding payment, paused state, or provider correction awaiting credit. Transient errors never pause hosting.
  - `monthlyCapUsd` (string, required): Monthly hosting cap in USD. Defaults to $10.
  - `monthSpendUsd` (string, required): Current UTC month ListCost plus Nexus rate, in USD.
  - `pauseAt` (string | null, required): The earliest cap or payment grace deadline. Null while healthy.
  - `pausedReason` (string | null, required): Cap, card or debt while hosting is paused.
- `400` The body is not a deploy: `name` (`invalid_name`), `framework` (`invalid_framework`) or `files` (`invalid_files`: none, too many, a bad or repeated path, or data that is not base64).
- `402` Add a saved card, resolve unpaid hosting, repay credit debt, or raise the app cap (apps_card_required, apps_payment_pending, apps_debt_pending, app_paused).
- `403` The caller is not a member of an organization (`member_required`), or the role may not use apps.
- `404` Nexus Apps is off on this Gateway (`apps_off`).
- `409` Another member of your organization has an app of this name (`app_name_taken`), or the app's Vercel project left Nexus's team (`app_gone`): it was claimed or deleted at Vercel.
- `413` The files are more than 20 MB decoded (`app_too_large`), or the body more than 30 MB.
- `422` Vercel refused the project or the deployment (`vercel_refused`), with Vercel's own message.
- `429` Your organization holds its most apps (`apps_limit`, `NEXUS_APPS_MAX_PER_TENANT`): delete one first. Also the caller's rate limit.
- `502` Vercel failed or did not answer (`vercel_error`); try again.
- `503` Nexus Apps has no Vercel token and team on this Gateway (`apps_unavailable`).

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | The body is not a deploy: `name` (`invalid_name`), `framework` (`invalid_framework`) or `files` (`invalid_files`: none, too many, a bad or repeated path, or data that is not base64). |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 402 | `budget_exceeded` | Add a saved card, resolve unpaid hosting, repay credit debt, or raise the app cap (apps_card_required, apps_payment_pending, apps_debt_pending, app_paused). |
| 403 | `role_required` | Your role does not have this permission |
| 404 |  | Nexus Apps is off on this Gateway (`apps_off`). |
| 409 |  | Another member of your organization has an app of this name (`app_name_taken`), or the app's Vercel project left Nexus's team (`app_gone`): it was claimed or deleted at Vercel. |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 413 |  | The files are more than 20 MB decoded (`app_too_large`), or the body more than 30 MB. |
| 422 |  | Vercel refused the project or the deployment (`vercel_refused`), with Vercel's own message. |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Your organization holds its most apps (`apps_limit`, `NEXUS_APPS_MAX_PER_TENANT`): delete one first. Also the caller's rate limit. |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 502 |  | Vercel failed or did not answer (`vercel_error`); try again. |
| 503 |  | Nexus Apps has no Vercel token and team on this Gateway (`apps_unavailable`). |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/apps" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Platform",
    "files": [
      {
        "path": "<path>",
        "data": "<data>"
      }
    ]
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fapps)

## Get app

`GET /v1/apps/{id}`

One app, with what Vercel billed for it. While its deployment builds, Gateway reads its state from Vercel again; if Vercel does not answer, the last state stands.

Permission: `apps.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The app's id (`app_…`), as POST /v1/apps answered it |

### Responses

- `200` OK (application/json, App)
  - `id` (string, required): `app_…`
  - `name` (string, required) [max length 48; pattern ^[a-z0-9]+(-[a-z0-9]+)*$]
  - `userId` (string, required): The member who deployed it first.
  - `url` (string | null, required): The app's address: its production URL once Vercel assigned it, else its last deployment's own. Null before the first deployment.
  - `state` ("QUEUED" | "INITIALIZING" | "BUILDING" | "READY" | "ERROR" | "CANCELED" | "BLOCKED" | null, required): Vercel's state of the last deployment; null before the first.
  - `framework` (string | null, required): The Vercel framework preset it was deployed with; null for Vercel's own detection.
  - `projectName` (string, required): The Vercel project's name on Nexus's team (`nx-<8 hex>-<name>`).
  - `deployedAt` (string (date-time) | null, required): When the last deployment started.
  - `claimRequestedAt` (string (date-time) | null, required): When a member last asked for a claim link: the project may since be on their own Vercel account.
  - `createdAt` (string (date-time), required)
  - `updatedAt` (string (date-time), required)
  - `costToDate` (string | null, required): What Vercel billed Nexus for this app in all, in USD, as a decimal string (root rule 9); null until a cost pull saw a charge for it. [pattern ^-?[0-9]+\.[0-9]{6}$]
  - `cost30d` (string | null, required): What Vercel billed for it over the last 30 days, in USD, as a decimal string; null until a cost pull saw a charge for it. [pattern ^-?[0-9]+\.[0-9]{6}$]
  - `costUpdatedAt` (string (date-time) | null, required): When the costs were last read from Vercel's charges, which come a day late; null with no cost.
  - `billingError` (string | null, required): An outstanding payment, paused state, or provider correction awaiting credit. Transient errors never pause hosting.
  - `monthlyCapUsd` (string, required): Monthly hosting cap in USD. Defaults to $10.
  - `monthSpendUsd` (string, required): Current UTC month ListCost plus Nexus rate, in USD.
  - `pauseAt` (string | null, required): The earliest cap or payment grace deadline. Null while healthy.
  - `pausedReason` (string | null, required): Cap, card or debt while hosting is paused.
- `403` The caller is not a member of an organization (`member_required`), or the role may not use apps.
- `404` Nexus Apps is off on this Gateway (`apps_off`), or no such app reaches you: another member's and another organization's are as absent as a missing one.
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `503` Nexus Apps has no Vercel token and team on this Gateway (`apps_unavailable`).

### Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | Nexus Apps is off on this Gateway (`apps_off`), or no such app reaches you: another member's and another organization's are as absent as a missing one. |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 503 |  | Nexus Apps has no Vercel token and team on this Gateway (`apps_unavailable`). |

### Example

```sh
curl "$NEXUS_URL/v1/apps/<id>" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fapps%2F%7Bid%7D)

## Delete app

`DELETE /v1/apps/{id}`

Delete the app and its Vercel project, with every deployment. A project Vercel no longer has, or a claimed one, is not an error. Audited as app.deleted.

Permission: `apps.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The app's id (`app_…`), as POST /v1/apps answered it |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Responses

- `200` OK (application/json, AppDeleted)
  - `id` (string, required)
  - `deleted` (boolean, required)
- `403` The caller is not a member of an organization (`member_required`), or the role may not use apps.
- `404` Nexus Apps is off on this Gateway (`apps_off`), or no such app reaches you: another member's and another organization's are as absent as a missing one.
- `422` Vercel refused the delete (`vercel_refused`).
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `502` Vercel failed or did not answer (`vercel_error`); try again.
- `503` Nexus Apps has no Vercel token and team on this Gateway (`apps_unavailable`).

### Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | Nexus Apps is off on this Gateway (`apps_off`), or no such app reaches you: another member's and another organization's are as absent as a missing one. |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 |  | Vercel refused the delete (`vercel_refused`). |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 502 |  | Vercel failed or did not answer (`vercel_error`); try again. |
| 503 |  | Nexus Apps has no Vercel token and team on this Gateway (`apps_unavailable`). |

### Example

```sh
curl -X DELETE "$NEXUS_URL/v1/apps/<id>" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#delete%3A%2Fv1%2Fapps%2F%7Bid%7D)

## Claim app

`POST /v1/apps/{id}/claim`

A claim link: whoever opens it signs in to Vercel (or signs up, free) and moves the app's project to their own Vercel account, where it stops costing Nexus. Anyone with the link can claim the app, so share it with nobody else. It works for 24 hours (`expiresAt`). Gateway records when it was asked for (`claimRequestedAt`), and audits each request as app.claim_requested.

Permission: `apps.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The app's id (`app_…`), as POST /v1/apps answered it |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Responses

- `200` OK (application/json, AppClaim)
  - `id` (string, required)
  - `claimUrl` (string (uri), required): Vercel's claim page for the app's project. Anyone with it can claim the app.
  - `expiresAt` (string (date-time), required): When the link stops working: 24 hours after it was made.
- `403` The caller is not a member of an organization (`member_required`), or the role may not use apps.
- `404` Nexus Apps is off on this Gateway (`apps_off`), or no such app reaches you: another member's and another organization's are as absent as a missing one.
- `409` The app has no Vercel project yet (`app_not_deployed`), or its project left Nexus's team (`app_gone`).
- `422` Vercel refused the transfer request (`vercel_refused`).
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `502` Vercel failed or did not answer (`vercel_error`); try again.
- `503` Nexus Apps has no Vercel token and team on this Gateway (`apps_unavailable`).

### Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | Nexus Apps is off on this Gateway (`apps_off`), or no such app reaches you: another member's and another organization's are as absent as a missing one. |
| 409 |  | The app has no Vercel project yet (`app_not_deployed`), or its project left Nexus's team (`app_gone`). |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 |  | Vercel refused the transfer request (`vercel_refused`). |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 502 |  | Vercel failed or did not answer (`vercel_error`); try again. |
| 503 |  | Nexus Apps has no Vercel token and team on this Gateway (`apps_unavailable`). |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/apps/<id>/claim" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fapps%2F%7Bid%7D%2Fclaim)

## Set app cap

`PUT /v1/apps/{id}/cap`

Set the monthly hosting cap for an app you own or manage. A cap above $10, or above the cap a manager set, needs `budgets.manage` (owners and admins). Audited as app.cap_changed. The app resumes after its blocking state clears.

Permission: `apps.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The app's id (`app_…`), as POST /v1/apps answered it |

### Request body (application/json, required)

- `monthlyCapUsd` (string, required): USD decimal string in whole cents, $0.01 to $1,000,000.

### Responses

- `200` OK (application/json, App)
  - `id` (string, required): `app_…`
  - `name` (string, required) [max length 48; pattern ^[a-z0-9]+(-[a-z0-9]+)*$]
  - `userId` (string, required): The member who deployed it first.
  - `url` (string | null, required): The app's address: its production URL once Vercel assigned it, else its last deployment's own. Null before the first deployment.
  - `state` ("QUEUED" | "INITIALIZING" | "BUILDING" | "READY" | "ERROR" | "CANCELED" | "BLOCKED" | null, required): Vercel's state of the last deployment; null before the first.
  - `framework` (string | null, required): The Vercel framework preset it was deployed with; null for Vercel's own detection.
  - `projectName` (string, required): The Vercel project's name on Nexus's team (`nx-<8 hex>-<name>`).
  - `deployedAt` (string (date-time) | null, required): When the last deployment started.
  - `claimRequestedAt` (string (date-time) | null, required): When a member last asked for a claim link: the project may since be on their own Vercel account.
  - `createdAt` (string (date-time), required)
  - `updatedAt` (string (date-time), required)
  - `costToDate` (string | null, required): What Vercel billed Nexus for this app in all, in USD, as a decimal string (root rule 9); null until a cost pull saw a charge for it. [pattern ^-?[0-9]+\.[0-9]{6}$]
  - `cost30d` (string | null, required): What Vercel billed for it over the last 30 days, in USD, as a decimal string; null until a cost pull saw a charge for it. [pattern ^-?[0-9]+\.[0-9]{6}$]
  - `costUpdatedAt` (string (date-time) | null, required): When the costs were last read from Vercel's charges, which come a day late; null with no cost.
  - `billingError` (string | null, required): An outstanding payment, paused state, or provider correction awaiting credit. Transient errors never pause hosting.
  - `monthlyCapUsd` (string, required): Monthly hosting cap in USD. Defaults to $10.
  - `monthSpendUsd` (string, required): Current UTC month ListCost plus Nexus rate, in USD.
  - `pauseAt` (string | null, required): The earliest cap or payment grace deadline. Null while healthy.
  - `pausedReason` (string | null, required): Cap, card or debt while hosting is paused.
- `403` The caller is not a member of an organization (`member_required`), the role may not use apps, or the cap needs `budgets.manage` (`role_required`).
- `404` Nexus Apps is off on this Gateway (`apps_off`), or no such app reaches you: another member's and another organization's are as absent as a missing one.
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `503` Nexus Apps has no Vercel token and team on this Gateway (`apps_unavailable`).

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | Nexus Apps is off on this Gateway (`apps_off`), or no such app reaches you: another member's and another organization's are as absent as a missing one. |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 503 |  | Nexus Apps has no Vercel token and team on this Gateway (`apps_unavailable`). |

### Example

```sh
curl -X PUT "$NEXUS_URL/v1/apps/<id>/cap" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "monthlyCapUsd": "<monthlyCapUsd>"
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#put%3A%2Fv1%2Fapps%2F%7Bid%7D%2Fcap)
