# Check whether an app can be published now, and which build would go live.

GET https://services.leadconnectorhq.com/ai-builder-api/projects/{projectId}/publishability

Computed by the same resolver as promote-to-production. Without
`sourceRunId`: publishable iff some ready run of this project (caller's
location, main lineage) has a sealed build; the newest one goes live
with the newest config-only revision made on its lineage. With
`sourceRunId` (the reviewed preview): publishes what that preview shows —
its own sealed build, or for a ready run that built nothing, the sealed
build it descends from with config-only edits on that lineage; a run
that failed or has not finished is reviewed_preview_not_publishable. Send the returned
`sourceRunId` on promote-to-production. Tenant scope comes from the
session only.


## Authentication

Send `Authorization: Bearer <token>` using:

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

## Parameters

### Header Parameters

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

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `projectId` | string | Yes | The project. |

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `sourceRunId` | string | No | Run whose preview the creator is reviewing; bounds what may go live. |

## 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}/publishability": {
      "get": {
        "summary": "Check whether an app can be published now, and which build would go live.",
        "operationId": "checkWhetherAnAppCanBePublishedNowAndWhichBuildWouldGoLive",
        "description": "Computed by the same resolver as promote-to-production. Without\n`sourceRunId`: publishable iff some ready run of this project (caller's\nlocation, main lineage) has a sealed build; the newest one goes live\nwith the newest config-only revision made on its lineage. With\n`sourceRunId` (the reviewed preview): publishes what that preview shows —\nits own sealed build, or for a ready run that built nothing, the sealed\nbuild it descends from with config-only edits on that lineage; a run\nthat failed or has not finished is reviewed_preview_not_publishable. Send the returned\n`sourceRunId` on promote-to-production. Tenant scope comes from the\nsession only.\n",
        "parameters": [
          {
            "in": "path",
            "name": "projectId",
            "required": true,
            "description": "The project.",
            "example": "prj_5f0c2a3e",
            "schema": {
              "type": "string",
              "pattern": "^prj_[A-Za-z0-9_-]+$"
            }
          },
          {
            "in": "query",
            "name": "sourceRunId",
            "required": false,
            "description": "Run whose preview the creator is reviewing; bounds what may go live.",
            "example": "run_7b2c9e41",
            "schema": {
              "type": "string",
              "pattern": "^run_[A-Za-z0-9_-]+$"
            }
          },
          {
            "name": "Version",
            "in": "header",
            "required": true,
            "description": "The API version.",
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Publishability answer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectPublishability"
                },
                "examples": {
                  "publishable": {
                    "value": {
                      "publishable": true,
                      "sourceRunId": "run_01J9CFG",
                      "workspaceRunId": "run_01J9BLD",
                      "workspaceCreatedAt": "2026-10-01T12:00:00.000Z",
                      "experienceRevision": 5
                    }
                  },
                  "neverBuilt": {
                    "value": {
                      "publishable": false,
                      "reason": "no_sealed_build"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed projectId.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Project not found for this tenant.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Malformed sourceRunId.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": [
              "clientportal-ai.readonly"
            ]
          }
        ]
      }
    }
  },
  "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": {
      "ProjectPublishability": {
        "type": "object",
        "required": [
          "publishable"
        ],
        "properties": {
          "publishable": {
            "type": "boolean",
            "description": "Whether a publish now would succeed.",
            "example": true
          },
          "sourceRunId": {
            "type": "string",
            "description": "Run id to send as `sourceRunId` on promote-to-production. Present when publishable.",
            "example": "run_7b2c9e41"
          },
          "workspaceRunId": {
            "type": "string",
            "description": "Run that sealed the build that would go live. Present when publishable.",
            "example": "run_7b2c9e41"
          },
          "workspaceCreatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When that sealed build was made. Present when publishable.",
            "example": "2026-10-23T09:41:12.000Z"
          },
          "experienceRevision": {
            "type": "integer",
            "minimum": 1,
            "description": "Experience revision that would go live, when one applies.",
            "example": 5
          },
          "reason": {
            "type": "string",
            "enum": [
              "no_sealed_build",
              "mobile_uses_apk_lane",
              "finalizing",
              "source_run_not_found",
              "reviewed_preview_not_publishable"
            ],
            "description": "Why nothing is publishable. Present when not publishable.",
            "example": "no_sealed_build"
          }
        },
        "title": "ProjectPublishability"
      },
      "ApiError": {
        "type": "object",
        "required": [
          "type",
          "title",
          "status",
          "code",
          "requestId"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri",
            "example": "about:blank",
            "description": "A URI identifying the kind of error."
          },
          "title": {
            "type": "string",
            "example": "Request validation failed",
            "description": "Short summary of the kind of error."
          },
          "status": {
            "type": "integer",
            "minimum": 400,
            "maximum": 599,
            "example": 422,
            "description": "The HTTP status code."
          },
          "detail": {
            "type": "string",
            "example": "One or more fields are invalid.",
            "description": "What went wrong with this request."
          },
          "instance": {
            "type": "string",
            "example": "/api/v1/runs",
            "description": "The request path that failed."
          },
          "code": {
            "type": "string",
            "example": "validation_error",
            "description": "Stable, machine-readable error code."
          },
          "requestId": {
            "type": "string",
            "example": "req_01HXQ8Z6J9K2",
            "description": "The request's id, for support."
          },
          "fieldErrors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "code",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string",
                  "example": "prompt",
                  "description": "The invalid field, as a dotted path."
                },
                "code": {
                  "type": "string",
                  "example": "required",
                  "description": "Machine-readable reason."
                },
                "message": {
                  "type": "string",
                  "example": "Prompt is required.",
                  "description": "Human-readable reason."
                }
              },
              "title": "FieldError"
            },
            "description": "One entry per invalid field, when the request body was invalid.",
            "example": [
              {
                "field": "name",
                "code": "too_long",
                "message": "name must be at most 120 characters"
              }
            ]
          }
        },
        "title": "ApiError"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X GET 'https://services.leadconnectorhq.com/ai-builder-api/projects/<projectId>/publishability' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3'
```

**Node.js**

```javascript
const options = {
  method: 'GET',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3'
  }
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/ai-builder-api/projects/<projectId>/publishability', 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}/publishability"

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

response = requests.get(url, 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>/publishability',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
  ],
]);

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

**Java**

```java
HttpResponse<String> response = Unirest
  .get("https://services.leadconnectorhq.com/ai-builder-api/projects/<projectId>/publishability")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/ai-builder-api/projects/<projectId>/publishability"
  req, _ := http.NewRequest("GET", url, nil)
  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>/publishability")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"

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

**PowerShell**

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

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/ai-builder-api/projects/<projectId>/publishability' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
