Endpoints

Get deployment

Get the status of the newest publish attempt for a chat

GET/api/chat/{chatId}/deployment

Get the status of the newest publish attempt for a chat, or of the attempt that deploymentId names. The newest attempt can still be building, or can have failed while an older version stays live. Use liveUrl for the URL of the version that is live now. If the deployment is not in a final state, this endpoint will sync the status with Vercel before returning.

Request

GET /api/chat/{chatId}/deployment

Headers

HeaderRequiredDescription
AuthorizationYesBearer macaly_...

Path Parameters

ParameterTypeDescription
chatIdstringThe chat ID

Query Parameters

ParameterRequiredDescription
deploymentIdNoThe id or deploymentId that POST /deploy returned. Without it, the endpoint returns the newest publish attempt of the chat.

Example Request

curl "https://www.macaly.com/api/chat/abc123/deployment?deploymentId=jzga0sttml37v6mbizb8tk1x" \
  -H "Authorization: Bearer macaly_abc123..."

Response

Deployment Ready

{
  "id": "jzga0sttml37v6mbizb8tk1x",
  "url": "https://macaly-staging-abc123.macaly.app",
  "status": "READY",
  "deploymentId": "dpl_HKLBd2QDTwq58AMUJiaMyUzk8WUw",
  "createdAt": "2025-01-12T21:18:54.906Z",
  "error": null,
  "domain": "macaly-staging-abc123.macaly.app",
  "domains": [
    {
      "domain": "macaly-staging-abc123.macaly.app",
      "verified": true,
      "isCustomDomain": false
    }
  ],
  "liveUrl": "https://macaly-staging-abc123.macaly.app"
}

No Deployment

{
  "id": null,
  "url": null,
  "status": null,
  "deploymentId": null,
  "createdAt": null,
  "error": null,
  "domain": null,
  "domains": [
    {
      "domain": "macaly-staging-abc123.macaly.app",
      "verified": true,
      "isCustomDomain": false
    }
  ],
  "liveUrl": null
}

Deployment Failed

A failed re-publish keeps the previous version live, so liveUrl stays set.

{
  "id": "jzga0sttml37v6mbizb8tk1x",
  "url": "https://macaly-staging-abc123.macaly.app",
  "status": "ERROR",
  "deploymentId": "dpl_HKLBd2QDTwq58AMUJiaMyUzk8WUw",
  "createdAt": "2025-01-12T21:18:54.906Z",
  "error": ["Build failed: Module not found"],
  "domain": "macaly-staging-abc123.macaly.app",
  "domains": [],
  "liveUrl": "https://macaly-staging-abc123.macaly.app"
}

Response Fields

FieldTypeDescription
idstring | nullDatabase deployment ID (null if never deployed)
urlstring | nullThe deployment URL
statusstring | nullVercel deployment status (see below)
deploymentIdstring | nullVercel deployment ID
createdAtstring | nullISO timestamp of deployment creation
errorstring[] | nullError messages if deployment failed
domainstring | nullPrimary domain for the deployment
domainsarrayAll connected domains
domains[].domainstringDomain name
domains[].verifiedbooleanWhether the domain is verified
domains[].isCustomDomainbooleanWhether this is a custom domain
liveUrlstring | nullURL of the live version (null if nothing is live)

Deployment Status Values

StatusDescription
QUEUEDDeployment is queued
BUILDINGBuild is in progress
READYDeployment successful
ERRORDeployment failed
CANCELEDDeployment was cancelled
UNPUBLISHEDDeployment was unpublished

Status Codes

StatusDescription
200Success (even if no deployment exists, returns null fields)
401Invalid or missing API key
403Chat does not belong to your team
404Chat not found, or deploymentId matches no deployment of this chat

Polling Pattern

Pass the id that POST /deploy returned as deploymentId.

while true; do
  DEPLOYMENT=$(curl -s "https://www.macaly.com/api/chat/$CHAT_ID/deployment?deploymentId=$DEPLOYMENT_ID" \
    -H "Authorization: Bearer macaly_...")

  STATUS=$(echo $DEPLOYMENT | jq -r '.status')
  echo "Status: $STATUS"

  if [[ $STATUS == "READY" ]]; then
    echo "Deployed: $(echo $DEPLOYMENT | jq -r '.liveUrl')"
    break
  elif [[ $STATUS == "ERROR" ]]; then
    echo "Failed: $(echo $DEPLOYMENT | jq -r '.error')"
    break
  fi

  sleep 3
done