Skip to content

Get all collections

Listing all collections

This endpoint retrieves a summary of all collections in your Tallyfy Answers account. Collections are sorted by creation date in descending order (newest first), making it easy to find recently created collections.

API endpoint

GET /v1/collections

Query parameters

ParameterTypeRequiredDefaultDescription
limitintegerNo20Maximum number of collections to return (1-100)
offsetintegerNo0Number of collections to skip (for pagination)

Response

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

{
"collections": [
{
"name": "products",
"description": "Collection of product information",
"object_count": 142,
"created_at": "2023-08-15T14:32:21Z"
},
{
"name": "customers",
"description": "Customer account information",
"object_count": 1253,
"created_at": "2023-07-28T09:15:33Z"
}
],
"meta": {
"total_collections": 5,
"limit": 20,
"offset": 0
}
}

Response fields

FieldTypeDescription
collectionsarrayList of collection summary objects
meta.total_collectionsintegerTotal number of collections in your account
meta.limitintegerLimit value used in the request
meta.offsetintegerOffset value used in the request

Error scenarios

StatusDescription
400Invalid query parameters

Example request

Terminal window
# Get first page of collections
curl -X GET https://go.tallyfy.com/api/v1/collections \
-H "X-Answers-API-Key: your_api_key"
# Get second page with 10 collections per page
curl -X GET "https://go.tallyfy.com/api/v1/collections?limit=10&offset=10" \
-H "X-Answers-API-Key: your_api_key"

Pagination

To paginate through large numbers of collections:

  1. Make an initial request with desired limit
  2. Check the meta.total_collections value to determine total pages
  3. Increase the offset parameter by the limit value for each subsequent page
  4. Continue until you’ve processed all collections

Example pagination calculation:

  • If you have 45 total collections with a limit of 10:
    • Page 1: offset=0, limit=10 (collections 1-10)
    • Page 2: offset=10, limit=10 (collections 11-20)
    • Page 3: offset=20, limit=10 (collections 21-30)
    • Page 4: offset=30, limit=10 (collections 31-40)
    • Page 5: offset=40, limit=10 (collections 41-45)

Usage scenarios

  • Displaying a list of collections in a management interface
  • Generating reports on collection usage
  • Performing operations across all collections
  • Finding collections by name when browsing

Collections > Get a collection

The GET endpoint retrieves detailed collection information including metadata schema and object counts by using a unique collection name while returning a JSON response with appropriate status codes and error handling.

Answers > Collections

Collections in Tallyfy Answers serve as organizational containers that group similar objects together while enabling operations like searching filtering and managing data through dynamic schemas and efficient organization methods.

Collections > Create a collection

Collections must be created with unique names before adding objects to Tallyfy Answers which automatically detects data types like strings and string lists when indexing through a POST API endpoint.

Collections > Delete a collection

The DELETE endpoint permanently removes collections and their objects through a straightforward API call while offering best practices and alternatives to mitigate risks of irreversible data loss.