> 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.

# Create a conversation

POST https://api.runtype.com/v1/conversations
Content-Type: application/json

Reference: https://docs.runtype.com/api-reference/runtype-api/conversations/create-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

### Body (application/json)

This endpoint expects an object.

- `agentId` (string, optional) — Agent (agent_...) this conversation belongs to, stored as metadata.agentId. Must name an agent the caller owns.
- `messages` (list of ConversationTranscriptMessage, optional, default: []) — 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.
- `metadata` (map from string to any, optional, default: {})
- `modelId` (string, optional)
- `ownerId` (string, optional, nullable) — Owner key for this conversation, stored in the indexed owner_id column and filterable via ?ownerId=. Overrides a nested metadata.ownerId. Null means no owner.
- `source` (ConversationSource, optional) — Import provenance, stored as metadata.importSource.
- `systemPrompt` (string, optional)
- `title` (string, optional, default: New Chat)

## Response

### 200

A conversation with this `source.system` and `source.externalId` was already imported. Nothing was created and the existing conversation is returned with `imported: false`.

- `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 V1ConversationsPostResponsesContentApplicationJsonSchemaSchemaWarningsItems, optional)

### 201

Conversation created (`imported: true`)

- `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 V1ConversationsPostResponsesContentApplicationJsonSchemaSchemaWarningsItems, 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 V1ConversationsPostResponsesContentApplicationJsonSchemaDetailsItems, 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

The requested agentId names no agent the caller owns

- `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.

### 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)

### V1ConversationsPostResponsesContentApplicationJsonSchemaSchemaWarningsItems

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

### V1ConversationsPostResponsesContentApplicationJsonSchemaDetailsItems

- `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, …).

### 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

### Create Conversation

**Request**

```json
{
  "metadata": {
    "topic": "general"
  },
  "modelId": "gpt-4",
  "systemPrompt": "You are a helpful assistant.",
  "title": "New Chat"
}
```

**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 Create Conversation
import requests

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

payload = {
    "metadata": { "topic": "general" },
    "modelId": "gpt-4",
    "systemPrompt": "You are a helpful assistant.",
    "title": "New Chat"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create Conversation
const url = 'https://api.runtype.com/v1/conversations';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"metadata":{"topic":"general"},"modelId":"gpt-4","systemPrompt":"You are a helpful assistant.","title":"New Chat"}'
};

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

```go Create Conversation
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"metadata\": {\n    \"topic\": \"general\"\n  },\n  \"modelId\": \"gpt-4\",\n  \"systemPrompt\": \"You are a helpful assistant.\",\n  \"title\": \"New Chat\"\n}")

	req, _ := http.NewRequest("POST", 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 Create Conversation
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"metadata\": {\n    \"topic\": \"general\"\n  },\n  \"modelId\": \"gpt-4\",\n  \"systemPrompt\": \"You are a helpful assistant.\",\n  \"title\": \"New Chat\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/conversations")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"metadata\": {\n    \"topic\": \"general\"\n  },\n  \"modelId\": \"gpt-4\",\n  \"systemPrompt\": \"You are a helpful assistant.\",\n  \"title\": \"New Chat\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/conversations', [
  'body' => '{
  "metadata": {
    "topic": "general"
  },
  "modelId": "gpt-4",
  "systemPrompt": "You are a helpful assistant.",
  "title": "New Chat"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Create Conversation
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/conversations");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"metadata\": {\n    \"topic\": \"general\"\n  },\n  \"modelId\": \"gpt-4\",\n  \"systemPrompt\": \"You are a helpful assistant.\",\n  \"title\": \"New Chat\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create Conversation
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "metadata": ["topic": "general"],
  "modelId": "gpt-4",
  "systemPrompt": "You are a helpful assistant.",
  "title": "New Chat"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/conversations")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
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()
```

### Create Conversation

**Request**

