# Get customer statistics

The method allows you to get statistics on returning, new and lost customers

Endpoint: GET /locations/{location_id}/analytics/loyalty_programs/visits
Version: 1.0.0
Security: BearerPartnerUser

## Security:

  - `BearerPartnerUser` (unknown)
    http bearer Bearer {PartnerToken}, User {UserToken}

## Path parameters:

  - `location_id` (number, required)
    location ID

## Query parameters:

  - `date_to` (string, required)
    Period end date

  - `date_from` (string, required)
    Period start date

  - `loyalty_program_id` (string, required)
    Loyalty Program ID

## Header parameters:

  - `Accept` (string, required)
    application/vnd.api.v2+json

  - `Content-Type` (string, required)
    application/json

  - `Authorization` (string, required)
    Bearer bearer_token, User user_token

## Response 200:

  - `200` (unknown)
    OK

## Response 200 fields (application/json):

  - `success` (boolean)
    Execution success status

  - `data` (object)
    Object with data

  - `data.client_stats` (object)
    Client statistics

  - `data.client_stats.new` (object)
    New clients

  - `data.client_stats.new.all_count` (integer)
    Total

  - `data.client_stats.new.lost_count` (integer)
    Lost Clients

  - `data.client_stats.new.returned_count` (integer)
    Returning clients

  - `data.client_stats.new.returned_percent` (number)
    Percentage of returning customers

  - `data.client_stats.old` (object)
    Old clients

  - `data.client_stats.old.all_count` (integer)
    Total

  - `data.client_stats.old.lost_count` (integer)
    Lost Clients

  - `data.client_stats.old.returned_count` (integer)
    Returning clients

  - `data.client_stats.old.returned_percent` (number)
    Percentage of returning customers

  - `data.client_stats.total` (object)
    Total Quantity

  - `data.client_stats.total.all_count` (integer)
    Total

  - `data.client_stats.total.lost_count` (integer)
    Lost Clients

  - `data.client_stats.total.returned_count` (integer)
    Returning clients

  - `data.client_stats.total.returned_percent` (number)
    Percentage of returning customers

  - `data.visits_stats_by_day` (array)
    Number of clients per day

  - `data.visits_stats_by_day.date` (string)
    date

  - `data.visits_stats_by_day.new_count` (integer)
    Number of new clients

  - `data.visits_stats_by_day.old_count` (integer)
    Number of old clients

  - `meta` (array)
    Metadata (empty array)

## Response 401:

  - `401` (unknown)
    Unauthorized

## Response 401 fields (application/json):

  - `success` (boolean)
    Response status.
    Example: false

  - `data` (object | null)
    Response data.
    Example: null

  - `meta` (object)
    Additional response data.

  - `meta.message` (string)
    Error message.
    Example: Authentication needed.

## Response 403:

  - `403` (unknown)
    Forbidden

## Response 403 fields (application/json):

  - `success` (boolean)
    Response status.
    Example: false

  - `data` (object | null)
    Response data.
    Example: null

  - `meta` (object)
    Additional response data.

  - `meta.message` (string)
    Error message.
    Example: Access denied.

## Response 404:

  - `404` (unknown)
    Not Found

## Response 404 fields (application/json):

  - `success` (boolean)
    Response status.
    Example: false

  - `data` (object | null)
    Response data.
    Example: null

  - `meta` (object | array)
    Additional response data (empty object or empty array)
    Example: {}

