# Statistics

Get pass creation, installation, and uninstallation counts for projects and templates.


Endpoints for `/activity` report net total activities, including repeated actions by the same user. For example, if the same user installs, removes, and then adds the same pass again, a response will show two passes installed and one pass removed. Endpoints for `/stats` will not count repeated actions from the same user.


## Pass statistics with external ID {#getpassstatisticsexternalid}

Returns statistics for a pass with an external ID, including the total number of installs and uninstalls. The response payload lists the internal Wallet ID for the template rather than the external ID.


This endpoint does not count repeated actions by the same user.


[Jump to examples ↓](#getpassstatisticsexternalid-examples)

### `GET /pass/id/{externalId}/stats`

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wrpt

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `externalId` | `integer` | Required | The external ID of the pass you want to return statistics for. |

**Request headers:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Api-Revision` | `string` | Required | The particular API revision you want to use. In general, this is `1.2`. Possible values: `1.2` |

**Responses**

**`200`** Returns a summary of statistics for the pass.

Response body:

**Content-Type:** `application/json`

- **`installed`** `integer`

  The number of installed passes with this external ID.

- **`templates`** `array[object]`

  The individual pass statistics for each template used to create passes with this external ID. Each object in the array represents a template.

- **`total`** `integer`

  A count of the total number of passes with this external ID.

- **`uninstalled`** `integer`

  The number of uninstalled passes with this external ID.

**Examples**

*Example request*

```http
GET /v1/pass/id/my_pass/stats HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

```

*Response*

```http
HTTP/1.1 200 OK
Content-Type: application/json

{
  "total": 1,
  "installed": 1,
  "uninstalled": 0,
  "templates": [
    {
      "id": 5350,
      "installed": 1,
      "uninstalled": 0
    }
  ]
}

```

---

## Project activity {#getprojectactivity}

Returns daily pass activity for a given project ID. You can also add start and end date parameters in the path to return activity between two dates, in the format `/template/{templateId}/activity/2018-08-10/2018-10-01`.
If your request did not specify a date range, the response includes all activity, organized by day, since the template's `createdAt` date.

This endpoint represents net activity, including repeated actions by the same user. For example, if the same user installs, removes, and then adds the same pass again, the report shows two passes installed and one pass removed.


[Jump to examples ↓](#getprojectactivity-examples)

### `GET /project/{projectId}/activity`

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wrpt

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `projectId` | `integer` | Required | The ID of the project you want to return activity for. For [External IDs](/docs/developer/rest-api/wallet/introduction/#external-ids), format the `{projectId}` as `id/{externalId}`. |

**Request headers:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Api-Revision` | `string` | Required | The particular API revision you want to use. In general, this is `1.2`. Possible values: `1.2` |

**Responses**

**`200`** Returns a per-day activity for all days in the time range. If your request did not specify a date range, the response includes all activity, organized by day, since the projects's `createdAt` date.

Response body:

**Content-Type:** `application/json`

- **`details`** `array[object]`

  Each object in this array represents pass activity for a single day. Each object represents net activity, including repeated actions by the same user. For example, if the same user installs, removes, and then adds the same pass again, the object shows two passes installed and one pass removed.

- **`endDate`** `string`

  The end date for a statistics report.

  Format: `date`

- **`id`** `integer`

  The ID of the project specified in the path.

- **`startDate`** `string`

  The start date for a statistics report.

  Format: `date`

- **`summary`** `object`

  Represents activity for a template or project.

  **OBJECT PROPERTIES**

  - **`created`** `integer`

    The number of passes created.

  - **`installed`** `integer`

    The number of passes that were installed.

  - **`uninstalled`** `integer`

    The number of passes that were uninstalled.

**Examples**

*Example request*

```http
GET /v1/project/12345/activity/2015-08-19/2015-08-20 HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

```

*Example request with external ID*

```http
GET /v1/project/id/myExternalProject/activity/2015-08-19/2015-08-20 HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

```

*Response*

```http
HTTP/1.1 200 OK
Content-Type: application/json

{
    "id": 12345,
    "startDate": "2015/08/19",
    "endDate": "2015/08/20",
    "summary": {
        "created": 113,
        "installed": 0,
        "uninstalled": 0
    },
    "details": [
        {
            "date": "2015/08/19",
            "activity": {
                "created": 111,
                "installed": 0,
                "uninstalled": 0
            }
        },
        {
            "date": "2015/08/20",
            "activity": {
                "created": 0,
                "installed": 0,
                "uninstalled": 0
            }
        }
    ]
}

```

---

## Project statistics {#getprojectstatistics}

Returns statistics for a given project ID. This endpoint does not count repeated actions by the same user. For [External IDs](/docs/developer/rest-api/wallet/introduction/#external-ids), the response payload lists the internal Wallet ID for the template rather than the external ID.

[Jump to examples ↓](#getprojectstatistics-examples)

### `GET /project/{projectId}/stats`

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wrpt

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `projectId` | `integer` | Required | The ID of the project you want to return statistics for. For [External IDs](/docs/developer/rest-api/wallet/introduction/#external-ids), format the `{projectId}` as `id/{externalId}`. |

**Request headers:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Api-Revision` | `string` | Required | The particular API revision you want to use. In general, this is `1.2`. Possible values: `1.2` |

**Responses**

**`200`** Returns a summary of pass statistics for every template in the project.

Response body:

**Content-Type:** `application/json`

- **`id`** `integer`

  The identifier for the project.

- **`installed`** `integer`

  The total number of passes from this project that are installed.

- **`lastUpdated`** `string`

  The date and time when the item was last updated.

  Format: `date-time`

  Read only: true

- **`templates`** `array[object]`

  Contains statistics for each template belonging to the project.

- **`total`** `integer`

  The total number of passes created in the project.

- **`uninstalled`** `integer`

  The total number of passes created from this project that are uninstalled.

**Examples**

*Example request*

```http
GET /v1/project/12345/stats HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

```

*Example request with external ID*

```http
GET /v1/project/id/ext_54321/stats HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

```

*Response*

```http
HTTP/1.1 200 OK
Content-Type: application/json

{
    "id": 12345,
    "lastUpdated": "2015-10-01T20:15:29.000-07:00",
    "templates": [
        {
            "id": 1234,
            "vendor": "Apple",
            "lastUpdated": "2015-10-01T20:15:29.000-07:00",
            "total": 2194,
            "installed": 2,
            "uninstalled": 7
        }
    ],
    "total": 2194,
    "installed": 2,
    "uninstalled": 7
}

```

---

## Tag statistics {#gettagstatistics}

Returns statistics for a given tag. Tags are typically used for segmentation but can also be useful for reporting.
This endpoint does not count repeated actions by the same user.


[Jump to examples ↓](#gettagstatistics-examples)

### `GET /tag/{tag}/stats`

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wrpt

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `tag` | `string` | Required | The tag you want to return statistics for. |

**Request headers:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Api-Revision` | `string` | Required | The particular API revision you want to use. In general, this is `1.2`. Possible values: `1.2` |

**Responses**

**`200`** Returns an object containing usage information about a tag.

Response body:

**Content-Type:** `application/json`

- **`installed`** `integer`

  The number of installed passes with the tag.

- **`lastUpdated`** `string`

  The date and time when the statistics were generated.

  Format: `date-time`

- **`not_been_installed`** `integer`

  The number of passes created but not installed.

- **`total`** `integer`

  A count of the total number of passes created with the tag.

- **`uninstalled`** `integer`

  The number of uninstalled passes with the tag.

**Examples**

*Example request*

```http
GET /v1/tag/my_tag/stats HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

```

*Response*

```http
HTTP/1.1 200 OK
Content-Type: application/json

{
  "total": 21,
  "installed": 11,
  "uninstalled": 0,
  "not_been_installed": 0,
  "lastUpdated": "2023-06-14T12:45:37.000Z"
}              

```

---

## Template activity {#gettemplateactivity}

Returns daily activity of passes created, installed, and uninstalled for a template, specified by template ID. You can also add start and end date parameters in the path to return activity between two dates, in the format `/template/id/{externalId}/activity/2018-08-10/2018-10-01`.
If your request did not specify a date range, the response includes all activity, organized by day, since the template's `createdAt` date.

This endpoint represents net activity, including repeated actions by the same user. For example, if the same user installs, removes, and then adds the same pass again, the report shows two passes installed and one pass removed.


[Jump to examples ↓](#gettemplateactivity-examples)

### `GET /template/{templateId}/activity`

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wrpt

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `templateId` | `integer` | Required | The ID of the template you want to return activity for. For [External IDs](/docs/developer/rest-api/wallet/introduction/#external-ids), format the `{templateId}` as `id/{externalId}`. |

**Request headers:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Api-Revision` | `string` | Required | The particular API revision you want to use. In general, this is `1.2`. Possible values: `1.2` |

**Responses**

**`200`** Returns a per-day activity for all days in the time range. If your request did not specify a date range, the response includes all activity, organized by day, since the template's `createdAt` date.

Response body:

**Content-Type:** `application/json`

- **`details`** `array[object]`

  Each object in this array represents pass activity for a single day.

- **`endDate`** `string`

  The end date for a statistics report.

  Format: `date`

- **`id`** `integer`

  The ID of the template specified in the path.

- **`startDate`** `string`

  The start date for a statistics report.

  Format: `date`

- **`summary`** `object`

  Represents activity for a template or project.

  **OBJECT PROPERTIES**

  - **`created`** `integer`

    The number of passes created.

  - **`installed`** `integer`

    The number of passes that were installed.

  - **`uninstalled`** `integer`

    The number of passes that were uninstalled.

- **`vendor`** `string`

  The device vendor the template is designed for.


  Possible values: `Apple`, `Google`

**Examples**

*Example request*

```http
GET /v1/template/1234/activity/2015-08-19/2015-08-20 HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

```

*Example request with external ID*

```http
GET /v1/template/id/myExternalId/activity/2015-08-19/2015-08-20 HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

```

*Response*

```http
HTTP/1.1 200 OK
Content-Type: application/json

{
    "id": 1234,
    "vendor": "Apple",
    "startDate": "2015/08/19",
    "endDate": "2015/08/20",
    "summary": {
        "created": 113,
        "installed": 0,
        "uninstalled": 0
    },
    "details": [
        {
            "date": "2015/08/19",
            "activity": {
                "created": 111,
                "installed": 0,
                "uninstalled": 0
            }
        },
        {
            "date": "2015/08/20",
            "activity": {
                "created": 0,
                "installed": 0,
                "uninstalled": 0
            }
        }
    ]
}

```

---

## Template statistics {#gettemplatestatistics}

Returns statistics for a given template by ID, including the total number of passes installed and uninstalled. For [External IDs](/docs/developer/rest-api/wallet/introduction/#external-ids), the response payload lists the internal Wallet ID for the template rather than the external ID.


This endpoint does not count repeated actions by the same user.


[Jump to examples ↓](#gettemplatestatistics-examples)

### `GET /template/{templateId}/stats`

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wrpt

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `templateId` | `integer` | Required | The ID of the template you want to return statistics for. For [External IDs](/docs/developer/rest-api/wallet/introduction/#external-ids), format the `{templateId}` as `id/{externalId}`. |

**Request headers:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Api-Revision` | `string` | Required | The particular API revision you want to use. In general, this is `1.2`. Possible values: `1.2` |

**Responses**

**`200`** Returns an object containing usage information about a template.

Response body:

**Content-Type:** `application/json`

- **`id`** `integer`

  The template specified in the request.

- **`installed`** `integer`

  The number of installed passes based on this template.

- **`lastUpdated`** `string`

  The date and time when the template was last updated.

  Format: `date-time`

- **`total`** `integer`

  A count of the total number of passes created from the template.

- **`uninstalled`** `integer`

  The number of uninstalled passes based on this template.

- **`vendor`** `string`

  The device vendor the template is designed for.


  Possible values: `Apple`, `Google`

**Examples**

*Example request*

```http
GET /v1/template/12345/stats HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

```

*Example request with external ID*

```http
GET /v1/template/id/ext_54321/stats HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

```

*Response*

```http
HTTP/1.1 200 OK
Content-Type: application/json

{
    "id": 12345,
    "vendor": "Apple",
    "lastUpdated": "2015-10-01T20:15:28.000-07:00",
    "total": 7,
    "installed": 0,
    "uninstalled": 0
}

```

---

