Cirqll Core
Home
Cirqll
Home
Cirqll
  1. Query Parameters
  • Getting Started
  • Translations
  • Documentation
    • Field Values
    • Rate Limiting
    • Zapier
      • Triggers
      • Actions
    • Query Parameters
      • Eager Loading
      • Partial Data
      • Count Relations
      • Filter
      • Order By
      • Pagination
    • OAuth2
      • Scopes
      • Authorize
      • Me
  • User
    • Me
      GET
    • Index
      GET
    • Show
      GET
    • Create
      POST
    • Update
      PATCH
    • Delete
      DELETE
  • Role
    • Index
      GET
    • Show
      GET
    • Create
      POST
    • Update
      PATCH
    • Delete
      DELETE
  • Customer
    • Index
      GET
    • Show
      GET
    • Create
      POST
    • Update
      PATCH
    • Delete
      DELETE
  • Contact
    • Index
    • Show
    • Create
    • Update
    • Delete
  • Task
    • Index
    • Show
    • Create
    • Update
    • Delete
  • Appointment
    • Index
    • Show
    • Create
    • Update
    • Delete
  • Financial
    • Chance
      • Index
      • Show
      • Create
      • Update
      • Delete
    • Assignment
      • Index
      • Show
      • Create
      • Update
      • Delete
    • Contract
      • Index
      • Show
      • Create
      • Update
      • Delete
  • Email
    • Index
    • Show
    • Create
    • Update
    • Delete
  • Field
    • Index
    • Show
    • Create
    • Update
    • Delete
  • Note
    • Index
    • Show
    • Create
    • Update
    • Delete
  • Todo
    • Index
    • Show
    • Create
    • Update
    • Delete
  • Template
    • Index
    • Show
    • Create
    • Update
    • Delete
  • Setting
    • Index
    • Update
  • Webhook
    • Index
    • Show
    • Create
    • Update
    • Delete
  • Schemas
    • Schemas
      • ActivityLog
        • ActivityLogResponse
        • ActivityLogRequestStore
        • ActivityLogRequestUpdate
      • Address
        • AddressResponse
        • AddressRequestStore
        • AddressRequestUpdate
      • Appointment
        • AppointmentResponse
        • AppointmentRequestStore
        • AppointmentRequestUpdate
      • Assignment
        • AssignmentResponse
        • AssignmentRequestStore
        • AssignmentRequestUpdate
      • Client
        • ClientResponse
        • ClientRequestStore
        • ClientRequestUpdate
      • Chance
        • ChanceResponse
        • ChanceRequestStore
        • ChanceRequestUpdate
      • Company
        • CompanyResponse
        • CompanyRequestStore
        • CompanyRequestUpdate
      • Contact
        • ContactResponse
        • ContactRequestStore
        • ContactRequestUpdate
      • Contract
        • ContractResponse
        • ContractRequestStore
        • ContractRequestUpdate
      • Customer
        • CustomerResponse
        • CustomerRequestStore
        • CustomerRequestUpdate
      • Email
        • EmailResponse
        • EmailRequestStore
        • EmailRequestUpdate
      • ExternalClient
        • ExternalClientResponse
        • ExternalClientRequestStore
        • ExternalClientRequestUpdate
      • FieldOption
        • FieldOptionResponse
        • FieldOptionRequestStore
        • FieldOptionRequestUpdate
      • Field
        • FieldResponse
        • FieldRequestStore
        • FieldRequestUpdate
      • Media
        • MediaResponse
        • MediaRequestStore
        • MediaRequestUpdate
      • Permission
        • PermissionsResponse
        • PermissionsRequestStore
        • PermissionsRequestUpdate
      • Role
        • RoleResponse
        • RoleRequestStore
        • RoleRequestUpdate
      • Scope
        • ScopeResponse
        • ScopeRequestStore
        • ScopeRequestUpdate
      • Task
        • TaskResponse
        • TaskRequestStore
        • TaskRequestUpdate
      • Template
        • TemplateResponse
        • TemplateRequestStore
        • TemplateRequestUpdate
      • TemplateItem
        • TemplateItemResponse
        • TemplateItemRequestStore
        • TemplateItemRequestUpdate
      • Todo
        • TodoResponse
        • TodoRequestStore
        • TodoRequestUpdate
      • Settings
        • SettingsResponse
        • SettingsRequestStore
        • SettingsRequestUpdate
      • User
        • UserResponse
        • UserRequestStore
        • UserRequestUpdate
      • Webhook
        • WebhookResponse
        • WebhookRequestStore
        • WebhookRequestUpdate
      • Origin
        • OriginResponse
        • OriginRequestStore
        • OriginRequestUpdate
      • Note
        • NoteResponse
        • NoteRequestStore
        • NoteRequestUpdate
    • Structure
      • Pagination
      • Exception
Home
Cirqll
Home
Cirqll
  1. Query Parameters

Count Relations

The count query parameter allows clients to include the count of related resources in the API response. This feature is designed for one-to-many or many-to-many relationships, providing the total number of associated records for specified relations. The count is returned in a {relation_name}_count field for each specified relation.

Usage#

The count parameter supports two formats:
1.
Comma-separated list:
?count=relation1,relation2
2.
Array-style query:
?count[]=relation1&count[]=relation2

Response Field#

For each specified relation, the API will include a field in the response with the format {relation_name}_count. This field will contain the total number of related records for that relation.

Examples#

Single Relation Count#

To include the count of a single relation, such as assignments:
GET /api/customer?count=assignments
Response:
{
  "id": 1,
  "name": "Example Customer",
  "assignments_count": 5
}

Multiple Relation Counts#

To include the count of multiple relations, such as assignments and contracts:
GET /api/customer?count=assignments,contracts
Response:
{
  "id": 1,
  "name": "Example Customer",
  "assignments_count": 5,
  "contracts_count": 3
}

Array-style Query#

You can also specify relations using an array-style query:
GET /api/customer?count[]=assignments&count[]=contracts
This will produce the same result as the comma-separated example above.

Summary#

Use the count parameter to include the count of related resources in API responses.
Specify relations as a comma-separated list or an array-style query.
The count for each relation is returned in a {relation_name}_count field.
By leveraging the count parameter, you can retrieve aggregate information about related resources efficiently, minimizing the need for additional API calls.
Modified at 2025-11-02 12:36:06
Previous
Partial Data
Next
Filter
Built with