> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bbrands.io/llms.txt
> Use this file to discover all available pages before exploring further.

# PaymentDebtOriginationItem

> One item of a debt origination request: a workbook row, an issued document or a migrated obligation, with its outcome and the debt it created.

## Primary key

[Navigate to header](#param-commercial-activity)

document\_id

uuid

default:"Random UUID"

public

required

Unique identifier of the debt origination item.

## Specific attributes

[Navigate to header](#param-commercial-activity)

amount

numeric

public

The amount of the debt origination item.

**Rules**: Precision: 18, Scale: 2

[Navigate to header](#param-commercial-activity)

attempts

PgSmallInt

default:"0"

public

required

The attempts of the debt origination item.

[Navigate to header](#param-commercial-activity)

dni

varchar

public

The DNI of the debt origination item.

**Rules**: Max length: 20 characters

[Navigate to header](#param-commercial-activity)

document\_number

varchar

public

The document number of the debt origination item.

**Rules**: Max length: 50 characters

[Navigate to header](#param-commercial-activity)

due\_date

date

public

Date associated with the due of the debt origination item.

[Navigate to header](#param-commercial-activity)

effective\_input

jsonb

public

required

The values in force: equal to `input` until a correction; the debt is created from them.

[Navigate to header](#param-commercial-activity)

errors

jsonb

public

The field errors of the last validation: field, code and message.

[Navigate to header](#param-commercial-activity)

input

jsonb

public

required

The original row or document snapshot, never changed.

[Navigate to header](#param-commercial-activity)

last\_attempt\_at

timestamp

public

Timestamp when the debt origination item was last attempt.

**Rules**: Precision: 6, with timezone

[Navigate to header](#param-commercial-activity)

position

integer

public

required

The row number; 1 for a single-item request.

[Navigate to header](#param-commercial-activity)

psp\_reason\_code

varchar

public

The psp reason code of the debt origination item.

**Rules**: Max length: 80 characters

[Navigate to header](#param-commercial-activity)

psp\_status

varchar

public

Read model of the PSP tab; `payment_debt_collect` stays the source of truth.

**Rules**: Max length: 30 characters

[Navigate to header](#param-commercial-activity)

psp\_status\_at

timestamp

public

Timestamp when the debt origination item was psp status.

**Rules**: Precision: 6, with timezone

[Navigate to header](#param-commercial-activity)

reason\_code

varchar

public

The reason code of the debt origination item.

**Rules**: Max length: 80 characters

[Navigate to header](#param-commercial-activity)

reason\_message

text

public

The reason message of the debt origination item.

[Navigate to header](#param-commercial-activity)

resolution

varchar

public

The resolution of the debt origination item.

**Rules**: Possible values: corrected, discarded, external\_invoice, replaced, retried. Max length: 20 characters

[Navigate to header](#param-commercial-activity)

resolved\_at

timestamp

public

When the item left the review or was resolved: a retry, correction, external invoice, replacement or discard, set by the action that did it, and an expiry, set by the system. A restore clears it. Filas › Descartadas and Vencidas read it as «Cuándo» (payment/debt-origination D-49, migration 0441).

**Rules**: Precision: 6, with timezone

[Navigate to header](#param-commercial-activity)

resolved\_by

uuid

public

Who resolved the item or discarded it: the actor of the action. Null for an expiry, which the system does, and after a restore.

[Navigate to header](#param-commercial-activity)

scheduled\_for

timestamp

public

The scheduled for of the debt origination item.

**Rules**: Precision: 6, with timezone

[Navigate to header](#param-commercial-activity)

source\_key

text

public

required

`workbook:{file_upload}:{row}`, `tax_document:{id}` or `sp_sync:{obligation}`; unique, so a retry returns the existing debt.

[Navigate to header](#param-commercial-activity)

status

varchar

public

required

The status of the debt origination item.

**Rules**: Possible values: canceled, created, discarded, expired, failed, processing, queued, received, rejected, resolved, scheduled, skipped, valid. Max length: 20 characters

[Navigate to header](#param-commercial-activity)

submission

integer

public

The send number that took the row; null while not sent.

[Navigate to header](#param-commercial-activity)

version

integer

default:"1"

public

required

Grows with every correction, discard or restore; a stale version gets a conflict.

## Foreign keys

[Navigate to header](#param-commercial-activity)

debt

uuid

public

Optional reference to the Debt associated with the debt origination item. [Ref: Debt Schema](https://docs.bbrands.io/schemas/payment/debt.md)

[Navigate to header](#param-commercial-activity)

payment\_debt\_origination

uuid

public

required

Reference to the Payment Debt Origination this debt origination item belongs to. [Ref: Payment Debt Origination Schema](https://docs.bbrands.io/schemas/payment/payment-debt-origination.md)

## Tracking attributes

[Navigate to header](#param-commercial-activity)

created\_at

timestamp

public

required

Timestamp when the record was created.

**Rules**: Precision: 6, with timezone

[Navigate to header](#param-commercial-activity)

deleted\_at

timestamp

public

Timestamp when the record was soft-deleted, when applicable.

**Rules**: Precision: 6, with timezone

[Navigate to header](#param-commercial-activity)

is\_actived

boolean

default:"true"

public

required

Indicates whether the record is currently active.

[Navigate to header](#param-commercial-activity)

is\_deleted

boolean

default:"false"

public

required

Indicates whether the record has been soft-deleted.

[Navigate to header](#param-commercial-activity)

updated\_at

timestamp

public

Timestamp when the record was last updated.

**Rules**: Precision: 6, with timezone


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.