---
title: "Set App Limit"
method: PUT
path: "/apps/{app_id}/limit"
tags: ["Apps"]
---

# Set App Limit

`PUT /apps/{app_id}/limit`

## Request

- Base URL: `https://be.graph8.com/api/v1`
- URL: `https://be.graph8.com/api/v1/apps/{app_id}/limit`
- Auth: HTTP bearer

PREVIEW. This endpoint is deployed but gated: it returns 404 unless the hosted app platform is enabled for your organization. It is published here so the contract describes the whole surface, not so it can be called today.

Set this app's hard credit cap for a window.

`set_limit` and `clear_limit` shipped with the repository layer
(`repositories/usage.py:198,229`), with a Protocol (`contracts.py:957`) and
tests, and NO route ever called them. So a builder could read their cap and
could never set one, and the only way a limit row came into existence was by
hand.

That matters more than a missing endpoint usually would: in a builder-pays
model the cap is the entire spend-safety story. Enforcement was complete and
unreachable.

Same shape as the #16816 bug, where `store_credential` and `revoke_credential`
shipped without callers so no service token could ever be minted.

SINGULAR `/limit`, not `/limits`. The read half is singular and is frozen
that way in `openapi_operation_ids.json` and the published bundle; adding a
plural verb would put two spellings of one resource in the public contract
forever.

## Path parameters

- `app_id` string, required

## Headers

- `Authorization` string, nullable
- `X-Org-Id` string, nullable

## Request body

- SetAppLimitRequest: Set an app's hard credit cap for a window. ``window`` is optional and defaults to the only value the enum has today (`calendar_month`, D5: fixed monthly allowance, monthly reset, no rollover). Accepting it explicitly now means adding a second window later does not change this DTO's shape.
  - `credit_cap` integer, required: Hard cap in credits for the window. `0` means 'cap at zero', NOT 'uncapped' -- to remove a cap, DELETE the limit instead.
  - `window` string: Cap window. `calendar_month` is the only value today.

## Response `200`

Successful Response

- ApiResponseAppLimitResponse
  - `data` AppLimitResponse, required: An app's hard credit cap. Mirrors `AppLimitDto`. The endpoint returns `null` for no cap. There is no "unlimited" sentinel, so an accidental zero can never read as no limit.
    - `app_id` string, required
    - `window` string, required: Cap window. `calendar_month` today.
    - `credit_cap` integer, required
    - `created_at` string, date-time, nullable
  - `pagination` PaginationMeta
    - `page` integer, required: Current page number (1-indexed)
    - `limit` integer, required: Items per page
    - `total` integer, required: Total number of items
    - `has_next` boolean, required: Whether there are more pages
    - `next_cursor` string, nullable: Opaque cursor for the next page; null when there are no more items. Pass it back as the `cursor` query param to fetch the following page without computing page numbers.
    - `total_available` integer, nullable: Search endpoints only: how many records really match, when known. Can be larger than `total`, which is capped at the 10,000 results that can be paged. For company search this is a distinct-company estimate. Null when unknown; absent outside search.
    - `total_is_lower_bound` boolean, nullable: Search endpoints only: true when more records match than `total` shows (the result set is larger than the 10,000 results that can be paged). Absent outside search.
    - `notes` string[], nullable: Search endpoints only: plain-language notes about the result, e.g. that more records match than can be paged, or that a reversed `between` range was put in order.

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/graph8/apis/graph8-developer-api.md) · [All operations](https://skmtc.dev/graph8/apis/graph8-developer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/graph8/apis/graph8-developer-api/revisions/2e7cfa0ca921?raw)
