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
Section titled “Authentication”Authorizationheader (bearer token, required) — Bearer authentication of the formBearer <token>, where token is your auth token.
Request
Section titled “Request”Body (application/json)
Section titled “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
Section titled “Response”conversationId(UUID, required)
Examples
Section titled “Examples”Request
{
"agentId": "82e4b12a-6990-45d4-8ebd-85c00e030c24",
"userEmail": "ravin@credal.ai"
}Response
{
"conversationId": "ac20e6ba-0bae-11ef-b25a-efca73df4c3a"
}SDK Code
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();
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",
)