Ir al contenido

API de cobros

List an invoice's collections

GET
/v1/ec/documents/{id}/collections

What was collected for one invoice, from newest to oldest, the voided ones among them with when and why.

Authorization

apiKey
headerAuthorizationBearer <token>

Your API key, which acts for the one business it was created for: fb_live_… keys work at api.fiscalbase.io and issue in live, and fb_sandbox_… keys work at api-sandbox.fiscalbase.io and issue in sandbox, on the simulated SRI. A key sent to the other host is refused with api_key_wrong_host, which names its host.

Path Parameters

id*string
Formatuuid

Query Parameters

limit?integer

How many per page, from 1 to 100.

Range1 <= value <= 100
Default20
cursor?string

The next_cursor or prev_cursor of a previous response. Without a cursor, the first page.

Lengthlength <= 200
created_at[gte]?string

Only what was created at or after this moment, ISO 8601 with its offset.

Formatdate-time
created_at[lte]?string

Only what was created at or before this moment, ISO 8601 with its offset.

Formatdate-time
updated_at[gte]?string

Only what last changed at or after this moment, ISO 8601 with its offset: poll with the time of your last read to get what changed since.

Formatdate-time
updated_at[lte]?string

Only what last changed at or before this moment, ISO 8601 with its offset.

Formatdate-time

Response Body

A page of collections

application/json
  1. response
object*"list"
Value in"list"
data*array<>
next_cursor*|

The next page (older); null if there are no more.

prev_cursor*|

The previous page (newer); null on the first.

Example Request
curl -X GET 'https://api-sandbox.fiscalbase.io/v1/ec/documents/497f6eca-6276-4993-bfeb-53cbbbba6f08/collections'
Example Response
{
  "object": "list",
  "data": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "object": "collection",
      "business_id": "f59fcbb7-848d-4242-af07-a8bb7e3ab37c",
      "environment": "sandbox",
      "document_id": "b792e8ae-2cb4-4209-85b9-32be4c2fcdd6",
      "status": "recorded",
      "amount": "string",
      "currency": "string",
      "collected_on": "2019-08-24",
      "method": "cash",
      "reference": "string",
      "note": "string",
      "recorded_by": {
        "type": "person",
        "id": "string",
        "name": "string"
      },
      "created_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z",
      "voided_at": "2019-08-24T14:15:22Z",
      "voided_by": {
        "type": "person",
        "id": "string",
        "name": "string"
      },
      "void_reason": "string"
    }
  ],
  "next_cursor": "string",
  "prev_cursor": "string"
}

Record a collection

POST
/v1/ec/documents/{id}/collections

Records money you received for an invoice that is owed (receivable not null): it lowers the invoice's balance, and collection.recorded is sent to your webhooks, then invoice.collected when nothing is left. Fiscalbase moves no money and nothing is sent to the SRI: this is your own record. A collection never exceeds what is owed. A mistake is voided, never edited. Requires an Idempotency-Key: a retry without one would record the money twice.

Authorization

apiKey
headerAuthorizationBearer <token>

Your API key, which acts for the one business it was created for: fb_live_… keys work at api.fiscalbase.io and issue in live, and fb_sandbox_… keys work at api-sandbox.fiscalbase.io and issue in sandbox, on the simulated SRI. A key sent to the other host is refused with api_key_wrong_host, which names its host.

Path Parameters

id*string
Formatuuid

Header Parameters

idempotency-key*string

Required. Without it a retry could record the money twice. A retry with the same key and body answers the first answer instead; the same key with another body is 409 idempotency_key_reused.

Length1 <= length <= 255

Request Body

application/json
  1. body
amount*string

What was received, above zero and at most the invoice's receivable.balance.

Match^\d+(\.\d{1,2})?$
collected_on?string

The day the money came in, from the invoice's issue date to today in Ecuador. Today by default.

Formatdate
method*string

How it was paid: cash, transfer, deposit, cheque, card or other.

Value in"cash""transfer""deposit""cheque""card""other"
reference?string

The transfer's, deposit's or cheque's number.

Length1 <= length <= 100
note?string
Length1 <= length <= 300

Response Body

Recorded

application/json
  1. response
