---
title: "replay a previously recorded request to its original target"
method: PUT
path: "/mockserver/replay"
tags: ["control"]
---

# replay a previously recorded request to its original target

`PUT /mockserver/replay`

## Request

- Base URL: `http://localhost:1080`
- URL: `http://localhost:1080/mockserver/replay`
- Auth: none declared

Re-issues a previously recorded or proxied HTTP request to its upstream target and returns the upstream response. The target host/port is resolved from the socketAddress field or the Host header in the submitted HttpRequest JSON. Subject to the SSRF policy (mockserver.forwardProxyBlockPrivateNetworks) and a 10 MB body-size cap on both the outbound request and the upstream response.

## Request body

- HttpRequest: request properties matcher
  - `secure` boolean
  - `keepAlive` boolean
  - `method` union: string value that can be support nottable, optional or a json schema
    - string
    - object
      - `not` boolean
      - `optional` boolean
      - `value` string
      - `schema` Schema (unresolved $ref)
      - `parameterStyle` 'SIMPLE' | 'SIMPLE_EXPLODED' | 'LABEL' | 'LABEL_EXPLODED' | 'MATRIX' | 'MATRIX_EXPLODED' | 'FORM_EXPLODED' | 'FORM' | 'SPACE_DELIMITED_EXPLODED' | 'SPACE_DELIMITED' | 'PIPE_DELIMITED_EXPLODED' | 'PIPE_DELIMITED' | 'DEEP_OBJECT'
  - `path` union: string value that can be support nottable, optional or a json schema
    - string
    - object
      - `not` boolean
      - `optional` boolean
      - `value` string
      - `schema` Schema (unresolved $ref)
      - `parameterStyle` 'SIMPLE' | 'SIMPLE_EXPLODED' | 'LABEL' | 'LABEL_EXPLODED' | 'MATRIX' | 'MATRIX_EXPLODED' | 'FORM_EXPLODED' | 'FORM' | 'SPACE_DELIMITED_EXPLODED' | 'SPACE_DELIMITED' | 'PIPE_DELIMITED_EXPLODED' | 'PIPE_DELIMITED' | 'DEEP_OBJECT'
  - `pathParameters` union
    - object[]
      - `name` string
      - `values` string[]
    - object
      - `keyMatchStyle` 'MATCHING_KEY' | 'SUB_SET'
  - `queryStringParameters` union
    - object[]
      - `name` string
      - `values` string[]
    - object
      - `keyMatchStyle` 'MATCHING_KEY' | 'SUB_SET'
  - `body` union: request body matcher
    - object: binary body matcher
      - `not` boolean
      - `type` 'BINARY'
      - `base64Bytes` string
      - `contentType` string
    - object: json body matcher
      - `not` boolean
      - `type` 'JSON'
      - `json` string
      - `contentType` string
      - `matchType` 'STRICT' | 'ONLY_MATCHING_FIELDS'
      - `matchNumbersAsStrings` boolean
    - object: json matching fields body matcher
    - object: json schema body matcher
      - `not` boolean
      - `type` 'JSON_SCHEMA'
      - `jsonSchema` Schema (unresolved $ref)
    - object: JSON path body matcher
      - `not` boolean
      - `type` 'JSON_PATH'
      - `jsonPath` string
    - object: parameter body matcher
      - `not` boolean
      - `type` 'PARAMETERS'
      - `parameters` union
        - object[]
          - `name` string
          - `values` string[]
        - object
          - `keyMatchStyle` 'MATCHING_KEY' | 'SUB_SET'
    - object: regex body matcher
      - `not` boolean
      - `type` 'REGEX'
      - `regex` string
    - object: string body matcher
      - `not` boolean
      - `type` 'STRING'
      - `string` string
      - `contentType` string
      - `subString` boolean
    - string: substring body matcher
    - object: xml body matcher
      - `not` boolean
      - `type` 'XML'
      - `xml` string
      - `contentType` string
    - object: xml schema body matcher
      - `not` boolean
      - `type` 'XML_SCHEMA'
      - `xmlSchema` string
    - object: xpath body matcher
      - `not` boolean
      - `type` 'XPATH'
      - `xpath` string
    - object: all-of body matcher — matches only when every one of its component body matchers matches the same request body
      - `not` boolean
      - `optional` boolean
      - `type` 'ALL_OF'
      - `bodyAllOf` Body[], required
    - object: binary body matcher
      - `not` boolean
      - `optional` boolean
      - `type` 'BINARY'
      - `base64Bytes` string
      - `contentType` string
    - object: json body matcher
      - `not` boolean
      - `optional` boolean
      - `type` 'JSON'
      - `json` string
      - `contentType` string
      - `matchType` 'STRICT' | 'ONLY_MATCHING_FIELDS'
      - `matchNumbersAsStrings` boolean
    - object: json schema body matcher
      - `not` boolean
      - `optional` boolean
      - `type` 'JSON_SCHEMA'
      - `jsonSchema` Schema (unresolved $ref)
    - object: JSON path body matcher
      - `not` boolean
      - `optional` boolean
      - `type` 'JSON_PATH'
      - `jsonPath` string
    - object: parameter body matcher
      - `not` boolean
      - `optional` boolean
      - `type` 'PARAMETERS'
      - `parameters` union
        - object[]
          - `name` string
          - `values` string[]
        - object
          - `keyMatchStyle` 'MATCHING_KEY' | 'SUB_SET'
    - object: multipart form-data body matcher
      - `not` boolean
      - `optional` boolean
      - `type` 'MULTIPART'
      - `fields` union
        - object[]
          - `name` string
          - `values` string[]
        - object
          - `keyMatchStyle` 'MATCHING_KEY' | 'SUB_SET'
      - `filenames` union
        - object[]
          - `name` string
          - `values` string[]
        - object
          - `keyMatchStyle` 'MATCHING_KEY' | 'SUB_SET'
      - `partContentTypes` union
        - object[]
          - `name` string
          - `values` string[]
        - object
          - `keyMatchStyle` 'MATCHING_KEY' | 'SUB_SET'
    - object: regex body matcher
      - `not` boolean
      - `optional` boolean
      - `type` 'REGEX'
      - `regex` string
    - object: string body matcher
      - `not` boolean
      - `optional` boolean
      - `type` 'STRING'
      - `string` string
      - `contentType` string
      - `subString` boolean
    - object: xml body matcher
      - `not` boolean
      - `optional` boolean
      - `type` 'XML'
      - `xml` string
      - `contentType` string
    - object: xml schema body matcher
      - `not` boolean
      - `optional` boolean
      - `type` 'XML_SCHEMA'
      - `xmlSchema` string
    - object: xpath body matcher
      - `not` boolean
      - `optional` boolean
      - `type` 'XPATH'
      - `xpath` string
    - object: JSON-RPC body matcher
      - `not` boolean
      - `optional` boolean
      - `type` 'JSON_RPC'
      - `method` string
      - `paramsSchema` string
    - object: GraphQL body matcher
      - `not` boolean
      - `optional` boolean
      - `type` 'GRAPHQL', required
      - `query` string, required
      - `operationName` string
      - `variablesSchema` string
  - `headers` union
    - object[]
      - `name` string
      - `values` string[]
    - object
      - `keyMatchStyle` 'MATCHING_KEY' | 'SUB_SET'
  - `cookies` union
    - object[]
      - `name` string
      - `value` string
    - object
  - `socketAddress` SocketAddress: remote address to send request to, only used for request overrides
    - `host` string
    - `port` integer
    - `scheme` 'HTTP' | 'HTTPS'
  - `protocol` 'HTTP_1_1' | 'HTTP_2' | 'HTTP_3': protocol matcher
  - `jwt` Jwt: JSON Web Token (JWT) request matcher — decodes the token carried in a request header (no signature verification) and matches its claims
    - `header` string: name of the request header carrying the JWT (default 'authorization')
    - `scheme` string: authentication scheme prefix stripped from the header value before decoding (default 'Bearer')
    - `claims` object: claim-value criteria; each value may be an exact string, regex or '!'-negated form
    - `issuer` union: string value that can be support nottable, optional or a json schema
      - string
      - object
        - `not` boolean
        - `optional` boolean
        - `value` string
        - `schema` Schema (unresolved $ref)
        - `parameterStyle` 'SIMPLE' | 'SIMPLE_EXPLODED' | 'LABEL' | 'LABEL_EXPLODED' | 'MATRIX' | 'MATRIX_EXPLODED' | 'FORM_EXPLODED' | 'FORM' | 'SPACE_DELIMITED_EXPLODED' | 'SPACE_DELIMITED' | 'PIPE_DELIMITED_EXPLODED' | 'PIPE_DELIMITED' | 'DEEP_OBJECT'
    - `audience` union: string value that can be support nottable, optional or a json schema
      - string
      - object
        - `not` boolean
        - `optional` boolean
        - `value` string
        - `schema` Schema (unresolved $ref)
        - `parameterStyle` 'SIMPLE' | 'SIMPLE_EXPLODED' | 'LABEL' | 'LABEL_EXPLODED' | 'MATRIX' | 'MATRIX_EXPLODED' | 'FORM_EXPLODED' | 'FORM' | 'SPACE_DELIMITED_EXPLODED' | 'SPACE_DELIMITED' | 'PIPE_DELIMITED_EXPLODED' | 'PIPE_DELIMITED' | 'DEEP_OBJECT'
    - `algorithm` union: string value that can be support nottable, optional or a json schema
      - string
      - object
        - `not` boolean
        - `optional` boolean
        - `value` string
        - `schema` Schema (unresolved $ref)
        - `parameterStyle` 'SIMPLE' | 'SIMPLE_EXPLODED' | 'LABEL' | 'LABEL_EXPLODED' | 'MATRIX' | 'MATRIX_EXPLODED' | 'FORM_EXPLODED' | 'FORM' | 'SPACE_DELIMITED_EXPLODED' | 'SPACE_DELIMITED' | 'PIPE_DELIMITED_EXPLODED' | 'PIPE_DELIMITED' | 'DEEP_OBJECT'
  - `not` boolean
  - `respondBeforeBody` boolean: If true, MockServer responds to a matching request before consuming its body and may close the connection. Required: the matcher must not specify a body matcher, and the action must be RESPONSE or ERROR.

