---
title: "Create or update a patterns configuration"
method: PUT
path: "/api/v2/llm-obs/v1/topic-discovery-configs"
tags: ["LLM Observability"]
---

# Create or update a patterns configuration

`PUT /api/v2/llm-obs/v1/topic-discovery-configs`

Create a new patterns configuration, or update an existing one when a configuration ID is provided.

## Request body

- LLMObsPatternsConfigUpsertRequest — Request to create or update an LLM Observability patterns configuration.
  - `data` LLMObsPatternsConfigUpsertRequestData, required — Data object for creating or updating an LLM Observability patterns configuration.
    - `attributes` LLMObsPatternsConfigUpsertRequestAttributes, required — Attributes for creating or updating an LLM Observability patterns configuration.
      - `account_id` string — Integration account ID for a bring-your-own-model configuration.
      - `config_id` string — The ID of an existing configuration to update. If omitted, a new configuration is created.
      - `evp_query` string, required — Query that selects the spans the patterns run analyzes.
      - `hierarchy_depth` integer, required — Depth of the topic hierarchy to generate.
      - `integration_provider` string — Integration provider for a bring-your-own-model configuration.
      - `model_name` string — Model name for a bring-your-own-model configuration.
      - `name` string, required — Name of the configuration.
      - `num_records` integer, required — Maximum number of records to process for the run.
      - `sampling_ratio` number, double, required — Fraction of matching spans to sample for the run.
      - `scope` string — Scope of the configuration.
      - `template` string — Template used to guide topic generation.
    - `type` 'topic_discovery_configs', required — Resource type of an LLM Observability patterns configuration.

## Response `200`

OK

- LLMObsPatternsConfigResponse — Response containing a single LLM Observability patterns configuration.
  - `data` LLMObsPatternsConfigResponseData, required — Data object of an LLM Observability patterns configuration.
    - `attributes` LLMObsPatternsConfigAttributes, required — Attributes of an LLM Observability patterns configuration.
      - `account_id` string, nullable — Integration account ID for a bring-your-own-model configuration.
      - `created_at` string, date-time, required — Timestamp when the configuration was created.
      - `evp_query` string, required — Query that selects the spans the patterns run analyzes.
      - `hierarchy_depth` integer, required — Depth of the topic hierarchy to generate.
      - `integration_provider` string, nullable — Integration provider for a bring-your-own-model configuration.
      - `model_name` string, nullable — Model name for a bring-your-own-model configuration.
      - `name` string, required — Name of the configuration.
      - `num_records` integer, required — Maximum number of records to process for the run.
      - `sampling_ratio` number, double, required — Fraction of matching spans to sample for the run.
      - `scope` string, required — Scope of the configuration.
      - `template` string, nullable — Template used to guide topic generation.
      - `updated_at` string, date-time, required — Timestamp when the configuration was last updated.
    - `id` string, required — Unique identifier of the configuration.
    - `type` 'topic_discovery_configs', required — Resource type of an LLM Observability patterns configuration.

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `429` — Too many requests
- `500` — Internal Server Error

---

[API](https://skmtc.net/datadog/apis/api-v2.md) · [All operations](https://skmtc.net/datadog/apis/api-v2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/datadog/api-v2/revisions/da68bf029e4c/schema)