id*string
Formatuuid
object*"collection"
Value in"collection"
business_id*string
Formatuuid
environment*string
Value in"sandbox""test""live"
document_id*string

The invoice it pays.

Formatuuid
status*string

recorded counts against the invoice's balance; voided no longer does.

Value in"recorded""voided"
amount*string

What was received.

currency*string

The currency of the amounts, as its ISO 4217 code. New currencies may appear.

Match^[A-Z]{3}$
collected_on*string

The day the money came in.

Formatdate
method*string

How it was paid: cash, transfer, deposit, cheque, card or other. Yours to state, and never sent to the SRI: the invoice's payments already told it how the sale would be paid.

Value in"cash""transfer""deposit""cheque""card""other"
reference*|

The transfer's, deposit's or cheque's number.

note*string|null
recorded_by*
created_at*string
Formatdate-time
updated_at*string
Formatdate-time
voided_at*|
Formatdate-time
voided_by*
void_reason*string|null
receivable*

What the invoice is owed after this.

Example Request
curl -X POST 'https://api-sandbox.fiscalbase.io/v1/ec/documents/497f6eca-6276-4993-bfeb-53cbbbba6f08/collections' \
  -H 'idempotency-key: string' \
  -H 'Content-Type: application/json' \
  -d '{
  "amount": "1.00",
  "method": "cash"
}'
Example Response
{
  "id": "01a21860-672c-7058-be9a-185b682129ea",
  "object": "collection",
  "business_id": "01a21860-66d5-7966-b23f-f23170b3c8df",
  "environment": "sandbox",
  "document_id": "01a21860-671b-7591-939e-a45a1bc9a0fb",
  "status": "recorded",
  "amount": "1.00",
  "currency": "USD",
  "collected_on": "2026-11-26",
  "method": "cash",
  "reference": null,
  "note": null,
  "recorded_by": {
    "type": "api_key",
    "id": "01a21860-66e3-7701-929d-14614b70ea56",
    "name": "fb_sandbox_WQCC"
  },
  "created_at": "2026-11-26T15:01:40.777Z",
  "updated_at": "2026-11-26T15:01:40.777Z",
  "voided_at": null,
  "voided_by": null,
  "void_reason": null,
  "receivable": {
    "object": "receivable",
    "state": "open",
    "currency": "USD",
    "amount": "285.00",
    "collected": "1.00",
    "withheld": "0.00",
    "credited": "0.00",
    "balance": "284.00",
    "next_due_date": "2026-12-26",
    "overdue_days": 0,
    "collect_later": false,
    "installments": [
      {
        "amount": "285.00",
        "due_date": "2026-12-26",
        "balance": "284.00"
      }
    ],
    "closed_on": null
  }
}

List the collections

GET
/v1/ec/collections

What was collected across the business's invoices in your key's environment, newest first, the voided ones among them: for a system that books its income from Fiscalbase. collected_on[gte] and collected_on[lte] bound the days the money came in, status keeps the recorded or the voided ones; each one's invoice is document_id. A person reads those of the invoices they read.

Authorization

apiKey
headerAuthorizationBearer <token>

Your API key, which acts for the one business it was created for: fb_live_… keys work at api.fiscalbase.io and issue in live, and fb_sandbox_… keys work at api-sandbox.fiscalbase.io and issue in sandbox, on the simulated SRI. A key sent to the other host is refused with api_key_wrong_host, which names its host.

Query Parameters

limit?integer

How many per page, from 1 to 100.

Range1 <= value <= 100
Default20
cursor?string

The next_cursor or prev_cursor of a previous response. Without a cursor, the first page.

Lengthlength <= 200
created_at[gte]?string

Only what was created at or after this moment, ISO 8601 with its offset.

Formatdate-time
created_at[lte]?string

Only what was created at or before this moment, ISO 8601 with its offset.

Formatdate-time
updated_at[gte]?string

Only what last changed at or after this moment, ISO 8601 with its offset: poll with the time of your last read to get what changed since.

Formatdate-time
updated_at[lte]?string

Only what last changed at or before this moment, ISO 8601 with its offset.

Formatdate-time
collected_on[gte]?string

The first day the money came in.

Formatdate
collected_on[lte]?string

