Skip to main content
Pinecone Docs
current

Search documentation

Type to search this documentation.

Retrieve context from an assistant

Retrieve context snippets from an assistant to use as part of RAG or any agentic flow.

For guidance and examples, see Retrieve context snippets.

curl
PINECONE_API_KEY="YOUR_API_KEY"
ASSISTANT_NAME="example-assistant"

curl "https://prod-1-data.ke.pinecone.io/assistant/chat/$ASSISTANT_NAME/context" \
  -H "Api-Key: $PINECONE_API_KEY" \
  -H "accept: application/json" \
  -H "Content-Type: application/json" \
  -H "X-Pinecone-Api-Version: 2025-10" \
  -d '{
    "query": "Who is the CFO of Netflix?"
}'
curl
{
    "snippets":
    [
        {
            "type":"text",
            "content":"EXHIBIT 31.3\nCERTIFICATION OF CHIEF FINANCIAL OFFICER\nPURSUANT TO SECTION 302 OF THE SARBANES-OXLEY ACT OF 2002\nI, Spencer Neumann, certify that: ...",
            "score":0.9960699,
            "reference":
            {
                "type":"pdf",
                "file":
                {
                    "status":"Available","id":"e6034e51-0bb9-4926-84c6-70597dbd07a7",
                    "name":"Netflix-10-K-01262024.pdf", 
                    "size":1073470,
                    "metadata":null,
                    "updated_on":"2024-11-21T22:59:10.426001030Z",
                    "created_on":"2024-11-21T22:58:35.879120257Z", 
                    "percent_done":1.0,
                    "signed_url":"https://storage.googleapis.com...",
                    "error_message":null
                    },
                "pages":[78]
            }
        },
{
    "type":"text",
    "content":"EXHIBIT 32.1\n..."
...

POST /chat/{assistant_name}/context

Api-Keystringrequired

Pinecone API Key

Typestring
X-Pinecone-Api-Versionstringrequired

Required date-based version header

Typestring
Default2025-10
assistant_namestringrequired

The name of the assistant to be described.

Typestring

The desired configuration to retrieve context from an assistant.

query?string

The query that is used to generate the context. Exactly one of query or messages should be provided.

Typestring
filter?object

Optionally filter which documents can be retrieved using the following metadata fields.

Typeobject
messages?object[]

The list of messages to use for generating the context. Exactly one of query or messages should be provided.

Typeobject[]
Show child attributes
role?string

Role of the message such as 'user' or 'assistant'

Typestring
content?string

Content of the message

Typestring
top_k?integer

The maximum number of context snippets to return. Default is 16. Maximum is 64.

Example: 20

Typeinteger
snippet_size?integer

The maximum context snippet size. Default is 2048 tokens. Minimum is 512 tokens. Maximum is 8192 tokens.

Example: 4096

Typeinteger
multimodal?boolean

Whether or not to retrieve image-related context snippets. If false, only text snippets are returned.

Typeboolean
Defaulttrue
include_binary_content?boolean

If image-related context snippets are returned, this field determines whether or not they should include base64 image data. If false, only the image captions are returned. Only available when multimodal=true.

Typeboolean
Defaulttrue

200 — Context retrieval process successful.

The response format containing the context from an assistant.

id?string
snippetsobject[]required
Show child attributes
typestringrequired

The type of context snippet.

Typestring
contentstringrequired
scorenumberrequired
referenceobjectrequired

Represents a reference to a part of a text document.

Typeobject
Show child attributes
typestringrequired

The type of reference. Always 'text'.

Typestring
fileobjectrequired

The response format for a successful file upload request.

Typeobject
Show child attributes
namestringrequired
idstringrequired
metadata?object | null
created_on?string
updated_on?string
status?string

The current state of the uploaded file. Possible values: - Processing: File is being processed (parsed, chunked, embedded) - Available: Processing completed successfully; file is ready for use - Deleting: Deletion has been initiated but not yet completed - ProcessingFailed: Processing failed with an error Note: Once a file is deleted, the API returns 404 Not Found instead of a file object.

Typestring
percent_done?number | null

The percentage of the file that has been processed

Typenumber | null
signed_url?string | null

Example: https://storage.googleapis.com/bucket/file.pdf?...

Typestring | null

A signed URL that provides temporary, read-only access to the underlying file. Anyone with the link can access the file, so treat it as sensitive data. Expires after a short time.

error_message?string | null

A message describing any error during file processing. Provided only if an error occurs.

Typestring | null
multimodal?boolean

Indicates whether the file was processed as multimodal.

Typeboolean
usageobjectrequired

Describes the usage of a chat completion.

Typeobject
Show child attributes
prompt_tokens?integer
completion_tokens?integer
total_tokens?integer
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu