---
title: "Get the Latest Log Entries"
method: GET
path: "/v2.1/projects/{projectId}/logs/tail"
tags: ["Logs v2.1"]
---

# Get the Latest Log Entries

`GET /v2.1/projects/{projectId}/logs/tail`

Gets the latest 100 [log entries](https://docs.cognigy.com/ai/agents/test/logs) in a Project. Results are sorted descending by timestamp and `_id`. Supports cursor-based pagination via opaque base64url tokens returned in `nextCursor` and `previousCursor`. The `total` field is always `-1` because counting rows in this collection is intentionally skipped for performance reasons. If you provide an invalid `cursor` value, a 400 error will be returned. When the request header `x-cognigy-log-model-version` is set to `v2`, the response items use the V2 shape with a nested `metadata` object instead of a top-level `type` field.

## Path parameters

- `projectId` string, required

## Query parameters

- `next` string
- `previous` string
- `type` string[]
- `userId` string
- `flowName` string

## Headers

- `Accept` 'application/json' | 'application/hal+json' | 'application/xml' | 'text/xml' | 'text/csv'
- `x-cognigy-log-model-version` 'v1' | 'v2'

## Response `200`

Returns array of the latest Log Entries

- object
  - `items` union[]
    - union
      - object
        - `_id` string
        - `timestamp` string, date-time
        - `msg` string
        - `type` 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace'
        - `meta` object
        - `traceId` string
      - object
        - `_id` string, required
        - `timestamp` string, date-time, required
        - `msg` string
        - `meta` object
        - `traceId` string
        - `metadata` object, required
          - `organizationId` string, required
          - `projectId` string, required
          - `type` 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace', required
  - `total` integer
  - `nextCursor` string, nullable
  - `previousCursor` string, nullable

## Other responses

- `400` — Bad request. This can occur if an invalid cursor is provided. This error is thrown by the pagination plugin when the cursor value is not a valid ID for the field.
- `401` — The request has not been applied because it lacks valid authentication credentials for the target resource.
- `402` — Upgrade your Plan to increase your Quota.
- `403` — The server understood the request but refuses to authorize it.
- `404` — The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
- `405` — The method received in the request-line is known by the origin server but not supported by the target resource.
- `409` — The request conflicts with current state of the server.
- `413` — The request entity is larger than limits defined by server.
- `500` — The server encountered an unexpected condition that prevented it from fulfilling the request.
- `501` — The server does not support the functionality required to fulfill the request.
- `502` — The server, while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while attempting to fulfill the request.
- `503` — The server is not ready to handle the request.
- `504` — The server, while acting as a gateway or proxy, did not receive a timely response from an upstream server it needed to access in order to complete the request.

---

[API](https://skmtc.net/cognigy/apis/simulator-openapi-rest-ful-api-reference.md) · [All operations](https://skmtc.net/cognigy/apis/simulator-openapi-rest-ful-api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/cognigy/simulator-openapi-rest-ful-api-reference/revisions/85b2872bdfb7/schema)
