> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gaintrace.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get survey results

> Results for every question of one survey, shaped by the answer type: counts per choice, means for scores, ranking scores, matrix rows, date ranges and, for the product-market fit question, the share who would be very disappointed. Written answers are counted but never returned. Use `GET /survey-responses` to read individual responses. Requires a secret server key (`gt_live_`). Publishable keys (`gt_pub_`) return `403`.

**Scope:** `read:surveys`



## OpenAPI

````yaml /openapi.json get /surveys/{id}/results
openapi: 3.1.0
info:
  title: GainTrace API
  version: 1.0.0
  description: >-
    The GainTrace REST API (v1). Read your customer data and push product-usage
    events, metric events, and signals into GainTrace.


    All endpoints are authenticated with a Bearer API key and scoped to a single
    workspace.


    Each API key can send 60 requests a minute. A `429` response includes a
    `Retry-After` header with the seconds to wait.
servers:
  - url: https://app.gaintrace.com/api/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Companies
    description: Read and manage canonical company records.
  - name: Signals
    description: Read, create, and manage buyer / risk signals.
  - name: Ingest
    description: Push product-usage and metric events into GainTrace.
  - name: Contacts
    description: >-
      The original path for People. It shares its handlers with /people, and
      also offers delete-by-key.
  - name: Webhooks
    description: Subscribe to workspace events with signed, retried delivery.
  - name: People
    description: Read and manage People. One Person can belong to many Companies.
  - name: NPS responses
    description: Import NPS scores from another survey tool and read your NPS history.
  - name: Surveys
    description: >-
      Create and launch surveys, request invitations, record responses and mint
      in-app sessions.
  - name: Survey responses
    description: Read the responses collected by your surveys.
  - name: Survey segments
    description: Save groups of Companies and People that surveys can target.
  - name: Survey imports
    description: Pull responses from the survey tools your workspace has connected.
paths:
  /surveys/{id}/results:
    get:
      tags:
        - Surveys
      summary: Get survey results
      description: >-
        Results for every question of one survey, shaped by the answer type:
        counts per choice, means for scores, ranking scores, matrix rows, date
        ranges and, for the product-market fit question, the share who would be
        very disappointed. Written answers are counted but never returned. Use
        `GET /survey-responses` to read individual responses. Requires a secret
        server key (`gt_live_`). Publishable keys (`gt_pub_`) return `403`.


        **Scope:** `read:surveys`
      operationId: getSurveyResults
      parameters:
        - $ref: '#/components/parameters/surveyId'
      responses:
        '200':
          description: The results.
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/SurveyResults'
              example:
                data:
                  surveyId: 7b6f2c1e-4d3a-4b5c-9e8f-1a2b3c4d5e6f
                  measure: nps
                  totalResponses: 120
                  questions:
                    - index: 0
                      text: How likely are you to recommend us to a colleague?
                      type: rating
                      answered: 120
                      totalResponses: 120
                      average: 7.9
                      choices:
                        - label: '0'
                          count: 1
                        - label: '1'
                          count: 0
                        - label: '2'
                          count: 2
                        - label: '3'
                          count: 1
                        - label: '4'
                          count: 3
                        - label: '5'
                          count: 4
                        - label: '6'
                          count: 6
                        - label: '7'
                          count: 14
                        - label: '8'
                          count: 21
                        - label: '9'
                          count: 38
                        - label: '10'
                          count: 30
                    - index: 1
                      text: What is the main reason for your score?
                      type: text
                      answered: 84
                      totalResponses: 120
                      average: null
                      choices: []
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
        '504':
          $ref: '#/components/responses/GatewayTimeout'
