An invoice list, a billing page or a customer portal needs invoices long before a billing system is connected. The invoices template gives you a small, generic invoicing API behind a real URL: invoices with line items, totals and statuses. It is an example shape for building and testing your own code, not a copy of any provider's API.
What you get
The template creates a project with the base path /invoices-api and 4 endpoints. Each endpoint has one ready response, so the API answers as soon as the project exists.
| Method | Path | What it answers |
|---|---|---|
GET |
/invoices |
200 with six generated invoices. |
GET |
/invoices/:id |
200 with one invoice and three line items. The id is the one from the path. |
POST |
/invoices |
201 with customerName, amount and currency from the request body, a generated id and number and the status open. |
POST |
/invoices/:id/pay |
200 with the status paid for the invoice in the path and the method from the request body as paymentMethod. |
Amounts are integers in minor units (cents). An invoice in the list has id, number, customerName, total, currency (EUR, USD or GBP), status (draft, open, paid or overdue), issuedAt and dueDate. The single invoice has a customer with name and email and three lineItems with description, quantity, unitAmount and amount; its total is the sum of the three amounts. Company names are invented and descriptions are generated filler text.
Sample response
$ curl -s -X POST $URL/invoices-api/invoices \
-H "Content-Type: application/json" \
-d '{"customerName":"Northwind Tools","amount":25500,"currency":"eur"}'
{
"id": "7314",
"number": "INV-4410",
"customerName": "Northwind Tools",
"total": 25500,
"currency": "EUR",
"status": "open",
"issuedAt": "2026-11-15T09:12:44Z",
"dueDate": "2026-12-09"
}
customerName, amount (returned as total) and currency (returned in upper case) come from your request. The id, number and dueDate are generated on every call. Without a body, the mock answers with Example Company, 12900 and EUR.
How to start
- Sign up at
https://app.mockhop.com/register. The quickstart explains the account and the address of your organization. - Open Projects and select Start from a template.
- Choose Example invoices API and select Use template.
Then call the mock. Replace acme with your organization's address. Your mocks answer from outside once you've confirmed your email address.
$ URL=https://acme.mockhop.cloud
$ curl -s $URL/invoices-api/invoices/2207
$ curl -s -X POST $URL/invoices-api/invoices/2207/pay \
-H "Content-Type: application/json" \
-d '{"method":"card"}'
The first call returns one invoice with three line items whose amounts add up to total. The second answers 200 with the status paid and the payment method card.
What to do next
- Change the responses. Open an endpoint and edit the status code, headers and body of its response, or add more responses with matching rules.
- Add error cases and delays. For example a
404for an unknown invoice, a409for an invoice that is already paid, or a422for a missing amount. See Simulate API errors, timeouts and rate limits. - Use scenarios for flows. For example an invoice that is
openon the first call andpaidon the next. See Scenarios; scenarios are included from the Pro plan. - Export the project. Under Import/Export you can download the project as an OpenAPI 3.0 file.
Good to know
- No money moves, and this is not an accounting system. The template is a generic example: it is connected to no payment or invoicing provider, follows no provider's API and creates no legally valid invoices.
- Responses are generated per request and the mock keeps no state. An invoice you create is not in the list, and paying an invoice does not change it:
GET /invoices/:idreturns a random status ofopen,paidoroverdueon every call. - Nothing is calculated beyond the sum of the line items. There is no tax, no discount and no rounding, and the
totalin the answer ofPOST /invoices/:id/payis a random amount, not the invoice's total. - Invoice numbers are generated on every call. They are neither consecutive nor unique, and the single invoice and the pay answer always use
EUR. - The template creates a new project, and no other project in your organization may use the base path
/invoices-api. The Free plan includes one project. - You can change or delete the project and each of its endpoints at any time.
New to Mockhop? Start with the quickstart. Plans: pricing.