Skip to content
Support

Count feedback records

client.feedbackRecords.count(FeedbackRecordCountParams { tenant_id, created_since, created_until, 23 more } query, RequestOptionsoptions?): FeedbackRecordCountResponse { count }
GET/v1/feedback-records/count

Returns the total number of feedback records matching the given filters. Supports the same query parameters as the list endpoint.

ParametersExpand Collapse
query: FeedbackRecordCountParams { tenant_id, created_since, created_until, 23 more }
tenant_id: string

Tenant ID (required for isolation). NULL bytes not allowed.

minLength1
maxLength255
created_since?: string

Filter by created_at >= created_since (ISO 8601, inclusive). created_at is when Hub stored the record; collected_at (see since) is when the feedback was given. They diverge on a historical re-import, so this is the parameter for "what did this import bring in". Must be between 1970-01-01 and 2080-12-31.

formatdate-time
created_until?: string

Filter by created_at <= created_until (ISO 8601, inclusive). See created_since for how created_at differs from collected_at. Must be between 1970-01-01 and 2080-12-31.

formatdate-time
emotions?: Array<"joy" | "anger" | "sadness" | 3 more>

Filter by emotion label. Repeat the parameter to match ANY of the listed emotions: a record tagged {joy} and a record tagged {joy, anger} both match ?emotions=joy&emotions=anger. There is no "must carry all of them" form. An empty value is ignored rather than rejected, so ?emotions= is the same as omitting the filter.

Accepts one of the following:
"joy"
"anger"
"sadness"
"fear"
"surprise"
"disgust"
field_group_id?: Array<string>

Filter by field group ID (for ranking/matrix questions). Repeat the parameter to match any of several groups; the values are OR-ed. NULL bytes not allowed.

field_id?: Array<string>

Filter by field ID — every answer to one question. Repeat the parameter to match any of several fields; the values are OR-ed. NULL bytes not allowed.

field_type?: Array<"text" | "categorical" | "nps" | 6 more>

Filter by field type. Repeat the parameter to match any of several types; the values are OR-ed. An empty value is ignored rather than rejected, so ?field_type= is the same as omitting the filter.

Accepts one of the following:
"text"
"categorical"
"nps"
"csat"
"ces"
"rating"
"number"
"boolean"
"date"
has_emotions?: boolean

Filter on whether the record carries emotion labels: true selects records where emotions IS NOT NULL, false selects those where it IS NULL. Note that false covers both "not yet classified" and "classified, no emotion detected" — the two are indistinguishable here. Omit for no constraint.

has_sentiment?: boolean

Filter on whether sentiment enrichment has produced a label: true selects records where sentiment IS NOT NULL, false selects those where it IS NULL. Omit for no constraint.

has_translation?: boolean

Filter on whether the record has been translated: true selects records where translation_lang_key IS NOT NULL, false selects those where it IS NULL. Omit for no constraint.

language?: Array<string>

Filter by the language the feedback was given in. Repeat the parameter to match any of several languages; the values are OR-ed. NULL bytes not allowed.

sentiment?: Array<"very_negative" | "negative" | "neutral" | 3 more>

Filter by sentiment label. Repeat the parameter to match any of several labels (?sentiment=negative&sentiment=very_negative); the values are OR-ed. An empty value is ignored rather than rejected, so ?sentiment= is the same as omitting the filter. Records that have not been enriched carry no sentiment and are therefore never matched — use has_sentiment=false to find them.

Accepts one of the following:
"very_negative"
"negative"
"neutral"
"positive"
"very_positive"
"mixed"
sentiment_score_max?: number

Filter by sentiment_score <= sentiment_score_max (inclusive). Records that have not been enriched are excluded.

formatdouble
minimum-1
maximum1
sentiment_score_min?: number

Filter by sentiment_score >= sentiment_score_min (inclusive). The score is continuous where the label is bucketed, so this is the parameter for "the most negative feedback". Records that have not been enriched are excluded.

formatdouble
minimum-1
maximum1
since?: string

Filter by collected_at >= since (ISO 8601 format). Must be between 1970-01-01 and 2080-12-31.

formatdate-time
source_id?: Array<string>

Filter by source ID. Repeat the parameter to match any of several sources; the values are OR-ed. NULL bytes not allowed.

source_name?: Array<string>

Filter by source display name — the human-readable label stored alongside source_id. Prefer source_id where the records carry one: a name can be edited or translated, while the id is stable. Repeat the parameter to match any of several names; the values are OR-ed. NULL bytes not allowed.

source_type?: Array<string>

Filter by source type. Repeat the parameter to match any of several source types; the values are OR-ed. NULL bytes not allowed.

submission_id?: Array<string>

Filter by submission ID to group records belonging to one logical submission. Repeat the parameter to match any of several submissions; the values are OR-ed, and a single occurrence behaves exactly as it always has. Comma-separated values are NOT split. NULL bytes not allowed.

until?: string

Filter by collected_at <= until (ISO 8601 format). Must be between 1970-01-01 and 2080-12-31.

formatdate-time
user_id?: Array<string>

Filter by end-user identifier — everything one person submitted. Repeat the parameter to match any of several users; the values are OR-ed. NULL bytes not allowed.

value_date_max?: string

Filter by value_date <= value_date_max (ISO 8601, inclusive). Records whose value_date is NULL are excluded.

formatdate-time
value_date_min?: string

Filter by value_date >= value_date_min (ISO 8601, inclusive) — bounds the answer to a date question, not when the feedback was collected. Records whose value_date is NULL are excluded.

formatdate-time
value_id?: Array<string>

Filter by the source system's stable option id (e.g. all records for one survey choice). Repeat the parameter to match any of several options; the values are OR-ed. NULL bytes not allowed.

value_number_max?: number

Filter by value_number <= value_number_max (inclusive). Paired with value_number_min it selects a band: 9..10 is the NPS promoters, 0..6 the detractors. Records whose value_number is NULL are excluded. Supplying a max below the min is a 400, not an empty result.

formatdouble
value_number_min?: number

Filter by value_number >= value_number_min (inclusive) — e.g. NPS promoters with value_number_min=9. Records whose value_number is NULL (every non-numeric answer) are excluded, so this is never a no-op filter.

formatdouble
ReturnsExpand Collapse
FeedbackRecordCountResponse { count }
count: number

Number of feedback records matching the filters

formatint64

Count feedback records

import FormbricksHub from '@formbricks/hub';

const client = new FormbricksHub({
  apiKey: process.env['HUB_API_KEY'], // This is the default and can be omitted
});

const response = await client.feedbackRecords.count({ tenant_id: 'org-123' });

console.log(response.count);
{
  "type": "https://hub.formbricks.com/problems/validation",
  "title": "Validation Failed",
  "status": 400,
  "code": "validation",
  "detail": "One or more request parameters are invalid",
  "request_id": "0190a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
  "invalid_params": [
    {
      "name": "sentiment_score_min",
      "reason": "must be less than or equal to sentiment_score_max"
    }
  ]
}
Returns Examples
{
  "type": "https://hub.formbricks.com/problems/validation",
  "title": "Validation Failed",
  "status": 400,
  "code": "validation",
  "detail": "One or more request parameters are invalid",
  "request_id": "0190a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
  "invalid_params": [
    {
      "name": "sentiment_score_min",
      "reason": "must be less than or equal to sentiment_score_max"
    }
  ]
}