# Deploy REST API Server > Deploy Cognee as a REST API server using Docker or Python Deploy Cognee as a REST API server to expose its functionality via HTTP endpoints. ## Setup ```bash theme={null} # Clone repository git clone https://github.com/topoteretes/cognee.git cd cognee # Configure environment cp .env.template .env ``` Edit `.env` with your preferred configuration. See [Setup Configuration](/setup-configuration/overview) guides for all available options. ## Deployment Methods ### Start Server ```bash theme={null} # Start API server docker compose up --build cognee # Check status docker compose ps ``` ### Setup ```bash theme={null} # Create virtual environment uv venv && source .venv/bin/activate # Install with all extras uv sync --all-extras ``` ### Start Server ```bash theme={null} # Run API server uvicorn cognee.api.client:app --host 0.0.0.0 --port 8000 ``` ## Access API * **API:** [http://localhost:8000](http://localhost:8000) * **Documentation:** [http://localhost:8000/docs](http://localhost:8000/docs) ## Authentication If `REQUIRE_AUTHENTICATION=true` in your `.env` file: 1. **Register:** `POST /api/v1/auth/register` 2. **Login:** `POST /api/v1/auth/login` 3. **Use token:** Include `Authorization: Bearer ` header or use cookies ## API Examples **Register a user:** ```bash theme={null} curl -X POST "http://localhost:8000/api/v1/auth/register" \ -H "Content-Type: application/json" \ -d '{"email": "user1@example.com", "password": "strong_password"}' ``` **Login and get token:** ```bash theme={null} TOKEN="$(curl -s -X POST http://localhost:8000/api/v1/auth/login \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'username=user1@example.com&password=strong_password' | jq -r .access_token)" ``` **Create a dataset:** ```bash theme={null} curl -X POST http://localhost:8000/api/v1/datasets \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ -d '{"name": "project_docs"}' ``` **List datasets:** ```bash theme={null} curl -H "Authorization: Bearer $TOKEN" http://localhost:8000/api/v1/datasets ``` **Add data (upload file):** ```bash theme={null} curl -X POST http://localhost:8000/api/v1/add \ -H "Authorization: Bearer $TOKEN" \ -F "data=@/absolute/path/to/file.pdf" \ -F "datasetName=project_docs" ``` **Build knowledge graph:** ```bash theme={null} curl -X POST http://localhost:8000/api/v1/cognify \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ -d '{"datasets": ["project_docs"]}' ``` **Search data:** ```bash theme={null} curl -X POST http://localhost:8000/api/v1/search \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ -d '{"query": "What are the main topics?", "datasets": ["project_docs"], "top_k": 10}' ``` **Create tenant:** ```bash theme={null} curl -X POST "http://localhost:8000/api/v1/permissions/tenants?tenant_name=acme" \ -H "Authorization: Bearer $TOKEN" ``` **Add user to tenant:** ```bash theme={null} curl -X POST "http://localhost:8000/api/v1/permissions/users//tenants?tenant_id=" \ -H "Authorization: Bearer $TOKEN" ``` **Create role:** ```bash theme={null} curl -X POST "http://localhost:8000/api/v1/permissions/roles?role_name=editor" \ -H "Authorization: Bearer $TOKEN" ``` **Assign user to role:** ```bash theme={null} curl -X POST "http://localhost:8000/api/v1/permissions/users//roles?role_id=" \ -H "Authorization: Bearer $TOKEN" ``` **Grant dataset permissions:** ```bash theme={null} curl -X POST "http://localhost:8000/api/v1/permissions/datasets/?permission_name=read&dataset_ids=&dataset_ids=" \ -H "Authorization: Bearer $TOKEN" ``` Explore all API endpoints Configure providers and databases Set up AI assistant integration --- > To find navigation and other pages in this documentation, fetch the llms.txt file at: https://docs.cognee.ai/llms.txt