> 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.

# Evaluate Response

POST https://api.hiddenlayer.ai/detection/v2/response-evaluations
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.

Analyzes an LLM response payload for security threats after it is received from the model.

Accepts any valid provider response payload and returns:
- If detect or redact action: the response payload (potentially modified) in the provider's response format
- If block action: a canned block message in the provider's response format

Use this endpoint inline in your LLM pipeline to evaluate model outputs before returning them to users.

Supported provider formats:
- [OpenAI Chat Completions](https://platform.openai.com/docs/api-reference/chat)
- [OpenAI Responses](https://platform.openai.com/docs/api-reference/responses)
- [Anthropic Messages](https://docs.anthropic.com/en/api/messages)


Reference: https://hiddenlayer.ferndocs.com/api-reference/llm-proxy-api/runtime/evaluate-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

### Headers

- `HL-Project-Id` (string, optional) — The ID or alias for the Project to govern the request processing.
- `HL-Runtime-Session-Id` (string, optional) — An externally-defined session identifier to group interactions in separate requests into a single session. The identifier should be unique across the all sessions.

### Body (application/json)

This endpoint expects a map from string to any.

- `map from string to any`

## Response

### 200

Successful evaluation. Returns the (potentially modified) provider response payload.

- `map from string to any`

## Examples

### OpenAI Chat Completion Response

**Request**

```json
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1704067200,
  "model": "gpt-4",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "The capital of France is Paris."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 25,
    "completion_tokens": 10,
    "total_tokens": 35
  }
}
```

**Response**

```json
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1704067200,
  "model": "gpt-4",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "The capital of France is Paris."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 25,
    "completion_tokens": 10,
    "total_tokens": 35
  }
}
```

**SDK Code**

```python OpenAI Chat Completion Response
import requests

url = "https://api.hiddenlayer.ai/detection/v2/response-evaluations"

payload = {
    "id": "chatcmpl-abc123",
    "object": "chat.completion",
    "created": 1704067200,
    "model": "gpt-4",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "The capital of France is Paris."
            },
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 25,
        "completion_tokens": 10,
        "total_tokens": 35
    }
}
headers = {
    "HL-Project-Id": "internal-search-chatbot",
    "HL-Runtime-Session-Id": "sess_4b8cde94604f4c389406a0b2f806069a",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript OpenAI Chat Completion Response
const url = 'https://api.hiddenlayer.ai/detection/v2/response-evaluations';
const options = {
  method: 'POST',
  headers: {
    'HL-Project-Id': 'internal-search-chatbot',
    'HL-Runtime-Session-Id': 'sess_4b8cde94604f4c389406a0b2f806069a',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{"id":"chatcmpl-abc123","object":"chat.completion","created":1704067200,"model":"gpt-4","choices":[{"index":0,"message":{"role":"assistant","content":"The capital of France is Paris."},"finish_reason":"stop"}],"usage":{"prompt_tokens":25,"completion_tokens":10,"total_tokens":35}}'
};

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

```go OpenAI Chat Completion Response
package main

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

func main() {

	url := "https://api.hiddenlayer.ai/detection/v2/response-evaluations"

	payload := strings.NewReader("{\n  \"id\": \"chatcmpl-abc123\",\n  \"object\": \"chat.completion\",\n  \"created\": 1704067200,\n  \"model\": \"gpt-4\",\n  \"choices\": [\n    {\n      \"index\": 0,\n      \"message\": {\n        \"role\": \"assistant\",\n        \"content\": \"The capital of France is Paris.\"\n      },\n      \"finish_reason\": \"stop\"\n    }\n  ],\n  \"usage\": {\n    \"prompt_tokens\": 25,\n    \"completion_tokens\": 10,\n    \"total_tokens\": 35\n  }\n}")

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

	req.Header.Add("HL-Project-Id", "internal-search-chatbot")
	req.Header.Add("HL-Runtime-Session-Id", "sess_4b8cde94604f4c389406a0b2f806069a")
	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 OpenAI Chat Completion Response
require 'uri'
require 'net/http'

url = URI("https://api.hiddenlayer.ai/detection/v2/response-evaluations")

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

request = Net::HTTP::Post.new(url)
request["HL-Project-Id"] = 'internal-search-chatbot'
request["HL-Runtime-Session-Id"] = 'sess_4b8cde94604f4c389406a0b2f806069a'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"id\": \"chatcmpl-abc123\",\n  \"object\": \"chat.completion\",\n  \"created\": 1704067200,\n  \"model\": \"gpt-4\",\n  \"choices\": [\n    {\n      \"index\": 0,\n      \"message\": {\n        \"role\": \"assistant\",\n        \"content\": \"The capital of France is Paris.\"\n      },\n      \"finish_reason\": \"stop\"\n    }\n  ],\n  \"usage\": {\n    \"prompt_tokens\": 25,\n    \"completion_tokens\": 10,\n    \"total_tokens\": 35\n  }\n}"

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

```java OpenAI Chat Completion Response
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.hiddenlayer.ai/detection/v2/response-evaluations")
  .header("HL-Project-Id", "internal-search-chatbot")
  .header("HL-Runtime-Session-Id", "sess_4b8cde94604f4c389406a0b2f806069a")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"id\": \"chatcmpl-abc123\",\n  \"object\": \"chat.completion\",\n  \"created\": 1704067200,\n  \"model\": \"gpt-4\",\n  \"choices\": [\n    {\n      \"index\": 0,\n      \"message\": {\n        \"role\": \"assistant\",\n        \"content\": \"The capital of France is Paris.\"\n      },\n      \"finish_reason\": \"stop\"\n    }\n  ],\n  \"usage\": {\n    \"prompt_tokens\": 25,\n    \"completion_tokens\": 10,\n    \"total_tokens\": 35\n  }\n}")
  .asString();
```

```php OpenAI Chat Completion Response
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.hiddenlayer.ai/detection/v2/response-evaluations', [
  'body' => '{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1704067200,
  "model": "gpt-4",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "The capital of France is Paris."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 25,
    "completion_tokens": 10,
    "total_tokens": 35
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'HL-Project-Id' => 'internal-search-chatbot',
    'HL-Runtime-Session-Id' => 'sess_4b8cde94604f4c389406a0b2f806069a',
  ],
]);

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

```csharp OpenAI Chat Completion Response
using RestSharp;

var client = new RestClient("https://api.hiddenlayer.ai/detection/v2/response-evaluations");
var request = new RestRequest(Method.POST);
request.AddHeader("HL-Project-Id", "internal-search-chatbot");
request.AddHeader("HL-Runtime-Session-Id", "sess_4b8cde94604f4c389406a0b2f806069a");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"id\": \"chatcmpl-abc123\",\n  \"object\": \"chat.completion\",\n  \"created\": 1704067200,\n  \"model\": \"gpt-4\",\n  \"choices\": [\n    {\n      \"index\": 0,\n      \"message\": {\n        \"role\": \"assistant\",\n        \"content\": \"The capital of France is Paris.\"\n      },\n      \"finish_reason\": \"stop\"\n    }\n  ],\n  \"usage\": {\n    \"prompt_tokens\": 25,\n    \"completion_tokens\": 10,\n    \"total_tokens\": 35\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift OpenAI Chat Completion Response
import Foundation

let headers = [
  "HL-Project-Id": "internal-search-chatbot",
  "HL-Runtime-Session-Id": "sess_4b8cde94604f4c389406a0b2f806069a",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1704067200,
  "model": "gpt-4",
  "choices": [
    [
      "index": 0,
      "message": [
        "role": "assistant",
        "content": "The capital of France is Paris."
      ],
      "finish_reason": "stop"
    ]
  ],
  "usage": [
    "prompt_tokens": 25,
    "completion_tokens": 10,
    "total_tokens": 35
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.hiddenlayer.ai/detection/v2/response-evaluations")! 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()
```

### OpenAI Responses API Response

**Request**

```json
{
  "id": "resp_abc123",
  "object": "response",
  "created_at": 1704067200,
  "model": "gpt-4o",
  "output": [
    {
      "type": "message",
      "id": "msg_abc123",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "The capital of France is Paris."
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 25,
    "output_tokens": 10,
    "total_tokens": 35
  }
}
```

**Response**

```json
{
  "id": "resp_abc123",
  "object": "response",
  "created_at": 1704067200,
  "model": "gpt-4o",
  "output": [
    {
      "type": "message",
      "id": "msg_abc123",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "The capital of France is Paris."
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 25,
    "output_tokens": 10,
    "total_tokens": 35
  }
}
```

**SDK Code**

```python OpenAI Responses API Response
import requests

url = "https://api.hiddenlayer.ai/detection/v2/response-evaluations"

payload = {
    "id": "resp_abc123",
    "object": "response",
    "created_at": 1704067200,
    "model": "gpt-4o",
    "output": [
        {
            "type": "message",
            "id": "msg_abc123",
            "role": "assistant",
            "content": [
                {
                    "type": "output_text",
                    "text": "The capital of France is Paris."
                }
            ]
        }
    ],
    "usage": {
        "input_tokens": 25,
        "output_tokens": 10,
        "total_tokens": 35
    }
}
headers = {
    "HL-Project-Id": "internal-search-chatbot",
    "HL-Runtime-Session-Id": "sess_4b8cde94604f4c389406a0b2f806069a",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript OpenAI Responses API Response
const url = 'https://api.hiddenlayer.ai/detection/v2/response-evaluations';
const options = {
  method: 'POST',
  headers: {
    'HL-Project-Id': 'internal-search-chatbot',
    'HL-Runtime-Session-Id': 'sess_4b8cde94604f4c389406a0b2f806069a',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{"id":"resp_abc123","object":"response","created_at":1704067200,"model":"gpt-4o","output":[{"type":"message","id":"msg_abc123","role":"assistant","content":[{"type":"output_text","text":"The capital of France is Paris."}]}],"usage":{"input_tokens":25,"output_tokens":10,"total_tokens":35}}'
};

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

```go OpenAI Responses API Response
package main

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

func main() {

	url := "https://api.hiddenlayer.ai/detection/v2/response-evaluations"

	payload := strings.NewReader("{\n  \"id\": \"resp_abc123\",\n  \"object\": \"response\",\n  \"created_at\": 1704067200,\n  \"model\": \"gpt-4o\",\n  \"output\": [\n    {\n      \"type\": \"message\",\n      \"id\": \"msg_abc123\",\n      \"role\": \"assistant\",\n      \"content\": [\n        {\n          \"type\": \"output_text\",\n          \"text\": \"The capital of France is Paris.\"\n        }\n      ]\n    }\n  ],\n  \"usage\": {\n    \"input_tokens\": 25,\n    \"output_tokens\": 10,\n    \"total_tokens\": 35\n  }\n}")

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

	req.Header.Add("HL-Project-Id", "internal-search-chatbot")
	req.Header.Add("HL-Runtime-Session-Id", "sess_4b8cde94604f4c389406a0b2f806069a")
	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 OpenAI Responses API Response
require 'uri'
require 'net/http'

url = URI("https://api.hiddenlayer.ai/detection/v2/response-evaluations")

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

request = Net::HTTP::Post.new(url)
request["HL-Project-Id"] = 'internal-search-chatbot'
request["HL-Runtime-Session-Id"] = 'sess_4b8cde94604f4c389406a0b2f806069a'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"id\": \"resp_abc123\",\n  \"object\": \"response\",\n  \"created_at\": 1704067200,\n  \"model\": \"gpt-4o\",\n  \"output\": [\n    {\n      \"type\": \"message\",\n      \"id\": \"msg_abc123\",\n      \"role\": \"assistant\",\n      \"content\": [\n        {\n          \"type\": \"output_text\",\n          \"text\": \"The capital of France is Paris.\"\n        }\n      ]\n    }\n  ],\n  \"usage\": {\n    \"input_tokens\": 25,\n    \"output_tokens\": 10,\n    \"total_tokens\": 35\n  }\n}"

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

```java OpenAI Responses API Response
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.hiddenlayer.ai/detection/v2/response-evaluations")
  .header("HL-Project-Id", "internal-search-chatbot")
  .header("HL-Runtime-Session-Id", "sess_4b8cde94604f4c389406a0b2f806069a")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"id\": \"resp_abc123\",\n  \"object\": \"response\",\n  \"created_at\": 1704067200,\n  \"model\": \"gpt-4o\",\n  \"output\": [\n    {\n      \"type\": \"message\",\n      \"id\": \"msg_abc123\",\n      \"role\": \"assistant\",\n      \"content\": [\n        {\n          \"type\": \"output_text\",\n          \"text\": \"The capital of France is Paris.\"\n        }\n      ]\n    }\n  ],\n  \"usage\": {\n    \"input_tokens\": 25,\n    \"output_tokens\": 10,\n    \"total_tokens\": 35\n  }\n}")
  .asString();
```

```php OpenAI Responses API Response
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.hiddenlayer.ai/detection/v2/response-evaluations', [
  'body' => '{
  "id": "resp_abc123",
  "object": "response",
  "created_at": 1704067200,
  "model": "gpt-4o",
  "output": [
    {
      "type": "message",
      "id": "msg_abc123",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "The capital of France is Paris."
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 25,
    "output_tokens": 10,
    "total_tokens": 35
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'HL-Project-Id' => 'internal-search-chatbot',
    'HL-Runtime-Session-Id' => 'sess_4b8cde94604f4c389406a0b2f806069a',
  ],
]);

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

```csharp OpenAI Responses API Response
using RestSharp;

var client = new RestClient("https://api.hiddenlayer.ai/detection/v2/response-evaluations");
var request = new RestRequest(Method.POST);
request.AddHeader("HL-Project-Id", "internal-search-chatbot");
request.AddHeader("HL-Runtime-Session-Id", "sess_4b8cde94604f4c389406a0b2f806069a");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"id\": \"resp_abc123\",\n  \"object\": \"response\",\n  \"created_at\": 1704067200,\n  \"model\": \"gpt-4o\",\n  \"output\": [\n    {\n      \"type\": \"message\",\n      \"id\": \"msg_abc123\",\n      \"role\": \"assistant\",\n      \"content\": [\n        {\n          \"type\": \"output_text\",\n          \"text\": \"The capital of France is Paris.\"\n        }\n      ]\n    }\n  ],\n  \"usage\": {\n    \"input_tokens\": 25,\n    \"output_tokens\": 10,\n    \"total_tokens\": 35\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift OpenAI Responses API Response
import Foundation

let headers = [
  "HL-Project-Id": "internal-search-chatbot",
  "HL-Runtime-Session-Id": "sess_4b8cde94604f4c389406a0b2f806069a",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "id": "resp_abc123",
  "object": "response",
  "created_at": 1704067200,
  "model": "gpt-4o",
  "output": [
    [
      "type": "message",
      "id": "msg_abc123",
      "role": "assistant",
      "content": [
        [
          "type": "output_text",
          "text": "The capital of France is Paris."
        ]
      ]
    ]
  ],
  "usage": [
    "input_tokens": 25,
    "output_tokens": 10,
    "total_tokens": 35
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.hiddenlayer.ai/detection/v2/response-evaluations")! 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()
```

### Anthropic Messages Response

**Request**

```json
{
  "id": "msg_abc123",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "The capital of France is Paris."
    }
  ],
  "model": "claude-3-sonnet-20240229",
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 25,
    "output_tokens": 10
  }
}
```

**Response**

```json
{
  "id": "msg_abc123",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "The capital of France is Paris."
    }
  ],
  "model": "claude-3-sonnet-20240229",
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 25,
    "output_tokens": 10
  }
}
```

**SDK Code**

```python Anthropic Messages Response
import requests

url = "https://api.hiddenlayer.ai/detection/v2/response-evaluations"

payload = {
    "id": "msg_abc123",
    "type": "message",
    "role": "assistant",
    "content": [
        {
            "type": "text",
            "text": "The capital of France is Paris."
        }
    ],
    "model": "claude-3-sonnet-20240229",
    "stop_reason": "end_turn",
    "usage": {
        "input_tokens": 25,
        "output_tokens": 10
    }
}
headers = {
    "HL-Project-Id": "internal-search-chatbot",
    "HL-Runtime-Session-Id": "sess_4b8cde94604f4c389406a0b2f806069a",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Anthropic Messages Response
const url = 'https://api.hiddenlayer.ai/detection/v2/response-evaluations';
const options = {
  method: 'POST',
  headers: {
    'HL-Project-Id': 'internal-search-chatbot',
    'HL-Runtime-Session-Id': 'sess_4b8cde94604f4c389406a0b2f806069a',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{"id":"msg_abc123","type":"message","role":"assistant","content":[{"type":"text","text":"The capital of France is Paris."}],"model":"claude-3-sonnet-20240229","stop_reason":"end_turn","usage":{"input_tokens":25,"output_tokens":10}}'
};

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

```go Anthropic Messages Response
package main

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

func main() {

	url := "https://api.hiddenlayer.ai/detection/v2/response-evaluations"

	payload := strings.NewReader("{\n  \"id\": \"msg_abc123\",\n  \"type\": \"message\",\n  \"role\": \"assistant\",\n  \"content\": [\n    {\n      \"type\": \"text\",\n      \"text\": \"The capital of France is Paris.\"\n    }\n  ],\n  \"model\": \"claude-3-sonnet-20240229\",\n  \"stop_reason\": \"end_turn\",\n  \"usage\": {\n    \"input_tokens\": 25,\n    \"output_tokens\": 10\n  }\n}")

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

	req.Header.Add("HL-Project-Id", "internal-search-chatbot")
	req.Header.Add("HL-Runtime-Session-Id", "sess_4b8cde94604f4c389406a0b2f806069a")
	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 Anthropic Messages Response
require 'uri'
require 'net/http'

url = URI("https://api.hiddenlayer.ai/detection/v2/response-evaluations")

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

request = Net::HTTP::Post.new(url)
request["HL-Project-Id"] = 'internal-search-chatbot'
request["HL-Runtime-Session-Id"] = 'sess_4b8cde94604f4c389406a0b2f806069a'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"id\": \"msg_abc123\",\n  \"type\": \"message\",\n  \"role\": \"assistant\",\n  \"content\": [\n    {\n      \"type\": \"text\",\n      \"text\": \"The capital of France is Paris.\"\n    }\n  ],\n  \"model\": \"claude-3-sonnet-20240229\",\n  \"stop_reason\": \"end_turn\",\n  \"usage\": {\n    \"input_tokens\": 25,\n    \"output_tokens\": 10\n  }\n}"

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

```java Anthropic Messages Response
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.hiddenlayer.ai/detection/v2/response-evaluations")
  .header("HL-Project-Id", "internal-search-chatbot")
  .header("HL-Runtime-Session-Id", "sess_4b8cde94604f4c389406a0b2f806069a")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"id\": \"msg_abc123\",\n  \"type\": \"message\",\n  \"role\": \"assistant\",\n  \"content\": [\n    {\n      \"type\": \"text\",\n      \"text\": \"The capital of France is Paris.\"\n    }\n  ],\n  \"model\": \"claude-3-sonnet-20240229\",\n  \"stop_reason\": \"end_turn\",\n  \"usage\": {\n    \"input_tokens\": 25,\n    \"output_tokens\": 10\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.hiddenlayer.ai/detection/v2/response-evaluations', [
  'body' => '{
  "id": "msg_abc123",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "The capital of France is Paris."
    }
  ],
  "model": "claude-3-sonnet-20240229",
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 25,
    "output_tokens": 10
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'HL-Project-Id' => 'internal-search-chatbot',
    'HL-Runtime-Session-Id' => 'sess_4b8cde94604f4c389406a0b2f806069a',
  ],
]);

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

```csharp Anthropic Messages Response
using RestSharp;

var client = new RestClient("https://api.hiddenlayer.ai/detection/v2/response-evaluations");
var request = new RestRequest(Method.POST);
request.AddHeader("HL-Project-Id", "internal-search-chatbot");
request.AddHeader("HL-Runtime-Session-Id", "sess_4b8cde94604f4c389406a0b2f806069a");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"id\": \"msg_abc123\",\n  \"type\": \"message\",\n  \"role\": \"assistant\",\n  \"content\": [\n    {\n      \"type\": \"text\",\n      \"text\": \"The capital of France is Paris.\"\n    }\n  ],\n  \"model\": \"claude-3-sonnet-20240229\",\n  \"stop_reason\": \"end_turn\",\n  \"usage\": {\n    \"input_tokens\": 25,\n    \"output_tokens\": 10\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Anthropic Messages Response
import Foundation

let headers = [
  "HL-Project-Id": "internal-search-chatbot",
  "HL-Runtime-Session-Id": "sess_4b8cde94604f4c389406a0b2f806069a",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "id": "msg_abc123",
  "type": "message",
  "role": "assistant",
  "content": [
    [
      "type": "text",
      "text": "The capital of France is Paris."
    ]
  ],
  "model": "claude-3-sonnet-20240229",
  "stop_reason": "end_turn",
  "usage": [
    "input_tokens": 25,
    "output_tokens": 10
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.hiddenlayer.ai/detection/v2/response-evaluations")! 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()
```