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

# List top countries by customer count

> Ranks countries by active customers through the Portal API.

See the [Gateway API entry](/api-reference/gateway/analytics/list-top-countries-by-customer-count) for the full description.



## OpenAPI

````yaml /openapi/kintra-app.json get /tenant/{tenantId}/analytics/top-countries
openapi: 3.0.0
info:
  description: >-
    Tenant portal API for the Kintra loyalty platform. Requests are
    authenticated with an Auth0 bearer token and address a tenant by id in the
    path.
  title: Kintra Portal API
  version: 1.0.0
servers:
  - description: Production environment
    url: https://api.kintra.io/api/v1
security: []
paths:
  /tenant/{tenantId}/analytics/top-countries:
    get:
      tags:
        - Analytics
      summary: List top countries by customer count
      description: >-
        Ranks countries by active customers through the Portal API.


        See the [Gateway API
        entry](/api-reference/gateway/analytics/list-top-countries-by-customer-count)
        for the full description.
      operationId: GetTenantAnalyticsTopCountries
      parameters:
        - in: path
          name: tenantId
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/ApiResponse_ITenantTopCountriesAnalyticsResponseDto_
          description: ''
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse_null_'
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse_null_'
          description: Tenant not found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse_null_'
          description: Internal server error
      security:
        - auth0_jwt: []
components:
  schemas:
    ApiResponse_ITenantTopCountriesAnalyticsResponseDto_:
      additionalProperties: false
      properties:
        data:
          $ref: '#/components/schemas/ITenantTopCountriesAnalyticsResponseDto'
        errors:
          items:
            properties:
              message:
                type: string
              path:
                type: string
            required:
              - path
              - message
            type: object
          type: array
        message:
          type: string
        success:
          type: boolean
      required:
        - success
      type: object
    ApiResponse_null_:
      additionalProperties: false
      properties:
        data:
          enum:
            - null
          nullable: true
          type: number
        errors:
          items:
            properties:
              message:
                type: string
              path:
                type: string
            required:
              - path
              - message
            type: object
          type: array
        message:
          type: string
        success:
          type: boolean
      required:
        - success
      type: object
    ITenantTopCountriesAnalyticsResponseDto:
      additionalProperties: false
      properties:
        items:
          items:
            $ref: '#/components/schemas/ITenantTopCountryAnalyticsItemDto'
          type: array
        tenant_id:
          type: string
        total_active_tenant_customers:
          format: double
          type: number
      required:
        - tenant_id
        - total_active_tenant_customers
        - items
      type: object
    ITenantTopCountryAnalyticsItemDto:
      additionalProperties: false
      properties:
        active_fans_count:
          format: double
          type: number
        country:
          $ref: '#/components/schemas/ICountryResponse'
        share_of_tenant_customers_percent:
          format: double
          type: number
      required:
        - country
        - active_fans_count
        - share_of_tenant_customers_percent
      type: object
    ICountryResponse:
      additionalProperties: false
      description: JSON response for a row in `core.countries`.
      properties:
        code:
          nullable: true
          type: string
        icon_url:
          nullable: true
          type: string
        id:
          type: string
        name:
          type: string
        status:
          anyOf:
            - $ref: '#/components/schemas/CountryStatus'
            - type: string
      required:
        - id
        - name
        - code
        - icon_url
        - status
      type: object
    CountryStatus:
      description: Lifecycle status for reference rows in `core.countries`.
      enum:
        - active
        - inactive
      type: string
  securitySchemes:
    auth0_jwt:
      bearerFormat: JWT
      description: Auth0 access token
      scheme: bearer
      type: http

````