---
title: "Write a config revision"
method: PUT
path: "/v1/agent-config/{key}"
tags: ["Agent Config"]
---

# Write a config revision

`PUT /v1/agent-config/{key}`

## Request

- Base URL: `https://api.roark.ai`
- URL: `https://api.roark.ai/v1/agent-config/{key}`
- Auth: HTTP bearer

Write a new revision onto a channel. Writing production creates the key when it does not exist; writing staging stages a candidate that only Roark-recognized simulation sessions will read. Every write is a new revision; nothing is overwritten.

## Path parameters

- `key` string, required

## Request body

- WriteManagedConfigRequest
  - `channel` 'production' | 'staging', required: Which channel to write.
  - `document` object, required: The full config JSON for the new revision.
  - `summary` string: One-line story of the change.
  - `agentId` string, uuid: Link this config to a Roark agent (the one your calls report). Required before Autoimprove can run on it: the link is how a fix finds the config channel.

## Response `200`

The config with its updated channel pointers.

- object
  - `data` ManagedAgentConfig, required: A managed config for a code-first agent (LiveKit, Pipecat, or any stack using the SDK): your agent fetches its tunable surface from Roark at session start. Two channels: production for real traffic, staging for candidates under test.
    - `id` string, uuid, required
    - `key` string, required: The stable handle your code fetches by.
    - `agentId` string, uuid, nullable, required: The linked Roark agent, when one exists.
    - `productionRevisionId` string, uuid, nullable, required: The revision real traffic reads.
    - `stagingRevisionId` string, uuid, nullable, required: The candidate revision Roark test calls read. Null when nothing is staged.
    - `createdAt` string, required: ISO 8601.
    - `updatedAt` string, required: ISO 8601.

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Staging write on an unknown key
- `429`: Too Many Requests
- `500`: Internal Server Error

## Changes

> 187 revisions in range; 1 not diffed.

- **2026-09-22** `29256c5296cf`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/roarkhq/apis/roark-analytics-api/changes/v1/agent-config/:key/put.md)

---

[API](https://skmtc.dev/roarkhq/apis/roark-analytics-api.md) - [All operations](https://skmtc.dev/roarkhq/apis/roark-analytics-api/llms.txt) - [OpenAPI document](https://skmtc.dev/roarkhq/apis/roark-analytics-api/revisions/1a91a5c90e44?raw)
