Skip to main content

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

Description: The base domain for all MocklyAPI endpoints.
  • Protocol: Always https://
  • Domain: mock.mocklyapi.com - MocklyAPI’s server
  • Fixed: This part is same for all mock APIs

2. Static Path

Description: The fixed path segment that identifies mock API endpoints.
  • All mock APIs are accessed through the /mock/ path
  • Fixed: This part is same for all mock APIs

3. Mock API ID

Description: Your unique mock API identifier (UUID v4 format).
  • 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

Decoded: 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%3Duserstatus=active&role=user
Common Examples:

4.2 Order By Parameter

Description: The field name to sort results by.
  • Purpose: Specify which field to use for sorting
  • Format: Field name (supports nested paths with dot notation)
  • Examples:
    • order_by=createdAt - Sort by creation date
    • order_by=age - Sort by age
    • order_by=profile.firstName - Sort by nested field

4.3 Order Direction Parameter

Description: The sort direction for ordering results.
  • 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: asc if not specified
  • Requires: Must be used with order_by parameter

4.4 Limit Parameter

Description: Maximum number of results to return.
  • Purpose: Pagination and performance optimization
  • Format: Positive integer (0 or greater)
  • Minimum: 0 (returns empty array)
  • Example: limit=10 returns first 10 results
  • Applied: After filtering and ordering

4.5 Authentication Token

Description: Authentication token for private mock APIs.
  • Purpose: Secure access to private endpoints
  • Required: Only for private mock APIs
  • Optional: For public mock APIs
  • Alternative: Can be sent via header mocklyapiauthtoken also
  • Format: String token generated in your dashboard
  • Security: Keep your tokens secure and never commit them to public repositories
Never share your authentication tokens publicly or commit them to version control. Treat them like passwords.

Need Help?

If you’re having trouble constructing your API URLs, check out: Or contact our support team at support@mocklyapi.com