For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Trust CenterStatusSupportGet a demoPlatform
DocumentationEvals API ReferenceIntegrations & OTELPlatform SettingsSelf-HostingChangelog
DocumentationEvals API ReferenceIntegrations & OTELPlatform SettingsSelf-HostingChangelog
  • Get Started
    • Introduction
    • Quickstart
    • Authentication
    • Data Models
    • API Conventions
  • Metrics
    • GETList Metrics
    • POSTCreate Metrics
    • PUTUpdate Metrics
    • POSTBatch Create
  • Metric Collections
    • GETList Metric Collections
    • POSTAdd Collection
    • PUTUpdate Collection
  • Datasets
    • GETList Datasets
    • GETPull Dataset
    • POSTPush Dataset
    • DELDelete Dataset
  • Evaluation
    • POSTRun LLM Evals
    • POSTSimulate Conversation
    • POSTEvaluate Span
    • POSTEvaluate Trace
    • POSTEvaluate Thread
    • GETRetrieve Test Run
    • GETList Test Runs
  • Tracing
    • GETList Traces
    • POSTTrace Ingestion
    • GETRetrieve Trace
    • GETList Spans
    • GETRetrieve Span
  • Threads
    • GETList Threads
    • GETRetrieve Thread
  • Prompt
    • GETList Prompts
    • POSTPush Prompts
    • GETPull Prompts By Label
    • GETPull Prompts By Version
    • GETPull Prompts By Commit
    • GETList Versions
    • POSTCreate Version
    • GETList Commits
    • GETList Branches
    • POSTCreate Branch
    • PUTUpdate Branch
    • DELDelete Branch
  • Metric Data
    • GETList Metrics Data
  • Annotations
    • GETList Annotations
    • POSTCreate Annotation
    • GETGet Annotation
    • PUTUpdate Annotation
  • Annotation Queues
    • GETList Annotation Queues
    • POSTCreate Annotation Queue
    • GETGet Annotation Queue
    • DELDelete Annotation Queue
    • GETList Queue Items
    • POSTAnnotate Queue Item
  • Projects
    • GETList Projects
    • POSTCreate Project
    • PUTUpdate Project
LogoLogo
Trust CenterStatusSupportGet a demoPlatform
Metrics

Create Metrics

POST
https://api.confident-ai.com/v1/metrics
POST
/v1/metrics
$curl -X POST https://api.confident-ai.com/v1/metrics \
> -H "CONFIDENT_API_KEY: <PROJECT-API-KEY>" \
> -H "Content-Type: application/json" \
> -d '{
> "name": "Correctness",
> "multiTurn": false,
> "criteria": "Determine if the `actual output` is correct based on the `expected output`.",
> "evaluationParams": [
> "actualOutput",
> "expectedOutput"
> ]
>}'
200Single-Turn
1{
2 "success": true,
3 "data": {
4 "id": "METRIC-ID"
5 },
6 "deprecated": false
7}
Creates a new metric on your Confident AI project.
Was this page helpful?
Previous

Update Metrics

Next
Built with

Headers

CONFIDENT_API_KEYstringRequired
The API key of your Confident AI project.

Request

namestringRequired
The name of the metric you're creating in your project.
multiTurnbooleanRequired

This is true if your metric is used for evaluating multi-turn test cases.

criteriastringOptional
The criteria for this particular metric, that will be used to evaluate test cases later.
evaluationStepsstringOptional
An alternative to criteria, it is a list of steps to take to evaluate your test cases.
evaluationParamslist of enumsOptional
It is an array of the params that will be used to evaluate your test cases.
rubriclist of objectsOptional

A list of score ranges (0–10 inclusive). Must be in order and non-overlapping. Click here to learn more

Response

successboolean
This is true if the metric was created successfully.
dataobject
This maps to the id of the metric created.
deprecatedboolean
This is true if this metrics endpoint is deprecated.