---
title: "Configs Fetch"
method: POST
path: "/variants/configs/fetch"
tags: ["Variants"]
---

# Configs Fetch

`POST /variants/configs/fetch`

Fetch configuration for a variant or environment.

Either variant_ref OR environment_ref must be provided (if neither is provided,
a default environment_ref with slug="production" will be used).

For each reference object (variant_ref, environment_ref, application_ref):
- Provide either 'slug' or 'id' field
- 'version' is optional and can be set to null
- If 'id' is provided, it will be used directly to fetch the resource
- Otherwise, 'slug' will be used along with application_ref

Returns:
    ConfigResponseModel: The configuration for the requested variant or environment.

Raises:
    HTTPException: If the configuration is not found.

## Request body

- BodyConfigsFetch
  - `variant_ref` ReferenceRequestModel
    - `slug` string, nullable
    - `version` integer, nullable
    - `commit_message` string, nullable
    - `id` string, uuid, nullable
  - `environment_ref` ReferenceRequestModel
    - `slug` string, nullable
    - `version` integer, nullable
    - `commit_message` string, nullable
    - `id` string, uuid, nullable
  - `application_ref` ReferenceRequestModel
    - `slug` string, nullable
    - `version` integer, nullable
    - `commit_message` string, nullable
    - `id` string, uuid, nullable

## Response `200`

Successful Response

- ConfigResponseModel
  - `params` object, required
  - `url` string, nullable
  - `application_ref` ReferenceDTO
    - `slug` string, nullable
    - `version` integer, nullable
    - `commit_message` string, nullable
    - `id` string, uuid, nullable, required
  - `service_ref` ReferenceDTO
    - `slug` string, nullable
    - `version` integer, nullable
    - `commit_message` string, nullable
    - `id` string, uuid, nullable, required
  - `variant_ref` ReferenceDTO
    - `slug` string, nullable
    - `version` integer, nullable
    - `commit_message` string, nullable
    - `id` string, uuid, nullable, required
  - `environment_ref` ReferenceDTO
    - `slug` string, nullable
    - `version` integer, nullable
    - `commit_message` string, nullable
    - `id` string, uuid, nullable, required
  - `application_lifecycle` LegacyLifecycleDTO
    - `created_at` string, nullable
    - `updated_at` string, nullable
    - `updated_by_id` string, nullable
    - `updated_by` string, nullable
  - `service_lifecycle` LegacyLifecycleDTO
    - `created_at` string, nullable
    - `updated_at` string, nullable
    - `updated_by_id` string, nullable
    - `updated_by` string, nullable
  - `variant_lifecycle` LegacyLifecycleDTO
    - `created_at` string, nullable
    - `updated_at` string, nullable
    - `updated_by_id` string, nullable
    - `updated_by` string, nullable
  - `environment_lifecycle` LegacyLifecycleDTO
    - `created_at` string, nullable
    - `updated_at` string, nullable
    - `updated_by_id` string, nullable
    - `updated_by` string, nullable

## Other responses

- `422` — Validation Error

## Changes

- **2026-02-13** `72fe88316d15` — 2 info
  - added the optional property `detail/items/ctx` to the response with the `422` status
  - added the optional property `detail/items/input` to the response with the `422` status
- **2025-11-05** `e62506c24377` — 8 info
  - added `#/components/schemas/LegacyLifecycleDTO` to the `application_lifecycle` response property `anyOf` list for the response status `200`
  - added `#/components/schemas/LegacyLifecycleDTO` to the `environment_lifecycle` response property `anyOf` list for the response status `200`
  - added `#/components/schemas/LegacyLifecycleDTO` to the `service_lifecycle` response property `anyOf` list for the response status `200`
  - added `#/components/schemas/LegacyLifecycleDTO` to the `variant_lifecycle` response property `anyOf` list for the response status `200`
  - …4 more
- **2025-06-27** `e3e84db47198` — 3 breaking, 2 warning, 24 info
  - removed `#/components/schemas/ReferenceRequestModel-Input` from the `application_ref` request property `anyOf` list
  - removed `#/components/schemas/ReferenceRequestModel-Input` from the `environment_ref` request property `anyOf` list
  - removed `#/components/schemas/ReferenceRequestModel-Input` from the `variant_ref` request property `anyOf` list
  - removed the optional property `detail/items/ctx` from the response with the `422` status
  - …25 more

[Change history](https://skmtc.dev/agenta-ai/apis/agenta-api/changes/variants/configs/fetch/post.md)

---

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