> ## Documentation Index
> Fetch the complete documentation index at: https://upstash-fix-issues-on-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Index

> This endpoint creates an index.

## Request Parameters

<ParamField body="name" type="string" required>
  Name of the index.
</ParamField>

<ParamField body="region" type="string" required>
  Region of the database.\
  **Options:** `eu-west-1`, `us-east-1`,
</ParamField>

<ParamField body="similarity_function" type="string" required>
  Similarity function that's used to calculate the distance between two
  vectors.\
  **Options:** `COSINE`, `EUCLIDIAN`, `DOT_PRODUCT`
</ParamField>

<ParamField body="dimension_count" type="number" required>
  The amount of values in a single vector.
</ParamField>

<ParamField body="type" type="string">
  The payment plan of your index.\
  **Options:** `payg`, `fixed`
</ParamField>

## Response Parameters

<ResponseField name="customer_id" type="string" required>
  The associated ID of the owner of the index
</ResponseField>

<ResponseField name="id" type="string" required>
  Unique ID of the index
</ResponseField>

<ResponseField name="name" type="string" required>
  The name of the index.
</ResponseField>

<ResponseField name="similarity_function" type="string" required>
  Similarity function that's used to calculate the distance between two
  vectors
</ResponseField>

<ResponseField name="dimension_count" type="number" required>
  The amount of values in a single vector
</ResponseField>

<ResponseField name="endpoint" type="string" required>
  The REST endpoint of the index
</ResponseField>

<ResponseField name="token" type="string" required>
  The REST authentication token for the index
</ResponseField>

<ResponseField name="read_only_token" type="string" required>
  The REST authentication read only token for the index
</ResponseField>

<ResponseField name="type" type="string" required>
  The payment plan of the index
</ResponseField>

<ResponseField name="region" type="string" required>
  The region where the index is currently deployed.
</ResponseField>

<ResponseField name="max_vector_count" type="number" required>
  The number of maximum that your index can contain.
</ResponseField>

<ResponseField name="max_daily_updates" type="number" required>
  The number of maximum update operations you can perform in a day. Only upsert operations are included in update count.
</ResponseField>

<ResponseField name="max_daily_queries" type="number" required>
  The number of maximum query operations you can perform in a day. Only query operations are included in query count.
</ResponseField>

<ResponseField name="max_monthly_bandwidth" type="number" required>
  The maximum amount of monthly bandwidth for the index. Unit is bytes. `-1` if the limit is unlimited.
</ResponseField>

<ResponseField name="max_writes_per_second" type="number" required>
  The number of maximum write operations you can perform per second. Only upsert operations are included in write count.
</ResponseField>

<ResponseField name="max_query_per_second" type="number" required>
  The number of maximum query operations you can perform per second. Only query operations are included in query count.
</ResponseField>

<ResponseField name="max_reads_per_request" type="number" required>
  The number of maximum vectors in a read operation. Query and fetch operations are included in read operations.
</ResponseField>

<ResponseField name="max_writes_per_request" type="number" required>
  The number of maximum vectors in a write operation. Only upsert operations are included in write operations.
</ResponseField>

<ResponseField name="max_total_metadata_size" type="number" required>
  The amount of maximum size for the total metadata sizes in your index.
</ResponseField>

<ResponseField name="reserved_price" type="number">
  Monthly pricing of your index. Only available for fixed and pro plans.
</ResponseField>

<ResponseField name="creation_time" type="number" required>
  The creation time of the vector index in UTC as unix timestamp.
</ResponseField>

<RequestExample>
  ```shell curl
  curl -X POST https://api.upstash.com/v2/vector/index \
    -u 'EMAIL:API_KEY' \
    -d '{
          "name": "myindex",
          "region": "eu-west-1",
          "similarity_function": "COSINE",
          "dimension_count": 1536
        }' \
  ```

  ```javascript JavaScript
  const axios = require('axios');

  const postData = {
    name: "myindex",
    region: "eu-west-1",
    similarity_function: "COSINE",
    dimension_count: 1536,
  };

  const config = {
    auth: {
      username: 'EMAIL',
      password: 'API_KEY',
    },
    headers: {
      'Content-Type': 'application/json',
    },
  };

  axios.post('https://api.upstash.com/v2/vector/index', postData, config)
    .then((response) => {
      console.log('Response:', response.data);
    })
    .catch((error) => {
      console.error('Error:', error);
    });
  ```

  ```python Python
  import requests

  data = '{"name":"myindex","region":"eu-west-1","similarity_function":"COSINE","dimension_count":1536}'

  response = requests.post('https://api.upstash.com/v2/vector/index', data=data, auth=('EMAIL', 'API_KEY'))
  response.content
  ```

  ```go Go
  client := &http.Client{}
  var data = strings.NewReader('{
    "name":"myindex",
    "region":"eu-west-1",
    "similarity_function":"COSINE",
    "dimension_count":1536}'
   )
  req, err := http.NewRequest("POST", "https://api.upstash.com/v2/vector/index", data)
  if err != nil {
      log.Fatal(err)
  }
  req.SetBasicAuth("email", "api_key")
  resp, err := client.Do(req)
  if err != nil {
      log.Fatal(err)
  }
  bodyText, err := ioutil.ReadAll(resp.Body)
  if err != nil {
      log.Fatal(err)
  }
  fmt.Printf("%s\n", bodyText);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK
  {
      "customer_id": "test@upstash.com",
      "id": "0639864f-ece6-429c-8118-86a287b0e808",
      "name": "myindex",
      "similarity_function": "COSINE",
      "dimension_count": 5,
      "endpoint": "test-index-3814-eu1-vector.upstash.io",
      "token": "QkZGMk5heGltdW0tdXBkYXRlZC0zNzM1LWV1MkFkbWlOeGZGZ1J5Wm1GdE5tTXhNQzB1TmpsbExUb3hOekF0TVRJbFpqMTJORFUxTm1GZw==",
      "read_only_token": "QkZGRk1heGltdW0tdXBkYXRlZC0zNzM1LWV1MnJlYWRvbmx5TmtaZ05qS3JNWVV0Wm1aZ01pMDBOV1poTHRob05qY3RNR0U0TkRjejNqazJU"
      "type": "paid",
      "region": "eu-west-1",
      "max_vector_count": 400000000,
      "max_daily_updates": -1,
      "max_daily_queries": -1,
      "max_monthly_bandwidth": -1,
      "max_writes_per_second": 1000,
      "max_query_per_second": 1000,
      "max_reads_per_request": 1000,
      "max_writes_per_request": 1000,
      "max_total_metadata_size": 53687091200,
      "creation_time": 1707313165
  }
  ```
</ResponseExample>