The last day the money came in.

Formatdate
status?string

Only the recorded ones, or only the voided ones.

Value in"recorded""voided"

Response Body

A page of collections

application/json
  1. response
object*"list"
Value in"list"
data*array<>
next_cursor*|

The next page (older); null if there are no more.

prev_cursor*|

The previous page (newer); null on the first.

Example Request
curl -X GET 'https://api-sandbox.fiscalbase.io/v1/ec/collections'
Example Response
{
  "object": "list",
  "data": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "object": "collection",
      "business_id": "f59fcbb7-848d-4242-af07-a8bb7e3ab37c",
      "environment": "sandbox",
      "document_id": "b792e8ae-2cb4-4209-85b9-32be4c2fcdd6",
      "status": "recorded",
      "amount": "string",
      "currency": "string",
      "collected_on": "2019-08-24",
      "method": "cash",
      "reference": "string",
      "note": "string",
      "recorded_by": {
        "type": "person",
        "id": "string",
        "name": "string"
      },
      "created_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z",
      "voided_at": "2019-08-24T14:15:22Z",
      "voided_by": {
        "type": "person",
        "id": "string",
        "name": "string"
      },
      "void_reason": "string"
    }
  ],
  "next_cursor": "string",
  "prev_cursor": "string"
}

List the withholdings applied to an invoice

GET
/v1/ec/documents/{id}/applied-withholdings

The withholdings the buyer issued over one invoice that were applied to what it is owed, the removed ones among them, newest first, a list paged like every other. A withholding is a received document: it arrives through POST /v1/ec/imports, and is applied by itself when it names the invoice's number, comes from its buyer and carries its date.

Authorization

apiKey
headerAuthorizationBearer <token>

Your API key, which acts for the one business it was created for: fb_live_… keys work at api.fiscalbase.io and issue in live, and fb_sandbox_… keys work at api-sandbox.fiscalbase.io and issue in sandbox, on the simulated SRI. A key sent to the other host is refused with api_key_wrong_host, which names its host.

Path Parameters

id*string
Formatuuid

Query Parameters

limit?integer

How many per page, from 1 to 100.

Range1 <= value <= 100
Default20
cursor?string

The next_cursor or prev_cursor of a previous response. Without a cursor, the first page.

Lengthlength <= 200
created_at[gte]?string

Only what was created at or after this moment, ISO 8601 with its offset.

Formatdate-time
created_at[lte]?string

Only what was created at or before this moment, ISO 8601 with its offset.

Formatdate-time
updated_at[gte]?string

Only what last changed at or after this moment, ISO 8601 with its offset: poll with the time of your last read to get what changed since.

Formatdate-time
updated_at[lte]?string

Only what last changed at or before this moment, ISO 8601 with its offset.

Formatdate-time

Response Body

A page of the withholdings

application/json
  1. response
object*"list"
Value in"list"
data*array<>
next_cursor*|

The next page (older); null if there are no more.

prev_cursor*|

The previous page (newer); null on the first.

Example Request
curl -X GET 'https://api-sandbox.fiscalbase.io/v1/ec/documents/497f6eca-6276-4993-bfeb-53cbbbba6f08/applied-withholdings'
Example Response
{
  "object": "list",
  "data": [
    {
      "object": "applied_withholding",
      "document_id": "b792e8ae-2cb4-4209-85b9-32be4c2fcdd6",
      "received_document_id": "253690c7-3be0-404b-af50-84adc42eab06",
      "number": "string",
      "issue_date": "2019-08-24",
      "issuer": {
        "ruc": "string",
        "name": "string"
      },
      "status": "applied",
      "renta": "string",
      "iva": "string",
      "total": "string",
      "currency": "string",
      "applied_by": {
        "type": "person",
        "id": "string",
        "name": "string"
      },
      "applied_at": "2019-08-24T14:15:22Z",
      "removed_at": "2019-08-24T14:15:22Z",
      "created_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z"
    }
  ],
  "next_cursor": "string",
  "prev_cursor": "string"
}

Apply a received withholding to an invoice

POST
/v1/ec/documents/{id}/applied-withholdings

