Search customer credits
distru-search-creditsReadSearches customer credits from overpayments, returns, QuickBooks or issued by hand.
Inputs
Every tool also takes the common inputs.
| Field | Type | Required | Description |
|---|---|---|---|
| limit | integer | No | Default: 10 |
| cursor | string | No | nextCursor of the previous call; keep the other arguments unchanged. |
| creditNumber | string | No | Case-insensitive substring of the per-company sequential credit number: "104" matches "1042" and "1104". |
| customerIds | string[] | No | Resolve via distru-search-companies. |
| externalNote | string | No | Case-insensitive substring of the customer-visible note. |
| internalNote | string | No | Case-insensitive substring of the staff-only note. |
| ownerIds | string[] | No | Credit owner, not creator. Resolve via distru-search-users. |
| search | string | No | Case-insensitive substring of credit number, either note or owner full name. Not customer name; use customerIds. |
| sources | enum[]INVOICE_PAYMENTQB_CREDIT_MEMOQB_PAYMENTRETURNUSER | No | INVOICE_PAYMENT: overpayment of a payment recorded in Distru; QB_PAYMENT: unapplied amount of a payment synced from QuickBooks; QB_CREDIT_MEMO: created in QuickBooks, though a credit from another source can carry a qbCreditMemoId too, and a RETURN credit whose return was removed can become one. |
| statuses | enum[]ACTIVECANCELEDREDEEMED | No | ACTIVE: not canceled, remaining balance above 0; REDEEMED: not canceled, fully applied. |
| sortBy | object | No | Default UPDATED_AT DESC. |
| sortBy. | enumASCDESC | Yes | |
| sortBy. | enumAMOUNTCREDIT_NUMBERINSERTED_ATREMAINING_BALANCESOURCESTATUSUPDATED_AT | Yes | AMOUNT: current face value; REMAINING_BALANCE: amount minus applied uses; STATUS only separates canceled from non-canceled. |
Output
Presence on a nested field assumes its parent exists.
| Field | Type | Presence |
|---|---|---|
| hasMore | boolean | Always |
| nextCursor | string | Can be absent |
| totalCount | integer | Can be absent |
| items | object[] | Always |
| items[]. | string | Always |
| items[]. | string | Always |
| items[]. | enumACTIVECANCELEDREDEEMED | Always |
| items[]. | enumINVOICE_PAYMENTQB_CREDIT_MEMOQB_PAYMENTRETURNUSER | Always |
| items[]. | string | Always |
| items[]. | string | Always |
| items[]. | string | Always |
| items[]. | object | Can be null |
| items[]. | string | Always |
| items[]. | string | Null or absent |
| items[]. | object | Can be null |
| items[]. | string | Always |
| items[]. | object | Always |
| items[]. | string | Always |
| items[]. | string | Can be null |
| items[]. | string | Can be null |
| items[]. | string | Can be null |
| items[]. | string | Can be null |
| items[]. | enumDELETED_IN_QBOERRORNOT_SYNCEDPARTIALLY_SYNCEDPENDINGSYNCED | Can be null |
| items[]. | string | Always |
| items[]. | string | Always |
| items[]. | string | Can be null |
What the AI reads
One row per customer credit (from an overpayment, a return, QuickBooks, or issued by a user), without where it was applied, its line items or its history: for those use distru-get-credit. At least one filter required. No ID filter: find a credit by creditNumber or search. amount is the current face value, originalAmount the value at issue. remainingBalance is amount minus the credit already applied; a CANCELED credit keeps its balance but can't be spent, so leave CANCELED credits out of what a customer has available. INVOICE_PAYMENT and QB_PAYMENT credits are a payment's overpayment. customer is null when the caller's team can't see it. qbSyncStatus ERROR: distru-search-quickbooks-activities with creditIds gives the error. ERROR or NOT_SYNCED: distru-sync-to-quickbooks pushes it, or says why it can't.