---
title: "Update Project Spending Limits"
method: PATCH
path: "/v1/gateway/spending-limits/projects/{project_id}/"
tags: ["Gateway"]
---

# Update Project Spending Limits

`PATCH /v1/gateway/spending-limits/projects/{project_id}/`

## Request

- Base URL: `https://logfire-api.pydantic.dev/api`
- URL: `https://logfire-api.pydantic.dev/api/v1/gateway/spending-limits/projects/{project_id}/`
- Auth: OAuth 2
  - Authorization code: `api/oauth/authorize`
  - Token URL: `/api/oauth/token` scopes: `organization:write_gateway`
- TypeScript: <https://skmtc.dev/pydantic/apis/pydantic-logfire-api/docs/v1/gateway/spending-limits/projects/:project_id/patch.ts> (a function with typed inputs; its response is checked against the schema)

Update a project's Gateway spending limits.

A number sets the limit for that window and `null` removes it. A window that the body omits is unchanged.
When the project goes over a limit, the Gateway blocks every credential in the project until the window
resets.

## Path parameters

- `project_id` string, uuid, required

## Request body

- GatewaySpendingLimitsPatch
  - `daily_usd` integer, nullable
  - `weekly_usd` integer, nullable
  - `monthly_usd` integer, nullable

## Response `200`

Successful Response

- GatewaySpendingLimitsRead
  - `daily_usd` integer, nullable, required
  - `weekly_usd` integer, nullable, required
  - `monthly_usd` integer, nullable, required

## Other responses

- `403`: The organization plan does not include the AI Gateway
- `422`: Validation Error
- `429`: Rate limit exceeded

---

[API](https://skmtc.dev/pydantic/apis/pydantic-logfire-api.md) - [All operations](https://skmtc.dev/pydantic/apis/pydantic-logfire-api/llms.txt) - [OpenAPI document](https://skmtc.dev/pydantic/apis/pydantic-logfire-api/revisions/7996e45256f4?raw)
