HTTP Autoscaling
Use this endpoint to configure autoscaling for paid HTTP applications. The project keeps a reserved minimum instance count and can increase instances automatically during traffic spikes.
Required permissions
Configuring autoscaling requires project.instances.update on project:<project-id>. Reading scaling events requires project.metrics.read on the same project. owner has full access; assistant, member, and organization API Keys need the specific scope.
Headers
| Header | Required | Description |
|---|---|---|
x-api-key or Authorization | Yes | Organization API Key or user token |
x-organization-id | With a user token | Active project organization. Not needed with an organization API key |
Content-Type: application/json | Yes | Required for PATCH |
Update Autoscaling
PATCH /v1/project/:id/autoscalingRate limit: 20 requests every 5 minutes (counted per source IP).
Body
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | Yes | true enables or updates; false disables |
min_instances | integer | When enabling | Reserved minimum instances (positive integer) |
max_instances | integer | When enabling | Maximum instances allowed during spikes (positive integer) |
target_cpu_utilization_percent | integer | No | Target CPU, from 1 to 100. Default: 70 |
target_memory_utilization_percent | integer | No | Target memory, from 1 to 100. Default: 80 |
max_instances must be greater than or equal to min_instances. With enabled: false, sending any other field returns 400.
Enable or Update
{
"enabled": true,
"min_instances": 2,
"max_instances": 8,
"target_cpu_utilization_percent": 70,
"target_memory_utilization_percent": 80
}Disable
{
"enabled": false
}Response
{
"status": "success",
"message": "project autoscaling updated with success",
"data": {
"autoscaling": {
"enabled": true,
"min_instances": 2,
"max_instances": 8,
"target_cpu_utilization_percent": 70,
"target_memory_utilization_percent": 80
}
}
}Event History
GET /v1/project/:id/autoscaling/eventsRate limit: 100 requests per minute (counted per source IP).
Returns the paginated history of scale up and scale down events recorded by Zenifra. Use this endpoint for audit trails, support, and traffic spike analysis.
Query
| Field | Type | Required | Description |
|---|---|---|---|
direction | string | No | Filters by scale_up or scale_down |
from | ISO date | No | Start of the period |
to | ISO date | No | End of the period |
page | number | No | Page. Default: 1 |
limit | number | No | Items per page. Default: 50, maximum: 100 |
Response
{
"status": "success",
"message": "get project autoscaling events with success",
"data": {
"events": [
{
"id": "6a24f7...",
"direction": "scale_up",
"previous_instances": 2,
"new_instances": 5,
"desired_instances": 5,
"min_instances": 2,
"max_instances": 8,
"trigger_metric": "cpu",
"current_cpu_utilization_percent": 91,
"target_cpu_utilization_percent": 70,
"current_memory_utilization_percent": 62,
"target_memory_utilization_percent": 80,
"reason": "increased_capacity",
"message": "Automatic scaling increased the project instance count.",
"occurred_at": "2026-06-05T21:40:00.000Z"
}
],
"pagination": {
"page": 1,
"limit": 50,
"total": 1,
"total_pages": 1
}
}
}The history is retained for 13 months.
Billing
For hourly projects, billing uses observed instances during the billing period.
For monthly or yearly projects, the reserved minimum is part of the main contract. Instances above the minimum are billed per instance-hour, using the contract price converted to an hourly rate: the monthly price divided by 720 or the yearly price divided by 8,760.
Rules
| Situation | Result |
|---|---|
| Project is not HTTP | Rejected |
| Project is stopped | Rejected |
| Plan does not allow autoscaling | Rejected |
| Manually changing instances while autoscaling is enabled | Rejected with 409 |
Common Errors
| Status | Code | When it happens |
|---|---|---|
400 | — | The project is not HTTP, or the body is invalid |
403 | AUTOSCALING_NOT_AVAILABLE_FOR_PLAN | The current plan does not allow autoscaling |
409 | PROJECT_MUST_BE_RUNNING | The project must be running before autoscaling can be changed |
409 | AUTOSCALING_REQUIRES_SHARED_STORAGE | The project needs shared storage to use autoscaling |
409 | PROJECT_LIFECYCLE_OPERATION_IN_PROGRESS | Another project operation is in progress |
429 | AUTOSCALING_UPDATE_IN_PROGRESS | Another autoscaling update is already running for the project |
429 | AUTOSCALING_TOGGLE_COOLDOWN_ACTIVE | Autoscaling was enabled or disabled recently; the response includes retry_after_seconds |
503 | AUTOSCALING_TEMPORARILY_UNAVAILABLE | Autoscaling is temporarily unavailable; try again shortly |
Next Steps
- Check Instances to list current instances.
- Check Metrics and Logs to validate behavior during spikes.
Last updated on
Project Instances
List and change project instance count through the API, including scaling rules, hourly plans, and invalid states.
Application health check
Read, enable, or disable the health check of an HTTP application through the API and list the failures recorded in the last 30 days, with pagination.