# Web Cloud › Email and Collaborative Solutions › Microsoft 365 › Usage API

> Part of the OVHcloud developer hub. Index of every page and section: https://developers.eu.ovhcloud.com/llms.txt
> The Web Cloud product's sections: https://developers.eu.ovhcloud.com/reference/web-cloud/llms.txt
> Everything in one file: https://developers.eu.ovhcloud.com/llms-full.txt

> 2 operations of the OVHcloud API. Calls carry `authorization: Bearer $OVH_TOKEN`; the EU host is shown, Canada and the United States answer on api.ca.ovhcloud.com and api.us.ovhcloud.com.

Page: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/microsoft-365/usage/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/web-cloud/email-and-collaborative-solutions/microsoft-365/usage.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/web-cloud/email-and-collaborative-solutions/microsoft-365/usage.json?format=openapi3

## Operations

- `GET /license/office/{serviceName}/usageStatistics` — Get tenant usage statistics
- `GET /license/officePrepaid/{serviceName}/tenantUsageStatistics` — Get parent tenant usage statistics

## Get tenant usage statistics

`GET /1.0/license/office/{serviceName}/usageStatistics`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/microsoft-365/usage/#get-license-office-servicename-usagestatistics

**Status:** Alpha version  
**IAM actions:** `licenseOffice:apiovh:usageStatistics/get`

Returns, for each day between `from` and `to`, the peak and end-of-day counts of activated licenses of the tenant, by license type.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `from` | query | string (date-time) |  | Period's start point |
| `serviceName` | path | string | yes | Service name |
| `to` | query | string (date-time) |  | Period's end point |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | license.office.OfficeCurrentStatisticsNative[] | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `date` | string (date) | read-only | Date of the statistics |
| `lines` | license.office.StatisticsLineNative[] | read-only | List of lines associated to this statistics entity. |
| `lines[].endOfDayCount` | integer | read-only | Count of activated licenses at the end of the day. |
| `lines[].licenceType` | license.office.LicenseEnum | read-only | Type of the Office license. — one of `officeBusiness`, `officeProPlus` |
| `lines[].peakCount` | integer | read-only | Maximum count of simultaneous activated licences. |

```json
[
  {
    "date": "2024-01-01",
    "lines": [
      {
        "endOfDayCount": 0,
        "licenceType": "officeBusiness",
        "peakCount": 0
      }
    ]
  }
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/license/office/{serviceName}/usageStatistics" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/license/office/{serviceName}/usageStatistics")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/license/office/{serviceName}/usageStatistics");

print_r($result);
?>
```

## Get parent tenant usage statistics

`GET /1.0/license/officePrepaid/{serviceName}/tenantUsageStatistics`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/microsoft-365/usage/#get-license-officeprepaid-servicename-tenantusagestatistics

**Status:** Alpha version  
**IAM actions:** `licenseOfficePrepaid:apiovh:tenantUsageStatistics/get`

Returns, for each day between `from` and `to`, the peak and end-of-day counts of activated licenses of the parent tenant, by license type.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `from` | query | string (date-time) |  | Period's start point. |
| `serviceName` | path | string | yes | Service name |
| `to` | query | string (date-time) |  | Period's end point. |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | license.officePrepaid.OfficeCurrentStatisticsNative[] | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `date` | string (date) | read-only | Date of the statistics |
| `lines` | license.officePrepaid.StatisticsLineNative[] | read-only | List of lines associated to this statistics entity. |
| `lines[].endOfDayCount` | integer | read-only | Count of activated licenses at the end of the day. |
| `lines[].licenceType` | license.officePrepaid.LicenseEnum | read-only | Type of the Office license. — one of `officeBusiness`, `officeProPlus` |
| `lines[].peakCount` | integer | read-only | Maximum count of simultaneous activated licences. |

```json
[
  {
    "date": "2024-01-01",
    "lines": [
      {
        "endOfDayCount": 0,
        "licenceType": "officeBusiness",
        "peakCount": 0
      }
    ]
  }
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/license/officePrepaid/{serviceName}/tenantUsageStatistics" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/license/officePrepaid/{serviceName}/tenantUsageStatistics")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/license/officePrepaid/{serviceName}/tenantUsageStatistics");

print_r($result);
?>
```