```json
{
  "metadata": {
    "topic": "general"
  },
  "modelId": "gpt-4",
  "systemPrompt": "You are a helpful assistant.",
  "title": "New Chat"
}
```

**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 Create Conversation
import requests

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

payload = {
    "metadata": { "topic": "general" },
    "modelId": "gpt-4",
    "systemPrompt": "You are a helpful assistant.",
    "title": "New Chat"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create Conversation
const url = 'https://api.runtype.com/v1/conversations';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"metadata":{"topic":"general"},"modelId":"gpt-4","systemPrompt":"You are a helpful assistant.","title":"New Chat"}'
};

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

```go Create Conversation
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"metadata\": {\n    \"topic\": \"general\"\n  },\n  \"modelId\": \"gpt-4\",\n  \"systemPrompt\": \"You are a helpful assistant.\",\n  \"title\": \"New Chat\"\n}")

	req, _ := http.NewRequest("POST", 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 Create Conversation
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"metadata\": {\n    \"topic\": \"general\"\n  },\n  \"modelId\": \"gpt-4\",\n  \"systemPrompt\": \"You are a helpful assistant.\",\n  \"title\": \"New Chat\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/conversations")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"metadata\": {\n    \"topic\": \"general\"\n  },\n  \"modelId\": \"gpt-4\",\n  \"systemPrompt\": \"You are a helpful assistant.\",\n  \"title\": \"New Chat\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/conversations', [
  'body' => '{
  "metadata": {
    "topic": "general"
  },
  "modelId": "gpt-4",
  "systemPrompt": "You are a helpful assistant.",
  "title": "New Chat"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Create Conversation
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/conversations");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"metadata\": {\n    \"topic\": \"general\"\n  },\n  \"modelId\": \"gpt-4\",\n  \"systemPrompt\": \"You are a helpful assistant.\",\n  \"title\": \"New Chat\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create Conversation
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "metadata": ["topic": "general"],
  "modelId": "gpt-4",
  "systemPrompt": "You are a helpful assistant.",
  "title": "New Chat"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/conversations")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
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()
```

### Import a transcript

**Request**

```json
{
  "agentId": "agent_01j9r4x0h7f9k4b2n8t6q3m5cd",
  "messages": [
    {
      "content": "Where is my refund for order 1182?",
      "role": "user"
    },
    {
      "content": "",
      "role": "assistant",
      "toolCalls": [
        {
          "toolCallId": "call_1",
          "toolName": "lookup_order",
          "args": {
            "orderId": "1182"
          }
        }
      ]
    },
    {
      "content": "",
      "role": "tool",
      "toolResults": [
        {
          "toolCallId": "call_1",
          "toolName": "lookup_order",
          "result": null
        }
      ]
    },
    {
      "content": "Your refund for order 1182 was issued on August 30.",
      "role": "assistant"
    }
  ],
  "source": {
    "system": "intercom",
    "externalId": "conv_88213",
    "importedAt": "2026-09-01T10:00:00.000Z"
  },
  "title": "Refund for order 1182"
}
```

**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 Import a transcript
import requests

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

payload = {
    "agentId": "agent_01j9r4x0h7f9k4b2n8t6q3m5cd",
    "messages": [
        {
            "content": "Where is my refund for order 1182?",
            "role": "user"
        },
        {
            "content": "",
            "role": "assistant",
            "toolCalls": [
                {
                    "toolCallId": "call_1",
                    "toolName": "lookup_order",
                    "args": { "orderId": "1182" }
                }
            ]
        },
        {
            "content": "",
            "role": "tool",
            "toolResults": [
                {
                    "toolCallId": "call_1",
                    "toolName": "lookup_order",
                    "result": None
                }
            ]
        },
        {
            "content": "Your refund for order 1182 was issued on August 30.",
            "role": "assistant"
        }
    ],
    "source": {
        "system": "intercom",
        "externalId": "conv_88213",
        "importedAt": "2026-09-01T10:00:00.000Z"
    },
    "title": "Refund for order 1182"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Import a transcript
const url = 'https://api.runtype.com/v1/conversations';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"agentId":"agent_01j9r4x0h7f9k4b2n8t6q3m5cd","messages":[{"content":"Where is my refund for order 1182?","role":"user"},{"content":"","role":"assistant","toolCalls":[{"toolCallId":"call_1","toolName":"lookup_order","args":{"orderId":"1182"}}]},{"content":"","role":"tool","toolResults":[{"toolCallId":"call_1","toolName":"lookup_order","result":null}]},{"content":"Your refund for order 1182 was issued on August 30.","role":"assistant"}],"source":{"system":"intercom","externalId":"conv_88213","importedAt":"2026-09-01T10:00:00.000Z"},"title":"Refund for order 1182"}'
};

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

