---
title: "Generate Agent Config"
method: POST
path: "/voice/agents/{agentId}/generation/generate"
tags: ["Voice Agents"]
---

# Generate Agent Config

`POST /voice/agents/{agentId}/generation/generate`

## Request

- Base URL: `https://api.speakai.co/v1`
- URL: `https://api.speakai.co/v1/voice/agents/{agentId}/generation/generate`
- Auth: API key in header `x-speakai-key` and API key in header `x-access-token`

### Generate Agent Config

Requires the OWNER or ADMIN role. Runs the prompt-to-config pipeline against an existing agent: extracts a config from prompt via the LLM, and either persists it onto the agent (response has an agent key), or, when the prompt is too thin to act on and manualInstructions was not sent, returns a follow-up question instead (response has needsFollowUp: true) so you can call this again with more detail.

## Path parameters

- `agentId` string, required

## Request body

- object
  - `prompt` string, required: Required. Describe the agent you want in a sentence or two.
  - `name` string
  - `manualInstructions` string: Skips the thin-prompt follow-up question and generates immediately, folding this in as additional context.

## Response `200`

OK

- object
  - `status` 'success'
  - `data` union
    - object: When the prompt still needs more detail after the follow-up.
      - `needsFollowUp` true
      - `followUpQuestion` string
      - `extracted` object
    - object: When generation succeeded and the agent was updated.
      - `agent` object: The updated agent. Full shape documented on the Voice Agents page.

## Other responses

- `400`: Validation failed
- `403`: Caller's role is not OWNER or ADMIN
- `404`: Agent not found

---

[API](https://skmtc.dev/speakai/apis/speak-ai-api.md) · [All operations](https://skmtc.dev/speakai/apis/speak-ai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/speakai/apis/speak-ai-api/revisions/52d777e6d46e?raw)
