---
title: "Update a gateway policy"
method: PATCH
path: "/v1/platform/gateway-policies/{id}"
tags: ["gateway-policies"]
---

# Update a gateway policy

`PATCH /v1/platform/gateway-policies/{id}`

Partially updates a gateway policy. Only fields present in
the request body are applied; absent fields are left
unchanged. `policy_type` is immutable — to change a
policy's type, delete it and create a new one.

**config** if supplied must match the policy's type:
- spend-cap: `{"window": ..., "limit_usd": ...}`
- guard:     `{"version": 1, "detect": {...}, "timeout_seconds": <number>}`
Mismatched shapes are rejected with 400.

**default_spend_cap cascade:** editing a `default_spend_cap`
updates the config/action/enabled/priority on every
attached child policy so the template stays the source of
truth across rollouts.

## Path parameters

- `id` string, uuid, required

## Request body

- GatewayPoliciesUpdateGatewayPolicyRequest
  - `action` string
  - `config` object
  - `description` string
  - `enabled` boolean
  - `name` string
  - `priority` integer
  - `subject_matchers` GatewayPoliciesSubjectMatcher[]
    - `key` string
    - `value` string

## Response `200`

OK

- GatewayPoliciesGatewayPolicyRecord
  - `action` string
  - `config` object
  - `created_at` string
  - `created_by` string
  - `current_spend_usd` number — CurrentSpendUSD is the spend in the policy's current window. Set for any spend_cap policy regardless of enabled state — disabled policies still surface usage so users can see what would have been counted. Nil for non-spend_cap policies or when the spend lookup failed.
  - `description` string
  - `enabled` boolean
  - `id` string
  - `is_system_generated` boolean
  - `name` string
  - `organization_id` string
  - `parent_policy_id` string — ParentPolicyID is set on materialized children of a default_spend_cap to the default's id, and cleared (NULL) only when an admin Create with the same matchers takes over the materialized row. Update on a child preserves the link; Delete on the parent cascade-soft-deletes every child rather than detaching them.
  - `policy_type` string
  - `priority` integer
  - `subject_matchers` GatewayPoliciesSubjectMatcher[]
    - `key` string
    - `value` string
  - `updated_at` string

## Other responses

- `400` — validation failure
- `401` — Unauthorized
- `403` — LLM Gateway not enabled, or caller lacks OrganizationManage
- `404` — policy not found
- `409` — matcher edit collides with another policy in the same family
- `500` — Internal Server Error

---

[API](https://skmtc.net/langchain-ai/apis/langsmith.md) · [All operations](https://skmtc.net/langchain-ai/apis/langsmith/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/langchain-ai/langsmith/revisions/a0acb3a6a101/schema)
