---
title: "Add usage record"
method: POST
path: "/v2/usage"
tags: ["Usage"]
---

# Add usage record

`POST /v2/usage`

## Request

- Base URL: `https://api.app.subskribe.com`
- URL: `https://api.app.subskribe.com/v2/usage`
- Auth: API key in header `X-API-Key`

Load usage records into the system

## Request body

- RawUsagesData: A list of RawUsage objects
  - `data` RawUsage[], required
    - `id` string: Unique identifier for a particular usage record
    - `aliasId` string: Alias ID for an usage based subscription item. This value is required if subscriptionId and subscriptionChargeId are not provided
    - `subscriptionId` string: SubscriptionId to attach usage record to. This value is required if aliasId is not provided
    - `chargeId` string: ChargeId of an usage based charge to attach usage record to. This value is required if aliasId is not provided
    - `usageTime` integer: Usage time in unix timestamp (seconds)
    - `usageQuantity` integer
    - `attributeReferences` AttributeReference[]: List of attribute references to derive the price for the usage record
      - `attributeDefinitionId` string
      - `attributeValue` string

## Response `200`

successful operation

- UsageBatchInsertResult
  - `rawUsagesTotal` integer
  - `totalFailed` integer
  - `totalDuplicates` integer
  - `entries` Entry[]
    - `rowNumber` integer
    - `failed` boolean
    - `failureReason` string

---

[API](https://skmtc.dev/dealhub/apis/subskribe-api.md) - [All operations](https://skmtc.dev/dealhub/apis/subskribe-api/llms.txt) - [OpenAPI document](https://skmtc.dev/dealhub/apis/subskribe-api/revisions/c1ee531b82ce?raw)
