alawadi.cloudDocs
API Reference

Scaling & alerts API

Reference for the autoscaling policy endpoints, cost preview, scaling events, alert-policy CRUD, the alert feed, and notification email verification.

Autoscaling

One policy per app: PUT creates or replaces it, DELETE removes it and restores a fixed instance count. The preview endpoint prices a min/max range without saving anything (rate-limited per account), and the scaling-events endpoint pages through the instance-count history. Concepts and rules are on the autoscaling guide.

Errors worth knowing: 409 UNSUPPORTED_SERVICE_TYPE (managed databases don't autoscale), 409 AUTOSCALING_PERSISTENCE_CONFLICT (persistent storage), 409 QUOTA_EXCEEDED (plan instance ceiling), 422 INSUFFICIENT_BALANCE_FOR_AUTOSCALING (the 48-hour balance requirement). While a policy is active, changing replicas through the container-update endpoint returns 409 AUTOSCALING_OWNS_REPLICAS.

PUT
/v1/projects/{projectId}/containers/{containerId}/autoscaling

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer JWT obtained after Google sign-in in the portal.

In: header

Path Parameters

projectId*string
containerId*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X PUT "https://example.com/v1/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/containers/497f6eca-6276-4993-bfeb-53cbbbba6f08/autoscaling" \  -H "Content-Type: application/json" \  -d '{    "minReplicas": 1,    "maxReplicas": 1  }'
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "service_id": "641e839f-864e-4cce-98f9-40f6cbb3e9e0",
  "enabled": true,
  "minReplicas": 0,
  "maxReplicas": 0,
  "targetCPUPercent": 0,
  "targetMemoryPercent": 0,
  "scaleDownStabilizationSeconds": 0,
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z"
}
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}
GET
/v1/projects/{projectId}/containers/{containerId}/autoscaling

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer JWT obtained after Google sign-in in the portal.

In: header

Path Parameters

projectId*string
containerId*string

Response Body

application/json

application/json

application/json

curl -X GET "https://example.com/v1/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/containers/497f6eca-6276-4993-bfeb-53cbbbba6f08/autoscaling"
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "service_id": "641e839f-864e-4cce-98f9-40f6cbb3e9e0",
  "enabled": true,
  "minReplicas": 0,
  "maxReplicas": 0,
  "targetCPUPercent": 0,
  "targetMemoryPercent": 0,
  "scaleDownStabilizationSeconds": 0,
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z"
}
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}
DELETE
/v1/projects/{projectId}/containers/{containerId}/autoscaling

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer JWT obtained after Google sign-in in the portal.

In: header

Path Parameters

projectId*string
containerId*string

Response Body

application/json

application/json

curl -X DELETE "https://example.com/v1/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/containers/497f6eca-6276-4993-bfeb-53cbbbba6f08/autoscaling"
Empty
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}
GET
/v1/projects/{projectId}/containers/{containerId}/autoscaling/preview

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer JWT obtained after Google sign-in in the portal.

In: header

Path Parameters

projectId*string
containerId*string

Query Parameters

min*integer
max*integer

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/v1/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/containers/497f6eca-6276-4993-bfeb-53cbbbba6f08/autoscaling/preview?min=1&max=1"
{
  "minReplicas": 0,
  "maxReplicas": 0,
  "costUUSD": {
    "atMin": 0,
    "atMax": 0
  },
  "requiredBalanceUUSD": 98628
}
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}
GET
/v1/projects/{projectId}/containers/{containerId}/scaling-events

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer JWT obtained after Google sign-in in the portal.

In: header

Path Parameters

projectId*string
containerId*string

Query Parameters

limit?integer
before_time?string
before_id?string

Response Body

application/json

application/json

application/json

curl -X GET "https://example.com/v1/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/containers/497f6eca-6276-4993-bfeb-53cbbbba6f08/scaling-events"
{
  "events": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "fromReplicas": 0,
      "toReplicas": 0,
      "reason": "autoscale",
      "occurred_at": "2019-08-24T14:15:22Z"
    }
  ],
  "limit": 0,
  "next_before_time": "2019-08-24T14:15:22Z",
  "next_before_id": "0ce7fc60-5733-4ae4-967b-4beb905a3fd7"
}
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}

Alert policies

Up to 10 policies per service, for apps and managed databases alike. The metric is fixed at creation. PATCH covers everything else (name, threshold, window, severity, toggles). GET /v1/alerts is the account-wide alert event feed with keyset pagination. Metric semantics and the notification rules are on the alerts guide.

POST
/v1/projects/{projectID}/containers/{containerID}/alert-policies

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer JWT obtained after Google sign-in in the portal.

In: header

