DealSleek API · Billing
PreviewClose Billing Period
Advance a metering period one step: OPEN → CLOSING opens the late-arrival grace window, CLOSING → CLOSED seals it. Events already in flight still count during grace.
/api/v1/billing/dispatchHeaders
AuthorizationstringRequiredAccess token of the signed-in user, as a Bearer token. It identifies the user, their role and the workspace.
X-CQRS-ActionstringRequiredNames the command to run. Must be
CLOSE_BILLING_PERIODfor this endpoint.Content-TypestringRequiredAlways
application/json.X-Idempotency-KeystringOptionalA key you choose that is unique to this attempt. A command repeated with the same key is not applied a second time.
X-Correlation-IdstringOptionalYour own identifier for the request. Returned in the
x-correlation-idresponse header; generated when you leave it out.
Request body
current_statusenumRequiredA metering period's progress from open to invoiced.
- Allowed values
- OPEN
- CLOSING
- CLOSED
- INVOICED
- NO_CHARGE
- CARRIED_FORWARD
- OPEN
- Accepting usage events.
- CLOSING
- Boundary passed; inside the late-arrival grace window.
- CLOSED
- Sealed. Late events go to the next open period.
- INVOICED
- Rated onto an invoice.
- NO_CHARGE
- Independently reviewed zero-charge period.
- CARRIED_FORWARD
- Positive charges retained for a subsequent invoice.
period_enddate-timeRequiredNo description yet.
period_iduuidRequiredNo description yet.
expected_versioninteger or nullOptionalCORE invariant: mutations carry the version they read. Absent preserves the worker.
Response
Status 202. The command was applied. The body reports the outcome and, where the command changes a record, that record's new state.
successbooleanRequiredtruewhen the command was applied.error_messagestringRequiredEmpty when the command was applied.
projected_stateobjectOptionalThe record as it stands after the command.
event_payloadobjectOptionalThe event the command recorded.
insightsarray of objectOptionalAdvisory notes about the result. Each has a
code, amessageand animpactnumber.
Errors
Every error carries an HTTP status. Where it also carries a code, branch on the code, not on the message.
- 400
X-CQRS-Actionis missing or names a command this route does not accept. SendCLOSE_BILLING_PERIOD. - 400
DOMAIN_ROUTINGThe body is not a valid command. Check the required fields and their types. - 401The access token is missing, expired or not valid.
- 401
L1_AUTHThe caller's role is belowfinanceor the caller has no access to this record. - 403
L1_POLICYA business rule refused the command. The message names the rule. - 409
L1_VERSIONexpected_versionis not the record's current version. Read the record again, then retry. - 409
L1_IDEMPOTENCYA command with this idempotency key was already applied. - 409
CONFLICTThe command would duplicate a record that must be unique. - 500
L3_COMMITThe command was valid but could not be saved.