Refine Prompt
curl --request POST \
--url https://api.velt.dev/v2/agents/prompt/refine \
--header 'Content-Type: application/json' \
--header 'x-velt-api-key: <x-velt-api-key>' \
--header 'x-velt-auth-token: <x-velt-auth-token>' \
--data '
{
"data": {
"analysisPrompt": "<string>",
"demoFeedback": [
{}
],
"provider": "<string>"
}
}
'import requests
url = "https://api.velt.dev/v2/agents/prompt/refine"
payload = { "data": {
"analysisPrompt": "<string>",
"demoFeedback": [{}],
"provider": "<string>"
} }
headers = {
"x-velt-api-key": "<x-velt-api-key>",
"x-velt-auth-token": "<x-velt-auth-token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-velt-api-key': '<x-velt-api-key>',
'x-velt-auth-token': '<x-velt-auth-token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({data: {analysisPrompt: '<string>', demoFeedback: [{}], provider: '<string>'}})
};
fetch('https://api.velt.dev/v2/agents/prompt/refine', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.velt.dev/v2/agents/prompt/refine",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'analysisPrompt' => '<string>',
'demoFeedback' => [
[
]
],
'provider' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-velt-api-key: <x-velt-api-key>",
"x-velt-auth-token: <x-velt-auth-token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.velt.dev/v2/agents/prompt/refine"
payload := strings.NewReader("{\n \"data\": {\n \"analysisPrompt\": \"<string>\",\n \"demoFeedback\": [\n {}\n ],\n \"provider\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-velt-api-key", "<x-velt-api-key>")
req.Header.Add("x-velt-auth-token", "<x-velt-auth-token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.velt.dev/v2/agents/prompt/refine")
.header("x-velt-api-key", "<x-velt-api-key>")
.header("x-velt-auth-token", "<x-velt-auth-token>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"analysisPrompt\": \"<string>\",\n \"demoFeedback\": [\n {}\n ],\n \"provider\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.velt.dev/v2/agents/prompt/refine")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-velt-api-key"] = '<x-velt-api-key>'
request["x-velt-auth-token"] = '<x-velt-auth-token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"analysisPrompt\": \"<string>\",\n \"demoFeedback\": [\n {}\n ],\n \"provider\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"result": {
"status": "success",
"message": "Prompt refined successfully",
"data": {
"refinerResult": {
"analysis_prompt": "## Objective\n...\n\n## Detection Logic\n...",
"response_descriptions": {}
}
}
}
}
Prompt Tools
Refine Prompt
POST
/
v2
/
agents
/
prompt
/
refine
Refine Prompt
curl --request POST \
--url https://api.velt.dev/v2/agents/prompt/refine \
--header 'Content-Type: application/json' \
--header 'x-velt-api-key: <x-velt-api-key>' \
--header 'x-velt-auth-token: <x-velt-auth-token>' \
--data '
{
"data": {
"analysisPrompt": "<string>",
"demoFeedback": [
{}
],
"provider": "<string>"
}
}
'import requests
url = "https://api.velt.dev/v2/agents/prompt/refine"
payload = { "data": {
"analysisPrompt": "<string>",
"demoFeedback": [{}],
"provider": "<string>"
} }
headers = {
"x-velt-api-key": "<x-velt-api-key>",
"x-velt-auth-token": "<x-velt-auth-token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-velt-api-key': '<x-velt-api-key>',
'x-velt-auth-token': '<x-velt-auth-token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({data: {analysisPrompt: '<string>', demoFeedback: [{}], provider: '<string>'}})
};
fetch('https://api.velt.dev/v2/agents/prompt/refine', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.velt.dev/v2/agents/prompt/refine",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'analysisPrompt' => '<string>',
'demoFeedback' => [
[
]
],
'provider' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-velt-api-key: <x-velt-api-key>",
"x-velt-auth-token: <x-velt-auth-token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.velt.dev/v2/agents/prompt/refine"
payload := strings.NewReader("{\n \"data\": {\n \"analysisPrompt\": \"<string>\",\n \"demoFeedback\": [\n {}\n ],\n \"provider\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-velt-api-key", "<x-velt-api-key>")
req.Header.Add("x-velt-auth-token", "<x-velt-auth-token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.velt.dev/v2/agents/prompt/refine")
.header("x-velt-api-key", "<x-velt-api-key>")
.header("x-velt-auth-token", "<x-velt-auth-token>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"analysisPrompt\": \"<string>\",\n \"demoFeedback\": [\n {}\n ],\n \"provider\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.velt.dev/v2/agents/prompt/refine")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-velt-api-key"] = '<x-velt-api-key>'
request["x-velt-auth-token"] = '<x-velt-auth-token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"analysisPrompt\": \"<string>\",\n \"demoFeedback\": [\n {}\n ],\n \"provider\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"result": {
"status": "success",
"message": "Prompt refined successfully",
"data": {
"refinerResult": {
"analysis_prompt": "## Objective\n...\n\n## Detection Logic\n...",
"response_descriptions": {}
}
}
}
}
Use this API to refine an existing analysis prompt based on feedback from demo runs. You provide the current prompt and a list of demos with the user’s feedback on what went wrong; the engine returns a refined analysis prompt and updated response descriptions.
This is the iteration step in the prompt-design loop: run Validate Prompt to expand a simple instruction, run the demos against the resulting prompt, then refine when the demos don’t pass.
Errors:
Endpoint
POST https://api.velt.dev/v2/agents/prompt/refine
Headers
Your API key.
Your Auth Token.
Body
Params
Show properties
Show properties
Min 1 char. The current analysis prompt to refine. Typically the
analysis_prompt returned by Validate Prompt.Min 1 entry. Demo feedback items.Each entry:
| Field | Type | Required | Description |
|---|---|---|---|
demoId | string | yes | Min 1 char. Stable demo identifier. |
demoTitle | string | yes | Min 1 char. Human-readable demo title. |
demoHtml | string | yes | Min 1 char. HTML content the demo was run against. |
demoExpected | string | yes | Min 1 char. The expected outcome for this demo. |
feedback | string | yes | Min 1 char. Free-form feedback explaining what was wrong. |
LLM provider override:
"gemini" or "claude".Example Requests
Refine after a missed detection
{
"data": {
"analysisPrompt": "## Objective\nIdentify all broken links on the page.\n\n## Detection Logic\nCheck HTTP status codes for non-2xx responses.",
"demoFeedback": [
{
"demoId": "demo-1",
"demoTitle": "Mailto link with malformed address",
"demoHtml": "<a href=\"mailto:invalid email@\">Email us</a>",
"demoExpected": "detected",
"feedback": "The agent missed this — malformed mailto links should also count as broken links, not just non-2xx HTTP responses."
}
]
}
}
Response
Success Response
{
"result": {
"status": "success",
"message": "Prompt refined successfully",
"data": {
"refinerResult": {
"analysis_prompt": "## Objective\nIdentify all broken or non-functional hyperlinks on the page, including malformed mailto and tel links.\n\n## Detection Logic\nFor http(s) URLs, check HTTP status codes for non-2xx responses. For mailto links, validate the email address format. For tel links, validate the phone number format.",
"response_descriptions": {
"title": "Brief description of the broken link",
"severity": "critical for 5xx, high for 4xx and malformed mailto/tel, medium for timeouts, low for redirects",
"targetText": "The anchor text of the broken link",
"suggestion": "The correct URL, email address, or phone number"
}
}
}
}
}
| Field | Type | Description |
|---|---|---|
data.refinerResult.analysis_prompt | string | The refined analysis prompt. |
data.refinerResult.response_descriptions | object | Updated per-field descriptions for AI response shaping. |
Failure Response
{
"error": {
"message": "ERROR_MESSAGE",
"status": "INVALID_ARGUMENT"
}
}
INVALID_ARGUMENT (missing required fields, empty demoFeedback array, or any demo entry missing required fields).
{
"result": {
"status": "success",
"message": "Prompt refined successfully",
"data": {
"refinerResult": {
"analysis_prompt": "## Objective\n...\n\n## Detection Logic\n...",
"response_descriptions": {}
}
}
}
}
Was this page helpful?
⌘I

