AI

Qdrant REST API and gRPC: curl, grpcurl, Python and Go Examples

Qdrant answers on two ports, and most API trouble starts with sending a request to the wrong one. Port 6333 speaks REST over HTTP/1.1 with JSON bodies, port 6334 speaks gRPC over HTTP/2 with protobuf, and the two report a mix-up in error messages that never mention the port. Add an API key and a 32 MiB JSON cap, and a working client can fail four different ways before it stores a single vector.

Original content from computingforgeeks.com - post 168068

This guide drives both ports with curl, grpcurl, the Python client, raw Python gRPC stubs and the Go SDK, then times REST against gRPC on the same 20,000-vector batch. Keep REST for curl, debugging and browsers, and move your application clients to gRPC, which upserted about 1.8 times faster and served twice the concurrent queries in our runs. Every command below was run on Ubuntu 26.04 against Qdrant 1.20.0 in November 2026.

Pick REST or gRPC

Both protocols expose the same operations: collections, points, query, snapshots and cluster calls. REST is easier to reach because any HTTP tool works and the JSON is readable, while gRPC trades that for binary framing, one long-lived HTTP/2 connection and generated types in each SDK. The table below sums up what we saw on Qdrant 1.20.0.

PropertyRESTgRPC
Default port63336334
TransportHTTP/1.1, JSONHTTP/2, protobuf
Request size cap32 MiB JSON (max_request_size_mb)Not limited by max_request_size_mb; 9,000 points went in one call
Auth headerapi-key or Authorization: Bearerapi-key sent as call metadata
Upsert, 20k x 384-dimabout 4,950 points/sabout 8,850 points/s
Search p50, sequential5.2 to 5.3 ms3.5 to 3.8 ms
Best forcurl, scripts, browsers, debuggingApplication clients, bulk loads

You do not have to choose one for good. The Python client switches protocols with a single argument, so you can debug in REST and ship on gRPC without rewriting calls. If you’re new to Qdrant itself, the Qdrant vector database overview covers collections, distance metrics and payloads before you start calling the API. If you are also choosing the engine itself, see the Qdrant vs Weaviate vs Milvus vs pgvector comparison.

Start Qdrant with an API key

To test both APIs you need a Qdrant node with both ports published and auth turned on, because an open node hides the header mistakes you’ll make in production. We used Docker from the Ubuntu archive plus the tools the later sections call: jq for JSON, a Python venv for the client and Go for grpcurl and the Go SDK. If you prefer Docker’s own packages, follow the Docker CE install on Ubuntu 26.04 instead of the first line.

sudo apt-get install -y docker.io jq python3-venv golang-go

Every later command reads the URL and key from the shell, so export them once. Replace the key with a long random string of your own; Qdrant compares it as plain text.

export QDRANT_URL="http://localhost:6333"
export QDRANT_API_KEY="mySecretApiKey-2026"
export QDRANT_TAG="v1.20.0" # pin: tested release, keep server and client minors aligned #https://github.com/qdrant/qdrant/releases

Create the storage and snapshot directories on the host first, so collections and snapshots outlive the container. The QDRANT__SERVICE__API_KEY variable maps to service.api_key in the config file, and one key protects both ports at once.

sudo mkdir -p /opt/qdrant/storage /opt/qdrant/snapshots
sudo chown -R 1000:1000 /opt/qdrant
sudo docker run -d --name qdrant --restart=always \
  -p 6333:6333 -p 6334:6334 \
  -e QDRANT__SERVICE__API_KEY="${QDRANT_API_KEY}" \
  -v /opt/qdrant/storage:/qdrant/storage \
  -v /opt/qdrant/snapshots:/qdrant/snapshots \
  qdrant/qdrant:${QDRANT_TAG}

Confirm both listeners came up. The log lines matter more than docker ps here, because they tell you TLS is off on each port, which decides whether your clients connect with plaintext or HTTPS.

sudo docker ps --format 'table {{.Image}}\t{{.Status}}\t{{.Ports}}'
sudo docker logs qdrant 2>&1 | grep -E 'Version|listening on|TLS'

Our node reported version 1.20.0 with REST on 6333 and gRPC on 6334, both without TLS. Keep that in mind, because every client below has to be told to skip TLS or it fails with a handshake error.

IMAGE                   STATUS         PORTS
qdrant/qdrant:v1.20.0   Up 5 seconds   0.0.0.0:6333-6334->6333-6334/tcp, [::]:6333-6334->6333-6334/tcp
Version: 1.20.0, build: 222b2e44
INFO qdrant::actix: TLS disabled for REST API
INFO qdrant::actix: Qdrant HTTP listening on 6333
INFO qdrant::tonic: Qdrant gRPC listening on 6334
INFO qdrant::tonic: TLS disabled for gRPC API

In the terminal, the port mapping and the two listener lines look like this.

