Checking for freshness of the database

Hi all,

I have a question regarding the freshness of the database. From what I read in the documentation, there is a response header called x-pinecone-max-indexed-lsn.

How I want to do my workflow is the following:

  1. Document is uploaded, split in chunks
  2. The chunks are uploaded in batches
  3. The final call response header LSN is used in our relational database and linked to the document.
  4. If the user requests info from the document, the first check we do is to see if the current LSN is greater than the LSN of the document.

The problem is, I do not know if this is a valid flow and the .NET SDK does not support this.
I do not see any updates whether this header will be added to the response (now you only get number of upserts).

I am wondering how others are doing the verification of the freshness of the database.
Should I just query for the document id and see if the number of chunks equal the amount of chunks uploaded? Or do you have better/more efficient workflows?

Hi @matthijs,

At the moment, LSNs are only returned via direct REST calls—not through the SDKs. So your approach makes sense: use the REST API to upsert vectors and store the LSNs in your relational DB. Then run a periodic job to poll the index for the current max LSN.

Here’s a simple example using curl:

PINECONE_API_KEY="YOUR_API_KEY"
INDEX_HOST="INDEX_HOST"

curl -i "https://$INDEX_HOST/query" \
  -H "Api-Key: $PINECONE_API_KEY" \
  -H 'Content-Type: application/json' \
  -H "X-Pinecone-API-Version: 2025-01" \
  -d '{
    "vector": [0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3],
    "namespace": "example-namespace",
    "topK": 1,
    "includeValues": false,
    "includeMetadata": false
  }'

If you’re using .NET, RestClient.NET might be a better fit than curl.

Your job can then mark documents as indexed by updating a boolean field in your DB (e.g., is_indexed = true), using the LSNs for comparison.

Hi Cory,

Thanks for the ellaborate reply. I will try this out, I think for our application this should suffice.
Have a good day!

1 Like

Hey Cory,

I tried using your solution. However, I don’t see the lsn header in the response headers. Do you know if there is a setting I need to change to see the LSN header?

Okay, I figured out i was performing the wrong API call. Now i get the appropriate headers. Thanks for you explanation. This topic can be seen as resolved!

1 Like