Authentication#
Our API uses bearer token authentication to secure all endpoints. You must include a valid API token in the Authorization header of every request.Obtaining an API Token#
To obtain an API token, contact your account administrator or generate one through your account dashboard. Each token is unique to your account and should be kept secure.Making Authenticated Requests#
Include your API token in the Authorization header using the Bearer scheme:Authorization: Bearer your-api-token-here
Example Request#
Authentication Errors#
If authentication fails, the API will return a 401 Unauthorized response:{
"message": "Unauthenticated."
}
Common authentication issues:Missing Authorization header
Incorrect token format (must use "Bearer" prefix)
Security Best Practices#
Never share your API token or commit it to version control
Use environment variables to store tokens in your application
Use HTTPS for all API requests to prevent token interception
Pagination, Filtering, and Sorting#
Our API provides powerful features for querying collections of resources through pagination, filtering, and sorting.All list endpoints support cursor-based pagination using the page parameter. This allows you to retrieve large datasets efficiently by fetching results in manageable chunks.Parameters#
page[size] - Number of results per page (default: 15, max: 100)
page[number] - Page number to retrieve (starts at 1)
Example Request#
Paginated responses include metadata to help you navigate through results:{
"data": [
],
"links": {
"first": "https://api.litpro.com/v1/resources?page[number]=1",
"last": "https://api.litpro.com/v1/resources?page[number]=10",
"prev": "https://api.litpro.com/v1/resources?page[number]=1",
"next": "https://api.litpro.com/v1/resources?page[number]=3"
},
"meta": {
"current_page": 2,
"from": 26,
"last_page": 10,
"path": "https://api.litpro.com/v1/resources",
"per_page": 25,
"to": 50,
"total": 250
}
}
Filtering#
Filter resources by adding filter parameters to your request. You can filter on any exposed field.Basic Filtering#
Use the filter parameter followed by the field name:Multiple Filters#
Combine multiple filters to narrow results:Filter Operators#
The API supports various comparison operators:Exact match: filter[field]=value
Partial match: filter[field]=*value* (for text fields)
Greater than: filter[field]=>value
Less than: filter[field]=<value
Greater than or equal: filter[field]=>=value
Less than or equal: filter[field]=<=value
Filter Examples#
Sorting#
Sort results by one or more fields using the sort parameter.Basic Sorting#
Sort by a single field (ascending):Sort in descending order by prefixing with a minus sign:Multiple Sort Fields#
Sort by multiple fields by separating them with commas. The API will sort by the first field, then by subsequent fields for tie-breaking:This example sorts by priority (descending), then by name (ascending) for resources with the same priority.The API supports eager loading of related models using the include parameter. This allows you to retrieve a resource along with its relationships in a single request, reducing the need for multiple API calls.Query Parameter Summary#
| Parameter | Purpose | Example |
|---|
page[size] | Results per page | page[size]=25 |
page[number] | Page number | page[number]=2 |
filter[field] | Filter by field value | filter[status]=active |
sort | Sort results | sort=-created_at or sort=name,-amount |
Error Handling#
If you provide invalid query parameters, the API will return a 422 Unprocessable Entity response with details:{
"message": "The given data was invalid.",
"errors": {
"filter.amount": [
"The filter.amount field must be a number."
]
}
}
Use pagination to limit the number of results returned
Be specific with filters to reduce server load
Only sort when necessary, as it can impact response time
Consider caching frequently accessed filtered/sorted results on your end
Modified at 2026-01-19 17:44:51