# create\_collection

The function `create_collection(schema, collection_name)` creates a new collection, according to the provided `schema` configuration.

**Input**

* <mark style="color:purple;">schema</mark> – Specifies the path to the configuration file (for example, \schema.json) that you created locally on your machine, as described in [Creating a Database Schema Configuration File.](https://docs.hyper-space.io/hyperspace-docs/projects/setting-up/creating-a-database-schema-configuration-file)
* <mark style="color:purple;">collection\_name</mark> – Specifies the name of the collection to be created in the Hyperspace database. You can specify any name as long as it is unique to your Hyperspace Collection.

**Example**

{% tabs %}
{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
collection_name = 'new_collection'
hyperspace_client.create_collection('schema.json', collection_name)
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
Object collection_name = 'new_collection';
hyperspaceClient.createCollection('schema.json', collection_name);
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```javascript
const collection_name = 'new_collection';

await hyperspaceClient.indices.create({
    index: collectionName,
    body: 'schema.json'
})
```

{% endcode %}
{% endtab %}
{% endtabs %}

**Where -**&#x20;

* '<mark style="color:purple;">schema.json</mark>' - can be any of the following:
  * The score function (python only)
  * The score function  as string
  * The name of the file that includes the score function

**Response**

The following response should be received –

{'status': 'OK', 'code': 200, 'message': 'Collection was successfully created'}

{% hint style="info" %}
Collections are a fundamental concept in databases that may organize data as Collections of documents. Collections don't enforce a fixed schema or predefined structure, allowing each document within a Collection to have its own unique set of fields and data. Serving as containers for related documents and records, Collections facilitate logical grouping, making it simpler to organize, manage, and efficiently query, index, and retrieve related data.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hyper-space.io/hyperspace-docs/api-documentation/hyperspace-client/create_collection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
