> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt. For full content including API reference and SDK examples, see https://learning.postman.com/llms-full.txt.

# Get a mock server's call logs

GET https://api.getpostman.com/mocks/{mockId}/call-logs

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/).


Reference: https://learning.postman.com/api-docs/api-reference/mocks/get-mock-call-logs

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Postman API
  version: 1.0.0
paths:
  /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.getpostman.com
    description: https://api.getpostman.com
  - url: https://api.eu.postman.com
    description: https://api.eu.postman.com
components:
  schemas:
    mockId:
      type: string
      title: mockId
    limitDefault100:
      type: number
      format: double
      default: 100
      title: limitDefault100
    cursor:
      type: string
      title: cursor
    untilDateTime:
      type: string
      format: date-time
      title: untilDateTime
    sinceDateTime:
      type: string
      format: date-time
      title: sinceDateTime
    mockResponseStatusCode:
      type: number
      format: double
      title: mockResponseStatusCode
    mockResponseType:
      type: string
      title: mockResponseType
    mockRequestMethod:
      type: string
      title: mockRequestMethod
    mockRequestPath:
      type: string
      title: mockRequestPath
    mockSortServedAt:
      type: string
      enum:
        - servedAt
      title: mockSortServedAt
    ascDesc:
      type: string
      enum:
        - asc
        - desc
      title: ascDesc
    mockInclude:
      type: string
      title: mockInclude
    GetMockCallLogsCallLogsItemsRequestHeaders:
      type: object
      properties:
        key:
          type: string
          description: The request header's name.
        value:
          type: string
          description: The request header's value.
      description: The request's headers.
      title: GetMockCallLogsCallLogsItemsRequestHeaders
    GetMockCallLogsCallLogsItemsRequestBody:
      type: object
      properties:
        mode:
          type: string
          description: The request body's media type (mode).
        data:
          type: string
          description: The request body's contents.
      description: The request's body information.
      title: GetMockCallLogsCallLogsItemsRequestBody
    GetMockCallLogsCallLogsItemsRequest:
      type: object
      properties:
        method:
          type: string
          description: The request method.
        path:
          type: string
          description: The request's path.
        headers:
          $ref: '#/components/schemas/GetMockCallLogsCallLogsItemsRequestHeaders'
          description: The request's headers.
        body:
          $ref: '#/components/schemas/GetMockCallLogsCallLogsItemsRequestBody'
          description: The request's body information.
      description: The server response's request information.
      title: GetMockCallLogsCallLogsItemsRequest
    GetMockCallLogsCallLogsItemsResponseHeadersDescription:
      type: object
      properties:
        content:
          type: string
          description: The response header description's content.
        type:
          type: string
          description: The response header description's media type.
      description: The response header's description information.
      title: GetMockCallLogsCallLogsItemsResponseHeadersDescription
    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
    GetMockCallLogsCallLogsItemsResponseBody:
      type: object
      properties:
        data:
          type: string
          description: The response body's contents.
      description: The response's body information.
      title: GetMockCallLogsCallLogsItemsResponseBody
    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
    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
    GetMockCallLogsMeta:
      type: object
      properties:
        nextCursor:
          type:
            - string
            - 'null'
          format: base64
          description: >-
            The pagination cursor that points to the next record in the results
            set.
      description: The response's non-standard meta information.
      title: GetMockCallLogsMeta
    getMockCallLogs:
      type: object
      properties:
        call-logs:
          type: array
          items:
            $ref: '#/components/schemas/GetMockCallLogsCallLogsItems'
          description: A list of call logs.
        meta:
          $ref: '#/components/schemas/GetMockCallLogsMeta'
          description: The response's non-standard meta information.
      title: getMockCallLogs
    CommonErrorNameMessageError:
      type: object
      properties:
        name:
          type: string
          description: The error name.
        message:
          type: string
          description: The error message.
      description: Information about the error.
      title: CommonErrorNameMessageError
    commonErrorNameMessage:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/CommonErrorNameMessageError'
          description: Information about the error.
      title: commonErrorNameMessage
    CommonErrorNameMessageDetailsErrorDetails:
      oneOf:
        - type: object
          additionalProperties:
            description: Any type
        - type: array
          items:
            type: string
      description: Information about the error.
      title: CommonErrorNameMessageDetailsErrorDetails
    CommonErrorNameMessageDetailsError:
      type: object
      properties:
        name:
          type: string
          description: The error name.
        message:
          type: string
          description: The error message.
        details:
          $ref: '#/components/schemas/CommonErrorNameMessageDetailsErrorDetails'
          description: Information about the error.
      title: CommonErrorNameMessageDetailsError
    commonErrorNameMessageDetails:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/CommonErrorNameMessageDetailsError'
      title: commonErrorNameMessageDetails
    GetMockCallLogsRequestBadRequestError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorNameMessage'
        - $ref: '#/components/schemas/commonErrorNameMessageDetails'
      title: GetMockCallLogsRequestBadRequestError
    CommonErrorTypeTitleDetailStatusType:
      oneOf:
        - type: string
          format: uri-reference
        - type: string
      title: CommonErrorTypeTitleDetailStatusType
    commonErrorTypeTitleDetailStatus:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/CommonErrorTypeTitleDetailStatusType'
        title:
          type: string
          description: A short summary of the problem.
        detail:
          type: string
          description: Information about the error.
        status:
          type: integer
          description: The error's HTTP status code.
      title: commonErrorTypeTitleDetailStatus
    GetMockCallLogsRequestUnauthorizedError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessage'
      title: GetMockCallLogsRequestUnauthorizedError
    CommonErrorTypeTitleDetailDetail:
      oneOf:
        - type: string
        - type: object
          additionalProperties:
            description: Any type
      description: Information about the error.
      title: CommonErrorTypeTitleDetailDetail
    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
    GetMockCallLogsRequestInternalServerError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetail'
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessage'
      title: GetMockCallLogsRequestInternalServerError
  securitySchemes:
    PostmanApiKey:
      type: apiKey
      in: header
      name: x-api-key
    scimApiKey:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        A valid [SCIM API
        key](https://learning.postman.com/docs/administration/scim-provisioning/scim-provisioning-overview/#generating-scim-api-key)
        for calls to SCIM endpoints.
    basicAuth:
      type: http
      scheme: basic

```

## Examples



**Response**

```json
{
  "call-logs": [
    {
      "id": "c4505a1e-7261-497c-91ff-db4bd51351a6-9545",
      "responseName": "Double check your method and the request path and try again.",
      "servedAt": "2022-01-17T06:19:30.000Z",
      "request": {
        "method": "POST",
        "path": "/animals"
      },
      "response": {
        "type": "error",
        "statusCode": 404
      }
    },
    {
      "id": "0f63f54d-665e-436a-95b4-c1302d7685a9-3925",
      "responseName": "Bad request",
      "servedAt": "2022-01-17T06:19:22.000Z",
      "request": {
        "method": "POST",
        "path": "/animals"
      },
      "response": {
        "type": "success",
        "statusCode": 400
      }
    },
    {
      "id": "adab0d30-5c38-43bf-af90-4119925138e2-3795",
      "responseName": "Successful addition of animals to the store",
      "servedAt": "2022-01-17T06:19:16.000Z",
      "request": {
        "method": "POST",
        "path": "/animals"
      },
      "response": {
        "type": "success",
        "statusCode": 200
      }
    },
    {
      "id": "dae50669-f4c1-460a-b3a4-3a2445f4f39d-2468",
      "responseName": "Get filtered list of Animals",
      "servedAt": "2022-01-17T06:18:26.000Z",
      "request": {
        "method": "GET",
        "path": "/animals?type=dog"
      },
      "response": {
        "type": "success",
        "statusCode": 200
      }
    },
    {
      "id": "a5330463-26e1-4812-a962-e44b569a2054-9894",
      "responseName": "Get Animals",
      "servedAt": "2022-01-17T06:18:06.000Z",
      "request": {
        "method": "GET",
        "path": "/animals"
      },
      "response": {
        "type": "success",
        "statusCode": 200
      }
    }
  ],
  "meta": {
    "nextCursor": null
  }
}
```

**SDK Code**

```python Successful Response
import requests

url = "https://api.getpostman.com/mocks/e3d951bf-873f-49ac-a658-b2dcb91d3289/call-logs"

headers = {"x-api-key": "<apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript Successful Response
const url = 'https://api.getpostman.com/mocks/e3d951bf-873f-49ac-a658-b2dcb91d3289/call-logs';
const options = {method: 'GET', headers: {'x-api-key': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Successful Response
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.getpostman.com/mocks/e3d951bf-873f-49ac-a658-b2dcb91d3289/call-logs"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-api-key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Successful Response
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/mocks/e3d951bf-873f-49ac-a658-b2dcb91d3289/call-logs")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java Successful Response
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.getpostman.com/mocks/e3d951bf-873f-49ac-a658-b2dcb91d3289/call-logs")
  .header("x-api-key", "<apiKey>")
  .asString();
```

```php Successful Response
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.getpostman.com/mocks/e3d951bf-873f-49ac-a658-b2dcb91d3289/call-logs', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Successful Response
using RestSharp;

var client = new RestClient("https://api.getpostman.com/mocks/e3d951bf-873f-49ac-a658-b2dcb91d3289/call-logs");
var request = new RestRequest(Method.GET);
request.AddHeader("x-api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Successful Response
import Foundation

let headers = ["x-api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/mocks/e3d951bf-873f-49ac-a658-b2dcb91d3289/call-logs")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```