Quickstart
This guide will get you all set up and ready to use the Mainframe API. We'll cover how to authenticate and make your first API request to retrieve your profile. We'll also look at where to go next to find all the information you need to take full advantage of the API.
Before you can make requests to the Mainframe API, you will need valid user credentials (username and password) from your system administrator.
Authenticating
First, obtain a CSRF cookie, then log in with your credentials:
# 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-Requested-With: XMLHttpRequest" \
-H "X-XSRF-TOKEN: {xsrf_token}" \
--cookie cookies.txt \
--cookie-jar cookies.txt \
-d '{"username": "admin", "password": "password"}'
If two-factor authentication is enabled for the account, the response will include { "two_factor": true } instead of logging you in — send the code to POST /two-factor-challenge to complete the flow. See Authentication for details.
Making your first API request
After authenticating, you are ready to make your first call to the Mainframe API. Below, you can see how to send a GET request to the profile endpoint to retrieve the currently authenticated user.
curl https://your-domain.com/api/profile \
-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 API. Here are a few links that might be handy as you venture further into the Mainframe API:
- Explore the Users endpoint (Control Center)
- Explore the Payroll Items endpoint (Payroll)
- Explore the Employees endpoint (Personnel Management)
- Learn about the different error messages
- Read the module guides if you're looking for how-to documentation rather than the API