Authentication
Assistant API authentication with API keys, HTTP headers, and SDK client initialization for Pinecone Assistant requests and RAG apps.
All requests to the Pinecone Assistant API must contain a valid API key for the target project.
Get an API key
Section titled “Get an API key”Create a new API key in the Pinecone console, or use the connect widget below to generate a key.
Copy your generated key:
PINECONE_API_KEY="{{YOUR_API_KEY}}"
# This API key has ReadWrite access to all indexes in your project.Initialize a client
Section titled “Initialize a client”When using a Pinecone SDK, initialize a client object with your API key and then reuse the authenicated client in subsquent function calls. For example:
# To use the Python SDK, install the plugin:
# pip install --upgrade pinecone pinecone-plugin-assistant
from pinecone import Pinecone
pc = Pinecone(api_key="YOUR_API_KEY")
# Creates an assistant using the API key stored in the client 'pc'.
assistant = pc.assistant.create_assistant(
assistant_name="example-assistant",
instructions="Use American English for spelling and grammar.",
region="us"
)import { Pinecone } from '@pinecone-database/pinecone';
const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' });
// Creates an index using the API key stored in the client 'pc'.
const assistant = await pc.createAssistant({
name: 'example-assistant',
instructions: 'Use American English for spelling and grammar.',
region: 'us'
});Add headers to an HTTP request
Section titled “Add headers to an HTTP request”All HTTP requests to the Pinecone Assistant API must contain an Api-Key header that specifies a valid API key and must be encoded as JSON with the Content-Type: application/json header. For example:
PINECONE_API_KEY="YOUR_API_KEY"
curl "https://api.pinecone.io/assistant/assistants" \
-H "Api-Key: $PINECONE_API_KEY" \
-H "Content-Type: application/json" \
-H "X-Pinecone-Api-Version: 2025-01" \
-d '{
"name": "example-assistant",
"instructions": "Use American English for spelling and grammar.",
"region":"us"
}'