# Create Conversation

POST https://api.credal.ai/api/v0/copilots/createConversation
Content-Type: application/json

OPTIONAL. Create a new conversation with the Agent. The conversation ID can be used in the `sendMessage` endpoint. The `sendMessage` endpoint automatically creates new conversations upon first request, but calling this endpoint can simplify certain use cases where it is helpful for the application to have the conversation ID before the first message is sent.

Reference: https://docs.credal.ai/api-reference/api-reference/copilots/create-conversation

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Body (application/json)

This endpoint expects an object.

- `agentId` (UUID, required) — Credal-generated Agent ID to specify which agent to route the request to.
- `userEmail` (string, required) — End-user for the conversation.

## Response

### 200

- `conversationId` (UUID, required)

## Examples

**Request**

```json
{
  "agentId": "82e4b12a-6990-45d4-8ebd-85c00e030c24",
  "userEmail": "ravin@credal.ai"
}
```

**Response**

```json
{
  "conversationId": "ac20e6ba-0bae-11ef-b25a-efca73df4c3a"
}
```

**SDK Code**

```typescript Example0
import { CredalClient } from "@credal/sdk";

async function main() {
    const client = new CredalClient({
        apiKey: "YOUR_TOKEN_HERE",
    });
    await client.copilots.createConversation({
        agentId: "82e4b12a-6990-45d4-8ebd-85c00e030c24",
        userEmail: "ravin@credal.ai",
    });
}
main();

```

```python Example0
from credal import CredalV0
import uuid

client = CredalV0(
    api_key="YOUR_TOKEN_HERE",
)

client.copilots.create_conversation(
    agent_id=uuid.UUID("82e4b12a-6990-45d4-8ebd-85c00e030c24"),
    user_email="ravin@credal.ai",
)

```

## Related pages

- [Create Copilot](./api-reference-2-api-reference-copilots-create-copilot.md)
- [Provide Message Feedback](./api-reference-2-api-reference-copilots-provide-message-feedback.md)
- [Add Collection To Copilot](./api-reference-2-api-reference-copilots-add-collection-to-copilot.md)
- [Remove Collection From Copilot](./api-reference-2-api-reference-copilots-remove-collection-from-copilot.md)
- [Update Configuration](./api-reference-2-api-reference-copilots-update-configuration.md)
- [Delete Copilot](./api-reference-2-api-reference-copilots-delete-copilot.md)
- [Export](./api-reference-2-api-reference-copilots-export.md)
- [Send Message](./api-reference-2-api-reference-copilots-send-message.md)
- [Stream Message](./api-reference-2-api-reference-copilots-stream-message.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
