Get Span
GEThttps://api.confident-ai.com/v2/spans/{spanUuid}
Retrieves a span by uuid from your Confident AI project, with its full input and output, evaluation fields, results and annotations.
curl -X GET "https://api.confident-ai.com/v2/spans/{spanUuid}" \
-H "CONFIDENT_API_KEY: <PROJECT-API-KEY>"{
"success": true,
"data": {
"uuid": "<SPAN-UUID>",
"traceUuid": "<TRACE-UUID>",
"parentUuid": "<PARENT-SPAN-UUID>",
"name": "OpenAI Call",
"type": "SPAN",
"status": "SUCCESS",
"startTime": "2025-01-15T10:30:00.000Z",
"endTime": "2025-01-15T10:30:02.000Z",
"error": null,
"integration": "LangChain",
"provider": "OpenAI",
"model": "gpt-4o",
"endpoint": null,
"cost": 0.00018,
"inputTokenCost": 0.00006,
"outputTokenCost": 0.00012,
"costPerInputToken": 0.0000025,
"costPerOutputToken": 0.00001,
"inputTokenCount": 24,
"outputTokenCount": 12,
"promptAlias": "geography-assistant",
"promptVersion": "00.00.01",
"promptLabel": "production",
"promptCommitHash": "bab04ce",
"embedder": null,
"topK": null,
"chunkSize": null,
"description": null,
"agentHandoffs": null,
"availableTools": null,
"metadata": {
"region": "Europe"
},
"metricCollectionName": "LLM Collection Name",
"input": "What is the capital of France?",
"output": "The capital of France is Paris.",
"expectedOutput": "Paris",
"retrievalContext": [
"Paris is the capital and most populous city of France."
],
"context": null,
"toolsCalled": [
{
"name": "get_landmark_info",
"type": "FUNCTION",
"description": "This tool gives information about a mountain.",
"inputParameters": {
"mountain": "Everest"
},
"output": "8,848 metres",
"reasoning": "The user asked for the height of a mountain."
}
],
"expectedTools": [
{
"name": "get_landmark_info",
"type": "FUNCTION",
"description": "This tool gives information about a mountain.",
"inputParameters": {
"mountain": "Everest"
},
"output": "8,848 metres",
"reasoning": "The user asked for the height of a mountain."
}
],
"metricsData": [
{
"id": "<METRIC-DATA-ID>",
"name": "Answer Relevancy",
"score": 0.95,
"reason": "The answer directly states the capital of France.",
"success": true,
"threshold": 0.5,
"strictMode": false,
"skipped": false,
"flaky": false,
"evaluationModel": "gpt-4o",
"evaluationCost": 0.0004,
"error": null,
"errorType": "AI_CONNECTION_ERROR",
"createdAt": "2025-01-15T10:30:06.000Z",
"evaluatedAt": "2025-01-15T10:30:09.000Z",
"multiTurn": false
}
],
"annotations": [
{
"id": "<ANNOTATION-ID>",
"rating": 1,
"type": "FIVE_STAR_RATING",
"name": null,
"explanation": "Correct and concise.",
"expectedOutcome": null,
"expectedOutput": "The capital of France is Paris.",
"createdAt": "2025-01-15T11:00:00.000Z",
"user": {
"id": "<USER-ID>",
"email": "jane@acme.com",
"name": "Jane Doe",
"image": null
}
}
]
},
"deprecated": false
}Headers
CONFIDENT_API_KEYstringRequiredThe API key of your Confident AI project.
Path parameters
spanUuidstringRequiredThe unique identifier of the span.
Response
Get Span succeeded.
successbooleanIndicates if the request was successful.
dataobjectA span with its full input and output, evaluation fields, results and annotations.
Show 41 propertiesHide 41 properties
uuidstringThis is the unique identifier of the span.
traceUuidstringThis is the uuid of the trace containing the span.
parentUuidstring | nullThis is the uuid of the parent span, or null for a root span.
namestring | nullThis is the name of the span.
typeenumThe kind of work a span records: SPAN for a plain step, LLM for a model call, RETRIEVER for a knowledge-base lookup, TOOL for a tool call, and AGENT for an agent step.
Show 5 enum valuesHide 5 enum values
SPANAGENTTOOLRETRIEVERLLM
statusenumThis represents the error status of a trace or span: SUCCESS when it completed, ERRORED when it failed.
Show 2 enum valuesHide 2 enum values
SUCCESSERRORED
startTimestringThis is the time the span started.
endTimestringThis is the time the span ended.
errorstring | nullThis is the error string that caused the span to fail, or null when no error occurred.
integrationstring | nullThis is the integration associated with the span.
providerstring | nullThis is the LLM provider used in an LLM span.
modelstring | nullThis is the LLM model used in an LLM span.
endpointstring | nullThis is the API endpoint the model was called through in an LLM span.
costnumber | nullThis is the total cost of the span in USD, or null when it is not known.
inputTokenCostnumber | nullThis is the total cost of the input tokens passed to the LLM model in an LLM span.
outputTokenCostnumber | nullThis is the total cost of the output tokens generated by the LLM model in an LLM span.
costPerInputTokennumber | nullThis is the cost per input token of the LLM model for an LLM span.
costPerOutputTokennumber | nullThis is the cost per output token of the LLM model for an LLM span.
inputTokenCountinteger | nullThis is the total number of input tokens passed to the LLM model in an LLM span.
outputTokenCountinteger | nullThis is the total number of output tokens generated by the LLM model in an LLM span.
promptAliasstring | nullThis is the alias of your prompt which is stored on Confident AI.
promptVersionstring | nullThis is the version assigned to your prompt on Confident AI.
promptLabelstring | nullThis is the label assigned to a specific version of prompt on the Confident AI platform.
promptCommitHashstring | nullThis is the hash of the current prompt being logged in the llm span.
embedderstring | nullThis is the embedder model used in a retriever span.
topKinteger | nullThis is the top K chunks retrieved from your knowledge base in a retriever span.
chunkSizeinteger | nullThis is the chunk size of each retrieved context for a retriever span.
descriptionstring | nullThis is a description if the span is a tool span.
agentHandoffsarray | nullThis is the list of agent handoffs associated with an agent span.
availableToolsarray | nullThis is the list of available tools associated with an agent span.
metadataobject | nullThis is any additional metadata associated with the span.
metricCollectionNamestring | nullThis is the name of the metric collection to evaluate the span.
inputstring | nullThis is the input to the span. JSON inputs are serialized to a string.
outputstring | nullThis is the output of the span. JSON outputs are serialized to a string.
expectedOutputstring | nullThis is the expected output of your span, which is the ideal actual output and to be used for evaluation.
retrievalContextarray | nullThis is the retrieval context of your span, which is to be used for evaluation.
contextarray | nullThis is the ideal retrieval context of your span, which is to be used for evaluation.
toolsCalledarray | nullThis is the tools called by your span, which is to be used for evaluation.
Show 6 propertiesHide 6 properties
namestringThis is the name of the tool.
typeenumThe type of the tool call, either a function or an MCP tool.
Show 2 enum valuesHide 2 enum values
FUNCTIONMCP
descriptionstringThis is the description of the tool.
inputParametersobject | nullThis is the input parameters that are passed to the tool.
outputanyThis is the output of the tool.
reasoningstringThis is the reasoning your LLM provided for the tool call.
expectedToolsarray | nullThis is the expected tools to be called by the span, which is to be used for evaluation.
Show 6 propertiesHide 6 properties
namestringThis is the name of the tool.
typeenumThe type of the tool call, either a function or an MCP tool.
Show 2 enum valuesHide 2 enum values
FUNCTIONMCP
descriptionstringThis is the description of the tool.
inputParametersobject | nullThis is the input parameters that are passed to the tool.
outputanyThis is the output of the tool.
reasoningstringThis is the reasoning your LLM provided for the tool call.
metricsDatalist of objectsThis is the metrics data associated with the span.
Show 16 propertiesHide 16 properties
idstringThe unique identifier of the metric data entry.
namestringThe name of the metric.
scorenumber | nullThe final metric score, or null when the metric errored or was skipped.
reasonstring | nullThe reason for the metric score, generated by the evaluation model at evaluation time.
successboolean | nullWhether the metric score is above the threshold, or null while the evaluation is still running.
thresholdnumber | nullThe threshold for the metric, which determines if the metric is passing or failing.
strictModebooleanWhether the metric was run in strict mode, which outputs a binary score of 0 or 1.
skippedbooleanWhether the metric evaluation was skipped.
flakybooleanWhether the metric's verdict was non-deterministic across runs.
evaluationModelstring | nullThe evaluation model used to run the evaluation.
evaluationCostnumber | nullThe cost of running the evaluation in USD.
errorstring | nullThe error message if the evaluation failed.
errorTypeenum | nullWhy an evaluation errored: the AI connection or a transformer failed, the evaluation model failed, the test case lacked the parameters the metric needs, or an internal error occurred.
Show 5 enum valuesHide 5 enum values
AI_CONNECTION_ERRORTRANSFORMER_ERROREVALUATION_MODEL_ERRORINVALID_TEST_CASE_PARAMETERSINTERNAL_ERROR
createdAtstringThe time the metric data was created.
evaluatedAtstring | nullThe time the metric was evaluated, or null while it is still running.
multiTurnbooleanWhether this metric was evaluated on a multi-turn conversation.
annotationslist of objectsThis is the list of annotations associated with the span.
Show 9 propertiesHide 9 properties
idstringThis is the id of the annotation generated by Confident AI.
ratingintegerThis is the annotated rating score.
typeenumThis is the type of annotation, which can be either thumbs rating or five star rating.
Show 2 enum valuesHide 2 enum values
FIVE_STAR_RATINGTHUMBS_RATING
namestring | nullThe name of the annotation.
explanationstring | nullThis is the explanation for the annotation.
expectedOutcomestring | nullThis is the annotated expected outcome, for conversation annotations.
expectedOutputstring | nullThis is the annotated expected output, for span and trace annotations.
createdAtstringThe timestamp when the annotation was created.
userobject | nullA Confident AI user, as referenced by the records they created.
Show 4 propertiesHide 4 properties
idstringThis is the id of the user.
emailstringThis is the email address of the user.
namestring | nullThis is the display name of the user, or null when they have not set one.
imagestring | nullThis is the URL of the user's avatar, or null when they have none.
deprecatedbooleanIndicates if this endpoint is deprecated.