Endpoint URL Anatomy
MocklyAPI endpoints follow a structured URL format that combines the base API host, mock path, your unique mock API ID, and optional query parameters for filtering, ordering, and authentication.URL Structure Breakdown
Complete Example
Here’s a fully constructed MocklyAPI endpoint with all available parameters:Visual Breakdown
URL Components Explained
1. API Host
- Protocol: Always
https:// - Domain:
mock.mocklyapi.com- MocklyAPI’s server - Fixed: This part is same for all mock APIs
2. Static Path
- All mock APIs are accessed through the
/mock/path - Fixed: This part is same for all mock APIs
3. Mock API ID
- Format: UUID
- Generated: Automatically created when you create a new mock API
You can find your mock API ID in the MocklyAPI dashboard under your project’s mock API list.
4. Query Parameters
Query parameters are optional and control filtering, sorting, pagination, and authentication.4.1 Filters Parameter
filters=size=S
Description: URL-encoded filter conditions to narrow down results.
- Purpose: Filter data based on field values
- Encoding: Must be URL-encoded (special characters like
=become%3D,&becomes%26) - Operators: Supports
$eq,$eqi,$ne,$nei - Multiple: Combine with
&(encoded as%26) - Example:
filters=status%3Dactive%26role%3Duser→status=active&role=user
4.2 Order By Parameter
- Purpose: Specify which field to use for sorting
- Format: Field name (supports nested paths with dot notation)
- Examples:
order_by=createdAt- Sort by creation dateorder_by=age- Sort by ageorder_by=profile.firstName- Sort by nested field
4.3 Order Direction Parameter
- Values:
asc- Ascending order (A to Z, 0 to 9, oldest to newest)desc- Descending order (Z to A, 9 to 0, newest to oldest)
- Default:
ascif not specified - Requires: Must be used with
order_byparameter
4.4 Limit Parameter
- Purpose: Pagination and performance optimization
- Format: Positive integer (0 or greater)
- Minimum:
0(returns empty array) - Example:
limit=10returns first 10 results - Applied: After filtering and ordering
4.5 Authentication Token
- Purpose: Secure access to private endpoints
- Required: Only for private mock APIs
- Optional: For public mock APIs
- Alternative: Can be sent via header
mocklyapiauthtokenalso - Format: String token generated in your dashboard
- Security: Keep your tokens secure and never commit them to public repositories
Need Help?
If you’re having trouble constructing your API URLs, check out:- Data Filtering, Ordering and Limiting - Detailed guide on query parameters
- Private endpoints - How to use auth tokens

