Enrollment API
The Enrollment API provides access to student enrollment data across different academic years and categories at Albion College.
Endpoint
GET /api/data/enrollment
Authentication
All requests to this endpoint require authentication using an API key. You can provide your API key in one of the following ways:
- HTTP Header:
X-API-Key: your_api_key
- Bearer Token:
Authorization: Bearer your_api_key
- Query Parameter:
?apiKey=your_api_key
If you don’t have an API key, you can obtain one from your dashboard settings .
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
academicYear | String | No | Filter results by academic year (e.g., “2022-2023”) |
category | String | No | Filter results by enrollment category (e.g., “Undergraduate”, “Graduate”) |
page | Integer | No | Page number for pagination (default: 1) |
limit | Integer | No | Number of results per page (default: 100, max: 1000) |
sortBy | String | No | Field to sort by (academic_year , category , subcategory , full_time , part_time ) |
sortOrder | String | No | Sort order (asc or desc ) |
Note: If neither academicYear
nor category
is provided, the API returns data for all years and categories.
Response Format
The API returns a JSON response with the following structure:
{
"success": true,
"data": [
{
"id": 1,
"academic_year": "2022-2023",
"category": "Undergraduate",
"subcategory": "First-Year",
"full_time": 320,
"part_time": 15
},
{
"id": 2,
"academic_year": "2022-2023",
"category": "Undergraduate",
"subcategory": "Sophomore",
"full_time": 285,
"part_time": 12
},
],
"pagination": {
"total": 150,
"page": 1,
"limit": 100,
"totalPages": 2
}
}
Response Fields
Field | Description |
---|---|
success | Boolean indicating if the request was successful |
data | Array of enrollment records |
data[].id | Unique identifier for the record |
data[].academic_year | Academic year of the enrollment data (e.g., “2022-2023”) |
data[].category | Main enrollment category (e.g., “Undergraduate”, “Graduate”) |
data[].subcategory | Specific subcategory within the main category (e.g., “First-Year”, “Sophomore”) |
data[].full_time | Number of full-time students |
data[].part_time | Number of part-time students |
pagination.total | Total number of records available |
pagination.page | Current page number |
pagination.limit | Number of records per page |
pagination.totalPages | Total number of pages available |
Examples
cURL
Get All Enrollment Data
curl -X GET "https://openalbion.org/api/data/enrollment" \
-H "X-API-Key: your_api_key"
Filter by Academic Year
curl -X GET "https://openalbion.org/api/data/enrollment?academicYear=2022-2023" \
-H "X-API-Key: your_api_key"
Filter by Category
curl -X GET "https://openalbion.org/api/data/enrollment?category=Undergraduate" \
-H "X-API-Key: your_api_key"
Pagination and Sorting
curl -X GET "https://openalbion.org/api/data/enrollment?page=2&limit=50&sortBy=full_time&sortOrder=desc" \
-H "X-API-Key: your_api_key"
Error Responses
Status Code | Description |
---|---|
401 | Authentication error (missing or invalid API key) |
500 | Server error |
Example error response:
{
"success": false,
"error": "API key missing",
"message": "Please provide an API key via X-API-Key header, Authorization: Bearer header, or apiKey query parameter.",
"docs": "https://docs.openalbion.org"
}