> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.runtype.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.runtype.com/_mcp/server.

# Update a conversation

PUT https://api.runtype.com/v1/conversations/{id}
Content-Type: application/json

Reference: https://docs.runtype.com/api-reference/runtype-api/conversations/update-a-conversation

## Authentication

- `Authorization` header (bearer token, required) — API key or Clerk session token

## Servers

- `https://api.runtype.com` (Production, default)
- `https://api.runtype-staging.com` (Staging)

## Request

### Path parameters

- `id` (string, required)

### Body (application/json)

This endpoint expects an object.

- `agentId` (string, optional, nullable) — Null clears metadata.agentId; omit to leave it unchanged.
- `messages` (list of ConversationTranscriptMessage, optional) — Full-fidelity transcript. A tool message must carry toolResults answering an assistant toolCalls entry issued earlier in the array; ids and createdAt are minted when omitted.
- `messagesMode` (enum, optional, default: replace) — How to apply `messages`. `replace` (the default) swaps the whole transcript. `append` adds them to the end, skipping any message whose id is already stored, so a chunked import can retry a chunk safely; the combined transcript is validated and must satisfy the same tool-pairing discipline.
  - Allowed values: `replace`, `append`
- `metadata` (map from string to any, optional)
- `modelId` (string, optional)
- `ownerId` (string, optional, nullable) — Reassigns the owner (indexed owner_id column, filterable via ?ownerId=). Overrides a nested metadata.ownerId. Null clears the owner; omit to leave it unchanged.
- `source` (ConversationSource, optional) — Import provenance, stored as metadata.importSource.
- `systemPrompt` (string, optional)
- `title` (string, optional)

## Response

### 200

Conversation updated

- `createdAt` (string, required)
- `id` (string, required)
- `messages` (list of ConversationTranscriptMessage, required)
- `metadata` (map from string to any, required)
- `modelId` (string, required, nullable)
- `ownerId` (string, required, nullable)
- `source` (enum, required)
  - Allowed values: `app`, `client_token`
- `systemPrompt` (string, required, nullable)
- `title` (string, required)
- `updatedAt` (string, required)
- `imported` (boolean, optional) — Set by POST /v1/conversations only. True when this call created the conversation (201); false when a conversation with the same source.system and source.externalId already existed and is returned unchanged (200).
- `schemaWarnings` (list of V1ConversationsIdPutResponsesContentApplicationJsonSchemaSchemaWarningsItems, optional)

## Errors

### 400 Bad Request Error

Validation error. `code: CONVERSATION_TRANSCRIPT_INVALID` when `messages` breaks the tool-pairing discipline; `details.issues` lists each offending message index.

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of V1ConversationsIdPutResponsesContentApplicationJsonSchemaDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.
- `message` (string, optional)

### 401 Unauthorized Error

Unauthorized

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 403 Forbidden Error

Insufficient permissions

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 404 Not Found Error

Conversation not found

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 409 Conflict Error

`messagesMode: "append"` lost the compare-and-swap on the stored transcript (`CONVERSATION_MODIFIED`) because a concurrent write moved it. Nothing was written; re-read the conversation and retry.

- `code` (enum, required) — The stored transcript changed between the read and the write; re-read and retry.
  - Allowed values: `CONVERSATION_MODIFIED`