Path Parameters

projectID*string
containerID*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/containers/497f6eca-6276-4993-bfeb-53cbbbba6f08/alert-policies" \  -H "Content-Type: application/json" \  -d '{    "name": "string",    "metric": "cpu_percent",    "threshold": 1,    "window_seconds": 60  }'
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "service_id": "641e839f-864e-4cce-98f9-40f6cbb3e9e0",
  "name": "string",
  "metric": "cpu_percent",
  "threshold": 1,
  "comparison": "gt",
  "window_seconds": 60,
  "severity": "warning",
  "enabled": true,
  "notify_email": false,
  "cooldown_seconds": 900,
  "state": "ok",
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z"
}
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}
null
GET
/v1/projects/{projectID}/containers/{containerID}/alert-policies

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer JWT obtained after Google sign-in in the portal.

In: header

Path Parameters

projectID*string
containerID*string

Response Body

application/json

application/json

application/json

curl -X GET "https://example.com/v1/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/containers/497f6eca-6276-4993-bfeb-53cbbbba6f08/alert-policies"
[
  {
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
    "service_id": "641e839f-864e-4cce-98f9-40f6cbb3e9e0",
    "name": "string",
    "metric": "cpu_percent",
    "threshold": 1,
    "comparison": "gt",
    "window_seconds": 60,
    "severity": "warning",
    "enabled": true,
    "notify_email": false,
    "cooldown_seconds": 900,
    "state": "ok",
    "created_at": "2019-08-24T14:15:22Z",
    "updated_at": "2019-08-24T14:15:22Z"
  }
]
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}
PATCH
/v1/projects/{projectID}/containers/{containerID}/alert-policies/{pid}

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer JWT obtained after Google sign-in in the portal.

In: header

Path Parameters

projectID*string
containerID*string
pid*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

All fields optional. metric is intentionally excluded — change metric by deleting and recreating.

Response Body

application/json

application/json

application/json

application/json

curl -X PATCH "https://example.com/v1/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/containers/497f6eca-6276-4993-bfeb-53cbbbba6f08/alert-policies/497f6eca-6276-4993-bfeb-53cbbbba6f08" \  -H "Content-Type: application/json" \  -d '{}'
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "service_id": "641e839f-864e-4cce-98f9-40f6cbb3e9e0",
  "name": "string",
  "metric": "cpu_percent",
  "threshold": 1,
  "comparison": "gt",
  "window_seconds": 60,
  "severity": "warning",
  "enabled": true,
  "notify_email": false,
  "cooldown_seconds": 900,
  "state": "ok",
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z"
}
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}
DELETE
/v1/projects/{projectID}/containers/{containerID}/alert-policies/{pid}

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer JWT obtained after Google sign-in in the portal.

In: header

Path Parameters

projectID*string
containerID*string
pid*string

Response Body

application/json

application/json

curl -X DELETE "https://example.com/v1/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/containers/497f6eca-6276-4993-bfeb-53cbbbba6f08/alert-policies/497f6eca-6276-4993-bfeb-53cbbbba6f08"
Empty
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}
GET
/v1/alerts

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer JWT obtained after Google sign-in in the portal.

In: header

Query Parameters

since?string

ISO-8601 / RFC3339 lower bound for fired_at.

service_id?string

Filter to events for a specific service.

before_fired_at?string

Keyset cursor — fired_at of the last item on the previous page.

before_id?string

Keyset cursor — id of the last item on the previous page.

limit?integer

Page size (1–100, default 50).

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/alerts"
[
  {
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "policy_id": "ee9b03e0-6495-427a-85a5-34444d24ae04",
    "policy_name": "string",
    "service_id": "641e839f-864e-4cce-98f9-40f6cbb3e9e0",
    "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
    "state": "firing",
    "metric": "string",
    "observed_value": 0,
    "threshold": 0,
    "fired_at": "2019-08-24T14:15:22Z"
  }
]
{
  "error": "validation failed",
  "request_id": "01J9Z3K8QWERTYUIOP"
}

Notification email verification

Alert emails are only sent to a verified address. verify sends the confirmation message (3 requests per hour); confirm is the link inside that message: it needs no authentication, works once, and expires after 24 hours.

POST
/v1/settings/notify-email/verify

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer JWT obtained after Google sign-in in the portal.

In: header

Response Body

application/json

curl -X POST "https://example.com/v1/settings/notify-email/verify"
Empty
null
Empty
Empty
GET
/v1/settings/notify-email/confirm

Query Parameters

token*string

Response Body

text/html

text/html

text/html

curl -X GET "https://example.com/v1/settings/notify-email/confirm?token=string"
"string"
"string"
"string"

On this page