Qdrant 1.20.0 container publishing REST port 6333 and gRPC port 6334 on Ubuntu 26.04

For a native package or systemd install instead of a container, the Qdrant install guide for Ubuntu sets the same key in config.yaml. The ports and headers in the rest of this article do not change either way.

Authenticate REST calls with curl

Once a key is set, every REST call except the health probes needs it. Qdrant accepts the key in an api-key header or as Authorization: Bearer, which helps when a proxy or SDK only knows how to send bearer tokens. Check all four cases so you know what each failure looks like:

curl -s -o /dev/null -w 'HTTP=%{http_code}\n' "${QDRANT_URL}/collections"
curl -s "${QDRANT_URL}/collections"; echo
curl -s -o /dev/null -w 'HTTP=%{http_code}\n' -H "api-key: ${QDRANT_API_KEY}" "${QDRANT_URL}/collections"
curl -s -H 'api-key: wrong-key' "${QDRANT_URL}/collections"; echo
curl -s -o /dev/null -w 'HTTP=%{http_code}\n' -H "Authorization: Bearer ${QDRANT_API_KEY}" "${QDRANT_URL}/collections"

A missing key and a wrong key both return 401 but with different bodies, so read the body before you start rotating secrets.

HTTP=401
Must provide an API key or an Authorization bearer token
HTTP=200
Invalid API key or JWT
HTTP=200

Side by side, the 401 and 200 responses make the header the only variable.

Qdrant REST API returning 401 without api-key header and 200 with it

Health probes are the exception. /healthz and /readyz answer without a key, which is what you want for a load balancer or Kubernetes probe that should not hold the secret.

curl -s "${QDRANT_URL}/healthz"; echo
curl -s "${QDRANT_URL}/readyz"; echo
curl -s -H "api-key: ${QDRANT_API_KEY}" "${QDRANT_URL}/" | jq

Calling the root endpoint returns the exact build. Use it whenever a client misbehaves after an upgrade, because it confirms which server version you are really talking to.

healthz check passed
all shards are ready
{
  "title": "qdrant - vector search engine",
  "version": "1.20.0",
  "commit": "222b2e44ab1c3f17e8246396ead6558e45041df7"
}

The same headers work from any language that can send HTTP, so nothing below depends on curl specifically.

Create a collection and upsert points over REST

We’ll use 4-dimension vectors so every request fits on screen and you can paste it as is. Real embedding models produce 384, 768 or 1536 dimensions, and the size you set here is enforced on every write and query afterwards. Create the collection first:

curl -sS -X PUT "${QDRANT_URL}/collections/docs" \
  -H "api-key: ${QDRANT_API_KEY}" -H 'Content-Type: application/json' \
  -d '{"vectors": {"size": 4, "distance": "Cosine"}}' | jq

A "result": true means the collection exists. The time field in every response is server-side seconds, here about 75 ms.

{
  "result": true,
  "status": "ok",
  "time": 0.075579888
}

Now upsert four points with payloads. The wait=true query parameter makes the call return only after the write is applied, which you want in scripts and tests. Leave it off for bulk loads where you’ll poll later.

curl -sS -X PUT "${QDRANT_URL}/collections/docs/points?wait=true" \
  -H "api-key: ${QDRANT_API_KEY}" -H 'Content-Type: application/json' \
  -d '{"points": [
    {"id": 1, "vector": [0.05, 0.61, 0.76, 0.74], "payload": {"title": "Intro to vectors", "category": "basics", "price": 0}},
    {"id": 2, "vector": [0.19, 0.81, 0.75, 0.11], "payload": {"title": "HNSW tuning", "category": "index", "price": 29}},
    {"id": 3, "vector": [0.36, 0.55, 0.47, 0.94], "payload": {"title": "Filter cookbook", "category": "filters", "price": 19}},
    {"id": 4, "vector": [0.18, 0.01, 0.85, 0.80], "payload": {"title": "Quantization notes", "category": "index", "price": 39}}
  ]}' | jq

Because we waited, the status reads completed. Without wait you get acknowledged, which means Qdrant accepted the batch but may not have applied it yet:

{
  "result": {
    "operation_id": 1,
    "status": "completed"
  },
  "status": "ok",
  "time": 0.002951275
}

Collection settings like HNSW parameters, quantization and on-disk storage live in the Qdrant collections guide. Here we only need a collection to query against.

Query, filter, scroll and delete over REST

POST /collections/{name}/points/query is the search endpoint to use on current releases. The older /points/search still exists, but query handles plain nearest-neighbour search, filters, prefetch and fusion in one shape. Run an unfiltered query, then the same query limited to the index category:

curl -sS -X POST "${QDRANT_URL}/collections/docs/points/query" \
  -H "api-key: ${QDRANT_API_KEY}" -H 'Content-Type: application/json' \
  -d '{"query": [0.2, 0.1, 0.9, 0.7], "limit": 3, "with_payload": true}' \
  | jq -c '.result.points[] | {id, score, title: .payload.title}'
