2 min read

Wire Formats & Streaming

SimHealth is engineered for high-throughput synthetic data generation. The API supports three primary wire formats via HTTP content negotiation, allowing clients to balance memory overhead and ingestion convenience.

Note

All formats support the exact same seed determinism. The chosen wire format impacts network transport and parsing throughput, not the generated data values.

Format comparison

FormatContent-Type HeaderRecord LimitTypical Use Case
Avro OCFapplication/avro-binary10,000,000+Large ETL pipelines, Snowflake/BigQuery bulk loading, DuckDB
NDJSONapplication/x-ndjson1,000,000Line-by-line stream ingestion, Kafka producers, CLI pipes
JSONapplication/json10,000Interactive testing, UI previews, Postman queries

Streaming Avro Object Container Files (OCF)

Avro OCF is the recommended format for production workloads generating over 10,000 records. Avro bundles a compact binary payload with an embedded JSON schema in the file header:

bash
# Stream 1,000,000 records directly into an Avro container file
simhealth sample person --count 1000000 --seed 9921 --format avro > persons.avro

HTTP request with Avro negotiation

curl -s -H "Authorization: Bearer $SIMHEALTH_API_KEY" \
  -H "Accept: application/avro-binary" \
  "https://api.preprod.simhealth.interoperabilitypro.com/v1/projects/{project_id}/random/person?count=50000&seed=1842" \
  -o export.avro
import fastavro
import requests

url = "https://api.simdata.interoperabilitypro.com/v1/projects/default/random/person?count=50000&seed=1842"
headers = {
    "Authorization": "Bearer sim_live_abcdef123456",
    "Accept": "application/avro-binary",
}

with requests.get(url, headers=headers, stream=True) as response:
    reader = fastavro.reader(response.raw)
    for record in reader:
        pass  # Process streaming record
import avro from "avsc";

const response = await fetch(
  "https://api.simdata.interoperabilitypro.com/v1/projects/default/random/person?count=50000&seed=1842",
  {
    headers: {
      Authorization: "Bearer sim_live_abcdef123456",
      Accept: "application/avro-binary",
    },
  }
);
const arrayBuffer = await response.arrayBuffer();
// Parse binary buffer with avsc decoder

Newline-Delimited JSON (NDJSON)

NDJSON streams each generated object as an individual JSON string terminated by a newline character \n. It requires no binary decoding tools and streams cleanly without buffering the entire dataset in memory:

bash
curl -s -H "Authorization: Bearer $SIMHEALTH_API_KEY" \
  -H "Accept: application/x-ndjson" \
  "https://api.preprod.simhealth.interoperabilitypro.com/v1/projects/{project_id}/random/person?count=1000&seed=1842" \
  | jq -r '.first_name + " " + .last_name'

Buffered JSON

Standard JSON is buffered in memory by the server and returned as a single JSON envelope with metadata:

json
{
  "recordType": "person",
  "count": 2,
  "seed": 1842,
  "records": [
    { "person_id": "P-001", "name": "Alice" },
    { "person_id": "P-002", "name": "Bob" }
  ]
}
Warning

Standard buffered JSON is hard-capped at 10,000 records per request to prevent browser memory exhaustion. For larger datasets, request application/avro-binary or application/x-ndjson.

Was this page helpful?