---
title: upsert-ai-gateway-budget-default
product: vercel
url: /docs/rest-api/ai-gateway/upsert-ai-gateway-budget-default
canonical_url: "https://vercel.com/docs/rest-api/ai-gateway/upsert-ai-gateway-budget-default"
last_updated: 2026-09-30
type: reference
prerequisites:
  []
related:
  - /docs/rest-api
summary: Learn about upsert-ai-gateway-budget-default on Vercel.
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

# Upsert AI Gateway budget default

```http
PUT /ai-gateway/budgets/defaults
```

Create or update an AI Gateway budget default for one scope. Team-level authority only (owners/admins).

## Authentication

**bearerToken**: HTTP bearer

## Query parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `teamId` | string | No | The Team identifier to perform the request on behalf of. |
| `slug` | string | No | The Team slug to perform the request on behalf of. |


## Request body

Required: No

Content-Type: `application/json`

```json
{
  "type": "object",
  "required": [
    "scopeType",
    "limitAmount"
  ],
  "properties": {
    "scopeType": {
      "type": "string",
      "enum": [
        "team",
        "project",
        "api-key",
        "user"
      ]
    },
    "limitAmount": {
      "type": "number",
      "description": "Default budget limit in dollars.",
      "minimum": 1
    },
    "refreshPeriod": {
      "type": "string",
      "enum": [
        "daily",
        "weekly",
        "monthly",
        "none"
      ]
    },
    "alertThresholds": {
      "type": "array",
      "items": {
        "type": "number",
        "enum": [
          50,
          75,
          100
        ]
      }
    }
  }
}
```

## Example request

### TypeScript

```typescript
const response = await fetch('https://api.vercel.com/ai-gateway/budgets/defaults?teamId=string&slug=string', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "scopeType": "team",
    "limitAmount": "123",
    "refreshPeriod": "daily",
    "alertThresholds": []
  }),
});

const data = await response.json();
console.log(data);
```

### Next.js

```typescript
'use server';

export async function callEndpoint() {
  const response = await fetch('https://api.vercel.com/ai-gateway/budgets/defaults?teamId=string&slug=string', {
    method: 'PUT',
    headers: {
      'Authorization': `Bearer ${process.env.VERCEL_ACCESS_TOKEN}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      "scopeType": "team",
      "limitAmount": "123",
      "refreshPeriod": "daily",
      "alertThresholds": []
    }),
    next: { revalidate: 3600 }
  });

  if (!response.ok) {
    throw new Error('Request failed');
  }

  return response.json();
}
```

### cURL

```bash
curl -X PUT 'https://api.vercel.com/ai-gateway/budgets/defaults?teamId=string&slug=string' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d "{
    \"scopeType\": \"team\",
    \"limitAmount\": \"123\",
    \"refreshPeriod\": \"daily\",
    \"alertThresholds\": []
  }"
```

## Example response

```json
{
  "active": "false",
  "alertThresholds": [],
  "createdAt": "123",
  "limitAmount": "123",
  "refreshPeriod": "daily",
  "scopeType": "api-key",
  "updatedAt": "123"
}
```

## Responses

### 200: No description

Content-Type: `application/json`

```json
{
  "type": "object",
  "required": [
    "active",
    "createdAt",
    "limitAmount",
    "refreshPeriod",
    "scopeType",
    "updatedAt"
  ],
  "properties": {
    "active": {
      "type": "boolean",
      "enum": [
        false,
        true
      ]
    },
    "alertThresholds": {
      "type": "array",
      "items": {
        "type": "number"
      }
    },
    "createdAt": {
      "type": "number"
    },
    "limitAmount": {
      "type": "number"
    },
    "refreshPeriod": {
      "type": "string",
      "enum": [
        "daily",
        "monthly",
        "none",
        "weekly"
      ]
    },
    "scopeType": {
      "type": "string",
      "enum": [
        "api-key",
        "project",
        "team",
        "user"
      ]
    },
    "updatedAt": {
      "type": "number"
    }
  }
}
```

### 400: One of the provided values in the request body is invalid.

### 401: The request is not authorized.

### 403: You do not have permission to access this resource.

### 404: No description

### 410: No description

### 500: No description

---

## Related

- [ai-gateway endpoints](/docs/rest-api#ai-gateway)

- [REST API overview](/docs/rest-api)

- [OpenAPI spec](https://vercel.com/openapi.json) (machine-readable, all endpoints)

---

[View full sitemap](/docs/sitemap)
