Upsert a usage record

Creates or updates a usage record with a specified ID.

SecurityAPI Key: SecretApiKey or HTTP: JWT
Request
path Parameters
id
required
string <= 50 characters ^[@~\-\.\w]+$

ID of the resource.

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.

put
/usages/{id}
Request samples
application/json
{ "subscriptionId": "sub_01HRF27SATGE4Z6PBJE6PD8328", "planId": "plan_0YV7DENSVGDBW9S71XZNNYYQ0X", "quantity": 0.01, "usageTime": "2019-08-24T14:15:22Z" }
Responses

200

Usage record updated.

Response Schema: application/json
id
string <= 50 characters

ID of the usage record.

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.

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.

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.

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.

201

Usage record created.

401

Unauthorized access. Invalid credentials used.

403

Access forbidden.

404

Resource not found.

422

Invalid data sent.

Response samples
application/json
{ "id": "ord_usg_0YVJ636B95DNA9M3B1638HXBCQ", "subscriptionId": "sub_01HRF27SATGE4Z6PBJE6PD8328", "planId": "plan_0YV7DENSVGDBW9S71XZNNYYQ0X", "invoiceId": "in_0YVF9605RKC62BP14NE2R7V2XT", "invoiceItemId": "ii_0YVFDEQS2KCFTBN9HXWJFY55GV", "quantity": 0.01, "usageTime": "2019-08-24T14:15:22Z", "createdTime": "2019-08-24T14:15:22Z", "updatedTime": "2019-08-24T14:15:22Z", "_links": [ ] }