> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# ApproveAppGeneration

# Package: containersProjects

# Namespace: ContainersProjects

# Method link: https://dev.wix.com/docs/api-reference/mobile/containers-app/containers-projects/project-v1/approve-app-generation.md

## Permission Scopes:
Manage AppSmith Projects: SCOPE.CONTAINERS.PROJECTS

## Introduction

Approves a saved plan and starts generating the app.

Call this only after the user approved the exact plan returned by Submit App Plan. Specify its
`revision` and `digest`; if the plan changed since, the call fails with `PLAN_REVISION_CHANGED`.

Generation creates a new, unpublished app. It never changes an existing app. Approving the same
plan again returns the same generation, so a call that timed out can be repeated safely. If the
returned generation has `resumeRequired: true`, repeat this call to continue it.

---

## REST API

### Schema

```
 Method: approveAppGeneration
 Description: Approves a saved plan and starts generating the app.  Call this only after the user approved the exact plan returned by Submit App Plan. Specify its `revision` and `digest`; if the plan changed since, the call fails with `PLAN_REVISION_CHANGED`.  Generation creates a new, unpublished app. It never changes an existing app. Approving the same plan again returns the same generation, so a call that timed out can be repeated safely. If the returned generation has `resumeRequired: true`, repeat this call to continue it.
 URL: https://www.wixapis.com/containers/projects/v1/app-plans/{proposalId}/approve
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  requestKey, revision, digest, approvalMethod
 Method parameters: 
   param name: approvalMethod | type: AppPlanApprovalMethod   | required: true 
      - enum:
           AGENT_RELAYED_CHAT_CONFIRMATION - The user approved the plan (or the publication) in a chat with the agent, and the agent relays
it. The approval can't be verified, so it's accepted only from the site owner.
   param name: digest | type: digest | description: `digest` of the plan the user approved. | required: true | validation: maxLength 64
   param name: requestKey | type: requestKey | description: Stable key for this approval, created by the caller. | required: true | validation: maxLength 100
   param name: revision | type: revision | description: `revision` of the plan the user approved. | required: true 
 Return type: ApproveAppGenerationResponse
  - name: generation | type: AppGeneration | description: The app generation.  
     - name: id | type: string | description: App generation GUID.  | validation: format GUID
     - name: proposalId | type: string | description: GUID of the approved plan.  | validation: format GUID
     - name: proposalRevision | type: string | description: Revision of the approved plan.  
     - name: status | type: AppGenerationStatus | description: Generation status.  
         - enum:
         -     PREPARING: Creating the project, its app, conversation and plan.
         -     QUEUED: The build is waiting to start.
         -     RUNNING: The coding agent is building the app.
         -     FINALIZING: The coding agent finished; the draft is being verified and saved. Not done yet.
         -     SUCCEEDED: The app draft is ready. It is unpublished.
         -     FAILED: The generation failed. See `failure`. Final, except `GENERATION_NOT_STARTED`: if the build starts late, the status follows it.
         -     CANCELLED: The generation was stopped.
     - name: failure | type: AppGenerationFailure | description: Why the generation failed. Returned when `status` is `FAILED`.  
        - name: code | type: AppGenerationFailureCode | description: Failure code.  
             - enum:
             -     NOT_AUTHORIZED: The current user isn't allowed to create a mobile app on this site.
             -     PREPARATION_FAILED: The project, app, conversation or plan couldn't be prepared.
             -     PLAN_SCOPE_MISMATCH: The stored plan differs from the approved plan, so the build wasn't started.
             -     GENERATION_NOT_STARTED: The build didn't start within 15 minutes, for example because the account has no AI credits left. If it starts later, the generation's status follows the build. Check again before starting over, so the app isn't created twice.
             -     GENERATION_FAILED: The build failed.
        - name: description | type: string | description: Safe description for the user.  | validation: maxLength 500
     - name: projectId | type: string | description: GUID of the app's project. Returned once the project exists.  | validation: format GUID
     - name: stopAvailable | type: boolean | description: Whether Stop App Generation can stop the generation now.  
     - name: resumeRequired | type: boolean | description: Whether preparation stopped before the build started. Call Approve App Generation again with the same plan to continue; this starts the build. To abandon it instead, call Stop App Generation.  
     - name: result | type: AppGenerationResult | description: The app draft. Returned when `status` is `SUCCEEDED`.  
        - name: projectId | type: string | description: GUID of the app's project.  | validation: format GUID
        - name: appUrl | type: string | description: Link to open the app draft in the dashboard. Not returned when the link isn't configured.  | validation: format WEB_URL
     - name: createdDate | type: string | description: Date and time the generation was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the generation was last updated.  | read-only: true | validation: format date-time

 Possible Errors:
   HTTP Code: 403 | Status Code: PERMISSION_DENIED | Application Code: APPROVAL_NOT_ACCEPTED | Description: The approval method isn't accepted from the current user. `AGENT_RELAYED_CHAT_CONFIRMATION` is accepted only from the site owner.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: APP_PLAN_NOT_FOUND | Description: Couldn't find the app plan for the current user and site.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: TEMPLATE_UNAVAILABLE | Description: No app template is available for new mobile apps.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: APP_PLAN_EXPIRED | Description: The plan expired before approval. A plan expires 24 hours after it's created. Submit it again.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: PLAN_REVISION_CHANGED | Description: The plan changed since the user saw it. Show the current plan and ask again.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: FEATURE_UNAVAILABLE | Description: App generation isn't available for this site.


```

