---
title: /v2/budgets
slug: back4app/v2budgets
createdAt: 2025-10-28T14:44:24.498Z
---

{
  "id": "D9TZrcAoXWVCVcKuBx_mh",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://dev-api.cloudzero.com/v2/budgets",
    "servers": [
      {
        "url": "https://dev-api.cloudzero.com/v2/budgets"
      }
    ],
    "name": "",
    "description": "Create a new Budget",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "kind": "optional",
          "name": "cloudzero-idempotency-key",
          "type": "string",
          "description": "<p>If passed, any subsequent operation with the same value for this header will return the exact same result.\nThis is true for all responses, i.e. successes and errors.</p>"
        },
        {
          "kind": "optional",
          "name": "cloudzero-test-key",
          "type": "string",
          "description": "<p>If passed, the operation executes in the namespace specified by this key.\nResource mutations in the namespace last for 1 hour.</p>"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "optional",
          "name": "body",
          "type": "object",
          "description": "",
          "customType": "budget_new",
          "schema": [
            {
              "name": "name",
              "kind": "required",
              "type": "string",
              "description": "Budget name, must be unique within a View",
              "example": ""
            },
            {
              "name": "planned_limits",
              "kind": "required",
              "type": "object",
              "description": "Mapping of date to amount, where\n  date is an ISO Formatted string\n  amount is a Mapping of the literal string \"amount\" to a dollar amount\n",
              "example": "{\"monthly\":{\"2022-02-01T00:00:00+00:00\":{\"amount\":\"1000.00\"}}}",
              "modelRef": "#/components/schemas/budget_planned_limits",
              "customType": "budget_planned_limits",
              "schema": [
                {
                  "name": "monthly",
                  "kind": "required",
                  "type": "map",
                  "description": "Monthly planned limit as a mapping of month date to amount, where\n  month date is an ISO Formatted Date [Time] String that will be coerced to the first of the month\n  amount is a Mapping of the literal string \"amount\" to a dollar amount\n",
                  "example": "",
                  "customType": "map<string, object>",
                  "schema": []
                }
              ]
            },
            {
              "name": "view",
              "kind": "required",
              "type": "object",
              "description": "View associated with this Budget",
              "modelRef": "#/components/schemas/with_id",
              "customType": "with_id",
              "schema": [
                {
                  "name": "id",
                  "kind": "required",
                  "type": "string",
                  "description": "",
                  "example": ""
                }
              ]
            },
            {
              "name": "alerts",
              "kind": "optional",
              "type": "object",
              "description": "Mapping of 1-100 to Y/N, where\n  1-100 is the percentage of the budget at which to send an alert\n  Y/N is whether or not to send the alert\n",
              "example": "{\"alerts\":{\"80\":\"N\",\"100\":\"Y\"}}",
              "modelRef": "#/components/schemas/budget_alerts",
              "customType": "budget_alerts",
              "schema": []
            }
          ],
          "modelRef": "#/components/schemas/budget_new",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "APIKeyAuth",
          "name": "Authorization",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        }
      ]
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Successful Operation",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "schema": [
              {
                "name": "budget",
                "kind": "optional",
                "type": "object",
                "description": "",
                "modelRef": "#/components/schemas/budget",
                "customType": "budget",
                "schema": [],
                "complexType": "allOf",
                "complexItems": [
                  {
                    "name": "budget_new",
                    "description": "",
                    "modelRef": "#/components/schemas/budget_new",
                    "schema": [
                      {
                        "name": "name",
                        "kind": "required",
                        "type": "string",
                        "description": "Budget name, must be unique within a View",
                        "example": ""
                      },
                      {
                        "name": "planned_limits",
                        "kind": "required",
                        "type": "object",
                        "description": "Mapping of date to amount, where\n  date is an ISO Formatted string\n  amount is a Mapping of the literal string \"amount\" to a dollar amount\n",
                        "example": "{\"monthly\":{\"2022-02-01T00:00:00+00:00\":{\"amount\":\"1000.00\"}}}",
                        "modelRef": "#/components/schemas/budget_planned_limits",
                        "customType": "budget_planned_limits",
                        "schema": [
                          {
                            "name": "monthly",
                            "kind": "required",
                            "type": "map",
                            "description": "Monthly planned limit as a mapping of month date to amount, where\n  month date is an ISO Formatted Date [Time] String that will be coerced to the first of the month\n  amount is a Mapping of the literal string \"amount\" to a dollar amount\n",
                            "example": "",
                            "customType": "map<string, object>",
                            "schema": []
                          }
                        ]
                      },
                      {
                        "name": "view",
                        "kind": "required",
                        "type": "object",
                        "description": "View associated with this Budget",
                        "modelRef": "#/components/schemas/with_id",
                        "customType": "with_id",
                        "schema": [
                          {
                            "name": "id",
                            "kind": "required",
                            "type": "string",
                            "description": "",
                            "example": ""
                          }
                        ]
                      },
                      {
                        "name": "alerts",
                        "kind": "optional",
                        "type": "object",
                        "description": "Mapping of 1-100 to Y/N, where\n  1-100 is the percentage of the budget at which to send an alert\n  Y/N is whether or not to send the alert\n",
                        "example": "{\"alerts\":{\"80\":\"N\",\"100\":\"Y\"}}",
                        "modelRef": "#/components/schemas/budget_alerts",
                        "customType": "budget_alerts",
                        "schema": []
                      }
                    ]
                  },
                  {
                    "name": "with_id",
                    "description": "",
                    "modelRef": "#/components/schemas/with_id",
                    "schema": [
                      {
                        "name": "id",
                        "kind": "required",
                        "type": "string",
                        "description": "",
                        "example": ""
                      }
                    ]
                  },
                  {
                    "name": "with_created",
                    "description": "",
                    "modelRef": "#/components/schemas/with_created",
                    "schema": [
                      {
                        "name": "created",
                        "kind": "required",
                        "type": "string",
                        "description": "UTC timestamp for the creation of this entity",
                        "modelRef": "#/components/schemas/epoch",
                        "customType": "epoch",
                        "schema": []
                      }
                    ]
                  },
                  {
                    "name": "with_last_updated",
                    "description": "",
                    "modelRef": "#/components/schemas/with_last_updated",
                    "schema": [
                      {
                        "name": "last_updated",
                        "kind": "required",
                        "type": "string",
                        "description": "UTC timestamp for the last update of this entity",
                        "modelRef": "#/components/schemas/epoch",
                        "customType": "epoch",
                        "schema": []
                      }
                    ]
                  },
                  {
                    "name": "object",
                    "description": "",
                    "schema": [
                      {
                        "name": "cost_type",
                        "kind": "required",
                        "type": "string",
                        "description": "Type of charges included in the cost calculation, where\n  real_cost: filters your bill to only display charges directly related to consumption\n",
                        "modelRef": "#/components/schemas/cost_type",
                        "customType": "cost_type",
                        "schema": [
                          {
                            "name": "",
                            "description": "",
                            "customType": "Max depth limit reached"
                          }
                        ]
                      },
                      {
                        "name": "granularity",
                        "kind": "required",
                        "type": "string",
                        "description": "Supported periods, e.g. \"monthly\"",
                        "modelRef": "#/components/schemas/granularity",
                        "customType": "granularity",
                        "schema": [
                          {
                            "name": "",
                            "description": "",
                            "customType": "Max depth limit reached"
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Bad Request Error",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "schema": [
              {
                "name": "error",
                "kind": "optional",
                "type": "object",
                "description": "",
                "modelRef": "#/components/schemas/error",
                "customType": "error",
                "schema": [
                  {
                    "name": "message",
                    "kind": "optional",
                    "type": "string",
                    "description": "",
                    "example": ""
                  },
                  {
                    "name": "type",
                    "kind": "optional",
                    "type": "string",
                    "description": "",
                    "example": ""
                  }
                ]
              }
            ],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "403",
        "description": "Forbidden",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "schema": [
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "",
                "example": ""
              }
            ],
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "example-0-curl",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://dev-api.cloudzero.com/v2/budgets \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"name\": \"\",\n     \"planned_limits\": {\n     \"monthly\": \"\"\n     },\n     \"view\": {\n     \"id\": \"\"\n     }\n     }'"
        },
        {
          "id": "example-1-javascript",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"name\": \"\",\n   \"planned_limits\": {\n      \"monthly\": \"\"\n   },\n   \"view\": {\n      \"id\": \"\"\n   }\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://dev-api.cloudzero.com/v2/budgets\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "example-2-ruby",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://dev-api.cloudzero.com/v2/budgets\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"name\": \"\",\n   \"planned_limits\": {\n      \"monthly\": \"\"\n   },\n   \"view\": {\n      \"id\": \"\"\n   }\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "example-3-python",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://dev-api.cloudzero.com/v2/budgets\"\n\npayload = json.dumps({\n   \"name\": \"\",\n   \"planned_limits\": {\n      \"monthly\": \"\"\n   },\n   \"view\": {\n      \"id\": \"\"\n   }\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "example-0-curl"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// Successful Operation\n{\n  \"budget\": {}\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Bad Request Error\n{\n  \"error\": {\n    \"message\": \"\",\n    \"type\": \"\"\n  }\n}"
        },
        {
          "id": "response-2-403",
          "language": "403",
          "code": "// Forbidden\n{\n  \"message\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}