> For the complete documentation index, see [llms.txt](https://developers.flipsnack.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.flipsnack.com/api-reference/api-method-user.getstats.md).

# user.getStats

**Note:**&#x20;

* requests must be made to **<https://api.flipsnack.com/v1>**
* the embedded flipbook may not function properly while the flipbook is in the processing state or the PDF document conversion is incomplete

## Request parameters <a href="#request_params" id="request_params"></a>

| Name                 | Type   | Description                                                                                                                                                                                                                                                                                                                                           |
| -------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| apiKey (required)    | string | The API key provided for your user. If it is not specified, the request will return the error code "30 - Missing mandatory parameter". If the key is incorrect the request returns the error code "41 - Invalid credentials".                                                                                                                         |
| signature (required) | string | The signature must be calculated by you and added to the request. See [How to sign a request](/how-to-sign-a-request.md) for more information. If the parameter is missing the request will return with error code "30 - Missing mandatory parameter". If the signature is incorrect the request will return the error code "44 - Invalid signature". |
| action (required)    | string | The API method that should be called. In this case the value should be *user.getStats*. If it is not specified, the request will return the error code "30 - Missing mandatory parameter".                                                                                                                                                            |

## Response parameters <a href="#response_params" id="response_params"></a>

| Name               | Type   | Description                                                                                              |
| ------------------ | ------ | -------------------------------------------------------------------------------------------------------- |
| impressions        | number | The number of impressions for all the flipbooks. Impressions are counted each time the player is loaded. |
| views              | number | The number of views for all the flipbooks. Views are counted each time a user interacts with the player. |
| time\_spent        | number | The total time spent is measured in seconds and shows how much time people spend viewing the flipbooks.  |
| downloads          | number | The number of times your documents were downloaded from your flipbooks.                                  |
| api\_uploads\_left | number | The number of uploads left via the API.                                                                  |

## Error codes <a href="#error_codes" id="error_codes"></a>

For complete list of error codes and messages go to [API status codes](/api-status-codes.md) section.

## Examples <a href="#example" id="example"></a>

### Request

{% tabs %}
{% tab title="cURL" %}

```bash
# GET
curl -X GET \
     -G \
     https://api.flipsnack.com/v1/ \
     -d action=user.getStats \
     -d apiKey=<YOUR-API-KEY> \
     -d signature=<YOUR-REQUEST-SIGNATURE>
```

{% endtab %}

{% tab title="HTML" %}

```html
<form method="get" action="https://api.flipsnack.com/v1/">
    <input type="hidden" name="action" value="user.getStats">
    <input type="hidden" name="apiKey" value="<YOUR-API-KEY>">
    <input type="hidden" name="signature" value="<YOUR-REQUEST-SIGNATURE>">
    <button type="submit">Submit</button>
</form>
```

{% endtab %}
{% endtabs %}

### Response

{% tabs %}
{% tab title="JSON" %}

```json
{
    "code": 20,
    "status": "OK",
    "data": {
        "impressions": 2945,
        "views": 3719,
        "time_spent": 154,
        "downloads": 28,
        "api_uploads_left": 53
    }
}
```

{% endtab %}
{% endtabs %}
