Quickstart

A quick introduction to building with Chronomics.

Introduction

If you haven't already, sign up for a free sandbox account. You can then generate your API key from Developers > Api Keys. You will need this to authenticate most API calls. You will need to switch this key once you're ready to go live.

Read the Basic Test Flow to understand the lifecycle of a test.

Create an order

First, you need to know which product you want to order. You can ask an Chronomics account manager for the list of SKUs you can use, or, for experimentation purposes, you can start with gen-wellness-energy-screen-gbp. In sandbox mode, no actual products will be shipped, but in production mode this endpoint requires a valid payment method and will ship the test.

πŸ“˜

SKUs and product codes

These will not change between the sandbox and production environment so you can hardcode these into your integration if you are focusing on specific products.

Once you have a valid SKU, it's time to make your first API call to place an order. Remember to replace API_TOKEN with the one you generated earlier.

import fetch from 'node-fetch';

const API_TOKEN = 'API_TOKEN';

const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer ' + API_TOKEN,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    product: 'gen-wellness-energy-screen-gbp',
    quantity: 1,
    firstName: 'Bob',
    lastName: 'Jones',
    deliveryAddress1: '130 Plumstead Road',
    deliveryAddress2: 'Plumstead',
    deliveryCity: 'London',
    deliveryPostcode: 'SE18 7DW',
    deliveryCounty: 'Greater London',
    deliveryCountryCode: 'GB',
    email: '[email protected]',
    mobileCountryCode: '44',
    mobileNumber: '77777777777'
  })
};

const response = await fetch('https://api.sandbox.chronomics.com/orders/v2', options);
const data = await response.json();

console.log(data);

🚧

For US customers

You will need to set 'deliveryCountry' to 'US' and replace the deliveryCounty field by a deliveryState one. In addition, if your organization has physicians who are prescribing the order, you should add an extra physicianDetails object. Here is a snippet to replace the body creation part in the previous example:

body: JSON.stringify({
    product: 'gen-wellness-energy-screen-gbp',
    quantity: 1,
    firstName: 'Bobby',
    lastName: 'Jones',
    deliveryAddress1: '130 Plumstead Road',
    deliveryAddress2: 'Plumstead',
    deliveryCity: 'London',
    deliveryPostcode: 'SE18 7DW',
    deliveryState: 'FL',
    deliveryCountryCode: 'US',
    email: '[email protected]',
    mobileCountryCode: '44',
    mobileNumber: '77777777777',
    physicianDetails: {
      npi: "1234",
      firstName: "joe",
      lastName: "smith",
      physicianAddress: {
        country: "United States",
        state: "FL",
        city: "Miami",
        zipCode: "12345",
        addressLine1: "main street 1"
      },
      organizationAddress: {
        country: "United States",
        state: "FL",
        city: "Miami",
        zipCode: "12345",
        addressLine1: "main street 1"
      }
    }

Order status (data.status) will depend on how your account is setup.

If you have added a credit card to your account and we could successfully charge it, or you have a commercial agreement the status will be "CONFIRMED" and the product will ship straight away.

Otherwise the status will be "CREATED" and the order will be in a pending state until payment is made. (See Orders > Order History page in dashboard)

Next steps

Congratulations, you have completed the Chronomics Quickstart guide to placing your first order!

At this point, the test will ship to the customer and they are required to register it before returning it back to the lab. If you are using the Chronomics portal to do this, no further work is required. However if you wish to build the registration flow into your own app see the Registration guide for how to do this.


What’s Next