curl -sS -X POST "${QDRANT_URL}/collections/docs/points/query" \
  -H "api-key: ${QDRANT_API_KEY}" -H 'Content-Type: application/json' \
  -d '{"query": [0.2, 0.1, 0.9, 0.7], "limit": 3, "with_payload": true,
       "filter": {"must": [{"key": "category", "match": {"value": "index"}}]}}' \
  | jq -c '.result.points[] | {id, score, title: .payload.title}'

Point 4 stays on top in both runs with the same score, 0.99248314. The filter drops points 1 and 3 and pulls in point 2, so the filtered list holds only two results even though we asked for three.

{"id":4,"score":0.99248314,"title":"Quantization notes"}
{"id":1,"score":0.89463294,"title":"Intro to vectors"}
{"id":3,"score":0.83872515,"title":"Filter cookbook"}
{"id":4,"score":0.99248314,"title":"Quantization notes"}
{"id":2,"score":0.66603535,"title":"HNSW tuning"}

Without a jq filter, each hit in 1.20.0 also carries a "version": 1 field, so do not let a strict response schema reject it. Filters on unindexed fields work fine at this size; once a collection grows, index the fields you filter on as shown in Qdrant filters and payload indexes.

Scroll pages through points without a query vector, which is how you export or re-embed a collection. Delete accepts the same filter syntax, so check the count before and after:

curl -sS -X POST "${QDRANT_URL}/collections/docs/points/scroll" \
  -H "api-key: ${QDRANT_API_KEY}" -H 'Content-Type: application/json' \
  -d '{"limit": 2, "with_payload": ["title"], "with_vector": false}' | jq -c .result
curl -sS -X POST "${QDRANT_URL}/collections/docs/points/delete?wait=true" \
  -H "api-key: ${QDRANT_API_KEY}" -H 'Content-Type: application/json' \
  -d '{"filter": {"must": [{"key": "price", "range": {"lt": 10}}]}}' | jq -c .result
curl -sS -X POST "${QDRANT_URL}/collections/docs/points/count" \
  -H "api-key: ${QDRANT_API_KEY}" -H 'Content-Type: application/json' \
  -d '{"exact": true}' | jq -c

Feed next_page_offset back as offset to get the next page. The delete removed point 1, the only one priced under 10, and the exact count dropped from 4 to 3:

{"points":[{"id":1,"payload":{"title":"Intro to vectors"}},{"id":2,"payload":{"title":"HNSW tuning"}}],"next_page_offset":3}
{"operation_id":2,"status":"completed"}
{"result":{"count":3},"status":"ok","time":0.000121809}

Here is the filtered query and the count check from the same session.

Qdrant REST query_points with payload filter, exact count and cluster status in curl

Snapshots and cluster state sit on the same REST surface. POST /collections/docs/snapshots returned docs-6925432713729263-2026-11-13-09-01-44-0.snapshot at 64,512 bytes with a SHA-256 checksum, and GET /cluster answered {"status":"disabled"} on this single node. Restoring those files is covered in backup, snapshot and restore for Qdrant.

Call the gRPC API with grpcurl

grpcurl is curl for gRPC, and Qdrant enables server reflection, so you do not need the .proto files. Ubuntu 26.04 has no grpcurl package, so build it with Go. Turning cgo off avoids a grp.h: No such file or directory build failure on hosts without libc headers:

CGO_ENABLED=0 go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
export PATH="$PATH:$HOME/go/bin"

Reflection sits behind the same API key, so even list fails without it. Pass the key with -H and use -plaintext because TLS is off:

grpcurl -plaintext localhost:6334 list
grpcurl -plaintext -H "api-key: ${QDRANT_API_KEY}" localhost:6334 list
grpcurl -plaintext -H "api-key: ${QDRANT_API_KEY}" localhost:6334 qdrant.Qdrant/HealthCheck

Without the key the first call is refused, and the keyed one lists six services. qdrant.Points carries the data plane, qdrant.Collections the schema calls:

Failed to list services: rpc error: code = Unauthenticated desc = Must provide an API key or an Authorization bearer token
grpc.health.v1.Health
qdrant.Collections
qdrant.Points
qdrant.Qdrant
qdrant.Snapshots
qdrant.StorageRead
{
  "title": "qdrant - vector search engine",
  "version": "1.20.0",
  "commit": "222b2e44ab1c3f17e8246396ead6558e45041df7"
}

The same three grpcurl calls, captured on the lab node.

grpcurl listing Qdrant gRPC services and calling HealthCheck with an api-key header

Add a service name to list, as in list qdrant.Points, and grpcurl prints every method on it. Running describe qdrant.QueryPoints then prints the request message with its field comments, which is the fastest way to learn the gRPC JSON shape. You need it, because that shape differs from REST in two places you will trip over. Query vectors are wrapped as {"nearest": {"dense": {"data": [...]}}}, and payload values carry their type.

