Endpoints

Three endpoints covering single, batch, and auto-inferred transformations.

/api/v1/translate

Single payload transformation. Supply a source payload and a mapping definition to receive the transformed result instantly.

Single

/api/v1/translate/batch

Batch transformation. Send an array of payloads with a shared mapping and receive all results in a single response.

Batch

/api/v1/translate/infer

Auto-detect source schema, infer the optimal mapping to the target schema, and transform in one step.

Auto

Request & Response

Example showing a single payload translation with field mapping and type coercion.

POST /api/v1/translate Request
{
  "source": {
    "first_name": "Jane",
    "last_name": "Doe",
    "dob": "03/18/1992",
    "height_in": 66,
    "active": "yes"
  },
  "mapping": {
    "rules": [
      { "op": "concatenate",   "from": ["first_name", "last_name"], "to": "full_name", "separator": " " },
      { "op": "date_format",   "from": "dob",  "to": "date_of_birth", "inputFmt": "MM/dd/yyyy", "outputFmt": "yyyy-MM-dd" },
      { "op": "unit_convert",  "from": "height_in", "to": "height_cm", "unitFrom": "in", "unitTo": "cm" },
      { "op": "enum_map",      "from": "active",    "to": "is_active", "values": { "yes": true, "no": false } }
    ]
  },
  "options": {
    "null_handling": "omit"
  }
}
200 OK Response
{
  "translated": {
    "full_name": "Jane Doe",
    "date_of_birth": "1992-03-18",
    "height_cm": 167.64,
    "is_active": true
  },
  "quality_score": 1.0,
  "fields_mapped": 4,
  "fields_total": 4,
  "warnings": [],
  "duration_ms": 0.42
}

Transformation Operations

14 built-in operations for reshaping, converting, and enriching payloads.

Operation Description Example Reversible
direct_copy Copy a field value as-is to the target "name" → "name" Yes
rename Copy value to a differently named target field "fname" → "first_name" Yes
type_coerce Cast a value to a different type (string, int, float, bool) "42" → 42 Yes
unit_convert Convert between measurement units 66 in → 167.64 cm Yes
date_format Reformat a date string between patterns "03/18/92" → "1992-03-18" Yes
flatten Flatten a nested object into dot-notation keys { a: { b: 1 } } → { "a.b": 1 } Yes
nest Nest dot-notation keys into a nested object { "a.b": 1 } → { a: { b: 1 } } Yes
enum_map Map discrete values via a lookup table "yes" → true Yes
concatenate Join multiple fields into one string "Jane" + "Doe" → "Jane Doe" No
split Split a single field into multiple fields "Jane Doe" → ["Jane", "Doe"] No
conditional Apply different mappings based on a condition if age ≥ 18 → "adult" No
default_fill Set a default value when the source field is null or missing null → "N/A" No
array_map Apply a sub-mapping to each element of an array field [{a:1},{a:2}] → [{b:1},{b:2}] Yes
aggregate Reduce an array to a single value (sum, avg, min, max, count) [10, 20, 30] → 20 (avg) No

Null Handling

Control how missing or null source values appear in the translated output.

Quality Score

Every translation response includes a quality score indicating mapping success.

Quality Score Calculation Explanation
// quality_score = fields_mapped / fields_total
//
// fields_mapped  = number of target fields successfully
//                  populated by the mapping rules
// fields_total   = total number of target fields defined
//                  in the mapping (including failures)
//
// A score of 1.0 means every rule produced a value.
// A score below 1.0 means some rules failed or produced
// null when null_handling is set to "omit".
//
// Example:
//   4 rules defined, 3 succeeded → quality_score = 0.75

{
  "quality_score": 0.75,
  "fields_mapped": 3,
  "fields_total": 4,
  "warnings": [
    "Rule 'unit_convert' on field 'weight_lb' failed: source value is null"
  ]
}