Skip to main content

kobana billing withholdings

Commands of kobana billing withholdings. Every global option (Global options) applies here.

CommandHTTPDescription
withholdings listGET /v1/withholdingsList withholdings
withholdings createPOST /v1/withholdingsCreate a withholding
withholdings updatePUT /v1/withholdingsCreate or update a withholding
withholdings convert-to-creditsPOST /v1/withholdings/convert-to-creditsConvert pending withholdings to credits (bulk)
withholdings getGET /v1/withholdings/{id}Get withholding
withholdings deleteDELETE /v1/withholdings/{id}Delete a withholding
withholdings convert-to-creditPOST /v1/withholdings/{id}/convert-to-creditConvert withholding to credit

withholdings list​

List withholdings

kobana billing withholdings list [OPTIONS]

GET /v1/withholdings

Returns a paginated list of the current organization's tax withholdings. Supports filters by tax type, status, withholder, invoice, NF-e and competence period.

Query parameters

NameTypeRequiredDescription
pageintegernoPage (starts at 1). Default: 1.
per_pageintegernoItems per page. Default: 20. Maximum: 100.
sort_bystringnoSort field. Default depends on the resource.
sort_orderstringnoSort direction. Default: desc. Values: asc, desc.
person_idstringnoFilter by associated person UUID.
person_document_numberstringnoFilter by person CPF/CNPJ (exact match).
person_name_containsstringnoFilter by person name (partial search, case-insensitive).
tax_typestringnoFilter by tax type: iss, pis, cofins, csll, irpj, irrf, csrf, inss, cbs or ibs. Values: iss, pis, cofins, csll, irpj, irrf, csrf, inss, cbs, ibs.
statusstringnoFilter by status: retained, compensated or partially_compensated. Values: retained, compensated, partially_compensated.
withholder_idstringnoFilter by withholdings of a specific withholder (billing account).
invoice_idstringnoFilter by withholdings associated with an invoice.
nfe_idstringnoFilter by withholdings associated with an NF-e.
competence_yearintegernoFilter by competence year (2000–3000).
competence_monthintegernoFilter by competence month (1–12).
amount_minnumber,nullnoMinimum withheld amount in BRL (e.g.: 10.5 for R$ 10.50).
amount_maxnumber,nullnoMaximum withheld amount in BRL (e.g.: 500.0 for R$ 500.00).
base_minnumber,nullnoMinimum calculation base in BRL.
base_maxnumber,nullnoMaximum calculation base in BRL.
compensated_minnumber,nullnoMinimum compensated amount in BRL.
compensated_maxnumber,nullnoMaximum compensated amount in BRL.
created_afterstringnoStart of creation date range (YYYY-MM-DD).
created_beforestringnoEnd of creation date range (YYYY-MM-DD).

Responses

HTTPDescription
200Paginated list of withholdings.
404Resource not found in the current organization.

withholdings create​

Create a withholding

kobana billing withholdings create [OPTIONS]

POST /v1/withholdings

Records a withholding at source for the given withholder. base and amount are values in BRL (float, up to 4 decimal places).

Request body

NameTypeRequiredDescription
tax_typestringyesWithheld tax. Values: iss, pis, cofins, csll, irpj, irrf, csrf, inss, cbs, ibs.
basenumberyesCalculation base, in BRL (float, up to 4 decimal places).
ratenumberyesApplied rate, as a percentage.
amountnumberyesWithheld amount, in BRL (float, up to 4 decimal places).
withholder_idstring (uuid)yesBilling account that performed the withholding.
competence_monthintegeryesCompetence month (1–12).
competence_yearintegeryesCompetence year.
invoice_idstring (uuid)noOriginating invoice, when there is one.
nfe_idstring (uuid)noRelated invoice document (NF-e), when there is one.
metadataobjectno
external_idstringnoIdentifier in your external system, for idempotency/sync.
custom_metadataobjectno

More fields and nested objects: kobana schema billing.withholdings.create.

Responses

