Send Your First API Request

Overview

In this guide, we will send a simple API request in test mode to get the list of medical insurance plans that the practitioners we expose appointment booking for may accept.

Of course, in test mode we return fake data but you will get a sense of how to use our API and our documentation.

Authentication

API requests are authenticated using an API secret key. You can use the key ch_sk_test_quickstart to follow this guide without registering.

Sending your first API request

How to use the documentation

Each Railway API resource is documented in our API reference, and follows a standard and predictable documentation format. Let's look at the Insurance object and the /insurances endpoints.

  1. The introduction describes the resource at a high level
  2. The object documentation describes the data structure in detail
  3. The endpoint documentation provides more detail on the endpoint, headers, accepted query and body parameters, generated requests in multiple languages, example responses, and much more

Listing all insurances

To list all of the medical insurance plans, we can copy the generated curl command on the endpoint's reference page.

First, fill out the Authentication input box on the right-hand side of the page. Specifically, fill the username input with our API secret key — ch_sk_test_quickstart. Leave the password input empty.

The generated curl command should look as follows:

curl --request GET \
     --url https://api.closurehealth.com/insurances \
     --header 'Accept: application/json' \
     --header 'Authorization: Basic Y2hfc2tfdGVzdF9xdWlja3N0YXJ0Og==' \
     --header 'Closure-API-Version: 2022-04-01' \
     --header 'Closure-Index-Version: idx_standard'

Copy the curl command and navigate to your terminal. Paste the request and hit enter! You should see something as follows:

[
  {
    "id": "ins_8rdzjCQtD1VLg9aLRwARNF",
    "carrier_brand": "Blue Cross Blue Shield",
    "carrier_name": "Empire Blue Cross Blue Shield",
    "plan_name": "Essential Choice PPO Gold",
    "plan_type": "PPO",
    "state": "NY",
    "display_name": "Empire Blue Cross Blue Shield Essential Choice PPO Gold",
    "created_at": "2022-04-01T00:00:00.000Z",
    "updated_at": "2022-04-01T00:00:00.000Z"
  },
  ...
]

Wrapping up

That's it! You successfully sent your first API request in test mode to get the list of medical insurance plans our practitioners accept.

From the endpoint reference page, you can learn more about the headers, possible query parameters, response body, and more. Try reading the documentation for a few more resources and sending API for them before moving on to the following quickstart guides!