3 min read

Random records API

Sample coherent synthetic records conforming to any compiled record schema in your dictionary.

Note

The project ID in the path must match the project permanently bound to your Bearer API key. The unscoped route GET /v1/random/{recordType} remains available for backward compatibility, but new integrations should specify the project ID explicitly.

Endpoint

text
GET /v1/projects/{project_id}/random/{recordType}

CLI equivalent: simhealth sample {recordType} --count 1 --seed 1842

Request parameters

ParameterPlacementTypeRequiredDefaultDescription
project_idpathstringrequired-Unique identifier of the dictionary project workspace.
recordTypepathstringrequired-Record definition name (e.g. person, patient, encounter).
countqueryintegeroptional1Number of records to generate. Up to 10,000 for JSON, 10,000,000 for Avro.
seedqueryintegeroptionalrandom64-bit unsigned integer seed for deterministic generation.
fieldsquerystringoptionalallComma-separated list of field names to project in the output.

Headers and content negotiation

HeaderFormat / Semantics
Authorization: Bearer <KEY>Required. A valid project-bound API key or signed-in Firebase ID token.
Accept: application/jsonDefault. Returns buffered JSON payload (up to 10,000 records).
Accept: application/avro-binaryStreaming binary Avro Object Container File (OCF), up to 10,000,000 records.
Accept: application/x-ndjsonLine-by-line Newline-Delimited JSON stream.
x-customer-id*Optional* ledger tracking identifier. Must be 1–128 ASCII letters, digits, _, or -.
Tip

Use Accept: application/avro-binary for bulk migrations or machine learning datasets. Avro streaming uses zero server buffering and is up to 12x faster to decode than JSON.

Code examples

curl -s -H "Authorization: Bearer $SIMHEALTH_API_KEY" \
  -H "Accept: application/json" \
  "https://api.preprod.simhealth.interoperabilitypro.com/v1/projects/default/random/person?count=1&seed=1842"
import requests

url = "https://api.preprod.simhealth.interoperabilitypro.com/v1/projects/default/random/person"
headers = {"Authorization": "Bearer $SIMHEALTH_API_KEY"}
params = {"count": 1, "seed": 1842}

response = requests.get(url, headers=headers, params=params)
data = response.json()
print(data["records"][0])
const response = await fetch(
  "https://api.preprod.simhealth.interoperabilitypro.com/v1/projects/default/random/person?count=1&seed=1842",
  {
    headers: { Authorization: "Bearer " + process.env.SIMHEALTH_API_KEY },
  }
);
const data = await response.json();
console.log(data.records[0]);
simhealth sample person --count 1 --seed 1842 --format json

Response schema

200 OK (application/json)

json
{
  "recordType": "person",
  "count": 1,
  "seed": 1842,
  "records": [
    {
      "person_id": "P-981742",
      "first_name": "Maria",
      "last_name": "Santos",
      "gender": "female",
      "birth_date": "1984-06-12",
      "mrn": "MRN-004928"
    }
  ]
}

400 Bad Request

json
{
  "error": "invalid customer id",
  "message": "invalid customer id"
}

403 Forbidden

json
{
  "error": "project mismatch",
  "message": "API key is bound to project 'default', cannot access project 'finance-qa'"
}
Was this page helpful?