Create a usage record

Creates a usage report.

SecuritySecretApiKey or JWT
Request
Request Body schema: application/json
subscriptionId
required
string <= 50 characters

ID of the subscription for which a usage is reported.

planId
required
string <= 50 characters

ID of the plan for which a usage is reported.

quantity
required
number <float> >= 0.01

Number of used product units of a plan. Products are the goods and services that your business sells. Plans describe how the customer must pay for products.

usageTime
string <date-time>

Date and time, in ISO 8601 format, when a usage occurred. If this value is not provided or is empty, the date and time of the request is used.

Responses
201

Usage record created.

Response Headers
Location
string <uri>

Location of the related resource.

Example: "https://api.rebilly.com/example"
Response Schema: application/json
subscriptionId
required
string <= 50 characters

ID of the subscription for which a usage is reported.

planId
required
string <= 50 characters

ID of the plan for which a usage is reported.

quantity
required
number <float> >= 0.01

Number of used product units of a plan. Products are the goods and services that your business sells. Plans describe how the customer must pay for products.

id
string <= 50 characters

Unique resource ID. Defaults to UUID v4.

invoiceId
string or null <= 50 characters

ID of the invoice to which usage is applied. This value is populated when the invoice is issued.

invoiceItemId
string or null <= 50 characters

ID of the invoice item to which usage is applied. This value is populated when the invoice is issued.

usageTime
string <date-time>

Date and time, in ISO 8601 format, when a usage occurred. If this value is not provided or is empty, the date and time of the request is used.

createdTime
string <date-time> (CreatedTime)

Date and time which is set automatically when the resource is created.

updatedTime
string <date-time> (UpdatedTime)

Date and time which updates automatically when the resource is updated.

Array of objects (SelfLink)

Related links.

Array
href
string

Link URL.

rel
string

Type of link.

Value: "self"
401

Unauthorized access. Invalid credentials used.

403

Access forbidden.

422

Invalid data sent.

post/usages
Request samples
application/json
{
  • "subscriptionId": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
  • "planId": "plan_0YV7DENSVGDBW9S71XZNNYYQ0X",
  • "quantity": 0.01,
  • "usageTime": "2019-08-24T14:15:22Z"
}
Response samples
application/json
{
  • "id": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
  • "subscriptionId": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
  • "planId": "plan_0YV7DENSVGDBW9S71XZNNYYQ0X",
  • "invoiceId": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
  • "invoiceItemId": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
  • "quantity": 0.01,
  • "usageTime": "2019-08-24T14:15:22Z",
  • "createdTime": "2019-08-24T14:15:22Z",
  • "updatedTime": "2019-08-24T14:15:22Z",
  • "_links": [
    ]
}