grpcurl -plaintext -H "api-key: ${QDRANT_API_KEY}" \
  -d '{"collection_name": "docs", "query": {"nearest": {"dense": {"data": [0.2, 0.1, 0.9, 0.7]}}}, "limit": 2, "with_payload": {"enable": true}}' \
  localhost:6334 qdrant.Points/Query

Scores match the REST call to the last digit. Notice the point ID comes back as a string inside num and each payload field is tagged stringValue or integerValue, because protobuf JSON encodes 64-bit integers as strings:

{
  "result": [
    {
      "id": {
        "num": "4"
      },
      "payload": {
        "category": {
          "stringValue": "index"
        },
        "price": {
          "integerValue": "39"
        },
        "title": {
          "stringValue": "Quantization notes"
        }
      },
      "score": 0.99248314,
      "version": "1"
    },
    {
      "id": {
        "num": "3"
      },
      "payload": {
        "category": {
          "stringValue": "filters"
        },
        "price": {
          "integerValue": "19"
        },
        "title": {
          "stringValue": "Filter cookbook"
        }
      },
      "score": 0.83872515,
      "version": "1"
    }
  ],
  "time": 0.000943694
}

Writes follow the same pattern, so a gRPC upsert needs a typed value for every payload field. This one adds point 5 with a string title and an integer price.

grpcurl -plaintext -H "api-key: ${QDRANT_API_KEY}" \
  -d '{"collection_name": "docs", "wait": true, "points": [{"id": {"num": 5}, "vectors": {"vector": {"dense": {"data": [0.4, 0.3, 0.2, 0.9]}}}, "payload": {"title": {"string_value": "gRPC upsert"}, "price": {"integer_value": 15}}}]}' \
  localhost:6334 qdrant.Points/Upsert

Notice grpcurl prints the reply in camelCase (operationId), the protobuf JSON naming, while REST returns snake_case. The protobuf field itself is operation_id, so if one script parses grpcurl output and REST responses, normalise the keys first.

{
  "result": {
    "operationId": "3",
    "status": "Completed"
  },
  "time": 0.002023126,
  "usage": {}
}

grpcurl is for poking at the API. For application code, the SDKs hide the protobuf wrapping entirely.

Switch the Python client between REST and gRPC

The official qdrant-client package speaks both protocols, and the constructor decides which. Install it in a venv so it can’t clash with distro Python packages. On our VM it pulled qdrant-client 1.20.0 with grpcio 1.85.1 and httpx 0.28.1.

python3 -m venv ~/venv
~/venv/bin/pip install qdrant-client

Only two constructor lines differ between the protocols. url= gives you REST; prefer_grpc=True with grpc_port=6334 gives you gRPC for every call the client supports. Keep https=False on the gRPC client while the node runs without TLS, because passing an API key otherwise makes the client attempt TLS. This is the exact bench.py we used for the timings in the next section. Set API_KEY to your own ${QDRANT_API_KEY} value before running it, otherwise every call fails with “Invalid API key or JWT”.

import random, statistics, time
from concurrent.futures import ThreadPoolExecutor
from qdrant_client import QdrantClient, models

API_KEY = "mySecretApiKey-2026"
DIM, N, BATCH, QUERIES = 384, 20_000, 500, 500

rng = random.Random(7)
vectors = [[rng.random() for _ in range(DIM)] for _ in range(N)]
queries = [[rng.random() for _ in range(DIM)] for _ in range(QUERIES)]
points = [models.PointStruct(id=i, vector=v, payload={"title": f"doc {i}", "price": i % 100})
          for i, v in enumerate(vectors)]

clients = {
    "REST": QdrantClient(url="http://localhost:6333", api_key=API_KEY),
    "gRPC": QdrantClient(host="localhost", grpc_port=6334, prefer_grpc=True,
                         https=False, api_key=API_KEY),
}

def pct(xs, p):
    xs = sorted(xs)
    return xs[min(len(xs) - 1, int(len(xs) * p / 100))]

for name, c in clients.items():
    coll = f"bench_{name.lower()}"
    if c.collection_exists(coll):
        c.delete_collection(coll)
    c.create_collection(coll, vectors_config=models.VectorParams(size=DIM, distance=models.Distance.COSINE))
    t0 = time.perf_counter()
    for i in range(0, N, BATCH):
        c.upsert(coll, points=points[i:i + BATCH], wait=True)
    up = time.perf_counter() - t0
    while c.get_collection(coll).status != models.CollectionStatus.GREEN:
        time.sleep(0.5)
    for q in queries[:20]:
        c.query_points(coll, query=q, limit=10)
    lat = []
    for q in queries:
        t = time.perf_counter()
        c.query_points(coll, query=q, limit=10, with_payload=True)
        lat.append((time.perf_counter() - t) * 1000)
    t = time.perf_counter()
    with ThreadPoolExecutor(8) as ex:
        list(ex.map(lambda q: c.query_points(coll, query=q, limit=10), queries * 4))
    par = time.perf_counter() - t
    print(f"{name:5} upsert {N} pts in {up:6.2f}s = {N/up:7.0f} pts/s | "
          f"search p50={statistics.median(lat):5.2f} p95={pct(lat,95):5.2f} p99={pct(lat,99):5.2f} ms | "
          f"8 threads {len(queries)*4/par:6.0f} q/s")

