API guide

Map your fields.
Check your types.

Send a small CSV or JSON table with explicit mapping rules. SchemaBridge returns JSON with the names and types you requested, or an error that points to what needs fixing.

Send a request

Use POST /v1/transform with Content-Type: application/json. Both formats use a JSON envelope with exactly three properties:

format
"csv" for a CSV string, or "json" for an array of flat objects.
data
The input table. CSV text goes inside this property, not directly in the HTTP body.
schema
An array of 1 to 20 mappings, each containing source, target and type.

No account or API key is required by this endpoint. Use synthetic, non-sensitive data for this public demo. Compressed request bodies are not supported.

Save either full request below as request.json, then run:

curl -X POST https://schemabridge.wiaikit.com/v1/transform \
  -H 'Content-Type: application/json' \
  --data-binary @request.json

This command uses a POSIX shell. On Windows, use curl.exe and put the command on one line.

CSV example

The header names the source fields. This request renames stock to quantity and converts its text value to an integer.

Full request

{
  "format": "csv",
  "data": "sku,name,stock,active\nA1,\"Tea, green\",7,true\nB2,Coffee,0,false\n",
  "schema": [
    {
      "source": "sku",
      "target": "id",
      "type": "string"
    },
    {
      "source": "name",
      "target": "name",
      "type": "string"
    },
    {
      "source": "stock",
      "target": "quantity",
      "type": "integer"
    },
    {
      "source": "active",
      "target": "available",
      "type": "boolean"
    }
  ]
}

Expected response · HTTP 200

{
  "ok": true,
  "data": [
    {
      "id": "A1",
      "name": "Tea, green",
      "quantity": 7,
      "available": true
    },
    {
      "id": "B2",
      "name": "Coffee",
      "quantity": 0,
      "available": false
    }
  ],
  "summary": {
    "inputRows": 2,
    "outputRows": 2,
    "mappedFields": 4,
    "convertedCells": 4
  }
}

CSV uses commas, unique headers and LF or CRLF line endings. Quoted cells may contain commas or newlines; escape a quote by doubling it. Every record must have the same number of cells as the header. An empty cell is an empty string, never an implicit null.

JSON example

JSON input is an array of flat objects. This example also trims a numeric string, preserves an allowed null and omits an optional missing field.

Full request

{
  "format": "json",
  "data": [
    {
      "reference": 101,
      "amount": " 12.50 ",
      "settled": "false",
      "note": null
    },
    {
      "reference": 102,
      "amount": 0,
      "settled": true
    }
  ],
  "schema": [
    {
      "source": "reference",
      "target": "id",
      "type": "string"
    },
    {
      "source": "amount",
      "target": "amount",
      "type": "number",
      "trim": true
    },
    {
      "source": "settled",
      "target": "settled",
      "type": "boolean"
    },
    {
      "source": "note",
      "target": "note",
      "type": "string",
      "required": false,
      "nullable": true
    }
  ]
}

Expected response · HTTP 200

{
  "ok": true,
  "data": [
    {
      "id": "101",
      "amount": 12.5,
      "settled": false,
      "note": null
    },
    {
      "id": "102",
      "amount": 0,
      "settled": true
    }
  ],
  "summary": {
    "inputRows": 2,
    "outputRows": 2,
    "mappedFields": 4,
    "convertedCells": 4
  }
}

The second record has no note, so its output has no note either. Arrays or objects inside cells are rejected; cells may contain strings, finite numbers, booleans or null.

Mapping rules

source and target are literal top-level field names, not paths. Output target names must be unique. Unmapped input fields are omitted from the result after structural validation. Input row order is preserved. JSON object property order is not part of the contract.

Supported target types
TypeAccepted valuesExamples that fail
stringA string, number or boolean converted to text.Nested objects or arrays.
integerA parsed safe integer, or a strict decimal integer string. Range: −9,007,199,254,740,991 to 9,007,199,254,740,991."7.0", "1e2", "+7", "07".
numberA finite number, or a strict numeric string using a decimal point and optional exponent, such as "12.5" or "1e2"."12,5", "+7", "07", infinity.
booleanA boolean, or exactly "true" / "false".1, "yes", "TRUE".

Optional mapping properties

required
Default true. Set to false to omit a missing field from the output instead of returning an error.
nullable
Default false. Set to true to preserve an explicit JSON null. This does not make a missing required field optional or turn an empty string into null.
trim
Default false. Set to true to trim a string before conversion. Otherwise spaces remain significant.

Unknown request or mapping properties are rejected. Field names must be non-empty, at most 64 UTF-16 code units, and cannot be __proto__, prototype or constructor.

Numeric precision

JSON numeric tokens are parsed as JavaScript IEEE-754 numbers before validation and may already be rounded. For example, the numeric token 1.0000000000000001 is parsed as 1. Use string input when the original digits must be validated. A number conversion still produces an IEEE-754 number; this is not an exact-decimal arithmetic service.

Read the summary

inputRows and outputRows count records; mappedFields counts schema mappings. convertedCells counts values changed by trimming or conversion after parsing. Renaming alone does not count as a changed cell.

Limits

  • 32 KiB (32,768 bytes) for the whole UTF-8 JSON request, including its schema.
  • 100 data records; the CSV header is separate.
  • 20 mappings and at most 20 fields per input record or CSV row.
  • 64 UTF-16 code units per field name; 2,048 per string cell.
  • 64 KiB (65,536 bytes) for the serialized response. The transformed data has a 65,280-byte budget to reserve 256 bytes for the envelope.
  • 40 field-error details at most, with the total count and a truncation flag.

These are request and response bounds, not a latency or availability guarantee.

Errors that tell you where to look

Conversion is all-or-nothing: if any field fails, no partial output is returned. For example, replacing the first CSV record's stock value with seven produces:

{
  "ok": false,
  "error": {
    "code": "VALIDATION_FAILED",
    "message": "Some fields could not be converted. No records were returned.",
    "details": {
      "totalErrors": 1,
      "truncated": false,
      "fields": [
        {
          "row": 0,
          "source": "stock",
          "target": "quantity",
          "expected": "integer",
          "code": "TYPE_MISMATCH"
        }
      ]
    }
  }
}

row is a zero-based data-record index, not a physical CSV line number. Field-error details include names and expected types, not submitted cell values.

HTTP status and next step
StatusMeaningWhat to do
400Invalid JSON, CSV, schema or record structure.Check the request format, headers, field names and options.
413A request, row, field, cell or output limit was exceeded.Send a smaller table or shorter cells.
415Unsupported media type or content encoding.Send uncompressed UTF-8 JSON with Content-Type: application/json.
422A required field is missing, null is disallowed or a value has the wrong type.Use error.details.fields to fix the records or mapping.
404 / 405Unknown route or unsupported method.Check the path; transforms require POST. A 405 response includes Allow.
500Unexpected processing failure.Retry later; do not treat this as valid output.
503Health or deployment proof has no valid configured commit or slug.Check service status; this is deployment configuration.

Errors include ok: false, an error.code and an error.message; error.details is optional.

OpenAPI specification

The machine-readable specification describes request fields and response shapes for API tools. Download raw OpenAPI JSON. For a readable introduction, use the examples above.