# Get by ID

Fetch one or more entities by primary key from a loaded collection.

SDK: `@zilliz/milvus2-sdk-node@3.0.10` · Tested with Milvus 3.0.6

Canonical documentation: https://milvus-io.github.io/milvus-sdk-node/rest-api/entities/get/

## Section links

- [cURL command](https://milvus-io.github.io/milvus-sdk-node/rest-api/entities/get/#curl-command)
- [Default request](https://milvus-io.github.io/milvus-sdk-node/rest-api/entities/get/#default-request)
- [Sample response](https://milvus-io.github.io/milvus-sdk-node/rest-api/entities/get/#sample-response)
- [Request fields](https://milvus-io.github.io/milvus-sdk-node/rest-api/entities/get/#request-fields)

`POST /v2/vectordb/entities/get`

Replace `https://your-cluster.example.com` with your Milvus endpoint. Set `MILVUS_TOKEN` for authentication or omit the Authorization header on an unauthenticated cluster.

## cURL command

```bash
curl --request POST --url 'https://your-cluster.example.com/v2/vectordb/entities/get' \
  --header 'Content-Type: application/json' \
  --header "Authorization: Bearer ${MILVUS_TOKEN}" \
  --data-raw '{
  "dbName": "default",
  "collectionName": "books",
  "id": [
    101
  ],
  "outputFields": [
    "title"
  ]
}'
```

## Default request

```json
{
  "dbName": "default",
  "collectionName": "books",
  "id": [
    101
  ],
  "outputFields": [
    "title"
  ]
}
```

## Sample response

```json
{
  "code": 0,
  "data": [
    {
      "id": 101,
      "title": "Invisible Cities"
    }
  ],
  "cost": 0
}
```

## Request fields

- `dbName` string
  Database name. Operations on collections use default when omitted.
- `collectionName` string (required)
  Name of the collection.
- `partitionName` string
  Name of the partition.
- `partitionNames` array of string
  Names of the partitions to target.
- `outputFields` array of string
  Field names to include in the returned entities.
- `id` JSON value (required)
  Primary key or array of primary keys, matching the collection schema.
- `consistencyLevel` string
  Read consistency level, such as Strong, Session, or Bounded.

See [`HttpClient.get`](https://milvus-io.github.io/milvus-sdk-node/api-reference/http-client/#get) for the Node.js SDK method.
