Quickstart

This guide will get you all set up and ready to use the CMS Admin API. We'll cover how to authenticate and make your first API request to retrieve case records. We'll also look at where to go next to find all the information you need to take full advantage of the API.

Authenticating

First, obtain a CSRF cookie, then log in with your credentials:

POST
/login
# Step 1: Get CSRF cookie
curl -X GET https://your-domain.com/sanctum/csrf-cookie \
  -H "Accept: application/json" \
  --cookie-jar cookies.txt

# Step 2: Login
curl -X POST https://your-domain.com/login \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "X-XSRF-TOKEN: {xsrf_token}" \
  --cookie cookies.txt \
  --cookie-jar cookies.txt \
  -d '{"email": "admin@example.com", "password": "password"}'

A successful JSON login returns {"two_factor": false} with a 200 status. If the account has two-factor authentication enabled, two_factor will be true and you must complete the /two-factor-challenge flow before the session is fully authenticated — see Authentication.

Making your first API request

After authenticating, you are ready to make your first call to the CMS Admin API. Below, you can see how to send a GET request to the Case Records endpoint to retrieve a paginated list of cases.

GET
/api/case-records
curl https://your-domain.com/api/case-records \
  -H "Accept: application/json" \
  -H "X-XSRF-TOKEN: {xsrf_token}" \
  --cookie cookies.txt

What's next?

Great, you're now authenticated and have made your first request to the CMS Admin API. Here are a few links that might be handy as you venture further into the API:

Was this page helpful?