Applies a withholding you received to an invoice because it is that invoice's, whatever number it names: for one the match on arrival left out, such as a number the buyer mistyped, or one removed before. It lowers the balance by the renta and the IVA it withheld, and invoice.withholding_applied is sent to your webhooks.

Authorization

apiKey
headerAuthorizationBearer <token>

Your API key, which acts for the one business it was created for: fb_live_… keys work at api.fiscalbase.io and issue in live, and fb_sandbox_… keys work at api-sandbox.fiscalbase.io and issue in sandbox, on the simulated SRI. A key sent to the other host is refused with api_key_wrong_host, which names its host.

Path Parameters

id*string
Formatuuid

Header Parameters

idempotency-key?string

Send the same key to retry safely: a repeat of the same request answers what the first answered, without doing it again. Keys are scoped to the business the call acts for and its environment; the same key with another request is 409 idempotency_key_reused.

Length1 <= length <= 255

Request Body

application/json
  1. body
received_document_id*string

The withholding, a received document of the same business (GET /v1/ec/received-documents?type=withholding).

Formatuuid

Response Body

Applied

application/json
  1. response
object*"applied_withholding"
Value in"applied_withholding"
document_id*string

The invoice it lowers.

Formatuuid
received_document_id*string

The withholding, a received document (GET /v1/ec/received-documents/{id}).

Formatuuid
number*string
issue_date*string
Formatdate
issuer*
status*string

applied lowers the invoice's balance; removed no longer does: a person said it does not belong, or its issuer annulled it.

Value in"applied""removed"
renta*string

The renta it withheld over this invoice.

iva*string

The IVA it withheld over this invoice.

total*string

Both together: what it lowers the balance by.

currency*string

The currency of the amounts, as its ISO 4217 code. New currencies may appear.

Match^[A-Z]{3}$
applied_by*

system when it was matched as it arrived (the invoice's number, its buyer and its date), person or api_key when someone applied it; who, by id and name, is not kept.

applied_at*string
Formatdate-time
removed_at*|
Formatdate-time
created_at*string
Formatdate-time
updated_at*string
Formatdate-time
Example Request
curl -X POST 'https://api-sandbox.fiscalbase.io/v1/ec/documents/497f6eca-6276-4993-bfeb-53cbbbba6f08/applied-withholdings' \
  -H 'Content-Type: application/json' \
  -d '{
  "received_document_id": "01a21860-875f-75cb-9786-879a78dde554"
}'
Example Response
{
  "object": "applied_withholding",
  "document_id": "01a21860-8720-7eea-a90e-20e8ee9a63d0",
  "received_document_id": "01a21860-875f-75cb-9786-879a78dde554",
  "number": "001-001-000000001",
  "issue_date": "2026-11-26",
  "issuer": {
    "ruc": "1790012345001",
    "name": "COMERCIAL RIVERA S.A."
  },
  "status": "applied",
  "renta": "15.42",
  "iva": "34.70",
  "total": "50.12",
  "currency": "USD",
  "applied_by": {
    "type": "api_key",
    "id": null,
    "name": null
  },
  "applied_at": "2026-11-26T15:01:49.032Z",
  "removed_at": null,
  "created_at": "2026-11-26T15:01:49.032Z",
  "updated_at": "2026-11-26T15:01:49.032Z"
}

Remove a withholding from an invoice

DELETE
/v1/ec/documents/{id}/applied-withholdings/{received_document_id}

Says a withholding does not belong to this invoice: the balance goes back up by what it withheld, it stays listed as removed, and it is not applied by itself again. invoice.withholding_removed is sent to your webhooks.

Authorization

apiKey
headerAuthorizationBearer <token>

Your API key, which acts for the one business it was created for: fb_live_… keys work at api.fiscalbase.io and issue in live, and fb_sandbox_… keys work at api-sandbox.fiscalbase.io and issue in sandbox, on the simulated SRI. A key sent to the other host is refused with api_key_wrong_host, which names its host.

Path Parameters

id*string
Formatuuid
received_document_id*string
Formatuuid

Response Body

Removed

Example Request
curl -X DELETE 'https://api-sandbox.fiscalbase.io/v1/ec/documents/497f6eca-6276-4993-bfeb-53cbbbba6f08/applied-withholdings/497f6eca-6276-4993-bfeb-53cbbbba6f08'
Example Response
Empty

