Records a single conversation turn to long-term memory. The project scope is carried by the route id path parameter and the org is derived from that project. The caller supplies user_id (required) and an optional agent_id to identify the end user.
Responses
-
Unsupported or malformed API version, an operation unavailable in the selected published contract, or an unacceptable representation (including unsupported media-type parameters or excluded SSE). Existing authentication, authorization, and rate-limit failures take precedence.
-
Turn already recorded (idempotent replay of a previously-supplied idempotency_key)
-
Turn recorded
-
Invalid request body
-
Missing or invalid credentials
-
Caller lacks deployment-management permission on the project
-
Internal error
-
Memory service unreachable
curl \
--request POST 'https://agentengine.mongodb.com/api/v1/projects/{id}/memory/turns' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '{
"agent_id": "string",
"content": "string",
"idempotency_key": "string",
"is_error": true,
"metadata": {},
"model_name": "string",
"role": "string",
"session_id": "string",
"tool_call_id": "string",
"tool_calls": [
{}
],
"tool_name": "string",
"user_id": "string"
}'
{
"agent_id": "string",
"content": "string",
"idempotency_key": "string",
"is_error": true,
"metadata": {},
"model_name": "string",
"role": "string",
"session_id": "string",
"tool_call_id": "string",
"tool_calls": [
{}
],
"tool_name": "string",
"user_id": "string"
}
{
"detail": "This operation is not available in API version 2026-09-20-preview.",
"error": 406,
"errorCode": "OPERATION_NOT_IN_API_VERSION",
"parameters": [
"Accept"
],
"reason": "Not Acceptable"
}
{
"detail": "This operation supports text/event-stream, which the Accept header excludes. Remove unsupported media-type parameters or accept this type with a positive q value.",
"error": 406,
"errorCode": "UNACCEPTABLE_MEDIA_TYPE",
"parameters": [
"Accept"
],
"reason": "Not Acceptable"
}
{
"detail": "The requested API version is not supported. Supported versions: 2026-09-20-preview.",
"error": 406,
"errorCode": "UNSUPPORTED_API_VERSION",
"parameters": [
"Accept"
],
"reason": "Not Acceptable"
}
{
"detail": "This operation is not available in API version 2026-09-20-preview.",
"error": 406,
"errorCode": "OPERATION_NOT_IN_API_VERSION",
"parameters": [
"Accept"
],
"reason": "Not Acceptable"
}
{}
{}
{}
{}
{
"code": "string",
"error": "string",
"success": true
}
{
"code": "string",
"error": "string",
"success": true
}
{
"code": "string",
"error": "string",
"success": true
}
{
"code": "string",
"error": "string",
"success": true
}
{
"code": "string",
"error": "string",
"success": true
}
{
"code": "string",
"error": "string",
"success": true
}
{
"code": "string",
"error": "string",
"success": true
}
{
"code": "string",
"error": "string",
"success": true
}
{
"code": "string",
"error": "string",
"success": true
}
{
"code": "string",
"error": "string",
"success": true
}