Create Mock

POST https://api.getpostman.com/mocks

This endpoint allows you to create a mock on a collection. You can also provide an environment UID to resolve any environment variables in the collection.

You can also specify the context of a workspace to create a mock in directly by passing the workspace as a query param.

Requires API Key as X-Api-Key request header or apikey URL query parameter.

Request Body

{"mock"=>{"collection"=>"1679925-39fee52f-b806-3ffa-1173-00a6f5b183dc", "environment"=>"1679925-0b9e9f15-3208-a2b1-22e0-d58392f01524"}}

HEADERS

KeyDatatypeRequiredDescription
Content-Typestring

RESPONSES

status: OK

{"mock":{"id":"0fca2246-c108-41f5-8454-cc032def329f","owner":"1679925","uid":"1679925-0fca2246-c108-41f5-8454-cc032def329f","collection":"1679925-39fee52f-b806-3ffa-1173-00a6f5b183dc","environment":"1679925-0b9e9f15-3208-a2b1-22e0-d58392f01524","mockUrl":"https://0fca2246-c108-41f5-8454-cc032def329f.mock.pstmn.io"}}