Void a collection

POST
/v1/ec/documents/{id}/collections/{collection_id}/void

Takes back a collection recorded by mistake, with why: it stops counting against the invoice's balance, stays in the list as voided, and collection.voided is sent to your webhooks. To correct an amount, void it and record another.

Authorization

apiKey
headerAuthorizationBearer <token>

Your API key, which acts for the one business it was created for: fb_live_… keys work at api.fiscalbase.io and issue in live, and fb_sandbox_… keys work at api-sandbox.fiscalbase.io and issue in sandbox, on the simulated SRI. A key sent to the other host is refused with api_key_wrong_host, which names its host.

Path Parameters

id*string
Formatuuid
collection_id*string
Formatuuid

Header Parameters

idempotency-key?string

Send the same key to retry safely: a repeat of the same request answers what the first answered, without doing it again. Keys are scoped to the business the call acts for and its environment; the same key with another request is 409 idempotency_key_reused.

Length1 <= length <= 255

Request Body

application/json
  1. body
reason*string

Why it is voided: it stays with the collection.

Length1 <= length <= 300

Response Body

Voided

application/json
  1. response
id*string
Formatuuid
object*"collection"
Value in"collection"
business_id*string
Formatuuid
environment*string
Value in"sandbox""test""live"
document_id*string

The invoice it pays.

Formatuuid
status*string

recorded counts against the invoice's balance; voided no longer does.

Value in"recorded""voided"
amount*string

What was received.

currency*string

The currency of the amounts, as its ISO 4217 code. New currencies may appear.

Match^[A-Z]{3}$
collected_on*string

The day the money came in.

Formatdate
method*string

How it was paid: cash, transfer, deposit, cheque, card or other. Yours to state, and never sent to the SRI: the invoice's payments already told it how the sale would be paid.

Value in"cash""transfer""deposit""cheque""card""other"
reference*|

The transfer's, deposit's or cheque's number.

note*string|null
recorded_by*
created_at*string
Formatdate-time
updated_at*string
Formatdate-time
voided_at*|
Formatdate-time
voided_by*
void_reason*string|null
receivable*

What the invoice is owed after this.

Example Request
curl -X POST 'https://api-sandbox.fiscalbase.io/v1/ec/documents/497f6eca-6276-4993-bfeb-53cbbbba6f08/collections/497f6eca-6276-4993-bfeb-53cbbbba6f08/void' \
  -H 'Content-Type: application/json' \
  -d '{
  "reason": "El cheque rebotó"
}'
Example Response
{
  "id": "01a21860-6f3d-7410-982d-ba01249de5c4",
  "object": "collection",
  "business_id": "01a21860-6f15-7030-91a1-ce0d2f5531d1",
  "environment": "sandbox",
  "document_id": "01a21860-6f22-7d64-9998-eff526c9e87e",
  "status": "voided",
  "amount": "142.50",
  "currency": "USD",
  "collected_on": "2026-11-26",
  "method": "transfer",
  "reference": null,
  "note": null,
  "recorded_by": {
    "type": "api_key",
    "id": "01a21860-6f19-7d2b-b10e-40b5898d3d73",
    "name": "fb_sandbox_dZik"
  },
  "created_at": "2026-11-26T15:01:42.842Z",
  "updated_at": "2026-11-26T15:01:47.015Z",
  "voided_at": "2026-11-26T15:01:47.015Z",
  "voided_by": {
    "type": "api_key",
    "id": "01a21860-6f19-7d2b-b10e-40b5898d3d73",
    "name": "fb_sandbox_dZik"
  },
  "void_reason": "El cheque rebotó",
  "receivable": {
    "object": "receivable",
    "state": "open",
    "currency": "USD",
    "amount": "285.00",
    "collected": "142.50",
    "withheld": "0.00",
    "credited": "0.00",
    "balance": "142.50",
    "next_due_date": "2026-12-26",
    "overdue_days": 0,
    "collect_later": false,
    "installments": [
      {
        "amount": "285.00",
        "due_date": "2026-12-26",
        "balance": "142.50"
      }
    ],
    "closed_on": null
  }
}