Update Storage Size
Changes the project's storage capacity.
Required permissions
Increasing or changing storage requires project.storage.update on project:<project-id>. To read usage, use project.metrics.read on the same project. owner has full access; assistant, member, and organization API Keys need the scope for the action.
PATCH /v1/project/:id/storage/sizeRate limit: 5 requests per minute (counted per source IP).
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Project ID |
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 when updating storage size |
Body
| Field | Type | Required | Description |
|---|---|---|---|
size | number | Yes | Storage size in GB (minimum 1, maximum 250) |
Example
{
"size": 20
}Response
{
"status": "success",
"message": "storage size updated with success"
}Common Errors
| Status | Code | When it happens |
|---|---|---|
409 | STORAGE_UPDATE_NOT_ALLOWED_FOR_CONTRACT | The project has a monthly or yearly contract; only projects with hourly billing can change storage |
409 | STORAGE_SIZE_CANNOT_DECREASE | The new capacity is lower than or equal to the current capacity |
409 | STORAGE_UPDATE_NOT_ALLOWED_FOR_FREE_PLAN | The Free plan does not allow storage changes |
409 | PROJECT_OPERATION_IN_PROGRESS | The project has another operation in progress |
409 | PROJECT_STATE_CONFLICT | The project is neither running nor stopped (for example, still being created) |
402 | ORGANIZATION_BILLING_BLOCKED | The organization has pending payments |
422 | PROJECT_OPERATION_NOT_SUPPORTED | The project type has no storage changes: Valkey Cache and scheduled Jobs |
404 | — | Project not found |
Storage can be changed while the project is running or stopped. Billing for the new size starts only after the change is applied. The standard error bodies are in Conflicts and billing block.
Get Storage Usage
Returns information about the current storage usage of the project.
GET /v1/project/:id/storage/usageRate limit: 100 requests per minute (counted per source IP). Returns 404 when the project does not exist. For Analytics projects, it returns 402 when the plan does not offer metrics and 409 (PROJECT_STATE_CONFLICT) when there is no running instance to measure, such as a stopped project.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Project ID |
Response
{
"status": "success",
"message": "get volume usage with success",
"data": {
"used": 5368709120,
"capacity": 10737418240,
"replica_count": 1
}
}used and capacity are numbers in bytes; replica_count is the number of measured volumes (for Analytics projects, the number of instances).
Examples
Update Storage Size
curl -X PATCH "https://api.zenifra.com/v1/project/507f1f77bcf86cd799439011/storage/size" \
-H "x-api-key: your-api-key" \
-H "x-organization-id: your-organization-id" \
-H "Content-Type: application/json" \
-d '{"size": 20}'Get Storage Usage
curl -X GET "https://api.zenifra.com/v1/project/507f1f77bcf86cd799439011/storage/usage" \
-H "x-api-key: your-api-key" \
-H "x-organization-id: your-organization-id"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}
# Update storage size
requests.patch(
f"https://api.zenifra.com/v1/project/{PROJECT_ID}/storage/size",
headers=headers,
json={"size": 20}
)
# Get storage usage
usage = requests.get(
f"https://api.zenifra.com/v1/project/{PROJECT_ID}/storage/usage",
headers=headers
).json()
print(usage)Limits
- Minimum: 1 GB
- Maximum: 250 GB
Notes
- For hourly payment models, storage can be increased at any time
- Storage cannot be reduced
- With hourly billing, additional cost is calculated in proportion to usage time
- Projects with a monthly or yearly contract cannot change storage (
409) - With contracts, storage above the included allowance is charged at creation using the monthly price per GB from the catalog (
GET /v1/project/storage/plans): the monthly contract uses the monthly price and the yearly contract uses 12 times that amount
Last updated on