Project Instances
Use these endpoints to discover active instances and change the number of replicas for a project. They are useful for scaling automation, cost-saving routines, and internal operations dashboards.
Required permissions
Listing requires project.read on project:<project-id>. Changing the count requires project.instances.update on the same project. owner has full access; assistant, member, and organization API Keys need the grant for the action.
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 only for PATCH |
List Instances
Returns the current project instance identifiers.
GET /v1/project/:id/instancesRate limit: 50 requests per minute (counted per source IP).
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Project ID |
Response
{
"status": "success",
"message": "get instances with success",
"data": [
{ "instance": "abc" },
{ "instance": "def" }
]
}For Key-Value, Cache, and Queue projects, instances are listed as instance-1, instance-2, and so on, with a status field. Scheduled Jobs have no permanent instances and respond 422 with PROJECT_OPERATION_NOT_SUPPORTED.
Use the instance value in metrics and logs calls when you want to inspect a specific instance.
Change Instance Count
Changes the number of project replicas.
PATCH /v1/project/:id/instancesRate limit: 15 requests per minute (counted per source IP).
Body
| Field | Type | Required | Description |
|---|---|---|---|
instances | number | Yes | New instance count. Must be a positive integer. |
Example
{
"instances": 3
}Response
{
"status": "success",
"message": "project instances changed with success"
}Operational Rules
| Situation | Result |
|---|---|
instances equals the current value | Returns 200 with the same success body and no change |
instances equals 0 | Rejected with 400 (validation). Use Lifecycle to stop the project |
| Project is stopped or not running | Rejected with 409 (PROJECT_STATE_CONFLICT). Use /resume before scaling |
| Another operation in progress | Rejected with 409 (PROJECT_OPERATION_IN_PROGRESS) |
| HTTP autoscaling enabled | Rejected with 409. Disable HTTP Autoscaling before manual changes |
| Monthly or yearly plan | Rejected with 409: manual scaling is only available with hourly billing |
Legacy db-free plan | Does not allow dynamic instance changes (409) |
| Analytics | Rejected with 409 (CLICKHOUSE_INSTANCES_FIXED_BY_PLAN): instances come from the plan; change the plan to change them |
| Valkey or scheduled Job | Rejected with 422 (PROJECT_OPERATION_NOT_SUPPORTED): the operation does not exist for these types |
| Legacy Free plan | Limit of 1 instance in total (2 for organizations created before the free offer update); above that, 409 |
| Organization with pending payments | Adding instances returns 402 (ORGANIZATION_BILLING_BLOCKED); reducing remains available |
| Capacity unavailable | 409 (requested capacity unavailable) or 503 (capacity temporarily unavailable); try again shortly |
| MariaDB | Requires exactly 3 instances |
Examples
curl
curl -X GET "https://api.zenifra.com/v1/project/507f1f77bcf86cd799439011/instances" \
-H "x-api-key: your-api-key" \
-H "x-organization-id: your-organization-id"curl -X PATCH "https://api.zenifra.com/v1/project/507f1f77bcf86cd799439011/instances" \
-H "x-api-key: your-api-key" \
-H "x-organization-id: your-organization-id" \
-H "Content-Type: application/json" \
-d '{"instances": 3}'Python
import requests
API_KEY = "your-api-key"
ORGANIZATION_ID = "your-organization-id"
PROJECT_ID = "507f1f77bcf86cd799439011"
headers = {"x-api-key": API_KEY, "x-organization-id": ORGANIZATION_ID}
instances = requests.get(
f"https://api.zenifra.com/v1/project/{PROJECT_ID}/instances",
headers=headers
).json()
scale = requests.patch(
f"https://api.zenifra.com/v1/project/{PROJECT_ID}/instances",
headers=headers,
json={"instances": 3}
).json()Common Errors
| Code | Likely reason | How to fix |
|---|---|---|
400 | instances is missing, invalid, or 0; MariaDB with a count other than 3 | Send a positive integer and use /stop to stop the project |
404 | Project not found | Check Project ID, API Key, and organization |
402 | The organization has pending payments and the request adds instances | Pay the outstanding amounts or reduce instances |
409 | Current state, plan, billing mode, capacity, or active autoscaling does not allow manual scaling | Check that the project is running and autoscaling is disabled. See Conflicts and billing block |
422 | The project type has no instance changes (PROJECT_OPERATION_NOT_SUPPORTED) | Use a plan change when the type allows it |
503 | Capacity temporarily unavailable | Try again shortly |
500 | Operational failure while applying scaling | Retry or contact support |
Next Steps
- Check Metrics and Logs to validate the new instance.
- Use HTTP Autoscaling when the application must absorb spikes automatically.
- Use Lifecycle to stop or resume a project.
- Review Storage before increasing instances with persistent volumes.
Last updated on
Project Plan
Change your project's plan through the Zenifra API, with the rules for each project type and the errors, and turn automatic renewal of contracts on or off.
HTTP Autoscaling
Enable, update, or disable autoscaling for Zenifra HTTP projects via the API, with minimum and maximum instances, CPU and memory targets, and event history.