HTTPDescription
201Withholding created.
400Request body failed validation.
404Resource not found in the current organization.
422Request body failed validation.

withholdings update​

Create or update a withholding

kobana billing withholdings update [OPTIONS]

PUT /v1/withholdings

Looks the withholding up by id, public_id or external_id. If it is not found, creates it from the full body and returns 201. If it is found, only competence_month, competence_year, metadata, external_id and custom_metadata are applied: base, rate, amount and withholder_id are immutable once recorded and are ignored in the update body.

Request body

NameTypeRequiredDescription
tax_typestringnoWithheld tax. Values: iss, pis, cofins, csll, irpj, irrf, csrf, inss, cbs, ibs.
basenumbernoCalculation base, in BRL (float, up to 4 decimal places).
ratenumbernoApplied rate, as a percentage.
amountnumbernoWithheld amount, in BRL (float, up to 4 decimal places).
withholder_idstring (uuid)noBilling account that performed the withholding.
competence_monthintegernoCompetence month (1–12).
competence_yearintegernoCompetence year.
invoice_idstring (uuid)noOriginating invoice, when there is one.
nfe_idstring (uuid)noRelated invoice document (NF-e), when there is one.
metadataobjectno
external_idstringnoIdentifier in your external system, for idempotency/sync.
custom_metadataobjectno
idstring (uuid)noRecord UUID. Used only to locate it — never written.
public_idstring (uuid)noPublic UUID of the record, used to locate it.

More fields and nested objects: kobana schema billing.withholdings.update.

Responses

HTTPDescription
200Record updated.
201Record created.
400Request body failed validation.
404Resource not found in the current organization.
422Request body failed validation.

withholdings convert-to-credits​

Convert pending withholdings to credits (bulk)

kobana billing withholdings convert-to-credits [OPTIONS]

POST /v1/withholdings/convert-to-credits

Converts all of the organization's pending withholdings — optionally narrowed by tax_type and/or competence period — into credits. Returns the list of generated credits, the total count converted and the total amount in BRL.

Request body

NameTypeRequiredDescription
tax_typestringnoRestricts conversion to a specific tax type (e.g.: irrf, pis, cofins). Values: iss, pis, cofins, csll, irpj, irrf, csrf, inss, cbs, ibs.
competence_yearintegernoRestricts conversion to the given competence year.
competence_monthintegernoRestricts conversion to the given competence month (1–12).

More fields and nested objects: kobana schema billing.withholdings.convert-to-credits.

Responses

HTTPDescription
200Batch of withholdings converted to credits.
400Request body failed validation.
404Resource not found in the current organization.
422Request body failed validation.

withholdings get​

Get withholding

kobana billing withholdings get [ID] [OPTIONS]

GET /v1/withholdings/{id}

Path arguments: id

Responses

HTTPDescription
200Withholding detail.
404Resource not found in the current organization.

withholdings delete​

Delete a withholding

kobana billing withholdings delete [ID] [OPTIONS]

DELETE /v1/withholdings/{id}

Refuses the deletion when the withholding has already been compensated, in full or in part.

Path arguments: id

Responses

HTTPDescription
200Withholding deleted.
404Resource not found in the current organization.
422Request body failed validation.

withholdings convert-to-credit​

Convert withholding to credit

kobana billing withholdings convert-to-credit [ID] [OPTIONS]

POST /v1/withholdings/{id}/convert-to-credit

Converts a withholding (fully or partially) into a credit on the billing account derived from the associated invoice — or, when absent, from the withholder itself. When amount is omitted, converts the withholding's pending balance.

Path arguments: id

Request body

NameTypeRequiredDescription
amountnumbernoAmount to convert in BRL (float, up to 4 decimal places). Default: pending balance of the withholding.

More fields and nested objects: kobana schema billing.withholdings.convert-to-credit.

Responses

HTTPDescription
201Credit generated from the withholding.
400Request body failed validation.
404Resource not found in the current organization.
422Request body failed validation.