# Create Collection

This endpoint will allow the User to create a collection in a specific bot.

### Request

The following request will create a collection in the bot specified by the Bot Token.

```bash
curl --location --request POST 'https://<SERVICE ENDPOINT>/data/collection' \
--header 'Authorization: Bearer <BOT_AUTH_TOKEN>' \
--header 'Content-Type: application/json'
--data-raw '{ "Item":{ 
    "CollectionName":"Customer_Emails" 
    }
}'
```

### Response

If successful, the response will contain the created collection associated with bot specified in the request token.

```javascript
{
        "CollectionId": "The ID of the collection",
        "Name": "Name of the collection",
        "Fields": [{
            "Group": "Group of the Field",
            "Name": "Name of the Field",
            "Value": "Value of the Field",
            "Mandatory": boolean,
            "DisplayInView": boolean,
            "Indexed": boolean,            
            "Type": number,
            "OrderField": "The position of the field",            
        }],
    }
```

The Type property is a number that goes from 0 to 8 that specifies the Field Type.

```
Text            = 0,
LongText        = 1,
MultiChoice     = 2,
Date            = 3,
DateTime        = 4,
IntegerNumber   = 5,
DecimalNumber   = 6,
Boolean         = 7,
Upload          = 8
```

### Response Codes

This endpoint will reply with the following standard HTTP codes.

<table data-header-hidden><thead><tr><th width="276">Code</th><th>Meaning</th></tr></thead><tbody><tr><td>Code</td><td>Meaning</td></tr><tr><td>200</td><td>Ok. The request has been successfully fulfilled.</td></tr><tr><td>400</td><td>Bad Request. The supplied token is invalid or does not have enough permissions.</td></tr><tr><td>401</td><td>Unauthorized. The account associated to the token is not authorized</td></tr><tr><td>404</td><td>Not Found. The account or the chatbot specified could not be found.</td></tr></tbody></table>


---

# 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.xenioo.com/xenioo-api/globa-platform-api/database/collections/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.
