Endpoints
An endpoint is a single mock API route within a project. It defines what happens when a request matches a specific HTTP method and path.
Creating an Endpoint
Section titled “Creating an Endpoint”- Open your project from the dashboard
- Click New Endpoint
- Fill in the configuration:
| Field | Description |
|---|---|
| Method | HTTP method (GET, POST, PUT, PATCH, DELETE) |
| Path | URL path (e.g. /api/users) |
| Status Code | HTTP status code to return (e.g. 200, 404) |
| Response Body | The content returned to the caller |
| Content-Type | Response content type (defaults to application/json) |
| Delay (ms) | Fixed response delay in milliseconds (default: 0) |
| Delay Max (ms) | Upper bound for random delay — when set, actual delay is randomized between Delay and Delay Max |
| Rate Limit | Maximum requests per minute for this endpoint |
Path Parameters
Section titled “Path Parameters”Paths support dynamic segments. For example, /api/users/:id matches any request to /api/users/123, /api/users/abc, etc.
If multiple endpoints could match a path, the most specific path wins — static segments take priority over dynamic ones.
Response Body
Section titled “Response Body”The response body can be any valid text. For JSON responses, enter valid JSON:
{ "users": [ { "id": 1, "name": "Alice" }, { "id": 2, "name": "Bob" } ]}Use template variables like {{$uuid}}, {{$randomName}}, or {{request.body.field}} to generate dynamic responses.
Delay and Jitter
Section titled “Delay and Jitter”To simulate realistic API latency, configure a delay range:
- Delay only — fixed delay at that exact value
- Delay + Delay Max — random delay between the two values (uniform distribution)
For example, Delay = 100ms and Delay Max = 500ms means each response is delayed by a random amount between 100–500ms.
Endpoint URL
Section titled “Endpoint URL”Once created, your endpoint is available at:
https://<project-slug>.mockd.sh/<path>Exporting and Importing Endpoints
Section titled “Exporting and Importing Endpoints”Export is in the endpoint actions menu on a project, or on an endpoint’s own page if you only want that one. It offers three formats:
| Format | Use it for |
|---|---|
| cURL | Commands you can run against the mock. Each method the endpoint’s rules match on gets its own command; an endpoint with no method rules is exported as a GET. |
| JSON | The mockd format, for recreating the endpoints in another project. |
| OpenAPI | A 3.0 spec for Postman, Swagger UI, and other OpenAPI tools. |
A JSON export includes everything needed to recreate each endpoint: path, status code, content type, response body and headers, delay and delay max, rate limit, and its rules. If an endpoint’s rules can’t be loaded, the export is blocked rather than producing a file without them — use Retry.
To import, choose Import in the endpoint actions menu, open the JSON tab, and paste the export. The preview shows how many rules and whether custom headers come with each endpoint. Anything that can’t be created is reported by path instead of being dropped silently, including:
- an endpoint that fails validation
- an endpoint’s rules that would exceed the rule limit
- rules with actions, when the project is on a Free plan
The cURL tab imports a single endpoint from a cURL command.
What Happens on a Request
Section titled “What Happens on a Request”When a request arrives at your endpoint:
- Rate limit is checked (per-minute window)
- Daily request limit is checked (per-project quota)
- Rules are evaluated top-to-bottom — see Rules
- For each matching rule, actions execute and the first rule with a response definition wins
- Response sequences advance if the matched rule has multiple steps
- Template variables are resolved in the response body
- Delay is applied
- Response is returned and the request is logged