---
title: "Refine Structured Prompt"
method: POST
path: "/tailored-gen/refine_structured_prompt"
tags: ["Dataset"]
---

# Refine Structured Prompt

`POST /tailored-gen/refine_structured_prompt`

Refines a Structured Prompt object (such as a Visual Schema or an Image Caption) based on user instructions.

**Access Control & Validation:**
* Requires a valid `dataset_id` to verify ownership.
* The referenced dataset must be in `draft` mode.

**Use Cases:**
1. **Refine Visual Schema:** Input the initial schema and instructions like "Make the style description more detailed".
2. **Refine Image Caption:** Input a specific image's caption and instructions like "Fix the description of the hair color".

## Headers

- `api_token` string, required

## Request body

- object
  - `dataset_id` integer, required — The ID of the dataset associated with this refinement.
  - `structured_prompt` string, required — The current structured prompt string (Visual Schema or Caption) to be refined.
  - `instruction` string, required — Natural language instruction describing how to modify the JSON.
  - `context_images` string[] — Optional. List of image URLs or Base64 strings to provide visual context.

## Response `200`

Successfully refined JSON.

- object
  - `structured_prompt` string — The refined Structured Prompt string.

## Other responses

- `400` — Bad request.
- `401` — Unauthorized.
- `403` — Forbidden.
- `404` — Dataset not found.
- `429` — Rate limit exceeded.
- `500` — Internal server error.

---

[API](https://skmtc.net/bria-ai/apis/tailored-generation-api-reference.md) · [All operations](https://skmtc.net/bria-ai/apis/tailored-generation-api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/bria-ai/tailored-generation-api-reference/revisions/806c6d31631b/schema)
