Seed a Mock Library
Import a HAR, Postman collection, or OpenAPI spec to start a service's mock library before you record traffic through Gostly. Seeding imports HTTP request and response examples. Review the imported routes, switch the service to MOCK mode, and check representative requests with your application.
Import one example by format
Choose a walkthrough for a downloadable synthetic input, target-service setup, format-specific warnings and a reader-owned replay assertion. Use the shared procedures and data-handling contract below for all three formats.
- Import saved Postman responses — start with one saved response from a collection.
- Import a HAR exchange — select a textual captured request and response.
- Import OpenAPI examples — send an explicit request and inspect its selected response fixture.
The empty-library problem
Recording in LEARN mode needs traffic you can send to an upstream. Seeding gives you a starting library when you already have captures or examples. Imported rows use the same mock library as recorded traffic and carry a source tag of seed_har, seed_postman, or seed_openapi. That common storage format does not establish response accuracy or coverage.
HAR
Captured HTTP exchangesHAR 1.2 JSON with request URLs, textual request bodies, response statuses, headers, and captured response text. A capture may include sign-in pages, throttling, or unrelated hosts. Import does not preserve timings, WebSocket frames or streaming behavior. Binary response content needs a separate replay check.
Postman
Saved examplesCollection v2.0 or v2.1 JSON. Each saved response example becomes a candidate mock. A request with no saved response gets an empty 200 response and a warning. Import does not execute requests, scripts, tests, or authentication flows.
OpenAPI
Examples and representative responsesOpenAPI 3.x JSON or YAML. Response examples take precedence over response schema synthesis. An operation that declares requestBody needs an explicit supported JSON example; otherwise the entire operation is omitted with a warning.
Postman folders are flattened. Collection variables, the API's environment overlay, and nested folder variables resolve placeholders in request URLs and bodies. Folder variables can override the inherited scope. Unresolved variables remain literal and are reported. Response bodies and headers are not variable-interpolated, and auth blocks do not generate request authentication. Form and multipart request bodies receive a best-effort textual representation; attached files are not migrated.
OpenAPI selects one response media type per response code, preferring common JSON media types. Within that media type, it tries the first named examples entry in sorted order, then a media-level example, then the response schema. The schema walk uses literal examples or defaults before representative values, merges allOf, and selects one oneOf / anyOf branch. It does not import every named example or prove realistic values, distributions, or complete schema validation. Only local references are resolved; external reference URLs are not fetched. A default response is stored as status 500, and a wildcard such as 2XX becomes 250. Check these representative statuses before relying on them in a test.
For a declared OpenAPI request body, the selected JSON media type must provide a named example value, a media-level example, or a schema-level example. The value must encode as valid, finite JSON in at most 8 KiB of canonical UTF-8 JSON. Request schema shapes, defaults, enums, and property-level examples do not generate a request body. An unusable selected named example does not fall through to another example. Missing, unsupported, invalid, oversized, or unresolved request examples omit every response row for that operation. Operations without requestBody use an empty request body.
OpenAPI path substitution reads operation-level path parameters, using a parameter example or its schema example/default. Path-item-level parameters are not applied by this substitution. Unresolved {parameter} placeholders remain in the URI. The optional prepend_basepath setting adds the path from the first top-level servers URL; check that it matches the path your client sends. Callbacks are not imported.
Seeding from the dashboard
Open /seed in your local operator dashboard. Select an existing service and import one file:
Drag a .har, .json, .yaml, or .yml file onto the drop zone, or browse for it. The staged view shows its name and size; it is not a dry run of the imported operations.
Choose the service whose library will receive the mocks. Create it first if needed. For HAR imports, check its upstream host before committing.
Choose HAR, Postman, or OpenAPI 3.x. The dashboard labels Postman as v2.1; the parser also accepts v2.0. JSON shape detection runs only when no format is selected and the file is at most 5 MiB. Choose YAML and larger files manually.
The dashboard uploads the file and shows the added count, duplicate count, parser warnings, and sample routes. Inspect warnings before checking the imported behavior in MOCK mode.
An Advanced options drawer exposes the deduplication setting, plus OpenAPI 2xx only and prepend basePath toggles. Deduplication defaults on; both OpenAPI toggles default off. Postman environment overlays, HAR method/status filters, and the options to retain other hosts or flagged responses are API-only.
The seeding endpoint
The dashboard uses the same authenticated control-plane endpoint you can call directly:
POST /v1/seed/{format}?service_id=<id>&dedup=true
# format: har, postman, or openapiUse an authenticated member session or an API key in X-API-Key. Send a multipart file field, an inline JSON document with Content-Type: application/json, or raw file bytes. For YAML OpenAPI, use application/yaml. The application/octet-stream transport does not add support for binary mock response fidelity. This endpoint imports an uploaded document; it does not fetch a source URL.
# Seed a service's library from a HAR export curl -X POST 'http://localhost:8000/v1/seed/har?service_id=svc-payments' \ -H "X-API-Key: $GHOST_API_KEY" \ -F 'file=@session.har' # Seed from an OpenAPI spec, keeping only 2xx responses curl -X POST 'http://localhost:8000/v1/seed/openapi?service_id=svc-payments&success_only=true' \ -H "X-API-Key: $GHOST_API_KEY" \ -H 'Content-Type: application/yaml' \ --data-binary @openapi.yaml
The response reports stored rows, duplicate rows dropped within this upload, warnings, up to five sample routes, and a flagged list for the captured-response screen. For example:
For a named import source, also review the added, updated, removed and kept rows. Reimporting synchronizes the rows owned by that source; it does not replace the whole service library. Inspect those changes before reloading or repeating an import.
{
"format": "har",
"count": 2,
"deduped": 1,
"service_id": "svc-payments",
"warnings": [],
"errors": [],
"sample_uris": ["GET /v1/charges", "GET /v1/customers/42"],
"flagged": []
}On the OSS proxy
Per-format options
All formats require service_id. Use options for their documented format; a valid option for another format has no effect on its parser, though malformed query values can still be rejected.
dedupAll formatsDefault true. Keep the first row with each combination of method, exact URI, response status, and response-body text within this request. The key ignores request bodies and all headers, so distinct request examples can collapse. Different JSON whitespace can prevent collapse. Existing stored rows are not checked; importing the same file again can add rows.
methods / statusesHAR onlyComma-separated allow-lists, such as methods=GET,POST or statuses=200,201,204.
keep_other_hostsHAR only · API-onlyDefault false. Retain the service's upstream host; if it has no readable host, use the most frequent host in the file, with first-seen order breaking a tie. No subdomain wildcard is applied; a configured upstream port is also checked. Relative URLs and reserved .invalid hosts remain eligible. Other hosts are reported in warnings. true retains them for response screening too.
keep_flaggedHAR / Postman · API-onlyDefault false. Skip detected bot challenges, sign-in pages/redirects, rate limits, and errors carried in a 2xx body. Ordinary error fixtures such as JSON 401, 404, or 500 responses can remain. Flagged exchanges are listed with the reason and action; true retains them before deduplication. This screen does not apply to OpenAPI rows and is not a general content-safety check.
environmentPostman onlyA URL-encoded JSON object such as {"baseUrl":"https://api.example.invalid"}, overlaid on collection variables before nested folder variables are applied. This is not a Postman environment-file upload.
success_onlyOpenAPI onlyDefault false. Omit non-2xx response rows. One response media/example is selected for each retained response code; all named examples are not imported.
prepend_basepathOpenAPI onlyDefault false. Prefix imported URIs with the path component of the first top-level servers[0].url.
What happens on import
Import prepares the rows, applies the format's filters, and stores them before asking the proxy to reload:
Convert source examples to method, URI, request body, response status, response headers, and response body. HAR host filtering runs before HAR/Postman response screening. Recoverable entry-level issues produce warnings; invalid documents can reject the upload. HAR timing is not replayed, and seeded latency is zero. Source request headers are not persisted as matching rules.
Unless dedup=false, collapse later duplicate rows within the parsed upload. First-occurrence order is preserved. This parsing step is separate from synchronizing the rows owned by a named import source.
Apply structural credential redaction and the sensitive response-header floor before writing the mock rows and their content revisions to Postgres. The serving JSONL is derived from those redacted rows. Rows are bound to the selected service and tagged source=seed_{format}.
Ask the proxy to reload. A network or timeout failure is logged without rolling back stored rows. If the proxy explicitly rejects the reload, the API returns 502: the rows are stored but the current serving library was retained. Restore connectivity or resolve the rejection and reload before checking the new mocks.
A stored-row count does not prove the mocks are live. After a successful reload, switch the service to MOCK mode and verify representative requests, including their status, body, and any headers your client depends on. Multiple response examples do not automatically become an ordered scenario or migrated assertion suite.
Errors and warnings
Request and reload errors have different implications for stored rows:
400Unsupported format, unreadable upload, or malformed query values such as a non-integer statuses value.
413OpenAPI document exceeds the admission byte limit.
422Unknown service for the current tenant, empty/malformed input, or OpenAPI content rejected by the parser/admission policy. OpenAPI uploads accept absent Content-Encoding or one identity encoding, not compressed documents.
502Rows were stored, but the proxy explicitly rejected the reload. Check the import-source changes and current serving state before rerunning; this response does not roll back stored rows.
503OpenAPI parsing capacity or parser isolation is unavailable; the response includes Retry-After.
Warnings describe omitted or approximated content: skipped HAR WebSocket entries, other hosts, flagged responses, unresolved Postman variables, selected OpenAPI branches, unsupported external references, or omitted request-body operations. A successful import can contain fewer routes than the source document. Inspect the warnings and the resulting library.
A note on the data you import
Review the source file before upload. Source files, including HAR and Postman exports, can contain sensitive request headers, query parameters, request bodies, response headers, and response bodies. The authenticated API receives that file before persistence redaction runs. Remove credentials and personal data you do not want submitted, including values outside the imported fields.
Before persistence, structural rules replace detected credential values in URI queries/fragments, request and response bodies, and response header values. The response-header floor also replaces sensitive named headers such as Authorization, Cookie, Set-Cookie, and API-key headers with [REDACTED]. Cookie evidence and, for HAR, response-to-later-request relationships help identify credentials. Request headers are not stored as mock matching rules.
This is not a general PII scrubber or pre-upload sanitizer. Names, emails, IDs, path segments, short secrets, and values outside the credential rules can remain. Import results and warnings are not a privacy review or a redaction receipt. Inspect the file before upload and the stored library before sharing or using it with another service.
Self-hosted, single-tenant
Next steps
Start with a Postman collection →
Prepare saved examples and check one imported request.
Start with a HAR capture →
Select the API host and inspect captured HTTP responses.
Start with an OpenAPI spec →
Prepare explicit request examples and inspect selected responses.
How It Works →
The LEARN → MOCK pipeline and serving behavior.
Configuration Reference →
Environment variables, capture redaction settings, and feature flags.