components:
  parameters:
    surveyId:
      name: id
      in: path
      required: true
      description: The survey's UUID.
      schema:
        type: string
        format: uuid
  schemas:
    SurveyResults:
      type: object
      required:
        - surveyId
        - measure
        - totalResponses
        - questions
      properties:
        surveyId:
          type: string
          format: uuid
        measure:
          $ref: '#/components/schemas/SurveyMeasure'
        totalResponses:
          type: integer
        questions:
          type: array
          items:
            $ref: '#/components/schemas/SurveyQuestionResult'
          description: One entry per question, in survey order.
    SurveyMeasure:
      type: string
      enum:
        - nps
        - csat
        - ces
        - custom
      description: >-
        `nps` is a 0-10 scale. `csat` and `ces` use a 1-5 or 1-7 scale. `custom`
        has no band and its responses are `unscored`. For `nps`, `csat` and
        `ces`, the first question must be a required `rating` or `scale`
        question: it carries the score.
    SurveyQuestionResult:
      type: object
      required:
        - index
        - text
        - type
        - answered
        - totalResponses
        - average
        - choices
      description: >-
        Results for one question. Which optional fields appear depends on the
        question's type.
      properties:
        index:
          type: integer
          description: Zero-based question index.
        text:
          type: string
        type:
          type: string
          enum:
            - rating
            - scale
            - text
            - multiple_choice
            - multi_select
            - dropdown
            - matrix
            - ranking
            - date
            - statement
            - consent
        answered:
          type: integer
          description: How many responses answered this question.
        totalResponses:
          type: integer
          description: How many responses the survey has.
        average:
          type:
            - number
            - 'null'
          description: >-
            Mean score for `rating` and `scale` questions, to two decimals.
            `null` otherwise, or with no answers.
        choices:
          type: array
          description: >-
            Counts in a fixed order: the scale from lowest to highest, the
            option order, months for a date, or a single `Agreed` row for
            consent. Text answers are counted in `answered` but never listed.
          items:
            type: object
            required:
              - label
              - count
            properties:
              label:
                type: string
              count:
                type: integer
        ranking:
          type: array
          description: >-
            `ranking` questions: items from most to least preferred. First place
            counts for the number of items and last place for 1.
          items:
            type: object
            properties:
              label:
                type: string
              score:
                type: number
              averagePosition:
                type:
                  - number
                  - 'null'
              firstPlace:
                type: integer
              count:
                type: integer
        matrix:
          type: array
          description: >-
            `matrix` questions: one entry per row, with the answers across the
            shared columns and the average column position, from 1.
          items:
            type: object
            properties:
              row:
                type: string
              answered:
                type: integer
              average:
                type:
                  - number
                  - 'null'
              choices:
                type: array
                items:
                  type: object
                  properties:
                    label:
                      type: string
                    count:
                      type: integer
        dates:
          type: object
          description: '`date` questions: the earliest and latest date answered.'
          properties:
            earliest:
              type:
                - string
                - 'null'
            latest:
              type:
                - string
                - 'null'
        pmf:
          type: object
          description: >-
            Questions with `preset: "pmf"`: the four answer counts, the base
            (the first three answers added up) and the share who would be very
            disappointed.
          properties:
            veryDisappointed:
              type: integer
            somewhatDisappointed:
              type: integer
            notDisappointed:
              type: integer
            noLongerUse:
              type: integer
            base:
              type: integer
            percent:
              type:
                - integer
                - 'null'
              description: >-
                Percent of the base who would be very disappointed. `null` with
                an empty base.
    Error:
      type: object
      required:
        - error
      description: The standard error envelope. Every 4xx/5xx response uses this shape.
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              enum:
                - bad_request
                - unauthorized
                - payment_required
                - forbidden
                - not_found
                - conflict
                - unprocessable_entity
                - rate_limit_exceeded
                - internal_server_error
                - service_unavailable
                - gateway_timeout
              description: >-
                Stable, machine-readable error code. Each code maps to exactly
                one HTTP status.
            message:
              type: string
              description: >-
                Human-readable, safe description of what went wrong. Never
                contains internal or provider detail.
            doc_url:
              type: string
              format: uri
              example: https://docs.gaintrace.com/errors#not_found
              description: Deep link to this code in the Errors reference.
  responses:
    Unauthorized:
      description: Missing, malformed, expired, or revoked API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: unauthorized
              message: Missing Authorization header
              doc_url: https://docs.gaintrace.com/errors#unauthorized
    Forbidden:
      description: >-
        The key is valid but lacks the required scope, the origin is not
        allowed, or API v1 is not enabled for the workspace.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: forbidden
              message: 'Insufficient scope: write:companies required'
              doc_url: https://docs.gaintrace.com/errors#forbidden
    NotFound:
      description: >-
        The resource, or a resource you referenced, was not found in this
        workspace.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: not_found
              message: Company not found
              doc_url: https://docs.gaintrace.com/errors#not_found
    RateLimited:
      description: >-
        The per-key rate limit was exceeded. Each API key can send 60 requests
        per minute, counted in calendar-minute windows. The `Retry-After` header
        gives the whole seconds (1 to 60) until the next window opens. Wait that
        long, then retry.
      headers:
        Retry-After:
          description: Whole seconds until the next one-minute window starts.
          schema:
            type: integer
            minimum: 1
            maximum: 60
          example: 23
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: rate_limit_exceeded
              message: >-
                Can't accept more than 60 requests a minute from one API key.
                Retry in 23 seconds.
              doc_url: https://docs.gaintrace.com/errors#rate_limit_exceeded
    InternalServerError:
      description: >-
        An unexpected error occurred on our side. The failure is logged; retry
        shortly.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: internal_server_error
              message: Something went wrong. Try again in a moment.
              doc_url: https://docs.gaintrace.com/errors#internal_server_error
    ServiceUnavailable:
      description: >-
        A backing service (for example, the database) was temporarily
        unavailable. Retry shortly.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: service_unavailable
              message: We had trouble reaching the database. Try again in a moment.
              doc_url: https://docs.gaintrace.com/errors#service_unavailable
    GatewayTimeout:
      description: >-
        The request took too long upstream before completing. Retry, and reduce
        batch size for large payloads.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: gateway_timeout
              message: The request timed out. Try again in a moment.
              doc_url: https://docs.gaintrace.com/errors#gateway_timeout
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer API key. Secret server keys start with `gt_live_`; client-safe
        browser keys start with `gt_pub_` (write-only, origin-pinned). Create
        and scope keys in Settings → API Keys.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.