Both clients print UserWarning: Api key is used with an insecure connection. on every start. That warning is correct: the key crosses the wire in plain text until you put TLS in front, which the Qdrant TLS and Nginx guide sets up. The same upsert and query_points calls run unchanged on either client, which is the point of the switch.

Benchmark REST against gRPC

Our script measures both protocols on identical data, seeded so every run uses the same vectors. For each client it does three things in order:

  1. Upsert 20,000 random 384-dimension vectors in 500-point batches, waiting on each
  2. Run 500 sequential queries with payload and record each latency
  3. Fire 2,000 queries from 8 threads and count queries per second

Client and server shared one 4 vCPU VM, so the network cost is loopback only. Across real hosts the JSON bodies also cross the wire, so expect the REST gap to grow rather than shrink. Run it a few times to see the spread.

~/venv/bin/python bench.py

Each run prints one line per protocol. These are our three runs with the insecure-connection warnings removed.

REST  upsert 20000 pts in   4.08s =    4897 pts/s | search p50= 5.31 p95= 7.51 p99= 8.60 ms | 8 threads    329 q/s
gRPC  upsert 20000 pts in   2.27s =    8812 pts/s | search p50= 3.78 p95= 6.25 p99= 7.44 ms | 8 threads    662 q/s
REST  upsert 20000 pts in   4.05s =    4932 pts/s | search p50= 5.33 p95= 7.46 p99= 8.95 ms | 8 threads    324 q/s
gRPC  upsert 20000 pts in   2.27s =    8822 pts/s | search p50= 3.54 p95= 5.37 p99= 6.89 ms | 8 threads    689 q/s
REST  upsert 20000 pts in   3.98s =    5021 pts/s | search p50= 5.17 p95= 7.51 p99= 8.75 ms | 8 threads    327 q/s
gRPC  upsert 20000 pts in   2.24s =    8930 pts/s | search p50= 3.52 p95= 5.73 p99= 6.84 ms | 8 threads    649 q/s

gRPC wins every row in every run, as the capture shows.

Qdrant REST vs gRPC benchmark: upsert throughput and search latency over three runs

Throughput stayed within a few percent across runs, and only the gRPC tail latency moved more, so the ranges below tell the whole story.

Metric (3 runs)RESTgRPCgRPC vs REST
Upsert 20k points3.98 to 4.08 s2.24 to 2.27 sabout 1.8x faster
Search p505.17 to 5.33 ms3.52 to 3.78 msabout 1.6 ms lower
Search p998.60 to 8.95 ms6.84 to 7.44 msabout 1.2 to 2 ms lower
8-thread throughput324 to 329 q/s649 to 689 q/sabout 2x

Encoding explains the upsert gap. 500 vectors of 384 floats as JSON text is several times the bytes of the same batch as packed protobuf floats, and both sides pay to format and parse it. The concurrency gap is bigger than the single-query gap, which fits gRPC multiplexing all 8 threads over one HTTP/2 connection while REST pays per-request HTTP/1.1 and JSON overhead. Per query the saving is only about 1.6 ms. If your app does one query per user request, REST is fine; if it bulk-loads embeddings or fans out queries, use gRPC. For how Qdrant compares with other engines on bigger datasets, see the Qdrant vs Weaviate vs Milvus vs pgvector benchmark.

Use raw gRPC stubs from Python

Besides the high-level API, qdrant-client ships the generated stubs under qdrant_client.grpc. You rarely need them, but they help when you want the server’s own timing, a per-call deadline, or to see the exact protobuf messages the SDK builds. The key travels as call metadata, not a header option. Save this as native.py and put your own key in META.

import time
import grpc
from qdrant_client.grpc import (
    CollectionsStub, ListCollectionsRequest,
    PointsStub, QueryPoints, Query, VectorInput, DenseVector, WithPayloadSelector,
)

META = [("api-key", "mySecretApiKey-2026")]
channel = grpc.insecure_channel("localhost:6334")
collections = CollectionsStub(channel)
points = PointsStub(channel)

names = [c.name for c in collections.List(ListCollectionsRequest(), metadata=META).collections]
print("collections:", names)

