mockbayuser manual

User manual

The complete guide,
for users and admins.

Two tracks. Users build and serve their own mocks; admins manage every namespace, import in bulk, copy endpoints between users, and watch real traffic. Start wherever you sit.

Part 1 · For users

Build and serve your own mocks

Everything a signed-in user can do, in order — each step builds on the last. Your namespace is assigned for you; the rest is yours to fill.

STEP 01

Sign in

Open the portal and sign in. Users land on their own endpoints; admins land on the dashboard.

  1. Go to /login.
  2. Enter your username and password.
  3. Seeded accounts: admin / password and user1 / password.
Your namespace — a short, permanent prefix like /abcd — is assigned automatically. Every mock you create is served under it.
mockbay / sign in
Sign in screen.

STEP 02

Create an endpoint

Choose a method and path, then define the response you want returned.

  1. Click New endpoint.
  2. Set the path — the live URL preview updates as you type.
  3. Pick the method and response status.
  4. Fill in response headers (JSON) and body.
  5. Leave active on and save.
mockbay / new endpoint
New endpoint form with live URL preview and an active toggle.

STEP 03

Call your mock

Your endpoint is live immediately under your namespace. Match is by method + normalized path.

  1. Open the endpoint and press Copy to grab the full URL.
  2. Request /<your-namespace>/<path> with the matching method.
  3. You get back the exact status, headers, and body you defined.
Inactive endpoints and unknown paths return 404 with {"error":"Mock API not found"}.
mockbay / endpoint
Endpoint detail with the copyable public URL.

STEP 04

Record from a curl

Skip authoring by hand — capture a real API's response.

  1. Click Record from curl.
  2. Paste a full curl command (headers, -d body, and auth all work).
  3. Press Record endpoint. mockbay calls the URL once and saves the live response — method and path come from the command.
Requests to localhost, private networks, and metadata addresses are refused, and each redirect hop is re-validated.
mockbay / record from curl
Record from curl form.

STEP 05

Import from Postman

Stand up a whole API surface at once from a Postman collection — entirely offline, with no network calls.

  1. Click Import Postman.
  2. In Postman, right-click a collection → ExportCollection v2.1.
  3. Upload the .json file and import.
Requests without a saved example are imported as a 200 with an empty body — edit them afterwards.

What gets imported

Folders
Walked recursively — every request becomes an endpoint.
Method & path
Read from each request's URL.
Response
The first saved example supplies status, headers, and body.
No example
Falls back to 200 with an empty body.

STEP 06

Encrypt the response

For gateways that wrap responses in an encrypted envelope.

  1. Edit the endpoint and turn on Encrypt response.
  2. Keep the body as readable JSON — mockbay encrypts it on serve.
  3. Clients receive { "eData": …, "code": … }; decrypting eData returns your JSON.
Recording from an encrypted API flips this on automatically — the envelope is detected and decrypted for you.
mockbay / encrypted endpoint
Encrypted endpoint detail with the eData chip.

Part 2 · For admins

Manage every namespace

Admins can do everything above, for anyone — plus user management, search and bulk operations across all namespaces, copying endpoints between users, and traffic analytics.

STEP 01

Create & manage users

Open Users to add accounts. Each user gets their own namespace, generated for them.

  1. Click New user.
  2. Set a username — it's permanent and can't be changed later.
  3. Choose a role (user or admin) and a password.
  4. Save — the namespace is assigned automatically.
Only role and password are editable afterwards. Username and namespace are fixed at creation.

User fields

username
Set once at creation — permanent.
namespace
Auto-generated, unique, 4 letters. Read-only.
role
user or admin. Editable.
password
Can be changed anytime.

STEP 02

Search & sort every endpoint

The Mock APIs page lists endpoints across all namespaces, each with its owner.

  1. Search by name, path, method, or owner.
  2. Click any column header to sort — click again to flip ascending/descending.
  3. Use Record from curl or Import Postman on behalf of any user — you pick the owner.
mockbay / admin · mock APIs
Admin mock APIs table across all namespaces.

STEP 03

Bulk actions & copying across namespaces

Select endpoints with the checkboxes, then apply one action to all of them at once.

  1. Tick rows individually, or the header box to select all.
  2. Choose a bulk action and press Apply.
  3. For Copy to namespace, pick the target user — the selected endpoints are duplicated into their namespace.
Copy promotes a mock from one user or team to another without re-authoring it. Traffic counters reset on the copy; the originals are untouched.

Bulk actions

Activate
Turn the selected endpoints live.
Deactivate
Take them offline (they 404 until re-activated).
Delete
Remove them — asks for confirmation first.
Copy
Duplicate into a chosen namespace.

STEP 04

The analytics dashboard

The dashboard reads real traffic — every served request is counted as it happens.

  1. Totals up top: users (admins vs. users), endpoints, and requests served.
  2. Charts: users by role, endpoints by owner, and the most-used endpoints.
  3. Most-active users, shown two ways — by traffic and by changes made.
mockbay / admin dashboard
Admin dashboard with KPI tiles and usage charts.

Reference

Concepts & configuration

The handful of ideas behind every mock, plus the environment variables that configure a deployment.

ConceptWhat it means
namespace (salt)A unique, auto-generated 4-letter prefix, one per user and permanent. Mocks are served under /<namespace>/….
roleuser manages only their own endpoints; admin manages every namespace, users, and the dashboard.
method + pathHow the dispatcher matches a request. Paths are normalized (leading slashes stripped).
responseStored status, headers (JSON), and body — replayed verbatim when the mock matches.
activeOnly active mocks are served; inactive ones 404.
encryptedServes the body inside an AES-256-CBC { eData, code } envelope.
request_countEvery served request is counted, powering the admin dashboard.
Env varPurpose (default)
DATABASE_HOST / PORTMySQL location (127.0.0.1 / 3307)
DATABASE_USERNAME / PASSWORDMySQL credentials (admin / pass)
MOCK_AES_KEY / IVeData cipher key (32 bytes) and IV (16 bytes)
RECORDER_MAX_BYTESCap on a recorded response body (5,000,000)
RECORDER_OPEN/READ_TIMEOUTcurl recorder timeouts (5s / 8s)
ALLOWED_HOSTSComma-separated Host allowlist (production)