Test Code
POSThttps://api.confident-ai.com/v2/transformers/{transformerId}/test-code
Runs the transformer's stored code against a sample value and returns what it produced. Code that raises or times out is a completed test, so it comes back with a 200 and success: false carrying error and reason — branch on success rather than on the status. A 404 means the transformer does not exist in this project, and a 400 means it has no code saved to run.
curl -X POST "https://api.confident-ai.com/v2/transformers/{transformerId}/test-code" \
-H "CONFIDENT_API_KEY: <PROJECT-API-KEY>" \
-H "Content-Type: application/json" \
-d '{
"inputData": {
"data": {
"answer": "Mount Everest is 8,849 metres tall."
}
}
}'{
"success": true,
"data": {
"success": true,
"output": "Mount Everest is 8,849 metres tall.",
"verboseLogs": null
},
"deprecated": false
}Headers
CONFIDENT_API_KEYstringRequiredThe API key of your Confident AI project.
Path parameters
transformerIdstringRequiredThe id of the transformer.
Request body
inputDataanyThe value to pass to the transformer's
transformfunction. Any JSON value is accepted; send the shape the transformer expects to see in production.
Response
Test Code succeeded.
successbooleanIndicates if the request was successful.
dataobject | objectWhat running the transformer's code against your sample produced. Branch on
success: the code raising is reported here, not as an error status.Show 2 variantsHide 2 variants
Transformer Code Run SuccessobjectA run of the transformer's code that returned a value.
Show 3 propertiesHide 3 properties
successenumMarks the run as successful.
Show 1 enum valueHide 1 enum value
true
outputanyThe value the transformer returned. Any JSON value.
verboseLogsstring | null
- OR
Transformer Code Run FailureobjectA run of the transformer's code that raised or timed out. Code that fails is still a completed test, so this is returned with a 200; branch on
success.Show 4 propertiesHide 4 properties
successenumMarks the run as failed.
Show 1 enum valueHide 1 enum value
false
errorstring | nullreasonstring | nullverboseLogsstring | null
deprecatedbooleanIndicates if this endpoint is deprecated.