Skip to main content

kobana billing nfes

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

CommandHTTPDescription
nfes bulk createPOST /v1/nfes/bulkBulk update NF-e
nfes bulk deleteDELETE /v1/nfes/bulkBulk delete NF-e
nfes request-tries listGET /v1/nfes/request-triesList request retries (organization)
nfes request-tries getGET /v1/nfes/{id}/request-triesList NF-e request retries
nfes requests getGET /v1/nfes/{id}/requests/{request_id}Get external request
nfes requests listGET /v1/nfes/{id}/requestsList NF-e external requests
nfes listGET /v1/nfesList NF-e
nfes createPOST /v1/nfesCreate draft NF-e
nfes updatePUT /v1/nfesUpsert NFe
nfes fetch-barueriPOST /v1/nfes/fetch-barueriFetch NFS-e from Barueri
nfes fetch-from-sefazPOST /v1/nfes/fetch-from-sefazFetch NFS-e from ADN (SEFAZ)
nfes import-barueriPOST /v1/nfes/import-barueriImport Barueri NFS-e
nfes syncPOST /v1/nfes/syncSync organization NF-e
nfes getGET /v1/nfes/{id}Get NF-e
nfes deleteDELETE /v1/nfes/{id}Delete NF-e
nfes cancelPOST /v1/nfes/{id}/cancelCancel NF-e
nfes issuePOST /v1/nfes/{id}/issueIssue NF-e
nfes pdfGET /v1/nfes/{id}/pdfDownload NF-e PDF
nfes retry-cancelPOST /v1/nfes/{id}/retry-cancelRetry NF-e cancellation
nfes validate-barueriPOST /v1/nfes/{id}/validate-barueriValidate Barueri NFS-e
nfes xmlGET /v1/nfes/{id}/xmlDownload NF-e XML

nfes bulk create​

Bulk update NF-e

kobana billing nfes bulk create [OPTIONS]

POST /v1/nfes/bulk

Updates multiple NF-e at once. Currently supports linking or unlinking an invoice (invoice_id) on up to 100 NF-e per request.

Request body

NameTypeRequiredDescription
nfe_idsarray<string (uuid)>yesUUIDs of the NF-e to update. Minimum 1.
invoice_idstring (uuid)yesUUID of the invoice to link. Send null to unlink.
invoice_withholdingstringnoWhat to do when the NF-e retention differs from the invoice retention: block (default) refuses with 409 NFE_WITHHOLDING_MISMATCH; update_invoice updates the invoice with the NF-e retention. Values: block, update_invoice.

More fields and nested objects: kobana schema billing.nfes.bulk.create.

Responses

HTTPDescription
200Number of NF-e updated.
400Request body failed validation.
404Resource not found in the current organization.
409The NF-e retention differs from the linked invoice retention (NFE_WITHHOLDING_MISMATCH). details carries both sides; retry with invoice_withholding: "update_invoice" to update the invoice.
422Request body failed validation.

nfes bulk delete​

Bulk delete NF-e

kobana billing nfes bulk delete [OPTIONS]

DELETE /v1/nfes/bulk

Deletes up to 100 NF-e at once. All must be in draft status and belong to the current organization. Requires the delete access level. Replaces POST /v1/nfes/bulk-delete, which was removed.

Request body

NameTypeRequiredDescription
idsarray<string (uuid)>yesUUIDs of the NF-e to delete. Minimum 1, maximum 100.

More fields and nested objects: kobana schema billing.nfes.bulk.delete.

Responses

HTTPDescription
200Number of NF-e deleted.
400Request body failed validation.
404Resource not found in the current organization.
422Request body failed validation.

nfes request-tries list​

List request retries (organization)

kobana billing nfes request-tries list [OPTIONS]

GET /v1/nfes/request-tries

Lists every NF-e provider request attempt for the organization, paginated and ordered by descending date.

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.

Responses

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

nfes request-tries get​

List NF-e request retries

kobana billing nfes request-tries get [ID] [OPTIONS]

GET /v1/nfes/{id}/request-tries

Lists the attempts (NfeRequestTry) made to the provider for this NF-e β€” one entry per call, with endpoint, HTTP status, duration and error messages.

Path arguments: id

Responses

