Postman Mocks API
Operations for creating and managing mock servers.
Operations for creating and managing mock servers.
openapi: 3.1.0
info:
title: Postman Mocks API
version: 1.0.0
description: 'Operations tagged mocks across 2 of this provider''s published API definitions: postman-api-openapi.yml, postman-mocks-api-openapi.yml. Each path carries the servers of the definition it was published in.'
servers:
- url: https://api.postman.com
description: https://api.postman.com
- url: https://api.eu.postman.com
description: https://api.eu.postman.com
tags:
- name: mocks
paths:
/mocks:
get:
operationId: getMocks
summary: Get all mock servers
description: 'Gets all active mock servers. By default, this endpoint returns only mock servers you created across all workspaces.
**Note:**
If you pass both the `teamId` and `workspace` query parameters, this endpoint only accepts the `workspace` query.
'
tags:
- mocks
parameters:
- name: teamId
in: query
description: Return only results that belong to the given team ID.
required: false
schema:
$ref: '#/components/schemas/teamIdResultsQuery'
- name: workspace
in: query
description: Return only results found in the given workspace ID.
required: false
schema:
$ref: '#/components/schemas/workspaceId'
- name: x-api-key
in: header
required: true
schema:
type: string
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/getMocks'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/GetMocksRequestUnauthorizedError'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/mock500Error'
post:
operationId: createMock
summary: Create a mock server
description: 'Creates a mock server in a collection.
**Note:**
- You cannot create mocks for collections added to an API definition.
- If you do not include the `workspaceId` query parameter, the system creates the mock server in the oldest personal Internal workspace you own.
'
tags:
- mocks
parameters:
- name: workspace
in: query
description: The workspace's ID.
required: true
schema:
$ref: '#/components/schemas/workspaceId'
- name: x-api-key
in: header
required: true
schema:
type: string
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/mockCreateUpdateResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/CreateMockRequestBadRequestError'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/CreateMockRequestUnauthorizedError'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/mock500Error'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/createMock'
servers:
- url: https://api.postman.com
description: https://api.postman.com
- url: https://api.eu.postman.com
description: https://api.eu.postman.com
/mocks/{mockId}:
get:
operationId: getMock
summary: Get a mock server
description: Gets information about a mock server.
tags:
- mocks
parameters:
- name: mockId
in: path
description: The mock's ID.
required: true
schema:
$ref: '#/components/schemas/mockId'
- name: x-api-key
in: header
required: true
schema:
type: string
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/getMock'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/GetMockRequestUnauthorizedError'
'404':
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/commonErrorNameMessageDetails'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/mock500Error'
put:
operationId: updateMock
summary: Update a mock server
description: Updates a mock server's properties, such as its name or collection.
tags:
- mocks
parameters:
- name: mockId
in: path
description: The mock's ID.
required: true
schema:
$ref: '#/components/schemas/mockId'
- name: x-api-key
in: header
required: true
schema:
type: string
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/mockCreateUpdateResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateMockRequestBadRequestError'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateMockRequestUnauthorizedError'
'404':
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/commonErrorNameMessageDetails'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/mock500Error'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/updateMock'
delete:
operationId: deleteMock
summary: Delete a mock server
description: Deletes a mock server.
tags:
- mocks
parameters:
- name: mockId
in: path
description: The mock's ID.
required: true
schema:
$ref: '#/components/schemas/mockId'
- name: x-api-key
in: header
required: true
schema:
type: string
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/deleteMock'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/DeleteMockRequestUnauthorizedError'
'404':
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/commonErrorNameMessageDetails'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/mock500Error'
servers:
- url: https://api.postman.com
description: https://api.postman.com
- url: https://api.eu.postman.com
description: https://api.eu.postman.com
/mocks/{mockId}/call-logs:
get:
operationId: getMockCallLogs
summary: Get a mock server's call logs
description: 'Gets a mock server''s call logs. You can get a maximum of 6.5MB of call logs or a total of 100 call logs, whichever limit is met first in one API call.
Call logs contain exchanged request and response data made to mock servers. The logs provide visibility into how the mock servers are being used. You can log data to debug, test, analyze, and more, depending upon the use case.
**Note:**
Call logs have a retention period based on your [Postman plan](https://www.postman.com/pricing/#mock-calls). For more information, see [this article](https://support.postman.com/hc/en-us/articles/21219973964951-I-can-t-see-my-mock-server-logs-history) in the [Postman Support Center](https://support.postman.com/).
'
tags:
- mocks
parameters:
- name: mockId
in: path
description: The mock's ID.
required: true
schema:
$ref: '#/components/schemas/mockId'
- name: limit
in: query
description: The maximum number of rows to return in the response.
required: false
schema:
$ref: '#/components/schemas/limitDefault100'
default: 100
- name: cursor
in: query
description: The pointer to the first record of the set of paginated results. To view the next response, use the `nextCursor` value for this parameter.
required: false
schema:
$ref: '#/components/schemas/cursor'
- name: until
in: query
description: Return only results created until this given time, in [ISO 8601](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format. This value cannot be earlier than the `since` value.
required: false
schema:
$ref: '#/components/schemas/untilDateTime'
- name: since
in: query
description: Return only results created since the given time, in [ISO 8601](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) format. This value cannot be later than the `until` value.
required: false
schema:
$ref: '#/components/schemas/sinceDateTime'
- name: responseStatusCode
in: query
description: Return only call logs that match the given HTTP response status code.
required: false
schema:
$ref: '#/components/schemas/mockResponseStatusCode'
- name: responseType
in: query
description: Return only call logs that match the given response type. Matching is not case-sensitive.
required: false
schema:
$ref: '#/components/schemas/mockResponseType'
- name: requestMethod
in: query
description: Return only call logs that match the given HTTP method. Matching is not case-sensitive.
required: false
schema:
$ref: '#/components/schemas/mockRequestMethod'
- name: requestPath
in: query
description: Return only call logs that match the given request path. Matching is not case-sensitive.
required: false
schema:
$ref: '#/components/schemas/mockRequestPath'
- name: sort
in: query
description: Sort the results by the given value. If you use this query parameter, you must also use the `direction` parameter.
required: false
schema:
$ref: '#/components/schemas/mockSortServedAt'
- name: direction
in: query
description: Sort in ascending (`asc`) or descending (`desc`) order. Matching is not case-sensitive. If you use this query parameter, you must also use the `sort` parameter.
required: false
schema:
$ref: '#/components/schemas/ascDesc'
- name: include
in: query
description: Include call log records with header and body data. This query parameter accepts the `request.headers`, `request.body`, `response.headers`, and `response.body` values. For multiple include types, comma-separate each value.
required: false
schema:
$ref: '#/components/schemas/mockInclude'
- name: x-api-key
in: header
required: true
schema:
type: string
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/getMockCallLogs'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/GetMockCallLogsRequestBadRequestError'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/GetMockCallLogsRequestUnauthorizedError'
'404':
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/commonErrorNameMessageDetails'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/GetMockCallLogsRequestInternalServerError'
servers:
- url: https://api.postman.com
description: https://api.postman.com
- url: https://api.eu.postman.com
description: https://api.eu.postman.com
/mocks/{mockId}/publish:
post:
operationId: publishMock
summary: Publish a mock server
description: Publishes a mock server. Publishing a mock server sets its **Access Control** configuration setting to public.
tags:
- mocks
parameters:
- name: mockId
in: path
description: The mock's ID.
required: true
schema:
$ref: '#/components/schemas/mockId'
- name: x-api-key
in: header
required: true
schema:
type: string
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/publishUnpublishMockResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/PublishMockRequestBadRequestError'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/PublishMockRequestUnauthorizedError'
'404':
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/commonErrorNameMessageDetails'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/mock500Error'
servers:
- url: https://api.postman.com
description: https://api.postman.com
- url: https://api.eu.postman.com
description: https://api.eu.postman.com
/mocks/{mockId}/unpublish:
delete:
operationId: unpublishMock
summary: Unpublish a mock server
description: Unpublishes a mock server. Unpublishing a mock server sets its **Access Control** configuration setting to private.
tags:
- mocks
parameters:
- name: mockId
in: path
description: The mock's ID.
required: true
schema:
$ref: '#/components/schemas/mockId'
- name: x-api-key
in: header
required: true
schema:
type: string
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/publishUnpublishMockResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/UnpublishMockRequestBadRequestError'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/UnpublishMockRequestUnauthorizedError'
'404':
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/commonErrorNameMessageDetails'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/mock500Error'
servers:
- url: https://api.postman.com
description: https://api.postman.com
- url: https://api.eu.postman.com
description: https://api.eu.postman.com
/mocks/{mockId}/server-responses:
get:
operationId: getMockServerResponses
summary: Get all server responses
description: Gets all of a mock server's server responses.
tags:
- mocks
parameters:
- name: mockId
in: path
description: The mock's ID.
required: true
schema:
$ref: '#/components/schemas/mockId'
- name: x-api-key
in: header
required: true
schema:
type: string
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/getMockServerResponses'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/GetMockServerResponsesRequestUnauthorizedError'
'404':
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/mockServerResponse404Error'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/GetMockServerResponsesRequestInternalServerError'
post:
operationId: createMockServerResponse
summary: Create a server response
description: 'Creates a server response. Server responses let you simulate 5xx server-level responses, such as 500 or 503.
Server-level responses are agnostic to application-level logic. Server responses let you simulate this behavior on a mock server. You do not need to define each error for all exposed paths on the mock server.
If you set a server response as active, then all the calls to the mock server return with that active server response.
**Note:**
You can create multiple server responses for a mock server, but only one mock server can be set as active.
'
tags:
- mocks
parameters:
- name: mockId
in: path
description: The mock's ID.
required: true
schema:
$ref: '#/components/schemas/mockId'
- name: x-api-key
in: header
required: true
schema:
type: string
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/mockServerResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/CreateMockServerResponseRequestBadRequestError'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/CreateMockServerResponseRequestUnauthorizedError'
'404':
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/mockServerResponse404Error'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/CreateMockServerResponseRequestInternalServerError'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/createMockServerResponse'
servers:
- url: https://api.postman.com
description: https://api.postman.com
- url: https://api.eu.postman.com
description: https://api.eu.postman.com
/mocks/{mockId}/server-responses/{serverResponseId}:
get:
operationId: getMockServerResponse
summary: Get a server response
description: Gets information about a server response.
tags:
- mocks
parameters:
- name: mockId
in: path
description: The mock's ID.
required: true
schema:
$ref: '#/components/schemas/mockId'
- name: serverResponseId
in: path
description: The server response's ID.
required: true
schema:
$ref: '#/components/schemas/serverResponseId'
- name: x-api-key
in: header
required: true
schema:
type: string
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/mockServerResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/GetMockServerResponseRequestUnauthorizedError'
'404':
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/mockServerResponse404Error'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/GetMockServerResponseRequestInternalServerError'
put:
operationId: updateMockServerResponse
summary: Update a server response
description: Updates a server response.
tags:
- mocks
parameters:
- name: mockId
in: path
description: The mock's ID.
required: true
schema:
$ref: '#/components/schemas/mockId'
- name: serverResponseId
in: path
description: The server response's ID.
required: true
schema:
$ref: '#/components/schemas/serverResponseId'
- name: x-api-key
in: header
required: true
schema:
type: string
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/mockServerResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateMockServerResponseRequestBadRequestError'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateMockServerResponseRequestUnauthorizedError'
'404':
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/mockServerResponse404Error'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateMockServerResponseRequestInternalServerError'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/updateMockServerResponse'
delete:
operationId: deleteMockServerResponse
summary: Delete a server response
description: Deletes a mock server's server response.
tags:
- mocks
parameters:
- name: mockId
in: path
description: The mock's ID.
required: true
schema:
$ref: '#/components/schemas/mockId'
- name: serverResponseId
in: path
description: The server response's ID.
required: true
schema:
$ref: '#/components/schemas/serverResponseId'
- name: x-api-key
in: header
required: true
schema:
type: string
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/deleteMockServerResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/DeleteMockServerResponseRequestUnauthorizedError'
'404':
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/mockServerResponse404Error'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/DeleteMockServerResponseRequestInternalServerError'
servers:
- url: https://api.postman.com
description: https://api.postman.com
- url: https://api.eu.postman.com
description: https://api.eu.postman.com
components:
schemas:
DeleteMockServerResponseRequestUnauthorizedError:
oneOf:
- $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
- $ref: '#/components/schemas/commonErrorNameMessage'
title: DeleteMockServerResponseRequestUnauthorizedError
GetMockCallLogsCallLogsItemsResponse:
type: object
properties:
type:
type: string
description: The type of response.
statusCode:
type: number
format: double
description: The response's status code.
headers:
$ref: '#/components/schemas/GetMockCallLogsCallLogsItemsResponseHeaders'
description: The response's headers.
body:
$ref: '#/components/schemas/GetMockCallLogsCallLogsItemsResponseBody'
description: The response's body information.
description: The server response's response information.
title: GetMockCallLogsCallLogsItemsResponse
UpdateMockMock:
type: object
properties:
name:
type: string
description: The mock server's name.
environment:
type: string
format: uid
description: The associated environment's unique ID.
description:
type: string
description: The mock server's description.
private:
type: boolean
default: false
description: If true, the mock server is set private. By default, mock servers are public and can receive requests from anyone and anywhere.
versionTag:
type: string
description: The API's version tag ID.
collection:
type: string
description: The ID of the collection associated with the mock server.
config:
$ref: '#/components/schemas/UpdateMockMockConfig'
description: The mock server's configuration settings.
title: UpdateMockMock
commonErrorNameMessageDetails:
type: object
properties:
error:
$ref: '#/components/schemas/CommonErrorNameMessageDetailsError'
title: commonErrorNameMessageDetails
GetMocksMocksItemsConfigDelay:
type: object
properties:
type:
$ref: '#/components/schemas/GetMocksMocksItemsConfigDelayType'
description: 'The type of simulated delay value:
- `fixed` — The delay value is a fixed value.
'
preset:
$ref: '#/components/schemas/GetMocksMocksItemsConfigDelayPreset'
description: 'The simulated fixed network delay value:
- `1` — 2G (300 ms).
- `2` — 3G (100 ms).
The object does not return this value for custom delay values.
'
duration:
type: integer
description: The configured delay, in milliseconds.
description: Information about the mock server's simulated network delay settings. This returns a null value if there are no configured network delay settings.
title: GetMocksMocksItemsConfigDelay
CommonErrorTypeTitleDetailStatusType:
oneOf:
- type: string
format: uri-reference
- type: string
title: CommonErrorTypeTitleDetailStatusType
mockRequestMethod:
type: string
title: mockRequestMethod
commonErrorTypeTitleDetail:
type: object
properties:
type:
type: string
description: The type of error.
title:
type: string
description: A short summary of the problem.
detail:
$ref: '#/components/schemas/CommonErrorTypeTitleDetailDetail'
description: Information about the error.
title: commonErrorTypeTitleDetail
GetMockCallLogsCallLogsItemsResponseHeaders:
type: object
properties:
description:
$ref: '#/components/schemas/GetMockCallLogsCallLogsItemsResponseHeadersDescription'
description: The response header's description information.
key:
type: string
description: The response header's name.
value:
type: string
description: The response header's value.
description: The response's headers.
title: GetMockCallLogsCallLogsItemsResponseHeaders
MockCreateUpdateResponseMockConfig:
type: object
properties:
matchBody:
type: boolean
description: If true, the mock server matches the request's body to the body of the saved examples.
matchHeader:
type: boolean
description: If true, the mock server matches the request's headers in the `header` array to the headers of the saved examples.
headers:
type: array
items:
type: string
description: A list of header key values.
matchQueryParams:
type: boolean
description: If true, match query parameters to the saved examples.
matchWildcards:
type: boolean
description: If true, use wildcard variable matching.
delay:
oneOf:
- $ref: '#/components/schemas/MockCreateUpdateResponseMockConfigDelay'
- type: 'null'
description: Information about the mock server's simulated network delay settings. This returns a null value if there are no configured network delay settings.
serverResponseId:
type:
- string
- 'null'
description: The ID of mock server's default response for requests. All calls to the mock server will return the defined response.
description: Information about the mock server's configuration.
title: MockCreateUpdateResponseMockConfig
publishUnpublishMockResponse:
type: object
properties:
mock:
$ref: '#/components/schemas/PublishUnpublishMockResponseMock'
description: Information about the mock server.
title: publishUnpublishMockResponse
GetMockCallLogsCallLogsItems:
type: object
properties:
id:
type: string
description: The server response's ID.
responseName:
type: string
description: The server response's name.
servedAt:
type: string
format: date-time
description: The date and time at which the server response was served.
request:
$ref: '#/components/schemas/GetMockCallLogsCallLogsItemsRequest'
description: The server response's request information.
response:
$ref: '#/components/schemas/GetMockCallLogsCallLogsItemsResponse'
description: The server response's response information.
description: Information about the mock server's server response.
title: GetMockCallLogsCallLogsItems
mockInclude:
type: string
title: mockInclud
# --- truncated at 32 KB (67 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/postman/refs/heads/main/openapi/postman-mocks-api-openapi.yml