# List usage records per sub-account

GET https://services.leadconnectorhq.com/wallet/company/locations/usage-records

Fetch per-sub-account usage rows for the agency resolved from the access token. Supports skip/limit pagination, a name search, and sorting by total or by a specific month.

## Authentication

Send `Authorization: Bearer <token>` using:

- **Agency token: OAuth access token or Private Integration Token.** Scopes: `wallet.readonly`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `skip` | number | No | Number of sub-accounts to skip for pagination. Defaults to 0. |
| `limit` | number | No | Maximum number of sub-accounts to return. Capped at 100 per request. |
| `query` | string | No | Free-text search across sub-account names. |
| `sortBy` | string | No | Field to sort by: `total`, or a specific month as YYYY-MM. Allowlisted -- an arbitrary value is rejected rather than passed to the query. |
| `sortOrder` | string | No | Sort direction. |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/wallet/company/locations/usage-records": {
      "get": {
        "summary": "List usage records per sub-account",
        "operationId": "listUsageRecordsPerSubaccount",
        "description": "Fetch per-sub-account usage rows for the agency resolved from the access token. Supports skip/limit pagination, a name search, and sorting by total or by a specific month.",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          },
          {
            "name": "skip",
            "required": false,
            "in": "query",
            "description": "Number of sub-accounts to skip for pagination. Defaults to 0.",
            "schema": {
              "minimum": 0,
              "example": 0,
              "type": "number"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of sub-accounts to return. Capped at 100 per request.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "example": 25,
              "type": "number"
            }
          },
          {
            "name": "query",
            "required": false,
            "in": "query",
            "description": "Free-text search across sub-account names.",
            "schema": {
              "example": "acme",
              "type": "string"
            }
          },
          {
            "name": "sortBy",
            "required": false,
            "in": "query",
            "description": "Field to sort by: `total`, or a specific month as YYYY-MM. Allowlisted -- an arbitrary value is rejected rather than passed to the query.",
            "schema": {
              "example": "total",
              "type": "string"
            }
          },
          {
            "name": "sortOrder",
            "required": false,
            "in": "query",
            "description": "Sort direction.",
            "schema": {
              "example": "desc",
              "enum": [
                "asc",
                "desc"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Usage records retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LocationUsageRecordsResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Resource not found"
          },
          "429": {
            "description": "Too many requests"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "Agency-Access": [
              "wallet.readonly"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "LocationUsageRecordsResponseDto": {
        "type": "object",
        "properties": {
          "locations": {
            "description": "Per-sub-account usage rows for the agency, ordered by the requested sort.",
            "items": {
              "type": "array"
            },
            "example": [
              {
                "locationId": "AUKAtFVo0lWezBsBQ3FE",
                "locationName": "Acme Dental",
                "total": 128.45,
                "months": {
                  "2024-03": 42.1
                }
              }
            ],
            "type": "array"
          },
          "months": {
            "description": "Months covered by the reported window, oldest first.",
            "items": {
              "type": "array"
            },
            "example": [
              "2024-01",
              "2024-02",
              "2024-03"
            ],
            "type": "array"
          }
        },
        "required": [
          "locations",
          "months"
        ],
        "title": "LocationUsageRecordsResponseDto"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X GET 'https://services.leadconnectorhq.com/wallet/company/locations/usage-records' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3'
```

**Node.js**

```javascript
const options = {
  method: 'GET',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3'
  }
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/wallet/company/locations/usage-records', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/wallet/company/locations/usage-records"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v3"
}

response = requests.get(url, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/wallet/company/locations/usage-records',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
  ],
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .get("https://services.leadconnectorhq.com/wallet/company/locations/usage-records")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/wallet/company/locations/usage-records"
  req, _ := http.NewRequest("GET", url, nil)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v3")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

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

url = URI("https://services.leadconnectorhq.com/wallet/company/locations/usage-records")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"

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

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v3"
}

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/wallet/company/locations/usage-records' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
