← Back to Home

SDK

Use the Syntherx SDK or direct API calls to generate synthetic datasets programmatically.

JavaScript

Example using fetch to generate a dataset.

const response = await fetch(`https://api.syntherx.com/datasets/generate`, {
  method: 'POST',
  headers: {
    'x-api-key': process.env.SYNTHERX_API_KEY,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    blueprint: 'diabetes_hba1c_trial',
    n_patients: 100,
  }),
});

const data = await response.json();
console.log(data.download_url);

Python

Example using Python requests.

import requests
import os

response = requests.post(
    'https://api.syntherx.com/datasets/generate',
    headers={
        'x-api-key': os.environ['SYNTHERX_API_KEY'],
        'Content-Type': 'application/json',
    },
    json={
        'blueprint': 'diabetes_hba1c_trial',
        'n_patients': 100,
    },
)

data = response.json()
print(data['download_url'])

Notes

  • All requests require a valid API key
  • Datasets are generated on demand
  • Responses return a signed download URL
  • URLs expire after a short period