# Stats

## Stat object

| Name                       | Description                                                                                                                                                                        |
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **\_id** ObjectId          | The stat object identifier                                                                                                                                                         |
| **starting** Date          | The starting time for this stat time frame.                                                                                                                                        |
| **ending** Date            | The ending time for this stat time frame.                                                                                                                                          |
| **org** ObjectId           | The org that this stat lives in                                                                                                                                                    |
| **object** String          | The object name (stat)                                                                                                                                                             |
| **code** Number            | The number that determines what kind of event this stat instance is representing. Request: 0 File Storage: 1 Document Storage: 2 Logins: 3 Accounts: 4 Scripts: 5 Notifications: 6 |
| **count** Number           | How many times this stat event has occurred in the time frame.                                                                                                                     |
| **size** Number            | The size of the file or document stored. Used for code 2 stats.                                                                                                                    |
| **total** Number           | Similar to count but used for different stat codes.                                                                                                                                |
| **s\_source** String       | Storage source name (e.g. account)                                                                                                                                                 |
| **s\_object** String       | Storage object name (e.g. account)                                                                                                                                                 |
| **s\_type** String         | Storage type name                                                                                                                                                                  |
| **s\_property** ObjectId   | Storage property name                                                                                                                                                              |
| **today** Number           |                                                                                                                                                                                    |
| **active** Number          |                                                                                                                                                                                    |
| **location** Number        | 1 if data stored to Medable 2 if stored to Amazon s3                                                                                                                               |
| **method** Number          | GET: 0 POST: 1 PUT: 2 DELETE: 3 HEAD: 4 OPTIONS: 5 PATCH: 6                                                                                                                        |
| **api** String             | The api endpoint that was called                                                                                                                                                   |
| **client** ObjectId        | The object id of the app that's issuing the request, if defined. (relevant only for request stats)                                                                                 |
| **ms** Number              | The total number of milliseconds it took to complete this task                                                                                                                     |
| **in** Number              | The total number of bytes in                                                                                                                                                       |
| **out** Number             | The total number of bytes out                                                                                                                                                      |
| **errs** Number            | The number of errors                                                                                                                                                               |
| **scriptId** ObjectId      | The script identifier                                                                                                                                                              |
| **scriptType** String      | Script type (like "route", "trigger", etc)                                                                                                                                         |
| **callouts** Number        | Total number of HTTP callouts used in the script                                                                                                                                   |
| **calloutsMs** Number      | Total milliseconds of HTTP callouts in the script                                                                                                                                  |
| **ops** Number             | Number of operations used in the script                                                                                                                                            |
| **notifType** ObjectId     | The notification object identifier. A notification might be a standard or custom one defined in the `Notifications` tab of the admin interface.                                    |
| **notifEndpoint** ObjectId | The notification endpoint identifier. Each notification might have an email, sms, or push endpoint.                                                                                |

```javascript
{
  "_id": "575f58bfa588cb8881e49833",
  "api": "",
  "client": null,
  "code": 0,
  "count": 1,
  "ending": "2016-06-14T01:59:59.999Z",
  "in": 0,
  "location": 1,
  "method": 0,
  "ms": 22,
  "object": "stat",
  "org": "575f58271d0c03a53ccc3840",
  "out": 2871,
  "starting": "2016-06-14T01:00:00.000Z"
}
```

## List

<mark style="color:blue;">`GET`</mark> `https://api.dev.medable.com/your_org_name/v2/stats`

#### Path Parameters

| Name            | Type   | Description |
| --------------- | ------ | ----------- |
| your\_org\_name | string |             |

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

```
{
    "data": [
        {
            "_id": "5810f6c3773c2ecc9439e34e",
            "api": "sys",
            "client": null,
            "code": 0,
            "count": 2,
            "ending": "2016-10-26T18:59:59.999Z",
            "in": 2302,
            "location": 1,
            "method": 1,
            "ms": 266,
            "object": "stat",
            "org": "5810f10e6d66738355843d7d",
            "out": 1514,
            "starting": "2016-10-26T18:00:00.000Z"
        },
        {
            "_id": "5810f6c3773c2ecc9439e350",
            "api": "",
            "client": null,
            "code": 0,
            "count": 5,
            "ending": "2016-10-26T18:59:59.999Z",
            "in": 4619,
            "location": 1,
            "method": 0,
            "ms": 222,
            "object": "stat",
            "org": "5810f10e6d66738355843d7d",
            "out": 15400,
            "starting": "2016-10-26T18:00:00.000Z"
        },
        {
            "_id": "5810f6c4773c2ecc9439e352",
            "api": "orgs",
            "client": null,
            "code": 0,
            "count": 25,
            "ending": "2016-10-26T18:59:59.999Z",
            "in": 22794,
            "location": 1,
            "method": 0,
            "ms": 1532,
            "object": "stat",
            "org": "5810f10e6d66738355843d7d",
            "out": 16325,
            "starting": "2016-10-26T18:00:00.000Z"
        },
        {
            "_id": "5810f6c4773c2ecc9439e354",
            "api": "accounts",
            "client": null,
            "code": 0,
            "count": 6,
            "ending": "2016-10-26T18:59:59.999Z",
            "in": 5419,
            "location": 1,
            "method": 0,
            "ms": 410,
            "object": "stat",
            "org": "5810f10e6d66738355843d7d",
            "out": 3786,
            "starting": "2016-10-26T18:00:00.000Z"
        }
      ],
    "hasMore": true,
    "object": "list"
}
```

{% endtab %}

{% tab title="400 " %}

```
{}
```

{% endtab %}
{% endtabs %}

```javascript
$.ajax({
    url: "https://api.dev.medable.com/example/v2/stats",
    method: "GET",
    dataType : "json",
    xhrFields: {
        withCredentials: true
    },
    headers: {
        "Medable-Client-Key": "GsAqlhnIMzrDeD8V2MBQWq"
    }
}).done(function(data) {
    // ...
});
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.medable.com/cortex-api/objects/stats.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
