Budgets endpoints
GET /api/v1/projects/{project_id}/budgets
Section titled “GET /api/v1/projects/{project_id}/budgets”List budgets
By name. Unpaginated: a project has at most 50 budgets.
| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
project_id |
path | string (uuid) | yes |
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json: array of BudgetOut |
| 422 | Validation Error | application/json: HTTPValidationError |
POST /api/v1/projects/{project_id}/budgets
Section titled “POST /api/v1/projects/{project_id}/budgets”Add a budget
Store a budget. 409 BUDGET_NAME_TAKEN; 422 UNKNOWN_SCOPE for a gateway key outside
the project, a metadata scope that is not key=value with a valid key, or a blank trace
name; 422 UNKNOWN_CHANNEL; 422 LIMIT_EXCEEDED past 50 budgets.
| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
project_id |
path | string (uuid) | yes |
Request body (application/json, required): BudgetSpec
| Status | Description | Body |
|---|---|---|
| 201 | Successful Response | application/json: BudgetOut |
| 422 | Validation Error | application/json: HTTPValidationError |
DELETE /api/v1/projects/{project_id}/budgets/{budget_id}
Section titled “DELETE /api/v1/projects/{project_id}/budgets/{budget_id}”Delete a budget
Delete the budget with its alert history. A firing budget is resolved first and sends
alert.resolved; a blocking one stops blocking at once.
| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
project_id |
path | string (uuid) | yes | |
budget_id |
path | string (uuid) | yes |
| Status | Description | Body |
|---|---|---|
| 204 | Successful Response | none |
| 422 | Validation Error | application/json: HTTPValidationError |
GET /api/v1/projects/{project_id}/budgets/{budget_id}
Section titled “GET /api/v1/projects/{project_id}/budgets/{budget_id}”Get a budget
| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
project_id |
path | string (uuid) | yes | |
budget_id |
path | string (uuid) | yes |
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json: BudgetOut |
| 422 | Validation Error | application/json: HTTPValidationError |
PATCH /api/v1/projects/{project_id}/budgets/{budget_id}
Section titled “PATCH /api/v1/projects/{project_id}/budgets/{budget_id}”Edit a budget
Change the fields sent; send scope_id together with scope. Errors as for the create.
Changing the amount, scope or period of a firing budget, or disabling it, resolves its alert
first and sends alert.resolved. A new scope or period clears the spend shown until the next
evaluation, about a minute later.
| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
project_id |
path | string (uuid) | yes | |
budget_id |
path | string (uuid) | yes |
Request body (application/json, required): BudgetPatch
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json: BudgetOut |
| 422 | Validation Error | application/json: HTTPValidationError |