### Examples

### Approve App Generation
Approves the plan that the user confirmed in the chat and starts generating the app.

```curl
curl -X POST \
'https://www.wixapis.com/containers/projects/v1/app-plans/3e8b6d2f-91a4-4c7e-b5d0-6f2a8c1e9b47/approve' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "requestKey": "e2a9f4c6-8d1b-4f37-a6e0-3c5b9d7f1a82",
  "revision": "1",
  "digest": "4f9a2c7e1b8d3a6f0e5c9b2d7a4e1f8c3b6d0a9e2f7c4b1d8a5e3f6c9b0d2a7e",
  "approvalMethod": "AGENT_RELAYED_CHAT_CONFIRMATION"
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.containers.projects.approveAppGeneration(proposalId, requestKey, options)
 Description: Approves a saved plan and starts generating the app.  Call this only after the user approved the exact plan returned by Submit App Plan. Specify its `revision` and `digest`; if the plan changed since, the call fails with `PLAN_REVISION_CHANGED`.  Generation creates a new, unpublished app. It never changes an existing app. Approving the same plan again returns the same generation, so a call that timed out can be repeated safely. If the returned generation has `resumeRequired: true`, repeat this call to continue it.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  proposalId, requestKey, options.revision, options.digest, options.approvalMethod, options
 Method parameters: 
   param name: options | type: ApproveAppGenerationOptions  none | required: true 
        - name: revision | type: string | description: `revision` of the plan the user approved. | required: true 
        - name: digest | type: string | description: `digest` of the plan the user approved. | required: true | validation: maxLength 64
        - name: approvalMethod | type: AppPlanApprovalMethod | description: How the user approved the plan. | required: true 
             - enum:
             -     AGENT_RELAYED_CHAT_CONFIRMATION: The user approved the plan (or the publication) in a chat with the agent, and the agent relays it. The approval can't be verified, so it's accepted only from the site owner.
   param name: proposalId | type: string | description: GUID of the plan to approve. | required: true | validation: format GUID
   param name: requestKey | type: string | description: Stable key for this approval, created by the caller. | required: true | validation: maxLength 100
 Return type: PROMISE<ApproveAppGenerationResponse>
  - name: generation | type: AppGeneration | description: The app generation.  
     - name: _id | type: string | description: App generation GUID.  | validation: format GUID
     - name: proposalId | type: string | description: GUID of the approved plan.  | validation: format GUID
     - name: proposalRevision | type: string | description: Revision of the approved plan.  
     - name: status | type: AppGenerationStatus | description: Generation status.  
         - enum:
         -     PREPARING: Creating the project, its app, conversation and plan.
         -     QUEUED: The build is waiting to start.
         -     RUNNING: The coding agent is building the app.
         -     FINALIZING: The coding agent finished; the draft is being verified and saved. Not done yet.
         -     SUCCEEDED: The app draft is ready. It is unpublished.
         -     FAILED: The generation failed. See `failure`. Final, except `GENERATION_NOT_STARTED`: if the build starts late, the status follows it.
         -     CANCELLED: The generation was stopped.
     - name: failure | type: AppGenerationFailure | description: Why the generation failed. Returned when `status` is `FAILED`.  
        - name: code | type: AppGenerationFailureCode | description: Failure code.  
             - enum:
             -     NOT_AUTHORIZED: The current user isn't allowed to create a mobile app on this site.
             -     PREPARATION_FAILED: The project, app, conversation or plan couldn't be prepared.
             -     PLAN_SCOPE_MISMATCH: The stored plan differs from the approved plan, so the build wasn't started.
             -     GENERATION_NOT_STARTED: The build didn't start within 15 minutes, for example because the account has no AI credits left. If it starts later, the generation's status follows the build. Check again before starting over, so the app isn't created twice.
             -     GENERATION_FAILED: The build failed.
        - name: description | type: string | description: Safe description for the user.  | validation: maxLength 500
     - name: projectId | type: string | description: GUID of the app's project. Returned once the project exists.  | validation: format GUID
     - name: stopAvailable | type: boolean | description: Whether Stop App Generation can stop the generation now.  
     - name: resumeRequired | type: boolean | description: Whether preparation stopped before the build started. Call Approve App Generation again with the same plan to continue; this starts the build. To abandon it instead, call Stop App Generation.  
     - name: result | type: AppGenerationResult | description: The app draft. Returned when `status` is `SUCCEEDED`.  
        - name: projectId | type: string | description: GUID of the app's project.  | validation: format GUID
        - name: appUrl | type: string | description: Link to open the app draft in the dashboard. Not returned when the link isn't configured.  | validation: format WEB_URL
     - name: _createdDate | type: Date | description: Date and time the generation was created.  | read-only: true 
     - name: _updatedDate | type: Date | description: Date and time the generation was last updated.  | read-only: true 

 Possible Errors:
   HTTP Code: 403 | Status Code: PERMISSION_DENIED | Application Code: APPROVAL_NOT_ACCEPTED | Description: The approval method isn't accepted from the current user. `AGENT_RELAYED_CHAT_CONFIRMATION` is accepted only from the site owner.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: APP_PLAN_NOT_FOUND | Description: Couldn't find the app plan for the current user and site.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: TEMPLATE_UNAVAILABLE | Description: No app template is available for new mobile apps.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: APP_PLAN_EXPIRED | Description: The plan expired before approval. A plan expires 24 hours after it's created. Submit it again.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: PLAN_REVISION_CHANGED | Description: The plan changed since the user saw it. Show the current plan and ask again.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: FEATURE_UNAVAILABLE | Description: App generation isn't available for this site.


```

