Create Conversation ID
Create Conversation ID
Used to request the creation and obtain a conversation_id, which is the identifier ID for the conversation between the user and the Agent. User attributes, long-term memory, and short-term memory are all associated with the conversation_id.
| ID Name | Description |
|---|---|
| conversation_id | A conversation identifier ID jointly generated by agent_id and user_id, used to carry out a multi-turn conversation between the user and the Agent. A single conversation_id usually contains multiple message_ids. |
| message_id | A message identifier ID jointly generated by user-sent messages and Agent-replied messages, representing a single round of conversation between the user and the Agent. The message_id must belong to a conversation_id. |
Request Method
POST
Request URL
https://api-${endpoint}.gptbots.ai/v1/conversation
Request Authentication
Refer to API Overview for authentication instructions.
Request
Request Example
curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/conversation' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
"user_id": "your_user_id"
}'
curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/conversation' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
"user_id": "your_user_id"
}'
Este bloque de código en una ventana flotante
Request Headers
| Field | Type | Description |
|---|---|---|
| Authorization | Bearer ${API Key} | Use Authorization: Bearer ${API Key} for authentication. Get API key from API Key page. |
| Content-Type | application/json | Data type, set to application/json. |
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| user_id | string | Yes | User ID defined by developer to uniquely identify a user in the Agent. Max length 32 chars. |
Response
Response Example
{
"conversation_id": "657303a8a764d47094874bbe"
}
{
"conversation_id": "657303a8a764d47094874bbe"
}
Este bloque de código en una ventana flotante
Success Response
| Field | Type | Description |
|---|---|---|
| conversation_id | string | Conversation identifier. |
Failure Response
| Field | Type | Description |
|---|---|---|
| code | int | Error code. |
| message | string | Error details. |
Error Codes
| Code | Message |
|---|---|
| 40000 | Parameter error |
| 40127 | Developer authentication failed |
| 40378 | Agent deleted |