- `error` (string, required)
- `details` (list of ConversationModifiedErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 422 Unprocessable Entity Error

Metadata violates a registered `conversation` collection schema (enforce mode)

- `collection` (string, required)
- `details` (list of RecordSchemaValidationErrorDetailsItems, required)
- `error` (enum, required)
  - Allowed values: `schema_validation_failed`
- `schemaVersion` (integer, required)
- `recordId` (string, optional)
- `recordName` (string, optional)

### 500 Internal Server Error

Internal server error

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 503 Service Unavailable Error

The type's collection schema could not be loaded, so the write was refused rather than left unvalidated; retry

- `code` (enum, required)
  - Allowed values: `COLLECTION_LOOKUP_FAILED`
- `collection` (string, required) — The record type whose collection schema could not be loaded.
- `error` (string, required) — Human-readable refusal; retry the request.
- `recordId` (string, optional)
- `recordName` (string, optional)

## Types

### ConversationTranscriptMessage

- `content` (ConversationTranscriptMessageContent, required) — Plain string, or an array of \{type:"text"|"image"|"file"|"reasoning"|"asset\_ref"} parts.
- `role` (enum, required)
  - Allowed values: `system`, `user`, `assistant`, `tool`
- `author` (ConversationMessageAuthor, optional) — Who wrote this message in the source system. Stored and returned, never replayed.
- `createdAt` (string, optional) — ISO 8601 when Runtype mints it; any string is accepted on import.
- `id` (string, optional) — Minted when omitted. Use the source system id to make an import resumable.
- `metadata` (map from string to any, optional) — Open key/value bag. Runtype stamps `executionId` on a turn an agent wrote; treat it as optional.
- `model` (string, optional) — The model that wrote this assistant message. Informational on import: only a message the agent engine stored itself (marked server-side) replays its reasoning parts and provider options, and only to this same model.
- `toolCalls` (list of ConversationTranscriptMessageToolCallsItems, optional) — Assistant messages only. Every entry must be answered by the next tool message. An agent turn stores one assistant and tool message pair per model round, in order.
- `toolResults` (list of ConversationTranscriptMessageToolResultsItems, optional) — Tool messages only, and required on them.

### ConversationSource

Import provenance, stored as metadata.importSource.

- `system` (string, required) — The system the transcript came from, for example "intercom" or "custom".
- `externalId` (string, optional) — The conversation id in the source system. Re-creating with the same system and externalId returns the existing conversation with imported: false instead of a duplicate.
- `importedAt` (datetime, optional)

### V1ConversationsIdPutResponsesContentApplicationJsonSchemaSchemaWarningsItems

- `code` (string, required)
- `field` (string, required)
- `message` (string, required)

### V1ConversationsIdPutResponsesContentApplicationJsonSchemaDetailsItems

- `message` (string, required)
- `code` (string, optional) — Stable Runtype validation code (e.g. MISSING_REQUIRED_FIELD, INVALID_ENUM).
- `path` (string, optional) — Dotted JSON path to the offending field.
- `suggestion` (string, optional) — Actionable hint (allowed values, accepted range, …).

### ErrorDetailsItems

- `message` (string, required)
- `code` (string, optional) — Stable Runtype validation code (e.g. MISSING_REQUIRED_FIELD, INVALID_ENUM).
- `path` (string, optional) — Dotted JSON path to the offending field.
- `suggestion` (string, optional) — Actionable hint (allowed values, accepted range, …).

### ConversationModifiedErrorDetailsItems

- `message` (string, required)
- `code` (string, optional) — Stable Runtype validation code (e.g. MISSING_REQUIRED_FIELD, INVALID_ENUM).
- `path` (string, optional) — Dotted JSON path to the offending field.
- `suggestion` (string, optional) — Actionable hint (allowed values, accepted range, …).

### RecordSchemaValidationErrorDetailsItems

- `code` (string, required)
- `field` (string, required)
- `message` (string, required)
- `path` (string, required)

### ConversationTranscriptMessageContent

Plain string, or an array of \{type:"text"|"image"|"file"|"reasoning"|"asset\_ref"} parts.

- string
- list of ConversationTranscriptMessageContentOneOf1Items

### ConversationMessageAuthor

Who wrote this message in the source system. Stored and returned, never replayed.

- `type` (enum, required)
  - Allowed values: `end_user`, `operator`, `agent`, `system`
- `externalId` (string, optional) — The author id in the source system.
- `id` (string, optional) — The author id in Runtype, when there is one.
- `name` (string, optional)

### ConversationTranscriptMessageToolCallsItems

- `toolCallId` (string, required)
- `toolName` (string, required)
- `args` (map from string to any, optional, default: {})
- `providerOptions` (map from string to any, optional)

### ConversationTranscriptMessageToolResultsItems

- `toolCallId` (string, required) — Must answer a toolCalls entry issued earlier.
- `toolName` (string, required)
- `providerOptions` (map from string to any, optional)
- `result` (any, optional) — Whatever the tool returned.

### ConversationTranscriptMessageContentOneOf1Items

- ConversationTranscriptMessageContentOneOf1Items0
- ConversationTranscriptMessageContentOneOf1Items1
- ConversationTranscriptMessageContentOneOf1Items2
- ConversationTranscriptMessageContentOneOf1Items3
- ConversationTranscriptMessageContentOneOf1Items4

### ConversationTranscriptMessageContentOneOf1Items0

- `text` (string, required)
- `type` (enum, required)
  - Allowed values: `text`

### ConversationTranscriptMessageContentOneOf1Items1

- `image` (string, required)
- `type` (enum, required)
  - Allowed values: `image`
- `mimeType` (string, optional)

### ConversationTranscriptMessageContentOneOf1Items2

- `data` (string, required)
- `filename` (string, required)
- `mimeType` (string, required)
- `type` (enum, required)
  - Allowed values: `file`

### ConversationTranscriptMessageContentOneOf1Items3

- `text` (string, required)
- `type` (enum, required)
  - Allowed values: `reasoning`
- `providerOptions` (map from string to any, optional)

### ConversationTranscriptMessageContentOneOf1Items4

- `assetId` (string, required)
- `mimeType` (string, required)
- `orgKey` (string, required)
- `refKind` (enum, required)
  - Allowed values: `image`, `file`
- `sizeBytes` (double, required)
- `type` (enum, required)
  - Allowed values: `asset_ref`
- `filename` (string, optional)

## Examples

### Replace the stored transcript

**Request**

```json
{
  "agentId": "agent_01j9r4x0h7f9k4b2n8t6q3m5cd",
  "messages": [
    {
      "content": "Book me a table for two at 7pm.",
      "role": "user"
    },
    {
      "content": "",
      "role": "assistant",
      "toolCalls": [
        {
          "toolCallId": "call_9",
          "toolName": "create_reservation",
          "args": {
            "partySize": 2,
            "time": "19:00"
          }
        }
      ]
    },
    {
      "content": "",
      "role": "tool",
      "toolResults": [
        {
          "toolCallId": "call_9",
          "toolName": "create_reservation",
          "result": null
        }
      ]
    },
    {
      "content": "Booked. Your table for two is confirmed for 7pm.",
      "role": "assistant"
    }
  ],
  "source": {
    "system": "custom"
  }
}
```

**Response**

```json
{
  "createdAt": "string",
  "id": "string",
  "messages": [
    {
      "content": "string",
      "role": "system",
      "author": {
        "type": "end_user",
        "externalId": "string",
        "id": "string",
        "name": "string"
      },
      "createdAt": "string",
      "id": "string",
      "metadata": {},
      "model": "string",
      "toolCalls": [
        {
          "toolCallId": "string",
          "toolName": "string",
          "args": {},
          "providerOptions": {}
        }
      ],
      "toolResults": [
        {
          "toolCallId": "string",
          "toolName": "string",
          "providerOptions": {},
          "result": null
        }
      ]
    }
  ],
  "metadata": {},
  "modelId": "string",
  "ownerId": "string",
  "source": "app",
  "systemPrompt": "string",
  "title": "string",
  "updatedAt": "string",
  "imported": true,
  "schemaWarnings": [
    {
      "code": "string",
      "field": "string",
      "message": "string"
    }
  ]
}
```

**SDK Code**

```python Replace the stored transcript
import requests

url = "https://api.runtype.com/v1/conversations/id"

payload = {
    "agentId": "agent_01j9r4x0h7f9k4b2n8t6q3m5cd",
    "messages": [
        {
            "content": "Book me a table for two at 7pm.",
            "role": "user"
        },
        {
            "content": "",
            "role": "assistant",
            "toolCalls": [
                {
                    "toolCallId": "call_9",
                    "toolName": "create_reservation",
                    "args": {
                        "partySize": 2,
                        "time": "19:00"
                    }
                }
            ]
        },
        {
            "content": "",
            "role": "tool",
            "toolResults": [
                {
                    "toolCallId": "call_9",
                    "toolName": "create_reservation",
                    "result": None
                }
            ]
        },
        {
            "content": "Booked. Your table for two is confirmed for 7pm.",
            "role": "assistant"
        }
    ],
    "source": { "system": "custom" }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript Replace the stored transcript
const url = 'https://api.runtype.com/v1/conversations/id';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"agentId":"agent_01j9r4x0h7f9k4b2n8t6q3m5cd","messages":[{"content":"Book me a table for two at 7pm.","role":"user"},{"content":"","role":"assistant","toolCalls":[{"toolCallId":"call_9","toolName":"create_reservation","args":{"partySize":2,"time":"19:00"}}]},{"content":"","role":"tool","toolResults":[{"toolCallId":"call_9","toolName":"create_reservation","result":null}]},{"content":"Booked. Your table for two is confirmed for 7pm.","role":"assistant"}],"source":{"system":"custom"}}'
};

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

```go Replace the stored transcript
package main

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

func main() {

	url := "https://api.runtype.com/v1/conversations/id"

	payload := strings.NewReader("{\n  \"agentId\": \"agent_01j9r4x0h7f9k4b2n8t6q3m5cd\",\n  \"messages\": [\n    {\n      \"content\": \"Book me a table for two at 7pm.\",\n      \"role\": \"user\"\n    },\n    {\n      \"content\": \"\",\n      \"role\": \"assistant\",\n      \"toolCalls\": [\n        {\n          \"toolCallId\": \"call_9\",\n          \"toolName\": \"create_reservation\",\n          \"args\": {\n            \"partySize\": 2,\n            \"time\": \"19:00\"\n          }\n        }\n      ]\n    },\n    {\n      \"content\": \"\",\n      \"role\": \"tool\",\n      \"toolResults\": [\n        {\n          \"toolCallId\": \"call_9\",\n          \"toolName\": \"create_reservation\",\n          \"result\": null\n        }\n      ]\n    },\n    {\n      \"content\": \"Booked. Your table for two is confirmed for 7pm.\",\n      \"role\": \"assistant\"\n    }\n  ],\n  \"source\": {\n    \"system\": \"custom\"\n  }\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

```ruby Replace the stored transcript
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/conversations/id")

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

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"agentId\": \"agent_01j9r4x0h7f9k4b2n8t6q3m5cd\",\n  \"messages\": [\n    {\n      \"content\": \"Book me a table for two at 7pm.\",\n      \"role\": \"user\"\n    },\n    {\n      \"content\": \"\",\n      \"role\": \"assistant\",\n      \"toolCalls\": [\n        {\n          \"toolCallId\": \"call_9\",\n          \"toolName\": \"create_reservation\",\n          \"args\": {\n            \"partySize\": 2,\n            \"time\": \"19:00\"\n          }\n        }\n      ]\n    },\n    {\n      \"content\": \"\",\n      \"role\": \"tool\",\n      \"toolResults\": [\n        {\n          \"toolCallId\": \"call_9\",\n          \"toolName\": \"create_reservation\",\n          \"result\": null\n        }\n      ]\n    },\n    {\n      \"content\": \"Booked. Your table for two is confirmed for 7pm.\",\n      \"role\": \"assistant\"\n    }\n  ],\n  \"source\": {\n    \"system\": \"custom\"\n  }\n}"

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

```java Replace the stored transcript
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.runtype.com/v1/conversations/id")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"agentId\": \"agent_01j9r4x0h7f9k4b2n8t6q3m5cd\",\n  \"messages\": [\n    {\n      \"content\": \"Book me a table for two at 7pm.\",\n      \"role\": \"user\"\n    },\n    {\n      \"content\": \"\",\n      \"role\": \"assistant\",\n      \"toolCalls\": [\n        {\n          \"toolCallId\": \"call_9\",\n          \"toolName\": \"create_reservation\",\n          \"args\": {\n            \"partySize\": 2,\n            \"time\": \"19:00\"\n          }\n        }\n      ]\n    },\n    {\n      \"content\": \"\",\n      \"role\": \"tool\",\n      \"toolResults\": [\n        {\n          \"toolCallId\": \"call_9\",\n          \"toolName\": \"create_reservation\",\n          \"result\": null\n        }\n      ]\n    },\n    {\n      \"content\": \"Booked. Your table for two is confirmed for 7pm.\",\n      \"role\": \"assistant\"\n    }\n  ],\n  \"source\": {\n    \"system\": \"custom\"\n  }\n}")
  .asString();
```

```php Replace the stored transcript
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.runtype.com/v1/conversations/id', [
  'body' => '{
  "agentId": "agent_01j9r4x0h7f9k4b2n8t6q3m5cd",
  "messages": [
    {
      "content": "Book me a table for two at 7pm.",
      "role": "user"
    },
    {
      "content": "",
      "role": "assistant",
      "toolCalls": [
        {
          "toolCallId": "call_9",
          "toolName": "create_reservation",
          "args": {
            "partySize": 2,
            "time": "19:00"
          }
        }
      ]
    },
    {
      "content": "",
      "role": "tool",
      "toolResults": [
        {
          "toolCallId": "call_9",
          "toolName": "create_reservation",
          "result": null
        }
      ]
    },
    {
      "content": "Booked. Your table for two is confirmed for 7pm.",
      "role": "assistant"
    }
  ],
  "source": {
    "system": "custom"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Replace the stored transcript
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/conversations/id");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"agentId\": \"agent_01j9r4x0h7f9k4b2n8t6q3m5cd\",\n  \"messages\": [\n    {\n      \"content\": \"Book me a table for two at 7pm.\",\n      \"role\": \"user\"\n    },\n    {\n      \"content\": \"\",\n      \"role\": \"assistant\",\n      \"toolCalls\": [\n        {\n          \"toolCallId\": \"call_9\",\n          \"toolName\": \"create_reservation\",\n          \"args\": {\n            \"partySize\": 2,\n            \"time\": \"19:00\"\n          }\n        }\n      ]\n    },\n    {\n      \"content\": \"\",\n      \"role\": \"tool\",\n      \"toolResults\": [\n        {\n          \"toolCallId\": \"call_9\",\n          \"toolName\": \"create_reservation\",\n          \"result\": null\n        }\n      ]\n    },\n    {\n      \"content\": \"Booked. Your table for two is confirmed for 7pm.\",\n      \"role\": \"assistant\"\n    }\n  ],\n  \"source\": {\n    \"system\": \"custom\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Replace the stored transcript
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "agentId": "agent_01j9r4x0h7f9k4b2n8t6q3m5cd",
  "messages": [
    [
      "content": "Book me a table for two at 7pm.",
      "role": "user"
    ],
    [
      "content": "",
      "role": "assistant",
      "toolCalls": [
        [
          "toolCallId": "call_9",
          "toolName": "create_reservation",
          "args": [
            "partySize": 2,
            "time": "19:00"
          ]
        ]
      ]
    ],
    [
      "content": "",
      "role": "tool",
      "toolResults": [
        [
          "toolCallId": "call_9",
          "toolName": "create_reservation",
          "result": 
        ]
      ]
    ],
    [
      "content": "Booked. Your table for two is confirmed for 7pm.",
      "role": "assistant"
    ]
  ],
  "source": ["system": "custom"]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/conversations/id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```

### Update Conversation

**Request**

```json
{
  "messages": [
    {
      "content": "Help me write a function",
      "role": "user",
      "id": "msg_1"
    },
    {
      "content": "Sure! What kind of function would you like?",
      "role": "assistant",
      "id": "msg_2"
    }
  ],
  "metadata": {
    "topic": "programming"
  },
  "modelId": "claude-sonnet-4-5",
  "systemPrompt": "You are a coding assistant.",
  "title": "Updated Chat Title"
}
```

**Response**

```json
{
  "createdAt": "string",
  "id": "string",
  "messages": [
    {
      "content": "string",
      "role": "system",
      "author": {
        "type": "end_user",
        "externalId": "string",
        "id": "string",
        "name": "string"
      },
      "createdAt": "string",
      "id": "string",
      "metadata": {},
      "model": "string",
      "toolCalls": [
        {
          "toolCallId": "string",
          "toolName": "string",
          "args": {},
          "providerOptions": {}
        }
      ],
      "toolResults": [
        {
          "toolCallId": "string",
          "toolName": "string",
          "providerOptions": {},
          "result": null
        }
      ]
    }
  ],
  "metadata": {},
  "modelId": "string",
  "ownerId": "string",
  "source": "app",
  "systemPrompt": "string",
  "title": "string",
  "updatedAt": "string",
  "imported": true,
  "schemaWarnings": [
    {
      "code": "string",
      "field": "string",
      "message": "string"
    }
  ]
}
```

**SDK Code**

```python Update Conversation
import requests

url = "https://api.runtype.com/v1/conversations/id"

payload = {
    "messages": [
        {
            "content": "Help me write a function",
            "role": "user",
            "id": "msg_1"
        },
        {
            "content": "Sure! What kind of function would you like?",
            "role": "assistant",
            "id": "msg_2"
        }
    ],
    "metadata": { "topic": "programming" },
    "modelId": "claude-sonnet-4-5",
    "systemPrompt": "You are a coding assistant.",
    "title": "Updated Chat Title"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript Update Conversation
const url = 'https://api.runtype.com/v1/conversations/id';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"messages":[{"content":"Help me write a function","role":"user","id":"msg_1"},{"content":"Sure! What kind of function would you like?","role":"assistant","id":"msg_2"}],"metadata":{"topic":"programming"},"modelId":"claude-sonnet-4-5","systemPrompt":"You are a coding assistant.","title":"Updated Chat Title"}'
};

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

```go Update Conversation
package main

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

func main() {

	url := "https://api.runtype.com/v1/conversations/id"

	payload := strings.NewReader("{\n  \"messages\": [\n    {\n      \"content\": \"Help me write a function\",\n      \"role\": \"user\",\n      \"id\": \"msg_1\"\n    },\n    {\n      \"content\": \"Sure! What kind of function would you like?\",\n      \"role\": \"assistant\",\n      \"id\": \"msg_2\"\n    }\n  ],\n  \"metadata\": {\n    \"topic\": \"programming\"\n  },\n  \"modelId\": \"claude-sonnet-4-5\",\n  \"systemPrompt\": \"You are a coding assistant.\",\n  \"title\": \"Updated Chat Title\"\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

```ruby Update Conversation
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/conversations/id")

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

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"messages\": [\n    {\n      \"content\": \"Help me write a function\",\n      \"role\": \"user\",\n      \"id\": \"msg_1\"\n    },\n    {\n      \"content\": \"Sure! What kind of function would you like?\",\n      \"role\": \"assistant\",\n      \"id\": \"msg_2\"\n    }\n  ],\n  \"metadata\": {\n    \"topic\": \"programming\"\n  },\n  \"modelId\": \"claude-sonnet-4-5\",\n  \"systemPrompt\": \"You are a coding assistant.\",\n  \"title\": \"Updated Chat Title\"\n}"

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

```java Update Conversation
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.runtype.com/v1/conversations/id")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"messages\": [\n    {\n      \"content\": \"Help me write a function\",\n      \"role\": \"user\",\n      \"id\": \"msg_1\"\n    },\n    {\n      \"content\": \"Sure! What kind of function would you like?\",\n      \"role\": \"assistant\",\n      \"id\": \"msg_2\"\n    }\n  ],\n  \"metadata\": {\n    \"topic\": \"programming\"\n  },\n  \"modelId\": \"claude-sonnet-4-5\",\n  \"systemPrompt\": \"You are a coding assistant.\",\n  \"title\": \"Updated Chat Title\"\n}")
  .asString();
```

```php Update Conversation
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.runtype.com/v1/conversations/id', [
  'body' => '{
  "messages": [
    {
      "content": "Help me write a function",
      "role": "user",
      "id": "msg_1"
    },
    {
      "content": "Sure! What kind of function would you like?",
      "role": "assistant",
      "id": "msg_2"
    }
  ],
  "metadata": {
    "topic": "programming"
  },
  "modelId": "claude-sonnet-4-5",
  "systemPrompt": "You are a coding assistant.",
  "title": "Updated Chat Title"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Update Conversation
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/conversations/id");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"messages\": [\n    {\n      \"content\": \"Help me write a function\",\n      \"role\": \"user\",\n      \"id\": \"msg_1\"\n    },\n    {\n      \"content\": \"Sure! What kind of function would you like?\",\n      \"role\": \"assistant\",\n      \"id\": \"msg_2\"\n    }\n  ],\n  \"metadata\": {\n    \"topic\": \"programming\"\n  },\n  \"modelId\": \"claude-sonnet-4-5\",\n  \"systemPrompt\": \"You are a coding assistant.\",\n  \"title\": \"Updated Chat Title\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Update Conversation
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "messages": [
    [
      "content": "Help me write a function",
      "role": "user",
      "id": "msg_1"
    ],
    [
      "content": "Sure! What kind of function would you like?",
      "role": "assistant",
      "id": "msg_2"
    ]
  ],
  "metadata": ["topic": "programming"],
  "modelId": "claude-sonnet-4-5",
  "systemPrompt": "You are a coding assistant.",
  "title": "Updated Chat Title"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/conversations/id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```