---
title: "Create new AI Config"
method: POST
path: "/api/v2/projects/{projectKey}/ai-configs"
tags: ["AI Configs"]
---

# Create new AI Config

`POST /api/v2/projects/{projectKey}/ai-configs`

Create a new AI Config within the given project.

## Path parameters

- `projectKey` string, required

## Request body

- AIConfigPost
  - `description` string
  - `key` string, required
  - `maintainerId` string
  - `maintainerTeamKey` string
  - `mode` 'agent' | 'completion' | 'judge'
  - `name` string, required
  - `tags` string[]
  - `defaultVariation` AIConfigVariationPost
    - `comment` string — Human-readable description of this variation
    - `description` string — Returns the description for the agent. This is only returned for agent variations.
    - `instructions` string — Returns the instructions for the agent. This is only returned for agent variations.
    - `key` string, required
    - `messages` Message[]
      - `content` string, required
      - `role` string, required
    - `model` object
    - `name` string, required
    - `modelConfigKey` string
    - `tools` VariationToolPost[] — List of tools to use for this variation. The latest version of the tool will be used.
      - `key` string, required — The key of the tool to use.
      - `version` integer, required — The version of the tool.
    - `toolKeys` string[] — List of tool keys to use for this variation. The latest version of the tool will be used.
    - `judgeConfiguration` JudgeConfiguration
      - `judges` JudgeAttachment[] — List of judges for this variation. When updating, this replaces all existing judge attachments, and if empty, removes all judge attachments.
        - `judgeConfigKey` string, required — Key of the judge AI Config
        - `samplingRate` number, float, required — Sampling rate for this judge attachment (0.0 to 1.0)
  - `evaluationMetricKey` string — Evaluation metric key for this AI Config
  - `isInverted` boolean — Whether the evaluation metric is inverted, meaning a lower value is better if set as true

## Response `201`

AI Config created

- AIConfig
  - `_access` AiConfigsAccess
    - `denied` AiConfigsAccessDenied[], required
      - `action` string, required
      - `reason` AiConfigsAccessDeniedReason, required
        - `resources` string[] — Resource specifier strings
        - `notResources` string[] — Targeted resources are the resources NOT in this list. The <code>resources</code> and <code>notActions</code> fields must be empty to use this field.
        - `actions` ActionSpecifier[] — Actions to perform on a resource
        - `notActions` ActionSpecifier[] — Targeted actions are the actions NOT in this list. The <code>actions</code> and <code>notResources</code> fields must be empty to use this field.
        - `effect` 'allow' | 'deny', required — Whether this statement should allow or deny actions on the resources.
        - `role_name` string
    - `allowed` AiConfigsAccessAllowedRep[], required
      - `action` string, required
      - `reason` AiConfigsAccessAllowedReason, required
        - `resources` string[] — Resource specifier strings
        - `notResources` string[] — Targeted resources are the resources NOT in this list. The <code>resources</code> and <code>notActions</code> fields must be empty to use this field.
        - `actions` ActionSpecifier[] — Actions to perform on a resource
        - `notActions` ActionSpecifier[] — Targeted actions are the actions NOT in this list. The <code>actions</code> and <code>notResources</code> fields must be empty to use this field.
        - `effect` 'allow' | 'deny', required — Whether this statement should allow or deny actions on the resources.
        - `role_name` string
  - `_links` ParentAndSelfLinks — The location and content type of related resources
    - `self` CoreLink, required
      - `href` string, required
      - `type` string, required
    - `parent` CoreLink, required
      - `href` string, required
      - `type` string, required
  - `description` string, required
  - `key` string, required
  - `_maintainer` union
    - object
      - `_id` string, required
      - `email` string, required
      - `firstName` string
      - `lastName` string
      - `role` string, required
      - `kind` string, required
    - object
      - `key` string, required
      - `name` string, required
      - `kind` string, required
  - `mode` 'agent' | 'completion' | 'judge'
  - `name` string, required
  - `tags` string[], required
  - `version` integer, required
  - `variations` AIConfigVariation[], required
    - `_links` ParentLink
      - `parent` CoreLink, required
        - `href` string, required
        - `type` string, required
    - `color` string
    - `comment` string
    - `description` string — Returns the description for the agent. This is only returned for agent variations.
    - `instructions` string — Returns the instructions for the agent. This is only returned for agent variations.
    - `key` string, required
    - `_id` string, required
    - `messages` Message[]
      - `content` string, required
      - `role` string, required
    - `model` object, required
    - `modelConfigKey` string
    - `name` string, required
    - `createdAt` integer, required
    - `version` integer, required
    - `state` string
    - `_archivedAt` integer
    - `_publishedAt` integer
    - `tools` VariationTool[]
      - `key` string, required — The key of the tool to use.
      - `version` integer, required — The version of the tool.
      - `customParameters` object — Custom metadata and configuration for application-level use
    - `judgeConfiguration` JudgeConfiguration
      - `judges` JudgeAttachment[] — List of judges for this variation. When updating, this replaces all existing judge attachments, and if empty, removes all judge attachments.
        - `judgeConfigKey` string, required — Key of the judge AI Config
        - `samplingRate` number, float, required — Sampling rate for this judge attachment (0.0 to 1.0)
    - `judgingConfigKeys` string[]
  - `createdAt` integer, required
  - `updatedAt` integer, required
  - `evaluationMetricKey` string — Evaluation metric key for this AI Config
  - `evaluationMetricKeys` string[] — List of evaluation metric keys for this AI Config
  - `isInverted` boolean — Whether the evaluation metric is inverted, meaning a lower value is better if set as true
  - `dependencies` AIConfigDependency[] — Resources that depend on this AI Config, grouped by type
    - `type` 'agent-graph', required — The type of the dependent resource
    - `key` string, required — The key of the dependent resource

## Other responses

- `400` — Bad request
- `403` — Forbidden
- `500` — Internal server error

## Changes

- **2026-02-28** `69c5c9aafe78` — 2 warning, 13 info
  - deleted the `header` request parameter `LD-API-Version`
  - added the new `judge` enum value to the `mode` response property for the response status `201`
  - api tag `AI Configs` added
  - api tag `AI Configs (beta)` removed
  - …11 more
- **2025-07-08** `b2724c5174d1` — 1 breaking, 5 info
  - the response property `variations/items/messages` became optional for the status `201`
  - added the new optional request property `mode`
  - added the optional property `mode` to the response with the `201` status
  - added the optional property `variations/items/description` to the response with the `201` status
  - …2 more

[Change history](https://skmtc.dev/launchdarkly/apis/launchdarkly-rest-api/changes/api/v2/projects/:projectKey/ai-configs/post.md)

---

[API](https://skmtc.dev/launchdarkly/apis/launchdarkly-rest-api.md) · [All operations](https://skmtc.dev/launchdarkly/apis/launchdarkly-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/launchdarkly/launchdarkly-rest-api/revisions/69c5c9aafe78/schema)
