Update Transformer
PUThttps://api.confident-ai.com/v2/transformers/{transformerId}
Renames a transformer, changes its description, or replaces its code, and returns it. Sending codeDefinition overwrites the stored code, which every AI connection and metric collection already using this transformer picks up on its next run.
curl -X PUT "https://api.confident-ai.com/v2/transformers/{transformerId}" \
-H "CONFIDENT_API_KEY: <PROJECT-API-KEY>" \
-H "Content-Type: application/json" \
-d '{
"name": "Extract nested answer",
"description": "Pulls the answer out of a nested envelope.",
"codeDefinition": {
"code": "def transform(input_data):\n return input_data[\"data\"][\"answer\"]",
"language": "PYTHON"
}
}'{
"success": true,
"data": {
"id": "<TRANSFORMER-ID>",
"name": "Extract nested answer",
"description": "Pulls the answer out of a nested envelope.",
"createdAt": "2025-01-15T10:30:00.000Z",
"updatedAt": "2025-01-20T08:15:00.000Z",
"codeDefinition": {
"code": "def transform(input_data):\n return input_data[\"data\"][\"answer\"]",
"language": "PYTHON"
}
},
"deprecated": false
}Headers
CONFIDENT_API_KEYstringRequiredThe API key of your Confident AI project.
Path parameters
transformerIdstringRequiredThe id of the transformer.
Request body
namestringThe name of the transformer, unique within the project.
descriptionstring | nullWhat the transformer extracts. Send null to clear it.
codeDefinitionobjectThe code a transformer runs, with the language it is written in.
Show 2 propertiesHide 2 properties
codestringRequiredThe source of the transformer. It defines a
transformfunction that takes the value being transformed and returns the value to use in its place.languageenumRequiredThe language a transformer's code is written in.
Show 1 enum valueHide 1 enum value
PYTHON
Response
Update Transformer succeeded.
successbooleanIndicates if the request was successful.
dataobjectCode that reshapes a value on its way into or out of an evaluation, such as extracting the answer from your endpoint's response.
Show 6 propertiesHide 6 properties
idstringThe id of the transformer, generated by Confident AI.
namestringThe name of the transformer.
descriptionstring | nullWhat the transformer extracts.
createdAtstringThe timestamp when the transformer was created.
updatedAtstringThe timestamp when the transformer was last updated.
codeDefinitionobject | nullThe code a transformer runs, with the language it is written in.
Show 2 propertiesHide 2 properties
codestringThe source of the transformer. It defines a
transformfunction that takes the value being transformed and returns the value to use in its place.languageenumThe language a transformer's code is written in.
Show 1 enum valueHide 1 enum value
PYTHON
deprecatedbooleanIndicates if this endpoint is deprecated.