# Get MAU total usage

GET https://app.launchdarkly.com/api/v2/usage/total-mau

Get a time series of the number of context key usages observed by LaunchDarkly in your account, for the primary context kind only.<br/><br/>For past months, this reflects the context kind that was most recently marked as primary for that month. For the current month, the context kind may vary as new primary kinds are observed.<br/><br/>The supported granularity varies by aggregation type. The maximum time range is 365 days.

Reference: https://launchdarkly.com/docs/api/account-usage-beta/get-mau-total-usage

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: LaunchDarkly REST API
  version: 1.0.0
paths:
  /api/v2/usage/total-mau:
    get:
      operationId: get-mau-total-usage
      summary: Get MAU total usage
      description: >-
        Get a time series of the number of context key usages observed by
        LaunchDarkly in your account, for the primary context kind
        only.<br/><br/>For past months, this reflects the context kind that was
        most recently marked as primary for that month. For the current month,
        the context kind may vary as new primary kinds are
        observed.<br/><br/>The supported granularity varies by aggregation type.
        The maximum time range is 365 days.
      tags:
        - subpackage_accountUsageBeta
      parameters:
        - name: from
          in: query
          description: >-
            The series of data returned starts from this timestamp (Unix
            milliseconds). Defaults to the beginning of the current month.
          required: false
          schema:
            type: string
            format: string
        - name: to
          in: query
          description: >-
            The series of data returned ends at this timestamp (Unix
            milliseconds). Defaults to the current time.
          required: false
          schema:
            type: string
            format: string
        - name: projectKey
          in: query
          description: >-
            A project key to filter results by. Can be specified multiple times,
            one query parameter per project key.
          required: false
          schema:
            type: string
            format: string
        - name: environmentKey
          in: query
          description: >-
            An environment key to filter results by. If specified, exactly one
            `projectKey` must be provided. Can be specified multiple times, one
            query parameter per environment key.
          required: false
          schema:
            type: string
            format: string
        - name: sdkName
          in: query
          description: >-
            An SDK name to filter results by. Can be specified multiple times,
            one query parameter per SDK name.
          required: false
          schema:
            type: string
            format: string
        - name: sdkType
          in: query
          description: >-
            An SDK type to filter results by. Can be specified multiple times,
            one query parameter per SDK type.
          required: false
          schema:
            type: string
            format: string
        - name: anonymous
          in: query
          description: >-
            An anonymous value to filter results by. Can be specified multiple
            times, one query parameter per anonymous value.<br/>Valid values:
            `true`, `false`.
          required: false
          schema:
            type: string
            format: string
        - name: groupBy
          in: query
          description: >-
            If specified, returns data for each distinct value of the given
            field. Can be specified multiple times to group data by multiple
            dimensions, one query parameter per dimension.<br/>Valid values:
            `projectId`, `environmentId`, `sdkName`, `sdkType`, `sdkAppId`,
            `anonymousV2`.
          required: false
          schema:
            type: string
            format: string
        - name: aggregationType
          in: query
          description: >-
            Specifies the aggregation method. Defaults to
            `month_to_date`.<br/>Valid values: `month_to_date`, `incremental`,
            `rolling_30d`.
          required: false
          schema:
            type: string
            format: string
        - name: granularity
          in: query
          description: >-
            Specifies the data granularity. Defaults to `daily`. Valid values
            depend on `aggregationType`: **month_to_date** supports `daily` and
            `monthly`; **incremental** and **rolling_30d** support `daily` only.
          required: false
          schema:
            type: string
            format: string
        - name: Authorization
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Usage response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeriesListRep'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidRequestErrorRep'
        '401':
          description: Invalid access token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedErrorRep'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenErrorRep'
        '429':
          description: Rate limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitedErrorRep'
        '503':
          description: Service unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatusServiceUnavailable'
servers:
  - url: https://app.launchdarkly.com
  - url: https://app.launchdarkly.us
components:
  schemas:
    SeriesMetadataRep:
      type: object
      additionalProperties:
        description: Any type
      title: SeriesMetadataRep
    SeriesTimeSliceRep:
      type: object
      additionalProperties:
        type: integer
      title: SeriesTimeSliceRep
    SeriesListRep:
      type: object
      properties:
        _links:
          type: object
          additionalProperties:
            description: Any type
          description: The location and content type of related resources
        metadata:
          type: array
          items:
            $ref: '#/components/schemas/SeriesMetadataRep'
          description: Metadata about each series
        series:
          type: array
          items:
            $ref: '#/components/schemas/SeriesTimeSliceRep'
          description: >-
            An array of data points with timestamps. Each element of the array
            is an object with a 'time' field, whose value is the timestamp, and
            one or more key fields. If there are multiple key fields, they are
            labeled '0', '1', and so on, and are explained in the
            <code>metadata</code>.
      required:
        - _links
        - metadata
        - series
      title: SeriesListRep
    InvalidRequestErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: InvalidRequestErrorRep
    UnauthorizedErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: UnauthorizedErrorRep
    ForbiddenErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: ForbiddenErrorRep
    RateLimitedErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: RateLimitedErrorRep
    StatusServiceUnavailable:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: StatusServiceUnavailable
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: Authorization

```

## SDK Code Examples

```python
import requests

url = "https://app.launchdarkly.com/api/v2/usage/total-mau"

headers = {"Authorization": "<apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://app.launchdarkly.com/api/v2/usage/total-mau';
const options = {method: 'GET', headers: {Authorization: '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://app.launchdarkly.com/api/v2/usage/total-mau"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://app.launchdarkly.com/api/v2/usage/total-mau")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://app.launchdarkly.com/api/v2/usage/total-mau")
  .header("Authorization", "<apiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://app.launchdarkly.com/api/v2/usage/total-mau', [
  'headers' => [
    'Authorization' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://app.launchdarkly.com/api/v2/usage/total-mau");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://app.launchdarkly.com/api/v2/usage/total-mau")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```