openapi: 3.1.0
info:
title: Rillet Accounting API Key Contract Items API
version: v4.0
servers:
- url: https://api.rillet.com
description: Production server url
- url: https://sandbox.api.rillet.com
description: Test server url
security:
- bearerAuth: []
tags:
- name: Contract Items
paths:
/contract-items/{contract_item_id}/usage:
patch:
tags:
- Contract Items
operationId: upsert-a-usage-record
summary: Upserts a usage record
parameters:
- name: contract_item_id
in: path
required: true
description: UUID of the contract line item that carries the usage-priced product.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UsageRecords'
required: true
description: Creates usage records on dates where previously no usage was recorded. Overwrites usage records on dates where usage was previously recorded already.
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/UsageRecords'
default:
description: Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
get:
tags:
- Contract Items
operationId: list-all-contract-item-usage-records
summary: Lists all contract item usage records
description: 'Returns historical usage quantities for a contract item, newest first, with optional pagination cursors.
Use before upsert-a-usage-record or delete-a-usage-record to understand existing coverage for each date.
'
parameters:
- name: contract_item_id
in: path
required: true
description: UUID of the contract line item whose usage rows are being listed.
schema:
type: string
- $ref: '#/components/parameters/limit'
- $ref: '#/components/parameters/cursor'
responses:
'200':
description: OK
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/UsageRecords'
- type: object
properties:
pagination:
$ref: '#/components/schemas/Pagination'
default:
description: Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
delete:
tags:
- Contract Items
operationId: delete-a-usage-record
summary: Deletes a usage record
description: 'Removes the usage entry for a single contract item on a specific calendar date.
This is narrower than upsert-a-usage-record and is ideal when you need to wipe a mistaken day without resending the entire usage payload.
'
parameters:
- name: contract_item_id
in: path
required: true
description: UUID of the contract line item whose usage row should be removed.
schema:
type: string
- name: date
in: query
description: Calendar date of the usage row to delete (ISO-8601 format).
schema:
type: string
format: date
required: true
responses:
'204':
description: No Content
default:
description: Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
Usage:
type: object
required:
- date
- quantity
properties:
date:
type: string
format: date
quantity:
type: number
format: float
minimum: 0
exclusiveMinimum: true
example: 1
Error:
type: object
required:
- type
- title
properties:
type:
type: string
format: uri
description: A URI reference that identifies the error type.
example: https://rillet.io/forbidden
title:
type: string
description: Summary of the problem.
example: Forbidden
status:
type: integer
description: The HTTP status code generated by the origin server for this occurrence of the error.
example: 403
detail:
type: string
description: Explanation specific to this occurrence of the error.
example: User does not have rights to perform this operation.
UsageRecords:
type: object
required:
- usage
properties:
usage:
type: array
minItems: 1
items:
$ref: '#/components/schemas/Usage'
description: Allows you to update multiple dates at once.
PageCursor:
type: string
description: If defined, a cursor to retrieve the next page.
example: iLQvkEj3sh3UiweC
PageLimit:
type: integer
minimum: 1
maximum: 100
default: 25
Pagination:
type: object
properties:
next_cursor:
$ref: '#/components/schemas/PageCursor'
parameters:
cursor:
name: cursor
in: query
required: false
description: Pagination cursor to navigate through the full response.
schema:
$ref: '#/components/schemas/PageCursor'
limit:
name: limit
in: query
required: false
description: Maximum number of rows to return in the page.
schema:
$ref: '#/components/schemas/PageLimit'
securitySchemes:
bearerAuth:
type: http
scheme: bearer
x-mcp-ready: true
x-readme:
headers:
- key: X-Rillet-API-Version
value: '4'