---
title: "Apply Test Run Recommendation"
method: POST
path: "/voice/testing/{agentId}/runs/{runId}/recommendations/{recId}/apply"
tags: ["Voice Agent Testing"]
---

# Apply Test Run Recommendation

`POST /voice/testing/{agentId}/runs/{runId}/recommendations/{recId}/apply`

## Request

- Base URL: `https://api.speakai.co/v1`
- URL: `https://api.speakai.co/v1/voice/testing/{agentId}/runs/{runId}/recommendations/{recId}/apply`
- Auth: API key in header `x-speakai-key` and API key in header `x-access-token`

### Apply Recommendation

Requires the OWNER or ADMIN role. Applies a recommendation's quick action to the agent:

- `patch_instructions` / `instructions` — appends the recommendation's suggested fix to the agent's instructions.
- `update_personality` / `personality` — appends it to the agent's personality.
- `add_topic_to_avoid` / `topics_to_avoid` — adds it to `chatSettings.topicsToAvoid`.
- `add_lexicon_term` / `lexicon` / `add_to_kb` / `kb` — **marked applied but makes no change to the agent.** These two categories are not wired up yet; the run record reflects the acknowledgement, the agent config does not.

Any other action type returns 400. A recommendation with no `suggestedFix` also returns 400.

## Path parameters

- `agentId` string, required
- `runId` string, required
- `recId` string, required

## Response `200`

OK

- object
  - `status` 'success'
  - `data` object
    - `applied` boolean
    - `recommendation` object: The recommendation as stored on the run, now with applied: true and appliedAt set.

## Other responses

- `400`: Invalid transition, or recommendation has no suggested fix
- `403`: Caller's role is not OWNER or ADMIN
- `404`: Agent, run, or recommendation 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)
