> ## Documentation Index
> Fetch the complete documentation index at: https://lava.so/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Pinecone

> Managed vector database for semantic search and retrieval-augmented generation.

Managed vector database for semantic search and retrieval-augmented generation. Use it to create indexes, generate embeddings and rerank results with Pinecone Inference, and upsert/query/fetch/delete vectors with metadata filtering. Unlike a general datastore, Pinecone is purpose-built for low-latency similarity search over high-dimensional embeddings at scale.

11 endpoints available through Lava's AI Gateway. See the [Pinecone API docs](https://docs.pinecone.io/reference/api/introduction) for full documentation.

<Warning>This provider requires your own credentials — connect your API key or OAuth account before use.</Warning>

## Endpoints

### List all indexes in the project

**GET** `https://api.pinecone.io/indexes` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.pinecone.io/indexes', { method: 'GET' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.pinecone.io%2Findexes" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY"
    ```
  </Tab>
</Tabs>

### Create a serverless index. `dimension` must match your embedding model (e.g. 1024 for multilingual-e5-large).

**POST** `https://api.pinecone.io/indexes` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.pinecone.io/indexes', {
      body: {
    "name": "my-index",
    "dimension": 1024,
    "metric": "cosine",
    "spec": {
      "serverless": {
        "cloud": "aws",
        "region": "us-east-1"
      }
    }
    },
    });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X POST "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.pinecone.io%2Findexes" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY" \
      -H "Content-Type: application/json" \
      -d '{"name":"my-index","dimension":1024,"metric":"cosine","spec":{"serverless":{"cloud":"aws","region":"us-east-1"}}}'
    ```
  </Tab>
</Tabs>

### Describe an index by name. Returns the `host` for data-plane requests (upsert/query/fetch/delete) on that index.

**GET** `https://api.pinecone.io/indexes/my-index` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.pinecone.io/indexes/my-index', { method: 'GET' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.pinecone.io%2Findexes%2Fmy-index" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY"
    ```
  </Tab>
</Tabs>

### Delete an index by name

**DELETE** `https://api.pinecone.io/indexes/my-index` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.pinecone.io/indexes/my-index', { method: 'DELETE' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X DELETE "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.pinecone.io%2Findexes%2Fmy-index" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY" \
      -H "Content-Type: application/json"
    ```
  </Tab>
</Tabs>

### Generate embeddings for input text with a hosted Pinecone model (e.g. multilingual-e5-large, llama-text-embed-v2)

**POST** `https://api.pinecone.io/embed` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.pinecone.io/embed', {
      body: {
    "model": "multilingual-e5-large",
    "parameters": {
      "input_type": "passage",
      "truncate": "END"
    },
    "inputs": [
      {
        "text": "The quick brown fox"
      }
    ]
    },
    });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X POST "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.pinecone.io%2Fembed" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY" \
      -H "Content-Type: application/json" \
      -d '{"model":"multilingual-e5-large","parameters":{"input_type":"passage","truncate":"END"},"inputs":[{"text":"The quick brown fox"}]}'
    ```
  </Tab>
</Tabs>

### Rerank documents against a query with a hosted reranking model (e.g. bge-reranker-v2-m3)

**POST** `https://api.pinecone.io/rerank` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.pinecone.io/rerank', {
      body: {
    "model": "bge-reranker-v2-m3",
    "query": "what is a vector database",
    "top_n": 2,
    "documents": [
      {
        "id": "1",
        "text": "Pinecone is a vector database"
      },
      {
        "id": "2",
        "text": "A fox is an animal"
      }
    ]
    },
    });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X POST "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.pinecone.io%2Frerank" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY" \
      -H "Content-Type: application/json" \
      -d '{"model":"bge-reranker-v2-m3","query":"what is a vector database","top_n":2,"documents":[{"id":"1","text":"Pinecone is a vector database"},{"id":"2","text":"A fox is an animal"}]}'
    ```
  </Tab>
</Tabs>

### Upsert vectors into a namespace. Target the index `host` from describe-index. `values` length must match the index dimension.

**POST** `https://my-index-abc123.svc.aped-4627-b74a.pinecone.io/vectors/upsert` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://my-index-abc123.svc.aped-4627-b74a.pinecone.io/vectors/upsert', {
      body: {
    "namespace": "ns1",
    "vectors": [
      {
        "id": "v1",
        "values": [
          0.1,
          0.2,
          0.3
        ],
        "metadata": {
          "text": "hello"
        }
      }
    ]
    },
    });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X POST "https://api.lava.so/v1/forward?u=https%3A%2F%2Fmy-index-abc123.svc.aped-4627-b74a.pinecone.io%2Fvectors%2Fupsert" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY" \
      -H "Content-Type: application/json" \
      -d '{"namespace":"ns1","vectors":[{"id":"v1","values":[0.1,0.2,0.3],"metadata":{"text":"hello"}}]}'
    ```
  </Tab>
</Tabs>

### Query a namespace for the topK nearest vectors. Target the index `host` from describe-index. Supports metadata `filter`.

**POST** `https://my-index-abc123.svc.aped-4627-b74a.pinecone.io/query` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://my-index-abc123.svc.aped-4627-b74a.pinecone.io/query', {
      body: {
    "namespace": "ns1",
    "vector": [
      0.1,
      0.2,
      0.3
    ],
    "topK": 3,
    "includeMetadata": true,
    "includeValues": false
    },
    });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X POST "https://api.lava.so/v1/forward?u=https%3A%2F%2Fmy-index-abc123.svc.aped-4627-b74a.pinecone.io%2Fquery" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY" \
      -H "Content-Type: application/json" \
      -d '{"namespace":"ns1","vector":[0.1,0.2,0.3],"topK":3,"includeMetadata":true,"includeValues":false}'
    ```
  </Tab>
</Tabs>

### Fetch vectors by id from a namespace. Target the index `host` from describe-index. Pass `ids` and `namespace` as query params.

**GET** `https://my-index-abc123.svc.aped-4627-b74a.pinecone.io/vectors/fetch?ids=v1&namespace=ns1` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://my-index-abc123.svc.aped-4627-b74a.pinecone.io/vectors/fetch?ids=v1&namespace=ns1', { method: 'GET' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.lava.so/v1/forward?u=https%3A%2F%2Fmy-index-abc123.svc.aped-4627-b74a.pinecone.io%2Fvectors%2Ffetch%3Fids%3Dv1%26namespace%3Dns1" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY"
    ```
  </Tab>
</Tabs>

### Delete vectors by id (or by metadata filter / deleteAll) from a namespace. Target the index `host` from describe-index.

**POST** `https://my-index-abc123.svc.aped-4627-b74a.pinecone.io/vectors/delete` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://my-index-abc123.svc.aped-4627-b74a.pinecone.io/vectors/delete', { body: {"namespace":"ns1","ids":["v1","v2"]} });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X POST "https://api.lava.so/v1/forward?u=https%3A%2F%2Fmy-index-abc123.svc.aped-4627-b74a.pinecone.io%2Fvectors%2Fdelete" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY" \
      -H "Content-Type: application/json" \
      -d '{"namespace":"ns1","ids":["v1","v2"]}'
    ```
  </Tab>
</Tabs>

### Get vector counts and fullness per namespace for an index. Target the index `host` from describe-index.

**POST** `https://my-index-abc123.svc.aped-4627-b74a.pinecone.io/describe_index_stats` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://my-index-abc123.svc.aped-4627-b74a.pinecone.io/describe_index_stats', { body: {} });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X POST "https://api.lava.so/v1/forward?u=https%3A%2F%2Fmy-index-abc123.svc.aped-4627-b74a.pinecone.io%2Fdescribe_index_stats" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY" \
      -H "Content-Type: application/json" \
      -d '{}'
    ```
  </Tab>
</Tabs>

## Next Steps

<CardGroup cols={2}>
  <Card title="All Providers" icon="grid" href="/gateway/supported-providers">
    Browse all supported AI providers
  </Card>

  <Card title="Forward Proxy" icon="route" href="/gateway/forward-proxy">
    Learn how to construct proxy URLs and authenticate requests
  </Card>
</CardGroup>
