Skip to main content
Pinecone Docs
current

Search documentation

Type to search this documentation.

Create a namespace

Create a namespace in a serverless index.

For guidance and examples, see Manage namespaces.

Note: This operation is not supported for pod-based indexes.

curl
# To get the unique host for an index,
# see https://docs.pinecone.io/guides/manage-data/target-an-index
PINECONE_API_KEY="YOUR_API_KEY"
INDEX_HOST="INDEX_HOST"

curl "https://$INDEX_HOST/namespaces" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "Api-Key: $PINECONE_API_KEY" \
  -H "X-Pinecone-Api-Version: 2025-10" \
  -d '{
        "name": "example-namespace",
        "schema": {
		  "fields": { 
            "document_id": {"filterable": true},
            "document_title": {"filterable": true},
            "chunk_number": {"filterable": true},
            "document_url": {"filterable": true},
            "created_at": {"filterable": true}
          }
        }
      }'

POST /namespaces

200
{
  "name": "example-namespace",
  "record_count": 20000,
  "schema": {
    "fields": {
      "description": {
        "filterable": true
      },
      "genre": {
        "filterable": true
      },
      "year": {
        "filterable": true
      }
    }
  },
  "indexed_fields": {
    "fields": [
      "genre",
      "year",
      "author"
    ]
  }
}
400
{
  "code": 123,
  "message": "<string>",
  "details": [
    {
      "typeUrl": "<string>",
      "value": "<string>"
    }
  ]
}
409
{
  "code": 123,
  "message": "<string>",
  "details": [
    {
      "typeUrl": "<string>",
      "value": "<string>"
    }
  ]
}
4XX
{
  "code": 123,
  "message": "<string>",
  "details": [
    {
      "typeUrl": "<string>",
      "value": "<string>"
    }
  ]
}
5XX
{
  "code": 123,
  "message": "<string>",
  "details": [
    {
      "typeUrl": "<string>",
      "value": "<string>"
    }
  ]
}
Api-Keystringrequired

An API Key is required to call Pinecone APIs. Get yours from the console.

X-Pinecone-Api-Versionstringrequired

Required date-based version header

Typestring
Default2025-10
namestringrequired

The name of the namespace.

Example: example-namespace

Typestring
schema?object

Schema for the behavior of Pinecone's internal metadata index. By default, all metadata is indexed; when schema is present, only fields which are present in the fields object with a filterable: true are indexed. Note that filterable: false is not currently supported.

Typeobject
Show child attributes
fieldsobjectrequired

A map of metadata field names to their configuration. The field name must be a valid metadata field name. The field name must be unique.

Typeobject

200 — A successful response.

A description of a namespace, including the name and record count.

name?string

The name of the namespace.

Example: example-namespace

Typestring
record_count?integer

The total amount of records within the namespace.

Example: 20000

Typeinteger
schema?object

Schema for the behavior of Pinecone's internal metadata index. By default, all metadata is indexed; when schema is present, only fields which are present in the fields object with a filterable: true are indexed. Note that filterable: false is not currently supported.

Typeobject
Show child attributes
fieldsobjectrequired

A map of metadata field names to their configuration. The field name must be a valid metadata field name. The field name must be unique.

Typeobject
indexed_fields?object

A list of all indexed metatadata fields in the namespace

Typeobject
Show child attributes
fields?string[]
Suggest an edit

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

Export
Documentation menu