Docs menu

Select message branch legacy

PUT /v1/organisations/{organisation_id}/workspaces/{workspace_id}/conversations/{conversation_id}/messages/{message_id}/branch Deprecated

Shows another version of the chat from the message carrying branch on: the messages from there on are swapped for those of version index, which the model then continues from.

Authentication

Send an API key, or an access token from your organisation’s identity provider, in the Authorization header. How API keys work

Scope the API key needs: conversations:write

Security schemes in the OpenAPI document: session_cookie (cookie __Host-ivy_session)bearer (bearer)api_key (bearer)

Parameters

  • organisation_id path string required
  • workspace_id path string required
  • conversation_id path string required
  • message_id path string required

Request body

application/json SelectBranch required

  • index integer (int32) required

    1-based, up to branch.count.

    minimum 0

Responses

  • 200 application/json ConversationDetail

    The chat with the chosen version of its messages

  • 401 application/json ErrorBody

    unauthenticated

  • 403 application/json ErrorBody

    workspace_content_restricted, invalid_origin, insufficient_scope; with several people, only the person who made the versions switches between them

  • 404 application/json ErrorBody

    No such chat of the caller's in this space, or no such message in its current version

  • 409 application/json ErrorBody

    run_in_progress while the assistant is answering in this chat

  • 422 application/json ErrorBody

    validation_failed: the message has no other versions, or index is out of range

  • 429 application/json ErrorBody

    rate_limited: the API key's requests per minute are used up; retry after Retry-After seconds

  • 500 application/json ErrorBody

    internal

  • 503 application/json ErrorBody

    unavailable: the database is briefly unavailable; retry after Retry-After seconds

Error codes

Errors come back as an ErrorBody whose code is one of these.

  • 401 unauthenticated
  • 403 workspace_content_restrictedinvalid_origininsufficient_scope
  • 404 not_found generic code for this status
  • 409 run_in_progress
  • 422 validation_failedindex
  • 429 rate_limited
  • 500 internal
  • 503 unavailable

Examples

curl
curl -X PUT "$IVY_API_URL/v1/organisations/$ORGANISATION_ID/workspaces/$WORKSPACE_ID/conversations/$CONVERSATION_ID/messages/$MESSAGE_ID/branch" \
  -H "Authorization: Bearer $IVY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"index":0}'
JavaScript SDK
import { client, selectMessageBranchLegacy } from "@spacivapp/ivy-sdk";

client.setConfig({
  baseUrl: process.env.IVY_API_URL,
  headers: { Authorization: `Bearer ${process.env.IVY_API_KEY}` },
});

const { data, error, response } = await selectMessageBranchLegacy({
  path: { organisation_id: organisationId, workspace_id: workspaceId, conversation_id: conversationId, message_id: messageId },
  body: {
    index: 0
  },
});
Example request body
{
  "index": 0
}
Example response (200)
{
  "active_run_id": "active_run_123",
  "conversation": {
    "agent_id": "agent_123",
    "answer_mode": "every_message",
    "archived_at": "2026-01-15T09:30:00Z",
    "assignee": "string",
    "can_post": false,
    "channel_id": "channel_123",
    "chat_origin": {
      "binding_id": "binding_123",
      "channel_name": "Ada Lovelace",
      "platform": {}
    },
    "created_at": "2026-01-15T09:30:00Z",
    "created_by": {
      "id": "id_123",
      "type": {}
    },
    "id": "id_123",
    "kind": "direct",
    "last_message_at": "2026-01-15T09:30:00Z",
    "last_read": 1,
    "last_reply_at": "2026-01-15T09:30:00Z",
    "last_reply_by": {
      "id": "id_123",
      "type": {}
    },
    "latest_replies": [
      {
        "author": {},
        "author_name": "Ada Lovelace",
        "author_platform": {},
        "created_at": "2026-01-15T09:30:00Z",
        "excerpt": "string",
        "mentions": [],
        "message_id": "message_123",
        "text": "Hello, Ivy",
        "text_cut": false
      }
    ],
    "mentioned": false,
    "notify": "all",
    "participant_keys": [
      "string"
    ],
    "peer_key": "string",
    "pinned": false,
    "post": {
      "author": {},
      "author_name": "Ada Lovelace",
      "author_platform": {},
      "created_at": "2026-01-15T09:30:00Z",
      "excerpt": "string",
      "mentions": [],
      "message_id": "message_123",
      "text": "Hello, Ivy",
      "text_cut": false
    },
    "reply_count": 0,
    "run_state": "working",
    "space_id": "space_123",
    "status": "open",
    "title": "string",
    "unread_count": 0,
    "updated_at": "2026-01-15T09:30:00Z",
    "visibility": "private",
    "workspace_id": "workspace_123"
  },
  "messages": [
    {
      "acting_for": {
        "id": "id_123",
        "type": {}
      },
      "ask_id": "ask_123",
      "attachments": [
        {
          "file_id": "file_123",
          "name": "Ada Lovelace"
        }
      ],
      "author": {
        "id": "id_123",
        "type": {}
      },
      "author_name": "Ada Lovelace",
      "branch": {
        "count": 0,
        "index": 0
      },
      "created_at": "2026-01-15T09:30:00Z",
      "deleted_at": "2026-01-15T09:30:00Z",
      "edited_at": "2026-01-15T09:30:00Z",
      "feedback": "up",
      "file_links": [
        {
          "file_id": "file_123",
          "name": "Ada Lovelace",
          "path": "string",
          "space_id": "space_123",
          "version": 1,
          "workspace_id": "workspace_123"
        }
      ],
      "id": "id_123",
      "in_reply_to": "string",
      "mentions": [
        "string"
      ],
      "model": "string",
      "notice": {
        "actor": {},
        "channel_id": "channel_123",
        "conversation_id": "conversation_123",
        "kind": {},
        "participants": [],
        "title": "string"
      },
      "origin": {
        "platform_message_id": "platform_message_123",
        "source": {}
      },
      "parts": [
        {
          "text": "Hello, Ivy",
          "type": "text"
        }
      ],
      "quote": {
        "author": {},
        "author_name": "Ada Lovelace",
        "created_at": "2026-01-15T09:30:00Z",
        "deleted": false,
        "excerpt": "string",
        "message_id": "message_123"
      },
      "reactions": [
        {
          "emoji": "string",
          "participants": []
        }
      ],
      "read_through": "string",
      "role": "user",
      "stopped_by": {
        "id": "id_123",
        "type": {}
      },
      "thinking": [
        {
          "before_part": 0,
          "duration_ms": 0,
          "text": "Hello, Ivy"
        }
      ]
    }
  ],
  "mirror": {
    "channel_name": "Ada Lovelace",
    "hidden_external_messages": 0,
    "platform": "slack"
  },
  "queue": {
    "items": [
      {
        "agent_id": "agent_123",
        "attachments": [],
        "author_id": "author_123",
        "conversation_id": "conversation_123",
        "created_at": "2026-01-15T09:30:00Z",
        "follow_up_of": "string",
        "id": "id_123",
        "mentions": [],
        "model": "string",
        "position": 1,
        "quote": {},
        "resumes_ask_id": "resumes_ask_123",
        "source": {},
        "text": "Hello, Ivy",
        "updated_at": "2026-01-15T09:30:00Z",
        "version": 1
      }
    ],
    "paused": false,
    "paused_reason": "failed"
  },
  "stream_seq": 0
}