# Get all wallet charges

GET https://services.leadconnectorhq.com/marketplace/billing/charges

Get all wallet charges

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token only (Private Integration Tokens are not accepted).** Scopes: `charges.readonly`

## Parameters

### Header Parameters

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

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `meterId` | string | No | Billing Meter ID (you can find this on your app's pricing page on the developer portal) |
| `eventId` | string | No | Event ID / Transaction ID |
| `userId` | string | No | Filter results by User ID that your server passed via API when the charge was created |
| `startDate` | string | No | Filter results AFTER a specific date. Use this in combination with endDate to filter results in a specific time window. |
| `endDate` | string | No | Filter results BEFORE a specific date. Use this in combination with startDate to filter results in a specific time window. |
| `skip` | number | No | Number of records to skip |
| `limit` | number | No | Maximum number of records to return |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "LeadConnector API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/marketplace/billing/charges": {
      "get": {
        "summary": "Get all wallet charges",
        "operationId": "getAllWalletCharges",
        "description": "Get all wallet charges",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "required": true,
            "description": "API Version",
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          },
          {
            "name": "meterId",
            "required": false,
            "in": "query",
            "description": "Billing Meter ID (you can find this on your app's pricing page on the developer portal)",
            "schema": {
              "example": "680b97022b4a34420f5f9b93",
              "type": "string"
            }
          },
          {
            "name": "eventId",
            "required": false,
            "in": "query",
            "description": "Event ID / Transaction ID",
            "schema": {
              "example": "evt_abc123",
              "type": "string"
            }
          },
          {
            "name": "userId",
            "required": false,
            "in": "query",
            "description": "Filter results by User ID that your server passed via API when the charge was created",
            "schema": {
              "example": "user_abc123",
              "type": "string"
            }
          },
          {
            "name": "startDate",
            "required": false,
            "in": "query",
            "description": "Filter results AFTER a specific date. Use this in combination with endDate to filter results in a specific time window.",
            "schema": {
              "example": "2025-03-26",
              "type": "string"
            }
          },
          {
            "name": "endDate",
            "required": false,
            "in": "query",
            "description": "Filter results BEFORE a specific date. Use this in combination with startDate to filter results in a specific time window.",
            "schema": {
              "example": "2025-03-26",
              "type": "string"
            }
          },
          {
            "name": "skip",
            "required": false,
            "in": "query",
            "description": "Number of records to skip",
            "schema": {
              "example": 0,
              "type": "number"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of records to return",
            "schema": {
              "example": 10,
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns list of wallet charges",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetAllWalletChargesResponse"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "Location-Access-Only": [
              "charges.readonly"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "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"
      },
      "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"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as 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"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "GetAllWalletChargesResponse": {
        "type": "object",
        "properties": {
          "charges": {
            "type": "array",
            "description": "List of wallet charges",
            "example": [],
            "items": {
              "type": "object",
              "properties": {
                "refunded": {
                  "type": "boolean",
                  "description": "Value is 'true' if the charge has subsequently been refunded.",
                  "example": false
                },
                "currency": {
                  "type": "string",
                  "description": "Currency of the transaction. We currently support USD only.",
                  "example": "USD"
                },
                "appId": {
                  "type": "string",
                  "description": "App ID",
                  "example": "6578278e879ad2646715ba9c"
                },
                "meterId": {
                  "type": "string",
                  "description": "Billing Meter ID (you can find this on your app's pricing page)",
                  "example": "680b97022b4a34420f5f9b93"
                },
                "chargeId": {
                  "type": "string",
                  "description": "Charge ID",
                  "example": "charge_123"
                },
                "entityType": {
                  "type": "string",
                  "description": "Indicates who was charged? Currently, we support charges for 'location' only",
                  "example": "location"
                },
                "entityId": {
                  "type": "string",
                  "description": "If the entityType is Location, entityld would be locationld.",
                  "example": "ve9EPM428h8vShlRW1KT"
                },
                "amountCharged": {
                  "type": "number",
                  "description": "Total amount charged",
                  "example": 0.1
                },
                "pricePerUnit": {
                  "type": "number",
                  "description": "Price per unit for the charge",
                  "example": 0.01
                },
                "transactionType": {
                  "type": "string",
                  "description": "This can be one of two values - 'charge' or 'refund'",
                  "example": "charge"
                },
                "units": {
                  "type": "number",
                  "description": "Number of units that the sub-account was charged for",
                  "example": 10
                },
                "meta": {
                  "type": "object",
                  "description": "meta object contains details that were sent while creating the charge via the API - eventID, description, eventTime, userld",
                  "example": {
                    "eventId": "evt_abc123",
                    "description": "Charge for 10 SMS messages"
                  }
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "description": "Timestamp when the charge was created in our system",
                  "example": "2025-03-26T00:00:00.000Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "description": "Timestamp when the charge was last updated in our system",
                  "example": "2025-03-26T00:00:00.000Z"
                }
              }
            }
          },
          "count": {
            "type": "number",
            "description": "Total number of charges",
            "example": 100,
            "deprecated": true
          },
          "pagination": {
            "type": "object",
            "description": "Pagination metadata for the charges list",
            "example": {
              "total": 100,
              "skip": 0,
              "limit": 10
            },
            "properties": {
              "total": {
                "type": "number",
                "description": "Total number of charges",
                "example": 100
              },
              "skip": {
                "type": "number",
                "description": "Number of records to skip",
                "example": 0
              },
              "limit": {
                "type": "number",
                "description": "Maximum number of records to return",
                "example": 10
              }
            }
          }
        }
      },
      "UnprocessableDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 422
          },
          "message": {
            "example": [
              "Unprocessable Entity"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string",
            "example": "Unprocessable Entity"
          }
        },
        "title": "UnprocessableDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X GET 'https://services.leadconnectorhq.com/marketplace/billing/charges' \
  -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/marketplace/billing/charges', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/marketplace/billing/charges"

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/marketplace/billing/charges',
  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/marketplace/billing/charges")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/marketplace/billing/charges"
  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/marketplace/billing/charges")

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/marketplace/billing/charges' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
