# Publish a saved revision of an app to its members.

POST https://services.leadconnectorhq.com/ai-builder-api/projects/{projectId}/app-config/publish

For a phone app send `platform: mobile` and the `revision` from `GET .../app-config`: installed apps get it over the air. Screens your agent wrote reach members only in a new APK (`POST .../app-config/apk-builds`). `web`, the default, is for ClientPortal configuration apps; a coded web app publishes with `POST .../infra/promote-to-production`.

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `clientportal-ai.write`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | The API version. |

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `projectId` | string | Yes | The app's id. |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/ai-builder-api/projects/{projectId}/app-config/publish": {
      "post": {
        "summary": "Publish a saved revision of an app to its members.",
        "operationId": "publishASavedRevisionOfAnAppToItsMembers",
        "description": "For a phone app send `platform: mobile` and the `revision` from `GET .../app-config`: installed apps get it over the air. Screens your agent wrote reach members only in a new APK (`POST .../app-config/apk-builds`). `web`, the default, is for ClientPortal configuration apps; a coded web app publishes with `POST .../infra/promote-to-production`.",
        "parameters": [
          {
            "in": "path",
            "name": "projectId",
            "required": true,
            "description": "The app's id.",
            "example": "prj_a7ca4adc-be67-40ff-ae79-4f5acf56ac67",
            "schema": {
              "type": "string",
              "pattern": "^prj_[A-Za-z0-9_-]+$"
            }
          },
          {
            "name": "Version",
            "in": "header",
            "required": true,
            "description": "The API version.",
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishAppCustomizationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Published configuration.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppCustomizationRecord"
                }
              }
            }
          },
          "409": {
            "description": "The requested revision has not finished applying, or the project target is unsupported."
          }
        },
        "security": [
          {
            "bearer": [
              "clientportal-ai.write"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "A sub-account access token: a Marketplace app's OAuth token or a Private Integration Token."
      }
    },
    "schemas": {
      "PublishAppCustomizationRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "revision"
        ],
        "properties": {
          "revision": {
            "type": "integer",
            "minimum": 1,
            "description": "The revision to publish: the app configuration's `revision`, once `appliedRevision` matches it and `status` is `ready`.",
            "example": 4
          },
          "platform": {
            "type": "string",
            "enum": [
              "web",
              "mobile"
            ],
            "default": "web",
            "description": "`mobile` for a phone app. `web` (the default) publishes a ClientPortal configuration app's web revision.",
            "example": "mobile"
          }
        },
        "title": "PublishAppCustomizationRequest"
      },
      "AppCustomizationRecord": {
        "type": "object",
        "required": [
          "projectId",
          "revision",
          "appliedRevision",
          "publishedRevision",
          "status",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "projectId": {
            "type": "string",
            "pattern": "^prj_[A-Za-z0-9_-]+$",
            "description": "Stable owner project for this location's shared ClientPortal Experience. It may differ from the web or mobile project in the current route.",
            "example": "prj_a7ca4adc-be67-40ff-ae79-4f5acf56ac67"
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "description": "The newest saved revision. A finished run or a restore saves a new one.",
            "example": 4
          },
          "appliedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The newest revision that finished applying. Publish a revision once it equals `revision` and `status` is `ready`.",
            "example": 4
          },
          "publishedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The revision members get. 0 until the first publish.",
            "example": 3
          },
          "status": {
            "description": "Where the newest revision is: `ready` once it has applied and can be published, `failed` when it could not apply.",
            "type": "string",
            "enum": [
              "idle",
              "queued",
              "applying",
              "ready",
              "failed"
            ],
            "title": "AppCustomizationStatus"
          },
          "previewUrl": {
            "type": "string",
            "format": "uri",
            "description": "Where the latest applied revision can be previewed, when the app has a preview.",
            "example": "https://prj-a7ca4adc-be67-40ff-ae79-4f5acf56ac67-sbx.staging.clientclub.net"
          },
          "lastError": {
            "type": "string",
            "description": "Why the latest revision failed to apply, when `status` is `failed`.",
            "example": "The Schedule screen does not match the route contract."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the app's configuration was first saved.",
            "example": "2026-10-23T10:41:44.873Z"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the latest revision was saved or changed state.",
            "example": "2026-10-23T11:24:45.263Z"
          }
        },
        "title": "AppCustomizationRecord"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X POST 'https://services.leadconnectorhq.com/ai-builder-api/projects/<projectId>/app-config/publish' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "revision": 4,
  "platform": "mobile"
}'
```

**Node.js**

```javascript
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "revision": 4,
      "platform": "mobile"
  })
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/ai-builder-api/projects/<projectId>/app-config/publish', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/ai-builder-api/projects/{projectId}/app-config/publish"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v3"
}

payload = {
    "revision": 4,
    "platform": "mobile"
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/ai-builder-api/projects/<projectId>/app-config/publish',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "revision": 4,
  "platform": "mobile"
}',
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .post("https://services.leadconnectorhq.com/ai-builder-api/projects/<projectId>/app-config/publish")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .header("Content-Type", "application/json")
  .body("{\"revision\":4,\"platform\":\"mobile\"}")
  .asString();
```

**Go**

```go
package main

import (
  "fmt"
  "net/http"
  "io"
  "strings"
)

func main() {
  url := "https://services.leadconnectorhq.com/ai-builder-api/projects/<projectId>/app-config/publish"
  payload := strings.NewReader(`{
  "revision": 4,
  "platform": "mobile"
}`)
  req, _ := http.NewRequest("POST", url, payload)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v3")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

```ruby
require 'uri'
require 'net/http'

url = URI("https://services.leadconnectorhq.com/ai-builder-api/projects/<projectId>/app-config/publish")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"
request["Content-Type"] = "application/json"
request.body = '{
  "revision": 4,
  "platform": "mobile"
}'

response = http.request(request)
puts response.read_body
```

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v3"
}

$body = '{
  "revision": 4,
  "platform": "mobile"
}'

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/ai-builder-api/projects/<projectId>/app-config/publish' -Method 'POST' -Headers $headers -Body $body -ContentType 'application/json'
$response | ConvertTo-Json
```
