API overview
Control session mock state from CI — Bearer auth, idempotent updates, no cookies.
On this page
The FlowMock Public API lets your CI pipeline set up test states before your app runs — flip a scenario, enable mocks, tear down when done. Server-to-server only. No browser cookies.
Available on Team and Business plans.
Base URL
text
https://api.flowmock.dev/api/v1Quick example
bash
KEY="fmk_your_api_key"
BASE="https://api.flowmock.dev/api/v1"
# Set up a session for CI run 42
curl -X PUT "$BASE/sessions/ci-42" \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-d '{"project":"checkout","environment":"staging","scenario":"scn_declined"}'
# Run tests with: x-flowmock-session: ci-42
# Clean up
curl -X DELETE "$BASE/sessions/ci-42?project=checkout&environment=staging&mode=delete" \
-H "Authorization: Bearer $KEY"The integration contract
Your app-under-test must send the same session key on every proxied request:
http
x-flowmock-session: ci-42The API stores that key (after normalization). The proxy matches sessions by exact string equality on this header.
Typical CI flow
- PUT
/sessions/ci-${RUN_ID}— set project, environment, scenario - Run tests — app hits FlowMock proxy with
x-flowmock-session: ci-${RUN_ID} - Assert — app behavior against deterministic mocks
- Optional: GET
/sessions/ci-${RUN_ID}/logs— verify upstream calls - DELETE
/sessions/ci-${RUN_ID}?mode=delete— tear down
Endpoints at a glance
| Method | Path | What it does |
|---|---|---|
GET | /scenarios | List available scenarios |
GET | /sessions/:sessionKey | Read session state |
PUT | /sessions/:sessionKey | Set session state (idempotent) |
DELETE | /sessions/:sessionKey | Reset or delete session |
POST | /sessions/:sessionKey/overrides/:overrideId | Enable one mock |
DELETE | /sessions/:sessionKey/overrides/:overrideId | Disable one mock |
GET | /sessions/:sessionKey/logs | Traffic logs for session |
GET | /logs/:logId/body | Fetch captured request/response body |
What's not in v1
These stay in the dashboard for now:
- Creating or editing mocks and scenarios
- Environment-wide mock activation
- Transforms
- Org, billing, and API key management
Manage API keys in the dashboard under Settings → API keys.
Next steps
- Authentication — keys, scoping, rate limits
- Sessions — the workhorse endpoint
- Errors — when things go wrong