Skip to main content

Documentation Index

Fetch the complete documentation index at: https://narev.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Endpoint

POST /api/applications/{application_id}/quality

Authentication

Include your Narev API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY

Request body

response_id
string
required
The ID of the response to score. Find this value in the generation logs under the id field of the chat completion response.
metric_name
string
required
Your custom metric name. Must start with the custom_ prefix (for example, custom_eslint_errors).
value
number
required
Numeric score for the metric. Narev treats higher values as better by default.
You must create a custom metric in the A/B test configuration before you can submit values for it. See the Narev Cloud dashboard under your A/B test’s Metrics settings.

Request example

import requests

response = requests.post(
    f"https://narev.ai/api/applications/{application_id}/quality",
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json"
    },
    json={
        "response_id": "gen-abc123",
        "metric_name": "custom_eslint_errors",
        "value": 4
    }
)

Error responses

All errors return a JSON object with an error field:
{
  "error": {
    "message": "Error description",
    "code": "error_code"
  }
}
StatusCodeDescription
400bad_requestInvalid request format or missing required fields
401invalid_api_keyInvalid or missing API key
404application_not_foundA/B test ID not found
404response_not_foundResponse ID not found in generation logs
500internal_errorInternal server error