> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://hiddenlayer.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://hiddenlayer.ferndocs.com/_mcp/server.

# Submit Target Response

POST https://api.hiddenlayer.ai/evaluations/v1/red-team/{workflow_id}/target-response
Content-Type: application/json

[BETA] This endpoint is not GA or Production ready and is subject to changes at any time. Breaking changes may occur.

Submit target's response.

This triggers the ProcessTargetResponseWorkflow child workflow
for the specified session. Returns immediately.


Reference: https://hiddenlayer.ferndocs.com/api-reference/llm-proxy-api/red-team/submit-target-response

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Servers

- `https://api.hiddenlayer.ai` (ProdUs, default)
- `https://api.eu.hiddenlayer.ai` (ProdEu)

## Request

### Path parameters

- `workflow_id` (string, required)

### Body (application/json)

This endpoint expects a SubmitTargetResponseBody.

- `session_id` (string, required) — Session identifier
- `target_response` (string, required) — Target's response text

## Response

### 202

Accepted - response processing started

- `is_ok` (boolean, required) — Whether the submission was successful
- `message` (string, required) — Human-readable status message
- `error` (string, optional) — Error code if ok=false

## Errors

### 400 Bad Request Error

The request failed due to a client error, with one or more of the following possible causes: 1. The request required a tenant_id field, which was missing. 2. The request was malformed syntactically or semantically.

- `any`

### 401 Unauthorized Error

Authentication Error

- `detail` (string, required, default: Failed to authenticate)

### 403 Forbidden Error

Forbidden Error

- `detail` (string, required, default: Forbidden operation)

### 404 Not Found Error

The specified resource was not found.

- `any`

### 422 Unprocessable Entity Error

Validation Error

- `errors` (list of ProblemDetailsErrorsItems, required) — Error details
- `type` (string, optional) — https://www.rfc-editor.org/rfc/rfc9457.html#name-type
- `title` (string, optional) — https://www.rfc-editor.org/rfc/rfc9457.html#name-title
- `detail` (string, optional) — https://www.rfc-editor.org/rfc/rfc9457.html#name-detail
- `instance` (string, optional) — https://www.rfc-editor.org/rfc/rfc9457.html#name-instance

## Types

### ProblemDetailsErrorsItems

- `code` (string, optional)
- `detail` (string, optional)
- `pointer` (list of string, optional) — array of JSON Pointers

## Examples

**Request**

```json
{
  "session_id": "string",
  "target_response": "string"
}
```

**Response**

```json
{
  "is_ok": true,
  "message": "string",
  "error": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.hiddenlayer.ai/evaluations/v1/red-team/workflow_id/target-response"

payload = {
    "session_id": "string",
    "target_response": "string"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.hiddenlayer.ai/evaluations/v1/red-team/workflow_id/target-response';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"session_id":"string","target_response":"string"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.hiddenlayer.ai/evaluations/v1/red-team/workflow_id/target-response"

	payload := strings.NewReader("{\n  \"session_id\": \"string\",\n  \"target_response\": \"string\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.hiddenlayer.ai/evaluations/v1/red-team/workflow_id/target-response")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"session_id\": \"string\",\n  \"target_response\": \"string\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.hiddenlayer.ai/evaluations/v1/red-team/workflow_id/target-response")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"session_id\": \"string\",\n  \"target_response\": \"string\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.hiddenlayer.ai/evaluations/v1/red-team/workflow_id/target-response', [
  'body' => '{
  "session_id": "string",
  "target_response": "string"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.hiddenlayer.ai/evaluations/v1/red-team/workflow_id/target-response");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"session_id\": \"string\",\n  \"target_response\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "session_id": "string",
  "target_response": "string"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.hiddenlayer.ai/evaluations/v1/red-team/workflow_id/target-response")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```