Getting Started
Get up and running with the NextSchool Data API in 5 minutes
Quick Start
Follow these steps to make your first API call.
Prerequisites
- API credentials (username and password) — provided by your school administrator
- An HTTP client (cURL, Postman, or your preferred programming language)
Step 1: Get an Access Token
Send a login mutation to get your access token:
curl -X POST https://data.nextschool.io/ \
-H "Content-Type: application/json" \
-d '{
"query": "mutation { login(username: \"your_username\", password: \"your_password\") { accessToken refreshToken expiresIn } }"
}'Response:
{
"data": {
"login": {
"accessToken": "eyJhbGciOiJIUzI1NiIs...",
"refreshToken": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"expiresIn": 900
}
}
}Step 2: Make an Authenticated Request
Use the accessToken in the Authorization header:
curl -X POST https://data.nextschool.io/ \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
-d '{
"query": "{ students(limit: 5) { id fullName classroomName status } }"
}'Response:
{
"data": {
"students": [
{
"id": 1,
"fullName": "เด็กชายสมชาย ใจดี",
"classroomName": "ม.1/1",
"status": 10
}
]
}
}Step 3: Handle Token Expiry
Access tokens expire after 15 minutes (900 seconds). Use the refresh token to get a new access token:
curl -X POST https://data.nextschool.io/ \
-H "Content-Type: application/json" \
-d '{
"query": "mutation { refreshToken(refreshToken: \"your_refresh_token\") { accessToken expiresIn } }"
}'Important Notes
- No public registration — API credentials are created by administrators
- School-scoped data — You can only access data belonging to your assigned school
- Rate limiting — Be mindful of request frequency in production