HTTPDescription
200List of attempts.
404Resource not found in the current organization.

nfes requests get​

Get external request

kobana billing nfes requests get [ID] [REQUEST_ID] [OPTIONS]

GET /v1/nfes/{id}/requests/{request_id}

Path arguments: id, request_id

Responses

HTTPDescription
200External request detail, including headers and bodies.
404Resource not found in the current organization.

nfes requests list​

List NF-e external requests

kobana billing nfes requests list [ID] [OPTIONS]

GET /v1/nfes/{id}/requests

Lists captured HTTP requests for this NF-e (provider calls and incoming webhooks), paginated. Use direction to filter between outbound and inbound.

Path arguments: id

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.
directionstringnoFilter requests by direction: outbound (outgoing calls) or inbound (incoming webhooks). Values: outbound, inbound.

Responses

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

nfes list​

List NF-e

kobana billing nfes list [OPTIONS]

GET /v1/nfes

Returns a paginated list of the current organization's NF-e (electronic invoices).

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).
billing_account_idstringnoFilter by billing_account_id.
company_idstringnoFilter by issuing company_id.
invoice_idstringnoFilter by linked invoice_id.
payment_idstringnoFilter by linked payment_id.
transaction_idstringnoFilter by linked transaction_id.
statusstringnoFilter by status: draft, pending, processing, issued, pending_cancel, canceling, canceled or error. Values: draft, pending, processing, issued, pending_cancel, canceling, canceled, error.
invoice_filterstringnoFilter by invoice presence: with (with invoice only) or without (one-off only). Values: with, without.
nfe_numberinteger,nullnoFilter by NF-e number.
nfe_seriesstringnoFilter by NF-e series.
nfe_keystringnoFilter by NF-e access key.
external_idstringnoFilter by NF-e external identifier.
lc116_codestringnoFilter by LC 116 code.
service_codestringnoFilter by municipal service code.
amount_minnumber,nullnoMinimum NF-e amount in BRL (filters amount).
amount_maxnumber,nullnoMaximum NF-e amount in BRL (filters amount).
created_afterstringnoStart of creation date range (YYYY-MM-DD).
created_beforestringnoEnd of creation date range (YYYY-MM-DD).
issue_date_fromstringnoFilter by start issue_date (inclusive, YYYY-MM-DD format).
issue_date_tostringnoFilter by end issue_date (inclusive, YYYY-MM-DD format).
cancelled_afterstringnoFilter by start cancelled_at (inclusive, YYYY-MM-DD format).
cancelled_beforestringnoFilter by end cancelled_at (inclusive, YYYY-MM-DD format).

Responses

HTTPDescription
200Paginated list of NF-e.
404Resource not found in the current organization.

nfes create​

Create draft NF-e

kobana billing nfes create [OPTIONS]

POST /v1/nfes

Creates a draft (draft) NF-e for later issuance via POST /nfes/{id}/issue. Accepts taker data (customer) and optional tax rates.

Request body