```go Import a transcript
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"agentId\": \"agent_01j9r4x0h7f9k4b2n8t6q3m5cd\",\n  \"messages\": [\n    {\n      \"content\": \"Where is my refund for order 1182?\",\n      \"role\": \"user\"\n    },\n    {\n      \"content\": \"\",\n      \"role\": \"assistant\",\n      \"toolCalls\": [\n        {\n          \"toolCallId\": \"call_1\",\n          \"toolName\": \"lookup_order\",\n          \"args\": {\n            \"orderId\": \"1182\"\n          }\n        }\n      ]\n    },\n    {\n      \"content\": \"\",\n      \"role\": \"tool\",\n      \"toolResults\": [\n        {\n          \"toolCallId\": \"call_1\",\n          \"toolName\": \"lookup_order\",\n          \"result\": null\n        }\n      ]\n    },\n    {\n      \"content\": \"Your refund for order 1182 was issued on August 30.\",\n      \"role\": \"assistant\"\n    }\n  ],\n  \"source\": {\n    \"system\": \"intercom\",\n    \"externalId\": \"conv_88213\",\n    \"importedAt\": \"2026-09-01T10:00:00.000Z\"\n  },\n  \"title\": \"Refund for order 1182\"\n}")

	req, _ := http.NewRequest("POST", 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 Import a transcript
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"agentId\": \"agent_01j9r4x0h7f9k4b2n8t6q3m5cd\",\n  \"messages\": [\n    {\n      \"content\": \"Where is my refund for order 1182?\",\n      \"role\": \"user\"\n    },\n    {\n      \"content\": \"\",\n      \"role\": \"assistant\",\n      \"toolCalls\": [\n        {\n          \"toolCallId\": \"call_1\",\n          \"toolName\": \"lookup_order\",\n          \"args\": {\n            \"orderId\": \"1182\"\n          }\n        }\n      ]\n    },\n    {\n      \"content\": \"\",\n      \"role\": \"tool\",\n      \"toolResults\": [\n        {\n          \"toolCallId\": \"call_1\",\n          \"toolName\": \"lookup_order\",\n          \"result\": null\n        }\n      ]\n    },\n    {\n      \"content\": \"Your refund for order 1182 was issued on August 30.\",\n      \"role\": \"assistant\"\n    }\n  ],\n  \"source\": {\n    \"system\": \"intercom\",\n    \"externalId\": \"conv_88213\",\n    \"importedAt\": \"2026-09-01T10:00:00.000Z\"\n  },\n  \"title\": \"Refund for order 1182\"\n}"

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

```java Import a transcript
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/conversations")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"agentId\": \"agent_01j9r4x0h7f9k4b2n8t6q3m5cd\",\n  \"messages\": [\n    {\n      \"content\": \"Where is my refund for order 1182?\",\n      \"role\": \"user\"\n    },\n    {\n      \"content\": \"\",\n      \"role\": \"assistant\",\n      \"toolCalls\": [\n        {\n          \"toolCallId\": \"call_1\",\n          \"toolName\": \"lookup_order\",\n          \"args\": {\n            \"orderId\": \"1182\"\n          }\n        }\n      ]\n    },\n    {\n      \"content\": \"\",\n      \"role\": \"tool\",\n      \"toolResults\": [\n        {\n          \"toolCallId\": \"call_1\",\n          \"toolName\": \"lookup_order\",\n          \"result\": null\n        }\n      ]\n    },\n    {\n      \"content\": \"Your refund for order 1182 was issued on August 30.\",\n      \"role\": \"assistant\"\n    }\n  ],\n  \"source\": {\n    \"system\": \"intercom\",\n    \"externalId\": \"conv_88213\",\n    \"importedAt\": \"2026-09-01T10:00:00.000Z\"\n  },\n  \"title\": \"Refund for order 1182\"\n}")
  .asString();
