RecoupGet a Free AuditFree Audit

API REFERENCE

Mark Chat Read

On this page
POST/api/sessions/{sessionId}/chats/{chatId}/read

Records that the authenticated account has read this chat up to the current timestamp. This upserts a row in chat_reads setting last_read_at = now(). After a successful call the hasUnread flag for this chat will be false in subsequent GET /api/sessions/{sessionId}/chats responses.

Authentication

x-api-key in header

BearerAuth bearer

Request

cURL
curl --request POST \
  --url 'https://api.recoupable.dev/api/sessions/YOUR_SESSION_ID/chats/YOUR_CHAT_ID/read' \
  --header 'x-api-key: YOUR_API_KEY'

Replace the YOUR_ placeholders with your values. Required query parameters are included; optional parameters are listed below.

Parameters

Path parameters

sessionIdstringrequired

The id of the parent session.

chatIdstringrequired

The id of the chat to mark as read.

Responses

200Chat marked as read successfully.

application/json

successboolean · enumrequired

Values: true

401Unauthorized — invalid or missing API key / Bearer token.

application/json

statusstring · enumrequired

Always "error" for error responses.

Values: "error"

errorstringrequired

Human-readable error message.

403Forbidden — the authenticated account does not own this session.

application/json

statusstring · enumrequired

Always "error" for error responses.

Values: "error"

errorstringrequired

Human-readable error message.

404Not found — no session exists with the given id, the chat does not exist, or the chat belongs to a different session.

application/json

statusstring · enumrequired

Always "error" for error responses.

Values: "error"

errorstringrequired

Human-readable error message.

500Server error — the read record could not be persisted.

application/json

statusstring · enumrequired

Always "error" for error responses.

Values: "error"

errorstringrequired

Human-readable error message.

Full specification

Download the OpenAPI file for complete schemas, constraints, and examples.

Download sessions.json
View operation source
json
{
  "operationId": "markChatRead",
  "summary": "Mark chat as read",
  "description": "Records that the authenticated account has read this chat up to the current timestamp. This upserts a row in `chat_reads` setting `last_read_at = now()`. After a successful call the `hasUnread` flag for this chat will be `false` in subsequent `GET /api/sessions/{sessionId}/chats` responses.",
  "parameters": [
    {
      "name": "sessionId",
      "in": "path",
      "required": true,
      "description": "The id of the parent session.",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "chatId",
      "in": "path",
      "required": true,
      "description": "The id of the chat to mark as read.",
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Chat marked as read successfully.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/MarkChatReadResponse"
          }
        }
      }
    },
    "401": {
      "description": "Unauthorized — invalid or missing API key / Bearer token.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Forbidden — the authenticated account does not own this session.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Not found — no session exists with the given id, the chat does not exist, or the chat belongs to a different session.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Server error — the read record could not be persisted.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}