---
title: "Add a new stub to the store"
method: POST
path: "/stubs"
tags: ["stubs"]
---

# Add a new stub to the store

`POST /stubs`

Creates a new stub or multiple stubs and adds them to the storage

## Request body

- union
  - Stub[]
    - `id` string, uuid
    - `service` string, required
    - `method` string, required
    - `priority` integer — Priority of the stub. Higher priority stubs are matched first.
    - `headers` StubHeaders
      - `equals` object
      - `contains` object
      - `matches` object
    - `input` StubInput, required
      - `ignoreArrayOrder` boolean
      - `equals` object
      - `contains` object
      - `matches` object
    - `inputs` StubInput[] — Inputs to match against. If multiple inputs are provided, the stub will be matched if any of the inputs match.
      - `ignoreArrayOrder` boolean
      - `equals` object
      - `contains` object
      - `matches` object
    - `output` StubOutput, required
      - `data` object
      - `stream` object[]
      - `headers` object
      - `error` string
      - `code` integer
      - `delay` string — Delay before sending the response
    - `options` StubOptions — Optional behavior settings for a stub
      - `times` integer — Max number of matches; 0 = unlimited
  - Stub
    - `id` string, uuid
    - `service` string, required
    - `method` string, required
    - `priority` integer — Priority of the stub. Higher priority stubs are matched first.
    - `headers` StubHeaders
      - `equals` object
      - `contains` object
      - `matches` object
    - `input` StubInput, required
      - `ignoreArrayOrder` boolean
      - `equals` object
      - `contains` object
      - `matches` object
    - `inputs` StubInput[] — Inputs to match against. If multiple inputs are provided, the stub will be matched if any of the inputs match.
      - `ignoreArrayOrder` boolean
      - `equals` object
      - `contains` object
      - `matches` object
    - `output` StubOutput, required
      - `data` object
      - `stream` object[]
      - `headers` object
      - `error` string
      - `code` integer
      - `delay` string — Delay before sending the response
    - `options` StubOptions — Optional behavior settings for a stub
      - `times` integer — Max number of matches; 0 = unlimited

## Response `200`

Successful operation

- ID[]

## Other responses

- `400` — Invalid stub data
- `422` — Validation error
- `500` — Internal Server Error

## Changes

- **2026-02-14** `001f2b1780f3` — 2 info
  - added the new optional request property `oneOf[#/components/schemas/StubList]/items/options`
  - added the new optional request property `oneOf[#/components/schemas/Stub]/options`
- **2025-12-06** `8784e347c130` — 4 breaking, 12 warning
  - the `oneOf[#/components/schemas/StubList]/items/output/data` request property type changed from no type to `object`
  - the `oneOf[#/components/schemas/StubList]/items/output/stream/items/` request property type changed from no type to `object`
  - the `oneOf[#/components/schemas/Stub]/output/data` request property type changed from no type to `object`
  - the `oneOf[#/components/schemas/Stub]/output/stream/items/` request property type changed from no type to `object`
  - …12 more

[Change history](https://skmtc.dev/bavix/apis/gripmock-api-schema/changes/stubs/post.md)

---

[API](https://skmtc.dev/bavix/apis/gripmock-api-schema.md) · [All operations](https://skmtc.dev/bavix/apis/gripmock-api-schema/llms.txt) · [OpenAPI document](https://skmtc.dev/bavix/apis/gripmock-api-schema/revisions/001f2b1780f3?raw)