## Response `200`

upstream response returned successfully

- HttpResponse: response to return
  - `delay` Delay: response delay
    - `timeUnit` 'DAYS' | 'HOURS' | 'MINUTES' | 'SECONDS' | 'MILLISECONDS' | 'MICROSECONDS' | 'NANOSECONDS'
    - `value` integer
    - `template` string: opt-in template rendered against the request whose output is parsed as a millisecond delay (e.g. respond more slowly for larger payloads); falls back to value/timeUnit on a non-numeric or blank result
    - `templateType` 'VELOCITY' | 'MUSTACHE': template engine used to evaluate the delay template; only VELOCITY and MUSTACHE are supported
    - `distribution` object: distribution for variable delays: UNIFORM requires min and max, LOG_NORMAL requires median and p99, GAUSSIAN requires mean and stdDev
      - `type` 'UNIFORM' | 'LOG_NORMAL' | 'GAUSSIAN', required
      - `min` integer
      - `max` integer
      - `median` integer
      - `p99` integer
      - `mean` integer
      - `stdDev` integer
  - `body` union: response body
    - object: binary response body
      - `not` boolean
      - `type` 'BINARY'
      - `base64Bytes` string
      - `contentType` string
      - `optional` boolean
    - object: json response body
      - `not` boolean
      - `type` 'JSON'
      - `json` string
      - `contentType` string
      - `optional` boolean
    - object: json response body
    - object: string response body
      - `not` boolean
      - `type` 'STRING'
      - `string` string
      - `contentType` string
      - `optional` boolean
    - string: string response body
    - object: xml response body
      - `not` boolean
      - `type` 'XML'
      - `xml` string
      - `contentType` string
      - `optional` boolean
    - object: file response body — served from a file, optionally rendered as a template against the request
      - `not` boolean
      - `type` 'FILE'
      - `filePath` string
      - `templateType` 'VELOCITY' | 'MUSTACHE'
      - `contentType` string
      - `optional` boolean
  - `cookies` union
    - object[]
      - `name` string
      - `value` string
    - object
  - `connectionOptions` ConnectionOptions: connection options
    - `suppressContentLengthHeader` boolean
    - `contentLengthHeaderOverride` integer
    - `suppressConnectionHeader` boolean
    - `chunkSize` integer
    - `keepAliveOverride` boolean
    - `closeSocket` boolean
    - `closeSocketDelay` Delay: response delay
      - `timeUnit` 'DAYS' | 'HOURS' | 'MINUTES' | 'SECONDS' | 'MILLISECONDS' | 'MICROSECONDS' | 'NANOSECONDS'
      - `value` integer
      - `template` string: opt-in template rendered against the request whose output is parsed as a millisecond delay (e.g. respond more slowly for larger payloads); falls back to value/timeUnit on a non-numeric or blank result
      - `templateType` 'VELOCITY' | 'MUSTACHE': template engine used to evaluate the delay template; only VELOCITY and MUSTACHE are supported
      - `distribution` object: distribution for variable delays: UNIFORM requires min and max, LOG_NORMAL requires median and p99, GAUSSIAN requires mean and stdDev
        - `type` 'UNIFORM' | 'LOG_NORMAL' | 'GAUSSIAN', required
        - `min` integer
        - `max` integer
        - `median` integer
        - `p99` integer
        - `mean` integer
        - `stdDev` integer
  - `headers` union
    - object[]
      - `name` string
      - `values` string[]
    - object
      - `keyMatchStyle` 'MATCHING_KEY' | 'SUB_SET'
  - `trailers` union
    - object[]
      - `name` string
      - `values` string[]
    - object
      - `keyMatchStyle` 'MATCHING_KEY' | 'SUB_SET'
  - `statusCode` integer
  - `reasonPhrase` string
  - `recoverAfter` RecoverAfter: fail the first failTimes matches then serve the configured response (deterministic retry/backoff recovery primitive)
    - `failTimes` integer: number of leading matches that serve the failure response before the configured response is served; null or <= 0 makes this inert
    - `failResponse` HttpResponse (recursive)
    - `idempotencyHeader` string: optional request header whose value keys an independent failure window per (expectation, header-value); when absent on a request the per-expectation match count is used
  - `statusCodeRange` string

## Other responses

- `400`: missing or unparseable HttpRequest body
- `403`: replay blocked by SSRF policy (target is a private/loopback/metadata address)
- `413`: request body exceeds maximum replay size
- `501`: replay not available (no HTTP client wired)
- `502`: upstream connection failed or upstream response body exceeds maximum size

---

[API](https://skmtc.dev/mock-server/apis/mockserver-api.md) · [All operations](https://skmtc.dev/mock-server/apis/mockserver-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mock-server/apis/mockserver-api/revisions/9239b693996e?raw)
