Skip to content

Create a collection

How do you create collections in Tallyfy Answers?

Before adding objects to Tallyfy Answers, you must first create a collection.

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

API endpoint

POST /v1/collections

Request body

The request body should contain a JSON object with the following collection properties:

ParameterTypeRequiredDescription
namestringYesUnique name for the collection (can include letters, numbers, hyphens, and underscores)
descriptionstringNoOptional description explaining the collection’s purpose

Example request body:

{
"name": "products",
"description": "Collection of product information including names, descriptions, and pricing"
}

Response

A successful collection creation request returns a 201 Created status code and a JSON response containing:

{
"name": "products",
"description": "Collection of product information including names, descriptions, and pricing",
"created_at": "2023-08-15T14:32:21Z"
}

Error scenarios

StatusDescription
400Invalid request format or collection name
409Collection name already exists

Example request

Terminal window
curl -X POST https://go.tallyfy.com/api/collections \
-H "X-Answers-API-Key: <your_api_key>" \
-H "Content-Type: application/json" \
-d '{
"name": "products",
"description": "Collection of product information"
}'

What data types does Tallyfy Answers support?

Tallyfy Answers automatically detects these data types when you index objects:

Data TypeExampleDescription
string”Wireless Headphones”Text values that can be searched and filtered
list of strings[“electronics”, “audio”]Arrays of text values for multi-value fields

What are collection naming best practices?

  • Use lowercase letters, numbers, hyphens, and underscores
  • Choose descriptive names that reflect the content (e.g., “products”, “users”, “articles”)
  • Avoid spaces and special characters
  • Keep collection names concise but meaningful
  • Use consistent naming conventions across all collections

Collections > Get a collection

The Tallyfy Answers API endpoint allows fetching detailed information about a specific collection including its metadata schema and object counts using a GET request with the collection name as a path parameter.

Answers > Collections

Tallyfy Answers collections are organizational structures that function like database tables to group related objects together while providing dynamic schema detection searchability and complete management capabilities for efficient data organization and retrieval.

Collections > Update a collection

The PATCH endpoint enables modification of existing collection properties like descriptions in Tallyfy Answers while maintaining immutable collection names and providing structured JSON responses with error handling.

Objects > Index a single object

The Tallyfy Answers API endpoint enables adding single objects to collections in real-time through POST requests with JSON data ideal for individual record creation and testing while bulk operations should use the import endpoint for better performance.