# Set auto-recharge (/docs/api/account/billing_autorecharge_set)

Top up by amount_usd whenever the balance drops below threshold_usd.

`PUT /v1/billing/auto-recharge`

```json
{
  "operationId": "billing_autorecharge_set",
  "summary": "Set auto-recharge",
  "description": "Top up by amount_usd whenever the balance drops below threshold_usd.",
  "tags": [
    "billing"
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "enabled": {
              "type": "boolean"
            },
            "threshold_usd": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000,
              "default": 5
            },
            "amount_usd": {
              "type": "integer",
              "minimum": 5,
              "maximum": 10000,
              "default": 25
            }
          },
          "required": [
            "enabled"
          ]
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "object": {
                "type": "string",
                "enum": [
                  "billing"
                ]
              },
              "mode": {
                "type": "string",
                "enum": [
                  "off",
                  "test",
                  "live"
                ]
              },
              "test_mode": {
                "type": "boolean"
              },
              "plan": {
                "type": "string",
                "enum": [
                  "free",
                  "pro",
                  "team",
                  "agency",
                  "enterprise"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "active",
                  "past_due",
                  "canceled"
                ]
              },
              "source": {
                "type": "string",
                "enum": [
                  "none",
                  "stripe",
                  "simulated"
                ]
              },
              "period_end": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "balance": {
                "type": "object",
                "properties": {
                  "object": {
                    "type": "string",
                    "enum": [
                      "balance"
                    ]
                  },
                  "balance_micro": {
                    "type": "integer"
                  },
                  "held_micro": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "available_micro": {
                    "type": "integer"
                  },
                  "frozen": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "object",
                  "balance_micro",
                  "held_micro",
                  "available_micro",
                  "frozen"
                ]
              },
              "simulated_micro": {
                "type": "integer"
              },
              "auto_recharge": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "threshold_micro": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "amount_micro": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "required": [
                  "enabled",
                  "threshold_micro",
                  "amount_micro"
                ]
              },
              "invoices": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "invoice"
                      ]
                    },
                    "number": {
                      "type": "string",
                      "pattern": "^(SIM|GR)-\\d{6,}$"
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "none",
                        "stripe",
                        "simulated"
                      ]
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "topup",
                        "subscription",
                        "refund",
                        "dispute",
                        "grant_expiry"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "paid",
                        "failed",
                        "refunded",
                        "disputed",
                        "void"
                      ]
                    },
                    "amount_micro": {
                      "type": "integer"
                    },
                    "plan": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "free",
                        "pro",
                        "team",
                        "agency",
                        "enterprise",
                        null
                      ]
                    },
                    "description": {
                      "type": "string",
                      "maxLength": 200
                    },
                    "ref": {
                      "type": "string"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "object",
                    "number",
                    "source",
                    "kind",
                    "status",
                    "amount_micro",
                    "plan",
                    "description",
                    "ref",
                    "created_at"
                  ]
                }
              }
            },
            "required": [
              "object",
              "mode",
              "test_mode",
              "plan",
              "status",
              "source",
              "period_end",
              "balance",
              "simulated_micro",
              "auto_recharge",
              "invoices"
            ]
          }
        }
      }
    },
    "default": {
      "description": "Error",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "enum": [
                      "invalid_request",
                      "unauthorized",
                      "insufficient_balance",
                      "max_cost_exceeded",
                      "scope_denied",
                      "budget_blocked",
                      "not_found",
                      "idempotency_mismatch",
                      "invalid_meta",
                      "rate_limited",
                      "upstream_error",
                      "response_buffer_limit",
                      "provider_capacity_unavailable",
                      "grid_saturated",
                      "upstream_timeout",
                      "conflict",
                      "internal_error",
                      "account_frozen",
                      "strict_filters",
                      "plan_limit_reached",
                      "validation_failed",
                      "deadline_exceeded",
                      "cancelled"
                    ]
                  },
                  "message": {
                    "type": "string"
                  },
                  "request_id": {
                    "type": "string"
                  },
                  "call_id": {
                    "type": "string"
                  },
                  "retry_after_ms": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "details": {
                    "type": "object",
                    "additionalProperties": {}
                  }
                },
                "required": [
                  "code",
                  "message"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    }
  }
}
```
