--- title: "Connect to a vector database" description: "Find a vector database's endpoint and API keys in TIR, open the Qdrant dashboard, and connect from Python or HTTP." content_type: "how-to" product: "vector-database" platform: "TIR" url: "/tir/vector-database/how-to/connect-to-a-vector-database/" topic: ["create-and-connect"] --- # Connect to a vector database Find the endpoint and API keys on the database's **Overview** tab, then connect from the Qdrant dashboard, the Python client, or HTTP. ## Before you begin You need a database in the **Running** state and a role with Read permission on Vector Database. For the Python client, you also need Python 3.8 or later. An [instance](/tir/tir-instance/) in the project can run it. ## Find the endpoint and the keys 1. In **Manage Vector Database**, select the database's row, then open **Overview**. 2. Copy the **Endpoint URL**. This is the hostname of your database. 3. Show **API Key** or **Read-only API Key** and copy it. The **API Key** gives full read and write access. The **Read-only API Key** gives read-only access, so give it to client applications that only query data. Store both keys somewhere safe, such as environment variables, and keep them out of version control and client-side code. Clients reach the database on port 6333 for REST, and on port 6334 for gRPC. Send the API key with each request. ## Open the Qdrant dashboard In the list, select the database's name, or select **Connect** in its row. Both open the Qdrant dashboard once the database is **Running**. Enter your **API Key** and select **Apply**. The dashboard has these sections: - **Collections**: create, view and delete collections, browse points, see collection details and visualize vectors. - **Console**: run Qdrant API commands, and browse the commands available. - **Tutorial**: Qdrant's interactive guide to its API. - **Datasets**: sample data to experiment with. Use **Console** to try an API call before you add it to your application. ## Copy sample commands In the list, select **Commands** in the database's row. The Python samples install the client, connect, create and list collections, add vectors, search, and close the connection. Your endpoint is filled in; type your API key where the sample asks. ## Connect from Python ```bash pip install qdrant-client ``` `` is the **Endpoint URL** and `` is your API key. ```python from qdrant_client import QdrantClient from qdrant_client.http.models import Distance, VectorParams client = QdrantClient(host="", port=6333, https=True, api_key="") client.create_collection( collection_name="my_collection", vectors_config=VectorParams(size=4, distance=Distance.COSINE), shard_number=1, replication_factor=3, ) ``` To connect over gRPC, use port 6334 and turn the gRPC option on: ```python client = QdrantClient( host="", port=6334, https=True, api_key="", prefer_grpc=True ) ``` ## Connect over HTTP Create the same collection with cURL: ```bash curl -X PUT \ -H "api-key: " \ -H "Content-Type: application/json" \ -d '{ "vectors": { "size": 4, "distance": "Cosine" }, "shard_number": 1, "replication_factor": 3 }' \ https://:6333/collections/my_collection ``` ## What to do next Add points and search them as in [Get started with Vector Database](/tir/vector-database/get-started/). To feed the database from LangChain or LlamaIndex, see [Use Qdrant with LangChain](/tir/vector-database/how-to/use-qdrant-with-langchain/) and [Use Qdrant with LlamaIndex](/tir/vector-database/how-to/use-qdrant-with-llamaindex/). If a connection fails, see [Troubleshooting Vector Database](/tir/vector-database/troubleshooting/vector-database/).