API mocking tools · Self-hosted mock server

API mocking for the services your app calls.

Run a self-hosted mock API server in front of the APIs your application depends on. Start from real traffic to those APIs or from responses you write, then add the errors, delays and state changes your tests need in development and CI.

14-day Pro trial. Runs on Docker Compose in your environment. See pricing · Read the quickstart

  • Self-hosted
  • Runs on Docker Compose
  • Built from real API traffic
  • Your test data, your control
  • Use the tests you already run

A login code request times out

accounts.northline.example/sign-in
NorthlineProduct workspace

Request trace

0 events
No requests yet

The next app action starts the trace.

A mocked code service answers after 4.5 seconds, and the app stops waiting at three. Send the code in the original app. Then switch to the version with timeout handling and send it again to compare what the user sees.

Start from the job you have.

  • GET /orders/1042 answers no answerthe service does not exist yet

    The orders API is not built yet, so the screen has nothing to show.

    Build before the API is ready.

    Build the client against the HTTP responses and state changes you expect while the upstream service is still taking shape.

    Build before dependencies are ready

  • CI run against the vendor sandbox answers passed · 3 of 3 checks

    CI run against the mock answers passed · 3 of 3 checksanswered from your reviewed responses

    Both runs pass while the sandbox is up. Take it down.

    Run the same API conditions in CI.

    Carry reviewed API inputs and a clear application assertion from a local fix into review and your existing CI suite.

    Keep useful cases through development and CI

Optional · Full stack

Train a model to simulate any API or service.

The model learns from the HTTP exchanges between your application and the service, whoever runs it: a payment provider, a partner, another team. Choose the exchanges you have reviewed, train a small adapter on your own compute, and attach the version you choose. Every answer says whether it was stored, retrieved or generated.

  • Full stack
  • Your own compute
  • Reviewed examples

See how a model is trained

  1. 1Choose traffic (current)
  2. 2Train a version
  3. 3Attach adapter

Service + URI filter

ServiceDemo API

URI filter/gostly-demo/anything/*

ExchangesThe ones you reviewed

Mock more than the happy path.

Pick the behavior a test needs to see, then decide how the mock answers the next request.

Return an error or a slow response

Serve a configured failure such as a 503, or add a delay, and check the retry, timeout or fallback your application actually uses.

Explore failure injection

POST /payments answers 201 Created · 38 msanswered from the mock library

The happy path. Pick the failure your test needs.

Keep state between calls

Follow the same resource through an action and a later read, such as an order from creation to cancellation.

Explore stateful workflows

GET /orders/1042 answers 200 · {"status": "open"}the same order, the state it is in now

Order 1042 is open. Cancel it, then read it again.

Cross an expiry or a rate-limit window

Advance simulated API time in a supported scenario, send the next request, then reset the scenario for another run.

Explore Time Chamber

Simulated API time09:00:00

GET /reports answers 429 Too Many Requests · Retry-After: 60

The API asks for a 60-second wait. Move its clock instead.

RelatedAPI simulation Service virtualization

Start a mock server from an OpenAPI file.

OpenAPI 3.x, JSON or YAML

Import the file and the response examples in it become the first responses of the mock API server. Where a response has no example, a value can be built from its schema for you to review.

Follow the OpenAPI import guide

Swagger 2.0 files

To mock an API from a Swagger file, convert the Swagger 2.0 document to OpenAPI 3.x, then import it the same way.

Read the seeding guide

Then add behavior

An imported example is a fixed answer. Add an error, a delay or state where a test needs the next request to go differently.

See the capabilities

From trial to a running HTTP mock server.

  1. Start the trial

    Register, verify your email and create your license key in your account dashboard.

  2. Install with Docker Compose

    Clone the public Compose repository onto the machine that will host Gostly and run its setup script.

    git clone https://github.com/gostlyai/gostly-docker-compose gostly-docker-compose && cd gostly-docker-compose
    ./setup.sh
  3. Add one API

    Register the service your application calls, or begin with the bundled demo API.

    curl -i http://localhost:8080/gostly-demo/get
  4. Run your tests against it

    Capture that API’s responses or import the ones you have, switch the service to MOCK, and point your tests at Gostly.

Read the quickstart Check the install requirements

Where Gostly runs.

Runs in your environment

Gostly is self-hosted. The supported stack starts with Docker Compose on the machine you choose to host it.

See how the stack fits together

What leaves it

In LEARN mode it calls your configured upstream. Connected editions also validate licenses and can send allowlisted operational telemetry.

Review where your test data goes

Lite or Full

Lite has no AI containers and is the default for every install. Full adds AI services and requires additional resources.

Check the install requirements

FAQ

Is Gostly a mock API server?

Yes. Gostly is a self-hosted API mock server: an HTTP proxy between your application and the APIs it calls. In MOCK mode it answers from the response library you prepared and does not call the upstream API.

Can I use Gostly as a stub server for a REST API?

Yes. A response you write or import is an API stub: the mock server returns it as saved for the request it matches. Add errors, delays or state only where a test needs more than a stub.

How do I choose between API mocking tools?

Choose known responses, related records or changing behavior for the experience you are developing. The guide below compares four practical cases, adequate alternatives and useful checks.

Can I keep my test runner?

Yes. Gostly supplies the HTTP dependency surface. Your client and test runner keep the application assertions and decide whether the result is right.

What do I need to run it?

You need Docker with Compose, git and curl. AI services run in the Full stack, which needs more memory; Lite runs without them.

Can Gostly answer a request it has no saved response for?

It can, as an option. On the Full stack you can train a small model on one service’s reviewed exchanges and let it generate an answer. The answer is labeled as generated, and your own checks decide whether it is right. Without that option a missing response stays a miss.

How does the trial work?

Every new account starts a 14-day Pro trial automatically, with no credit card required. A subscription is required after the trial.

Resources

Go deeper on API mocking

Choose an API mocking tool for your test

Compare four practical cases, adequate alternatives and useful checks with a downloadable worksheet.

Read the guide

Compare approaches for your API test

Choose a workflow comparison, or start from a HAR or OpenAPI example.

Open the comparisons

Review where your test data goes

Choose safe API test inputs with a data-flow map and the retained-data and outbound-connection boundaries.

Read the security evaluation

Mock one API your tests depend on.