List All Usage Records

POST

/v1/usage-records

Returns a paginated list of usage records.


Filter parameters

subscription_item_id

Only return usage records belonging to the subscription item with this ID.


curl "https://api.lemonsqueezy.com/v1/usage-records" \
  -H 'Accept: application/vnd.api+json' \
  -H 'Content-Type: application/vnd.api+json' \
  -H 'Authorization: Bearer {api_key}'
curl "https://api.lemonsqueezy.com/v1/usage-records?filter[subscription_item_id]=1" \
  -H 'Accept: application/vnd.api+json' \
  -H 'Content-Type: application/vnd.api+json' \
  -H 'Authorization: Bearer {api_key}'

Returns

Returns a paginated list of Usage Records objects ordered by created_at in descending order.

{
  "meta": {
    "page": {
      "currentPage": 1,
      "from": 1,
      "lastPage": 1,
      "perPage": 10,
      "to": 10,
      "total": 10
    }
  },
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "first": "https://api.lemonsqueezy.com/v1/usage-records?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=-created_at",
    "last": "https://api.lemonsqueezy.com/v1/usage-records?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=-created_at"
  },
  "data": [
    {
      "type": "usage-records",
      "id": "1",
      "attributes": {
        "subscription_item_id": 1,
        "quantity": 5,
        "action": "increment",
        "created_at": "2023-07-24T14:44:38.000000Z",
        "updated_at": "2023-07-24T14:44:38.000000Z"
      },
      "relationships": {
        "subscription-item": {
          "links": {
            "related": "https://api.lemonsqueezy.com/v1/usage-records/1/subscription-item",
            "self": "https://api.lemonsqueezy.com/v1/usage-records/1/relationships/subscription-item"
          }
        }
      },
      "links": {
        "self": "https://api.lemonsqueezy.com/v1/usage-records/1"
      }
    },
    {...},
    {...},
  ]
}

Was this page helpful?