AI Gateway

Create or replace an AI Gateway routing policy

Create or replace the routing policy document for an inbound pattern. Pass user_id to scope the policy to a user.

post/api/v2/policies

Request

Query parameters

user_idstring uuid

Filter or scope policies to a specific user. Omit for organization-wide policies.

Request body

Example request

{
  "data": {
    "attributes": {
      "inbound": "coding-agent",
      "priority": 1,
      "tiers": [
        {
          "priority": 1,
          "targets": [
            {
              "id": 901,
              "model": "gpt-5.2-codex",
              "provider": "prod-us"
            }
          ]
        }
      ]
    },
    "type": "routing-documents"
  }
}

Response

OK

Example response

{
  "data": {
    "attributes": {
      "priority": 1,
      "tiers": [
        {
          "targets": [
            {
              "id": 901,
              "model": "gpt-5.2-codex",
              "priority": 1,
              "provider": "prod-us"
            }
          ]
        }
      ]
    },
    "id": "coding-agent",
    "type": "routing-documents"
  }
}

Changes

Changes to this operation have not been checked yet.