API Reference

Chat sessions

A chat session is one conversation, owned by the user who created it. These endpoints list your sessions, read the messages in a session, copy a session's opening message and metrics, and rename or delete a session.

Every endpoint is scoped to the caller: you can only read or change sessions you own. A request for a session belonging to another user is refused with 403.

The chat session object

One conversation and its most recent activity.

Attributes

  • id integer

    The session's unique identifier.

  • agent_type string

    The kind of agent the session was started with.

  • title string

    The session's title. Defaults to New Chat until renamed.

  • user_id integer

    The owning user's identifier.

  • created_at string

    When the session was created.

  • last_message nullable string

    The content of the most recent message, or null when the session has none.

  • latest_metrics nullable object

    The most recent metrics recorded for the session, or null.

    Show child attributes Hide child attributes
    • id integer

      The metrics record's identifier.

    • type string

      The kind of metrics recorded.

    • data object

      The metrics payload.

The chat session object
{
  "id": 128,
  "agent_type": "master",
  "title": "Q3 board narrative",
  "user_id": 42,
  "created_at": "Tue, 01 Sep 2026 09:30:00 GMT",
  "last_message": "Here is the summary you asked for.",
  "latest_metrics": null
}

List chat sessions

GET /api/chat-sessions

Returns the caller's chat sessions, newest first.

Returns the sessions owned by the caller, most recently created first. Supply page or limit to page through the list; when neither is present, every session is returned in one response without the pagination fields.

Authentication
Bearer token How it works

Query parameters

  • page integer

    The 1-based page to return. Values below 1 are treated as 1.

    Defaults to 1.

  • limit integer

    Sessions per page, from 1 to 100. Values outside that range fall back to the default.

    Defaults to 20.

Returns

Returns a page of chat session objects.

Request
curl "$VDF_BASE_URL/api/chat-sessions?page=1&limit=20" \
  -H "Authorization: Bearer $VDF_ACCESS_TOKEN"
Response 200
{
  "success": true,
  "sessions": [
    {
      "id": 128,
      "agent_type": "master",
      "title": "Q3 board narrative",
      "user_id": 42,
      "created_at": "Tue, 01 Sep 2026 09:30:00 GMT",
      "last_message": "Here is the summary you asked for.",
      "latest_metrics": null
    }
  ],
  "total": 1,
  "page": 1,
  "limit": 20,
  "hasMore": false
}

List messages in a session

GET /api/chat/messages/{session_id}

Returns the messages in a session the caller owns.

Returns the messages in a session, oldest first. Restrict the result with mission_id, cap it with limit, or set latest=true alongside a limit to take the newest messages (still returned in chronological order). The caller must own the session.

Authentication
Bearer token How it works

Path parameters

  • session_id integer Required

    The session to read.

Query parameters

  • mission_id string

    Return only messages belonging to this mission.

  • limit integer

    Maximum number of messages to return, up to 1000.

  • latest boolean

    When true and a limit is set, take the newest messages rather than the oldest.

Returns

Returns the session's messages in messages.

Errors

  • 403 The session does not belong to the caller.
Request
curl "$VDF_BASE_URL/api/chat/messages/128?limit=50" \
  -H "Authorization: Bearer $VDF_ACCESS_TOKEN"
Response 200
{
  "success": true,
  "messages": [
    {
      "role": "user",
      "content": "Summarise the attached report.",
      "timestamp": "2026-09-01T09:30:00+00:00",
      "html_generation_id": null,
      "mission_id": null,
      "message_type": null,
      "step_index": null,
      "step_id": null
    },
    {
      "role": "assistant",
      "content": "Here is the summary you asked for.",
      "timestamp": "2026-09-01T09:30:42+00:00",
      "html_generation_id": null,
      "mission_id": null,
      "message_type": null,
      "step_index": null,
      "step_id": null
    }
  ]
}

Retrieve a session's opening message

GET /api/chat/{session_id}/copy

Returns a session's opening message and metrics for reuse.

Returns the first user message of a session together with its recorded metrics, so the conversation can be started again from the same prompt. The caller must own the session.

Authentication
Bearer token How it works

Path parameters

  • session_id integer Required

    The session to copy from.

Returns

Returns the opening message and metrics in data.

Errors

  • 403 The session does not belong to the caller.
  • 404 The session has no message to copy.
Request
curl "$VDF_BASE_URL/api/chat/128/copy" \
  -H "Authorization: Bearer $VDF_ACCESS_TOKEN"
Response 200
{
  "success": true,
  "data": {
    "message": "Summarise the attached report.",
    "metrics": [
      {
        "metrics_type": "clarity",
        "metrics_data": {
          "score": 0.82
        }
      }
    ]
  }
}

Rename a session

PUT /api/chat/{session_id}/rename

Changes the title of a session the caller owns.

Sets a new title on a session. The caller must own the session.

Authentication
Bearer token How it works

Path parameters

  • session_id integer Required

    The session to rename.

Body parameters application/json

  • title string Required

    The new title.

Returns

Returns success: true, a confirmation message, and the new title.

Errors

  • 400 The request body is missing or title was not supplied.
  • 403 The session does not belong to the caller.
Request
curl -X PUT "$VDF_BASE_URL/api/chat/128/rename" \
  -H "Authorization: Bearer $VDF_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Q3 board narrative"
  }'
Response 200
{
  "success": true,
  "message": "Session renamed successfully",
  "title": "Q3 board narrative"
}

Delete a session

DEL /api/chat/{session_id}

Deletes a session the caller owns and all of its data.

Permanently deletes a session together with its messages, metrics, and any diagram. The caller must own the session. This cannot be undone.

Authentication
Bearer token How it works

Path parameters

  • session_id integer Required

    The session to delete.

Returns

Returns success: true and a confirmation message once the session and its messages are deleted.

Errors

  • 403 The session does not belong to the caller.
Request
curl -X DELETE "$VDF_BASE_URL/api/chat/128" \
  -H "Authorization: Bearer $VDF_ACCESS_TOKEN"
Response 200
{
  "success": true,
  "message": "Chat session deleted successfully"
}