Skip to content
Developers

Create a collection

How do you create collections in Tallyfy Answers?

Section titled “How do you create collections in Tallyfy Answers?”

Before adding objects to Tallyfy Answers, you’ll need to create a collection.

Each collection requires a unique name, and Tallyfy Answers automatically detects the data types of your objects as you index them.

POST /collections

This endpoint needs the API key.

Your request body should contain a JSON object with this collection property:

ParameterTypeRequiredDescription
namestringYesUnique name for the collection, using lowercase letters and digits only

Example request body:

{
"name": "products"
}

A successful request returns a 200 OK status code and this JSON response:

{
"message": "Collection is created successfully",
"status": 200
}
StatusDescription
400The name has characters other than lowercase letters and digits. The message says “only lowercase letters”, but digits are allowed too.
403The Authorization header is missing or doesn’t match the API key
422{"error": "Collection already exists", "status": 422}. The service returns this for any failure to create the collection, not only a duplicate name.
422The request body has no name
Terminal window
curl -X POST https://answers.tallyfy.com/collections \
-H "Authorization: Bearer <your_api_key>" \
-H "Content-Type: application/json" \
-d '{
"name": "products"
}'

You don’t declare types. Creating a collection adds one text property, uid, which identifies each object. The rest are added as you index: Tallyfy Answers stores objects in Weaviate, which sets each new property’s type from the first value it sees. For example:

Data TypeExampleDescription
string”Wireless Headphones”Text
list of strings[“electronics”, “audio”]A list of text values for multi-value fields

Nested objects work too. The hierarchy field that search reads is one.

What are collection naming best practices?

Section titled “What are collection naming best practices?”
  • Use lowercase letters and digits only
  • Start the name with a letter, because the service turns it into a Weaviate class name
  • Don’t name a collection queries, since search keeps its own data in a collection with that name
  • Choose descriptive names that reflect the content (e.g., “products”, “users”, “articles”)
  • Don’t use spaces or special characters
  • Keep collection names concise but meaningful
  • Use consistent naming conventions across all collections

Answers > Collections

Collections in Tallyfy Answers group similar objects together, like database tables. You can…

Answers > Objects

Objects are the JSON records you store in a Tallyfy Answers collection. They’re indexed in…