```

```php Import a transcript
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/conversations', [
  'body' => '{
  "agentId": "agent_01j9r4x0h7f9k4b2n8t6q3m5cd",
  "messages": [
    {
      "content": "Where is my refund for order 1182?",
      "role": "user"
    },
    {
      "content": "",
      "role": "assistant",
      "toolCalls": [
        {
          "toolCallId": "call_1",
          "toolName": "lookup_order",
          "args": {
            "orderId": "1182"
          }
        }
      ]
    },
    {
      "content": "",
      "role": "tool",
      "toolResults": [
        {
          "toolCallId": "call_1",
          "toolName": "lookup_order",
          "result": null
        }
      ]
    },
    {
      "content": "Your refund for order 1182 was issued on August 30.",
      "role": "assistant"
    }
  ],
  "source": {
    "system": "intercom",
    "externalId": "conv_88213",
    "importedAt": "2026-09-01T10:00:00.000Z"
  },
  "title": "Refund for order 1182"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Import a transcript
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/conversations");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"agentId\": \"agent_01j9r4x0h7f9k4b2n8t6q3m5cd\",\n  \"messages\": [\n    {\n      \"content\": \"Where is my refund for order 1182?\",\n      \"role\": \"user\"\n    },\n    {\n      \"content\": \"\",\n      \"role\": \"assistant\",\n      \"toolCalls\": [\n        {\n          \"toolCallId\": \"call_1\",\n          \"toolName\": \"lookup_order\",\n          \"args\": {\n            \"orderId\": \"1182\"\n          }\n        }\n      ]\n    },\n    {\n      \"content\": \"\",\n      \"role\": \"tool\",\n      \"toolResults\": [\n        {\n          \"toolCallId\": \"call_1\",\n          \"toolName\": \"lookup_order\",\n          \"result\": null\n        }\n      ]\n    },\n    {\n      \"content\": \"Your refund for order 1182 was issued on August 30.\",\n      \"role\": \"assistant\"\n    }\n  ],\n  \"source\": {\n    \"system\": \"intercom\",\n    \"externalId\": \"conv_88213\",\n    \"importedAt\": \"2026-09-01T10:00:00.000Z\"\n  },\n  \"title\": \"Refund for order 1182\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Import a transcript
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "agentId": "agent_01j9r4x0h7f9k4b2n8t6q3m5cd",
  "messages": [
    [
      "content": "Where is my refund for order 1182?",
      "role": "user"
    ],
    [
      "content": "",
      "role": "assistant",
      "toolCalls": [
        [
          "toolCallId": "call_1",
          "toolName": "lookup_order",
          "args": ["orderId": "1182"]
        ]
      ]
    ],
    [
      "content": "",
      "role": "tool",
      "toolResults": [
        [
          "toolCallId": "call_1",
          "toolName": "lookup_order",
          "result": 
        ]
      ]
    ],
    [
      "content": "Your refund for order 1182 was issued on August 30.",
      "role": "assistant"
    ]
  ],
  "source": [
    "system": "intercom",
    "externalId": "conv_88213",
    "importedAt": "2026-09-01T10:00:00.000Z"
  ],
  "title": "Refund for order 1182"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/conversations")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
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()
```