### Examples

### Approve an app plan and start generating the app
Approves the plan that the site owner confirmed in the chat.

```javascript
import { projects } from "@wix/containers";

async function approveAppGeneration() {
  const response = await projects.approveAppGeneration(
    "3e8b6d2f-91a4-4c7e-b5d0-6f2a8c1e9b47",
    "e2a9f4c6-8d1b-4f37-a6e0-3c5b9d7f1a82",
    {
      revision: "1",
      digest: "4f9a2c7e1b8d3a6f0e5c9b2d7a4e1f8c3b6d0a9e2f7c4b1d8a5e3f6c9b0d2a7e",
      approvalMethod: "AGENT_RELAYED_CHAT_CONFIRMATION",
    },
  );
}

/* Promise resolves to:
 * {
 *   "generation": {
 *     "_id": "9c4a1f7e-2b6d-4e83-a0c5-7d1b3f8e6a92",
 *     "proposalId": "3e8b6d2f-91a4-4c7e-b5d0-6f2a8c1e9b47",
 *     "proposalRevision": "1",
 *     "status": "QUEUED",
 *     "projectId": "6b2e9d4a-1c7f-4a35-8e0b-5d3f7a9c2e18",
 *     "stopAvailable": false,
 *     "resumeRequired": false,
 *     "_createdDate": "2026-11-09T09:32:10.000Z",
 *     "_updatedDate": "2026-11-09T09:32:48.000Z"
 *   }
 * }
 */

```

### approveAppGeneration (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { projects } from '@wix/containers';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { projects },
  // Include the auth strategy and host as relevant
});


async function approveAppGeneration(proposalId,requestKey,options) {
  const response = await myWixClient.projects.approveAppGeneration(proposalId,requestKey,options);
};
```

---