Skip to main content

Create Collection

This API endpoint creates a new MongoDB collection for the agent.

Endpoint

POST `/agent_db/collections`
X-AGENT-API-KEY: your-api-key

Request Body

{
"collection": "test_collection"
}

Responses

200 - OK

{
"status": "success",
"status_code": 200,
"message": "Collection created successfully"
}

400 - Bad Request

{
"status": "error",
"status_code": 400,
"message": "Failed to create collection",
"error": "agent {agent_id} already has a collection"
}

Notes

  • Each agent can only create one collection. Subsequent attempts will return an error as shown above.
  • Deleting of Collections is not supported by the platform for security and auditing purposes.