For clean Markdown of any page, append .md to the page URL. For a complete documentation index, see https://docs.prolifi.io/endpoints/usage-events/llms.txt. For full documentation content, see https://docs.prolifi.io/endpoints/usage-events/llms-full.txt.

# Get customer usage summary

GET https://api.prolifi.co/api/v1/public/customers/{id}/usage

Returns a usage summary for a customer, grouped by event type. Includes event counts and last reported timestamps.


Reference: https://docs.prolifi.io/endpoints/usage-events/get-customer-usage

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Prolifi Public API
  version: 1.0.0
paths:
  /customers/{id}/usage:
    get:
      operationId: get-customer-usage
      summary: Get customer usage summary
      description: >
        Returns a usage summary for a customer, grouped by event type. Includes
        event counts and last reported timestamps.
      tags:
        - subpackage_usageEvents
      parameters:
        - name: id
          in: path
          description: The customer UUID.
          required: true
          schema:
            type: string
            format: uuid
        - name: start_date
          in: query
          description: Filter usage from this date (inclusive).
          required: false
          schema:
            type: string
            format: date
        - name: end_date
          in: query
          description: Filter usage up to this date (inclusive).
          required: false
          schema:
            type: string
            format: date
        - name: event_name
          in: query
          description: Filter by a specific event name.
          required: false
          schema:
            type: string
        - name: Authorization
          in: header
          description: >
            Use a secret key (`sk_test_*` or `sk_live_*`) for full read/write
            access, or a public key (`pk_test_*` or `pk_live_*`) for read-only
            access.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Customer usage summary
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Usage
                  Events_getCustomerUsage_Response_200
        '401':
          description: Authentication failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
servers:
  - url: https://api.prolifi.co/api/v1/public
  - url: https://sandbox.prolifi.co/api/v1/public
components:
  schemas:
    UsageSummary:
      type: object
      properties:
        event_name:
          type: string
          description: The usage event name.
        count:
          type: integer
          description: Total number of events reported.
        last_reported_at:
          type:
            - string
            - 'null'
          format: date-time
          description: Timestamp of the most recent event.
      title: UsageSummary
    Usage Events_getCustomerUsage_Response_200:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/UsageSummary'
      title: Usage Events_getCustomerUsage_Response_200
    ErrorResponseErrorType:
      type: string
      enum:
        - authentication_error
        - permission_error
        - validation_error
        - not_found
        - invalid_request
        - rate_limit_error
        - ip_restricted
        - conflict
        - api_error
      description: Machine-readable error type.
      title: ErrorResponseErrorType
    ErrorResponseErrorErrorsItems:
      type: object
      properties:
        field:
          type: string
          description: The field that failed validation.
        message:
          type: string
          description: The validation error message.
      title: ErrorResponseErrorErrorsItems
    ErrorResponseError:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/ErrorResponseErrorType'
          description: Machine-readable error type.
        message:
          type: string
          description: Human-readable error description.
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ErrorResponseErrorErrorsItems'
          description: >-
            Field-level validation errors (only present for `validation_error`
            type).
      required:
        - type
        - message
      title: ErrorResponseError
    ErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ErrorResponseError'
      title: ErrorResponse
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >
        Use a secret key (`sk_test_*` or `sk_live_*`) for full read/write
        access, or a public key (`pk_test_*` or `pk_live_*`) for read-only
        access.

```

## SDK Code Examples

```python summary
import requests

url = "https://api.prolifi.co/api/v1/public/customers/id/usage"

headers = {"Authorization": "Bearer <token>"}

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

print(response.json())
```

```javascript summary
const url = 'https://api.prolifi.co/api/v1/public/customers/id/usage';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

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

```go summary
package main

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

func main() {

	url := "https://api.prolifi.co/api/v1/public/customers/id/usage"

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

	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

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

url = URI("https://api.prolifi.co/api/v1/public/customers/id/usage")

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

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

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

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

HttpResponse<String> response = Unirest.get("https://api.prolifi.co/api/v1/public/customers/id/usage")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.prolifi.co/api/v1/public/customers/id/usage', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp summary
using RestSharp;

var client = new RestClient("https://api.prolifi.co/api/v1/public/customers/id/usage");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift summary
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolifi.co/api/v1/public/customers/id/usage")! 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()
```