t0 = time.perf_counter()
reply = points.Query(
    QueryPoints(
        collection_name="docs",
        query=Query(nearest=VectorInput(dense=DenseVector(data=[0.2, 0.1, 0.9, 0.7]))),
        limit=3,
        with_payload=WithPayloadSelector(enable=True),
    ),
    metadata=META,
    timeout=2.0,
)
wall = (time.perf_counter() - t0) * 1000
for r in reply.result:
    print(f"id={r.id.num} score={r.score:.4f} title={r.payload['title'].string_value}")
print(f"server time {reply.time * 1000:.2f} ms, client wall {wall:.2f} ms")

Run it with the venv’s interpreter, not the system python3, because only the venv has qdrant-client and grpcio installed.

~/venv/bin/python native.py

We ran this last, so the list includes the big collection from the errors section and point 6 from the Go program in the next section. Run it in page order and you’ll see three collections and point 5 in third place instead. The two timings show where the time goes: 1.20 ms in Qdrant and 2.62 ms end to end on the first call, the rest being channel setup and Python overhead:

collections: ['bench_grpc', 'bench_rest', 'big', 'docs']
id=6 score=0.9981 title=Go upsert
id=4 score=0.9925 title=Quantization notes
id=3 score=0.8387 title=Filter cookbook
server time 1.20 ms, client wall 2.62 ms

The message names are the trap here. A query vector must be a DenseVector inside VectorInput; passing the similarly named Vector message fails before anything leaves the client, as shown in the errors section.

Query Qdrant from Go over gRPC

Go gets a gRPC-only SDK, so your Go services always talk to 6334. Create a module and pull the client; @latest resolved to go-client v1.20.1 on grpc v1.84.0 for us:

mkdir ~/qdrant-go && cd ~/qdrant-go
go mod init qdrant-go-demo
go get github.com/qdrant/go-client/qdrant@latest

Save the program below as main.go, with your own key in APIKey. It upserts point 6, then runs the filtered query from the REST section with a 10-second context deadline, so a hung connection fails instead of blocking forever:

package main

import (
	"context"
	"fmt"
	"log"
	"time"

	"github.com/qdrant/go-client/qdrant"
)

func main() {
	ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
	defer cancel()

	client, err := qdrant.NewClient(&qdrant.Config{
		Host:   "localhost",
		Port:   6334,
		APIKey: "mySecretApiKey-2026",
		UseTLS: false,
	})
	if err != nil {
		log.Fatal(err)
	}
	defer client.Close()

	wait := true
	_, err = client.Upsert(ctx, &qdrant.UpsertPoints{
		CollectionName: "docs",
		Wait:           &wait,
		Points: []*qdrant.PointStruct{{
			Id:      qdrant.NewIDNum(6),
			Vectors: qdrant.NewVectors(0.15, 0.05, 0.88, 0.71),
			Payload: qdrant.NewValueMap(map[string]any{"title": "Go upsert", "category": "index", "price": 25}),
		}},
	})
	if err != nil {
		log.Fatal(err)
	}

	t0 := time.Now()
	res, err := client.Query(ctx, &qdrant.QueryPoints{
		CollectionName: "docs",
		Query:          qdrant.NewQuery(0.2, 0.1, 0.9, 0.7),
		Filter: &qdrant.Filter{
			Must: []*qdrant.Condition{qdrant.NewMatch("category", "index")},
		},
		Limit:       qdrant.PtrOf(uint64(3)),
		WithPayload: qdrant.NewWithPayload(true),
	})
	if err != nil {
		log.Fatal(err)
	}
	for _, r := range res {
		fmt.Printf("id=%d score=%.4f title=%s\n",
			r.GetId().GetNum(), r.GetScore(), r.GetPayload()["title"].GetStringValue())
	}
	fmt.Printf("query wall time: %v\n", time.Since(t0))
}

Run it with cgo off for the same grp.h reason as grpcurl.

CGO_ENABLED=0 go run main.go

Expect three warnings about the plaintext key before the filtered hits. Point 6 lands first because its vector sits closest to the query.

2026/11/13 09:05:31 WARN API key is being used without TLS(HTTPS). It will be transmitted in plaintext.
2026/11/13 09:05:31 WARN API key is being used without TLS(HTTPS). It will be transmitted in plaintext.
2026/11/13 09:05:31 WARN API key is being used without TLS(HTTPS). It will be transmitted in plaintext.
id=6 score=0.9981 title=Go upsert
id=4 score=0.9925 title=Quantization notes
id=2 score=0.6660 title=HNSW tuning
query wall time: 27.198629ms

Both gRPC clients, Go and the raw Python stubs, return the same top hits.

Qdrant Go SDK and native Python gRPC stub query results

Read the 27 ms as connection setup, not search latency. It is the first query on a fresh client, so it includes opening the HTTP/2 connection. Create one client at startup and reuse it; the benchmark numbers above are what a warm connection gives you.

Fix common Qdrant API errors

Every error below came from the lab node, triggered on purpose. Almost all of them trace back to one of four mismatches between client and server.

  • Missing or wrong API key
  • REST client on 6334, or gRPC client on 6333
  • TLS on one side only
  • Vector size or request size the server refuses

