---
title: "Refine generated test cases with a follow-up prompt"
method: POST
path: "/api/v1/tcg/{id}/refine"
tags: ["TCG"]
---

# Refine generated test cases with a follow-up prompt

`POST /api/v1/tcg/{id}/refine`

## Request

- Base URL: `https://toolkit.browserstack.com`
- URL: `https://toolkit.browserstack.com/api/v1/tcg/{id}/refine`
- Auth: API key in cookie `_wdt_rails_session`

Refines an already-completed test case generation in place: the TCG service iterates on the prior context (same contextReferenceKey) using the given prompt, and the report is rebuilt through the existing webhook pipeline (LV-3525).

## Path parameters

- `id` string, required

## Request body

- object
  - `user_prompt` string, required

## Response `200`

Refinement started successfully

- object
  - `data` object
    - `id` string
    - `attributes` object
      - `status` string
      - `refining` boolean

## Other responses

- `422`: Unprocessable entity - refinement rejected

---

[API](https://skmtc.dev/birdeatsbug/apis/wdt-rails-api.md) - [All operations](https://skmtc.dev/birdeatsbug/apis/wdt-rails-api/llms.txt) - [OpenAPI document](https://skmtc.dev/birdeatsbug/apis/wdt-rails-api/revisions/cbd06b547b6a?raw)
