# Metering


<style>
  span[class^="pill-"] {
    color: white;
    padding: 2px 12px;
    border-radius: 12px;
    font-size: 0.6em;
    vertical-align: middle;
    margin-right: 12px;
    font-family: sans-serif;
    font-weight: bold;
    display: inline-block;
    line-height: 1;
  }
  span.pill-GET { background-color: #61affe; }
  span.pill-POST { background-color: #49cc90; }
  span.pill-PUT { background-color: #fca130; }
  span.pill-DELETE { background-color: #f93e3e; }
  span.pill-PATCH { background-color: #50e3c2; }
  span[class^="pill-"]:after {
    content: attr(data-label);
    font-size: 0.9rem;
  }
</style>

The Metering API enables partners to send usage data for consolidated usage-based billing.

[Read more](https://www.exoscale.com/partner-programs/)


---

## Other Operations

## <span data-label="POST" class="pill-POST"></span>metering-transaction

Apply metering transaction

```
POST /metering:apply
```

Submit usage metering for the given organization. The API accepts a set of
`usage` entries. Each entry represents a product, its variable and a metering
value. The value might be negative or decimal (up to five
decimal places). Sample payload:

```json
{
  'usage': [
    {
      'product': 'partner',
      'variable': 'license_product',
      'quantity': 3.1415
    },
    {
      'product': 'partner',
      'variable': 'commission',
      'quantity': -42.00005
    }
  ],
  'organization': 'bf9bbc88-71ea-407c-9920-fc1101d86183'
}
```

### Request body

Content-Type: `application/json`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `organization` | string | no | Target Org<br/><br/>Must be a valid UUID. |
| `usage` | array of [Usage data](/reference/partner-api/_schemas/usage-data/) | no | Usage data |

<details>
<summary>Example</summary>

```json
{
  "organization": "string",
  "usage": [
    {
      "product": "string",
      "quantity": 0,
      "variable": "string"
    }
  ]
}
```
</details>


### Responses

Status: `204` - 204

Content-Type: `application/json`

| Property | Type | Description |
| --- | --- | --- |
| `ok` | boolean |  |

<details>
<summary>Example output</summary>

```json
{
  "ok": true
}
```
</details>


SDK reference for `metering-transaction`: [golang](https://pkg.go.dev/github.com/exoscale/egoscale/v3#Client.MeteringTransaction) | [Python](https://exoscale.github.io/python-exoscale/v2.html#exoscale.api.v2.Client.metering_transaction) | [Java](https://exoscale.github.io/exoscale-sdk-java/com/exoscale/sdk/api/ExoscaleApi.html#meteringTransaction(com.exoscale.sdk.model.MeteringTransactionRequest))

[CLI](https://community.exoscale.com/tools/command-line-interface/): `exo api metering-transaction`


