---
title: "Upsert AI Model version spec"
method: PUT
path: "/v1/ai-models/{aiModelId}/versions/latest/spec"
tags: ["Catalog AI Model Specs"]
---

# Upsert AI Model version spec

`PUT /v1/ai-models/{aiModelId}/versions/latest/spec`

## Request

- Base URL: `https://global.api.konghq.com`
- URL: `https://global.api.konghq.com/v1/ai-models/{aiModelId}/versions/latest/spec`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer

Creates or replaces the `latest` version's oas specification (upsert).

## Path parameters

- `aiModelId` string, uuid, required

## Request body

- AiModelVersionSpecWrite: Request body for creating or replacing a version's spec (upsert). The request body has a maximum size limit of 8MB.
  - `spec_content` string, required: The raw content of the oas specification, in json or yaml format (for example, an OpenAPI document).
  - `spec_provider` SpecProvider, nullable: Optional provenance. Omit (or `null`) for a user-uploaded specification.
    - `source` 'ai_gateway' | 'provider', required

## Response `200`

The replaced spec

- AiModelVersionSpec: The oas specification document for an AI Model version.
  - `spec_content` string, required: The raw content of the oas specification, in json or yaml format (for example, an OpenAPI document).
  - `spec_type` 'oas', required: The type of specification document. Currently always `oas` (OpenAPI Specification).
  - `spec_provider` object, nullable: Provenance of the specification. `null` (or absent) for a user-uploaded specification.
    - `source` 'ai_gateway' | 'provider', required
  - `created_at` string, date-time, required: An ISO-8601 timestamp representation of entity creation date.
  - `updated_at` string, date-time, required: An ISO-8601 timestamp representation of entity update date.

## Other responses

- `201`: The created spec
- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found

## Changes

- **2026-11-16** `a209c8bfa7b7`: 4 info
  - the `spec_type` response property const value `oas` was added for the status `200`
  - the `spec_type` response property const value `oas` was added for the status `201`
  - removed the `oas` enum value from the `spec_type` response property for the response status `200`
  - removed the `oas` enum value from the `spec_type` response property for the response status `201`
- **2026-11-12** `d8bd04cfbaf7`: 2 breaking, 2 warning
  - the `spec_type` response property const value `oas` was removed for the status `200`
  - the `spec_type` response property const value `oas` was removed for the status `201`
  - added the new `oas` enum value to the `spec_type` response property for the response status `200`
  - added the new `oas` enum value to the `spec_type` response property for the response status `201`
- **2026-10-15** `7aab863a6daa`: 1 breaking, 2 warning
  - added `#/components/schemas/InvalidParameterMinimumTime, #/components/schemas/InvalidParameterMaximumTime` to the `invalid_parameters/items/` response property `oneOf` list for the response status `400`
  - added the new `key_invalid` enum value to the `invalid_parameters/items/oneOf[#/components/schemas/InvalidParameterStandard]/rule` response property for the response status `400`
  - added the new `unique` enum value to the `invalid_parameters/items/oneOf[#/components/schemas/InvalidParameterStandard]/rule` response property for the response status `400`
- …earlier changes not shown

[Operation history](https://skmtc.dev/kong/apis/konnect-api-go-sdk/changes/v1/ai-models/:aiModelId/versions/latest/spec/put.md)

---

[API](https://skmtc.dev/kong/apis/konnect-api-go-sdk.md) - [All operations](https://skmtc.dev/kong/apis/konnect-api-go-sdk/llms.txt) - [OpenAPI document](https://skmtc.dev/kong/apis/konnect-api-go-sdk/revisions/3b071797f6e4?raw)