The messages rarely say which side is misconfigured, so match the text you see against the headings below and you’ll land on the fix faster than by reading logs.

“Must provide an API key or an Authorization bearer token”

The request carried no key at all. REST returns it with HTTP 401, gRPC as StatusCode.UNAUTHENTICATED, and grpcurl shows it even for list because reflection is protected too. Add -H "api-key: ${QDRANT_API_KEY}" to curl and grpcurl, or api_key= to the client constructor. If you already send it, check that a proxy in between isn’t stripping custom headers; switch to Authorization: Bearer in that case.

“Invalid API key or JWT”

A key arrived but does not match service.api_key, or it is a JWT that fails validation. Compare the value the container actually got with sudo docker inspect qdrant rather than trusting your shell history, because a stray trailing newline from a secrets file is enough to break the match.

“Received HTTP/0.9 when not allowed” or “illegal request line”

Both mean a REST client hit the gRPC port. curl prints curl: (1) Received HTTP/0.9 when not allowed because 6334 answers an HTTP/1.1 request with raw HTTP/2 frames. The Python REST client, built with QdrantClient(url="http://localhost:6334"), raises qdrant_client.http.exceptions.ResponseHandlingException: illegal request line. Point REST traffic at 6333.

“Failed parsing HTTP/2 (Expected SETTINGS frame as the first frame…)”

Here a gRPC client hit the REST port, the reverse mistake. Python raises StatusCode.UNAVAILABLE, and the detail names HTTP/1.x if you read far enough.

failed to connect to all addresses; last error: INTERNAL: ipv4:127.0.0.1:6333: Failed parsing HTTP/2 (Expected SETTINGS frame as the first frame, got frame type 80) (Trying to connect an http1.x server (HTTP status 400))

grpcurl is less helpful and only says Failed to dial target host "localhost:6333": context deadline exceeded, which looks like a firewall problem but isn’t. Set grpc_port=6334 and make sure 6334 is published on the container and open on the host firewall.

“Tls handshake failed … WRONG_VERSION_NUMBER”

The client tried TLS against a plaintext port. With the Python client this happens when you set prefer_grpc=True and api_key but leave out https=False. The client then defaults to TLS, and gRPC returns UNAVAILABLE with Tls handshake failed (TSI_PROTOCOL_FAILURE): SSL_ERROR_SSL: error:100000f7:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER. grpcurl without -plaintext fails the same way with tls: first record does not look like a TLS handshake. Either add https=False for a lab node or, better, enable TLS on the server.

“Wrong input: Vector dimension error: expected dim: 4, got 3”

Your vector length does not match the collection’s size. Qdrant rejects it on upsert and on query alike, with HTTP 400 over REST and InvalidArgument over gRPC.

curl -sS -X PUT "${QDRANT_URL}/collections/docs/points?wait=true" \
  -H "api-key: ${QDRANT_API_KEY}" -H 'Content-Type: application/json' \
  -d '{"points": [{"id": 9, "vector": [0.1, 0.2, 0.3]}]}' | jq

Both sizes appear in the response, so you can tell which side is wrong.

{
  "status": {
    "error": "Wrong input: Vector dimension error: expected dim: 4, got 3"
  },
  "time": 0.00001797
}

In practice this appears after someone swaps the embedding model. A 384-dimension model writing into a collection built for 768 cannot be fixed by a setting; create a new collection with the new size and re-embed into it, then switch an alias.

“JSON payload (36621623 bytes) is larger than allowed (limit: 33554432 bytes)”

REST bodies are capped at 32 MiB by service.max_request_size_mb, whose default in the shipped Qdrant config.yaml is 32. To reproduce it, create a 384-dimension collection and generate 9,000 points with a 200-byte payload each, which comes to a 35 MB file.

curl -sS -X PUT "${QDRANT_URL}/collections/big" \
  -H "api-key: ${QDRANT_API_KEY}" -H 'Content-Type: application/json' \
  -d '{"vectors": {"size": 384, "distance": "Cosine"}}'; echo
python3 -c '
import json, random
random.seed(1)
pts=[{"id":i,"vector":[round(random.random(),6) for _ in range(384)],"payload":{"title":"doc %d"%i,"body":"x"*200}} for i in range(9000)]
open("/tmp/big.json","w").write(json.dumps({"points":pts}))
'
ls -lh /tmp/big.json

Now send the whole file in one REST request. Use --data-binary for files this size, because plain -d makes curl strip newlines and is meant for short inline bodies.

curl -sS -X PUT "${QDRANT_URL}/collections/big/points?wait=true" \
  -H "api-key: ${QDRANT_API_KEY}" -H "Content-Type: application/json" \
  --data-binary @/tmp/big.json -w "\nHTTP=%{http_code}\n"