NameTypeRequiredDescription
billing_account_idstring (uuid)yesBilling account (taker) UUID. Required.
amountnumberyesNF-e amount in BRL (float, up to 4 decimal places). Required, must be positive.
customerobjectyesTaker data at issuance time. Required.
company_idstring (uuid)noIssuing company (provider) UUID. Default: organization's default company.
external_idstringnoIdentifier in your external system, for idempotency/sync.
invoice_idstring (uuid)noLinked invoice UUID (optional).
transaction_idstring (uuid)noOriginating transaction UUID (optional).
service_codestringnoService code per the municipal table.
service_descriptionstringnoFree-form description of the service provided.
lc116_codestringnoLC 116 code.
cnae_codestringnoCNAE code.
nbs_codestringnoNBS code.
c_class_tribstringnoIBS/CBS Tax Classification (cClassTrib).
ind_opstringnoIBS/CBS Operation Indicator (indOp).
rps_numberintegernoRPS number (when numbering is managed by the application).
rps_serial_numberstringnoRPS series.
taxesobjectnoTax rates (as decimals, e.g.: 0.05 for 5%). Falls back to company defaults when omitted.
custom_metadataobjectnoCustom fields (validated against the organization's schema).

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

Responses

HTTPDescription
201Draft NF-e created.
400Request body failed validation.
404Resource not found in the current organization.
422Request body failed validation.

nfes update​

Upsert NFe

kobana billing nfes update [OPTIONS]

PUT /v1/nfes

Takes the same body as POST, plus id and public_id, and dedups on id, public_id, external_id and the resource's natural keys, in that order, stopping at the first key that finds a record. A match is updated and returns 200; otherwise the record is created and returns 201. The POST's required fields are required only when no record is found, and updates are partial: absent fields keep their stored value.

Request body

NameTypeRequiredDescription
billing_account_idstring (uuid)noBilling account (taker) UUID. Required.
company_idstring (uuid)noIssuing company (provider) UUID. Default: organization's default company.
external_idstringnoIdentifier in your external system, for idempotency/sync.
invoice_idstring (uuid)noLinked invoice UUID (optional).
transaction_idstring (uuid)noOriginating transaction UUID (optional).
amountnumbernoNF-e amount in BRL (float, up to 4 decimal places). Required, must be positive.
service_codestringnoService code per the municipal table.
service_descriptionstringnoFree-form description of the service provided.
lc116_codestringnoLC 116 code.
cnae_codestringnoCNAE code.
nbs_codestringnoNBS code.
c_class_tribstringnoIBS/CBS Tax Classification (cClassTrib).
ind_opstringnoIBS/CBS Operation Indicator (indOp).
rps_numberintegernoRPS number (when numbering is managed by the application).
rps_serial_numberstringnoRPS series.
customerobjectnoTaker data at issuance time. Required.
taxesobjectnoTax rates (as decimals, e.g.: 0.05 for 5%). Falls back to company defaults when omitted.
custom_metadataobjectnoCustom fields (validated against the organization's schema).
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.nfes.update.

Responses

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

nfes fetch-barueri​

Fetch NFS-e from Barueri

kobana billing nfes fetch-barueri [OPTIONS]

POST /v1/nfes/fetch-barueri

Fetches an NFS-e from the Barueri municipal endpoint using the codigo_autenticidade printed on the DANFSE and the taker's CPF/CNPJ. Returns the raw XML and, when found, the NF-e already present in the organization.

Request body

NameTypeRequiredDescription
codigo_autenticidadestringyesAuthenticity code printed on the NFS-e DANFSE.
cnpj_tomadorstringyesTaker's CPF or CNPJ (digits only or formatted).
ambientestringnoMunicipal environment: production or homologation. Default: production. Values: production, homologation.

More fields and nested objects: kobana schema billing.nfes.fetch-barueri.

Responses

HTTPDescription
200Fetch result with XML and reference to the existing NF-e, when present.
400Request body failed validation.
404Resource not found in the current organization.
422Request body failed validation.

nfes fetch-from-sefaz​

Fetch NFS-e from ADN (SEFAZ)

kobana billing nfes fetch-from-sefaz [OPTIONS]

POST /v1/nfes/fetch-from-sefaz

Fetches an NFS-e from the Ambiente de Dados Nacional (ADN) using a 50-digit access key and a previously registered digital certificate (mTLS authentication).

Request body

NameTypeRequiredDescription
access_keystringyesNFS-e access key (50 digits).
certificate_idstringyesUUID of the digital certificate registered in the organization (used for mTLS authentication).
ambienteanyOfnoSEFAZ environment: 1 (production) or 2 (homologation). Default: 2.

More fields and nested objects: kobana schema billing.nfes.fetch-from-sefaz.

Responses

HTTPDescription
200ADN fetch result.
400Request body failed validation.
404Resource not found in the current organization.
422Request body failed validation.

nfes import-barueri​

Import Barueri NFS-e

kobana billing nfes import-barueri [OPTIONS]

POST /v1/nfes/import-barueri

Imports a Barueri NFS-e into the database. Accepts a raw XML (returned by POST /nfes/fetch-barueri) or the codigo_autenticidade + cnpj_tomador to re-fetch before importing. Creates the taker BillingAccount when it does not yet exist. Requires the import access level β€” write is not enough.

Request body

NameTypeRequiredDescription
codigo_autenticidadestringyesAuthenticity code printed on the NFS-e DANFSE.
cnpj_tomadorstringyesTaker's CPF or CNPJ (digits only or formatted).
xmlstringnoRaw XML returned by POST /nfes/fetch-barueri. Optional β€” when omitted, the NFS-e is re-fetched with codigo_autenticidade + cnpj_tomador.
ambientestringnoMunicipal environment: production or homologation. Default: production. Values: production, homologation.

More fields and nested objects: kobana schema billing.nfes.import-barueri.

Responses

HTTPDescription
200Import result with created/updated flags and the persisted NF-e.
400Request body failed validation.
404Resource not found in the current organization.
422Request body failed validation.

nfes sync​

Sync organization NF-e

kobana billing nfes sync [OPTIONS]

POST /v1/nfes/sync

Triggers a background job to sync every organization NF-e with the provider (updates status, downloads pending PDFs/XMLs). Returns the job_id for polling. Refuses if a sync is already running.

Responses

HTTPDescription
201Sync queued.
404Resource not found in the current organization.

nfes get​

Get NF-e

kobana billing nfes get [ID] [OPTIONS]

GET /v1/nfes/{id}

Path arguments: id

Responses

HTTPDescription
200NF-e detail.
404Resource not found in the current organization.

nfes delete​

Delete NF-e

kobana billing nfes delete [ID] [OPTIONS]

DELETE /v1/nfes/{id}

Deletes an NF-e. Allowed only for draft, pending, processing, error or canceled statuses. issued NF-e must be canceled via POST /nfes/{id}/cancel.

Path arguments: id

Responses

HTTPDescription
200NF-e deleted.
404Resource not found in the current organization.

nfes cancel​

Cancel NF-e

kobana billing nfes cancel [ID] [OPTIONS]

POST /v1/nfes/{id}/cancel

Cancels an issued NF-e. Enqueues the cancellation asynchronously with the provider. The reason must be at least 15 characters and is recorded in the audit log.

Path arguments: id

Request body

NameTypeRequiredDescription
reasonstringyesCancellation reason. Minimum 15 characters. Recorded in the audit log and sent to the provider.

More fields and nested objects: kobana schema billing.nfes.cancel.

Responses

HTTPDescription
200Cancellation queued.
400Request body failed validation.
404Resource not found in the current organization.
422Request body failed validation.

nfes issue​

Issue NF-e

kobana billing nfes issue [ID] [OPTIONS]

POST /v1/nfes/{id}/issue

Issues a draft (draft) NF-e or retries one in pending/error. Sends the request to the provider configured for the organization.

Path arguments: id

Responses

HTTPDescription
200NF-e queued/issued.
404Resource not found in the current organization.
422Request body failed validation.

nfes pdf​

Download NF-e PDF

kobana billing nfes pdf [ID] [OPTIONS]

GET /v1/nfes/{id}/pdf

Downloads the NF-e PDF (DANFE) as a binary attachment (application/pdf). Served from the database when available; otherwise fetched from the provider.

Path arguments: id

Responses

HTTPDescription
200NF-e PDF.
404Resource not found in the current organization.

nfes retry-cancel​

Retry NF-e cancellation

kobana billing nfes retry-cancel [ID] [OPTIONS]

POST /v1/nfes/{id}/retry-cancel

Retries cancellation of an NF-e stuck in pending_cancel, canceling or error. Re-enqueues the cancellation job.

Path arguments: id

Responses

HTTPDescription
200Cancellation retry queued.
404Resource not found in the current organization.
422Request body failed validation.

nfes validate-barueri​

Validate Barueri NFS-e

kobana billing nfes validate-barueri [ID] [OPTIONS]

POST /v1/nfes/{id}/validate-barueri

Re-fetches the NFS-e from the Barueri municipality and compares it to the local record, returning the diff list and the fresh XML for reapplication via POST /nfes/import-barueri.

Path arguments: id

Responses

HTTPDescription
200Validation result with differences and current XML.
404Resource not found in the current organization.

nfes xml​

Download NF-e XML

kobana billing nfes xml [ID] [OPTIONS]

GET /v1/nfes/{id}/xml

Downloads the NF-e XML as a binary attachment (application/xml). Served from the database when available; otherwise fetched from the provider.

Path arguments: id

Responses

HTTPDescription
200NF-e XML.
404Resource not found in the current organization.