Qdrant refuses the whole request with HTTP 400 and stores none of it.

{"status":{"error":"JSON payload (36621623 bytes) is larger than allowed (limit: 33554432 bytes)."},"time":0.0}
HTTP=400

This capture puts the size error next to the dimension and wrong-port errors.

Qdrant API errors: vector dimension mismatch, 32 MiB JSON payload limit and wrong port

You have three fixes, in the order we’d reach for them. Split the batch first, since a 1,000-point slice of these points was 4 MB and went in with status completed. Next, send it over gRPC, where the Python client pushed all 9,000 points in a single upsert call on 6334 and reported completed. That is the script below, run from the same venv as bench.py. Swap in your own key for the lab value.

import json, warnings
warnings.simplefilter("ignore")
from qdrant_client import QdrantClient, models
d = json.load(open("/tmp/big.json"))["points"]
c = QdrantClient(host="localhost", grpc_port=6334, prefer_grpc=True, https=False,
                 api_key="mySecretApiKey-2026", timeout=60)
pts = [models.PointStruct(id=p["id"], vector=p["vector"], payload=p["payload"]) for p in d]
r = c.upsert("big", points=pts, wait=True)
print(len(pts), "points in one gRPC call:", r.status)

Saved as grpcbig.py and run with python grpcbig.py, it printed one line.

9000 points in one gRPC call: completed

Two things make this work. The same batch encodes to roughly 16 MB as protobuf, about half the JSON size, and Qdrant’s gRPC services do not apply max_request_size_mb at all. Don’t read that as “no limit”: a gRPC batch of hundreds of MB still has to fit in server memory in one piece, so keep chunking big loads. Last, raise the REST limit by recreating the container with one more variable.

sudo docker rm -f qdrant
sudo docker run -d --name qdrant --restart=always \
  -p 6333:6333 -p 6334:6334 \
  -e QDRANT__SERVICE__API_KEY="${QDRANT_API_KEY}" \
  -e QDRANT__SERVICE__MAX_REQUEST_SIZE_MB=64 \
  -v /opt/qdrant/storage:/qdrant/storage \
  -v /opt/qdrant/snapshots:/qdrant/snapshots \
  qdrant/qdrant:${QDRANT_TAG}

Your data survives because storage is on the host mount. After the restart the same 35 MB request returned {"result":{"operation_id":4,"status":"completed"},"status":"ok","time":0.246293383} with HTTP 200. Raising the cap is still our last choice: it raises the ceiling for every client that can reach the port, not just your loader, so batch first.

“expected DenseVector got Vector” in Python stubs

Only the raw stubs raise this, never the high-level client. Building VectorInput(dense=Vector(...)) instead of DenseVector fails locally with TypeError: Parameter to initialize message field must be dict or instance of same class: expected <class 'points_pb2.DenseVector'> got <class 'points_pb2.Vector'>. Vector is the message an upsert wraps inside Vectors, while a query’s VectorInput takes DenseVector. When a message name is in doubt, grpcurl’s describe on the request type, as we did for qdrant.QueryPoints, shows the field types.

Harden the API before it leaves localhost

Everything above ran on plaintext ports, and both SDKs spent the whole session warning that the key was in the clear. Before either port is reachable from another host, put these in place.

  • TLS on both ports, or Nginx in front of them
  • A separate read_only_api_key for search-only services
  • Firewall rules that open 6333 and 6334 only to app servers
  • Unauthenticated /readyz for the load balancer probe

A read-only key is worth the extra minute, because a RAG front end that only queries should never hold a key that can delete collections. The TLS and Nginx guide for Qdrant covers the certificate and proxy side. Once traffic is flowing, the request counters in Qdrant monitoring with Prometheus and Grafana show whether REST or gRPC carries your load, and the Qdrant cheat sheet keeps the endpoint list from this page in one place. For a full application on top of these calls, the Qdrant, Ollama and LangChain RAG build uses the same Python client with real embeddings. For the full parameter list behind each endpoint, the Qdrant API reference documents both protocols.

Keep reading

Run Amazon Ergo Locally: Hardware Requirements and vLLM Setup AI Run Amazon Ergo Locally: Hardware Requirements and vLLM Setup Open Source LLM Comparison Table (2026) AI Open Source LLM Comparison Table (2026) Ollama Models Cheat Sheet: Best Models by VRAM, Tested (PDF) AI Ollama Models Cheat Sheet: Best Models by VRAM, Tested (PDF) AI NAS Explained: Is Local AI on a NAS Worth It? AI AI NAS Explained: Is Local AI on a NAS Worth It? MedGemma 2 vs Gemma 4 vs MedGemma 1.5: Local Benchmark AI MedGemma 2 vs Gemma 4 vs MedGemma 1.5: Local Benchmark Antigravity CLI Cheat Sheet AI Antigravity CLI Cheat Sheet

Leave a Comment

Press ESC to close