## TL;DR

When applying a vendor payment to a bill, identifying the bill by document number alone can match multiple lines; NetSuite then rejects the call as ambiguous. Disambiguate with the line element on the VendorPaymentApply sublist: initialize the payment from the bill to obtain exact doc and line values, then reference both.

## Error

```text
Ambiguous sublist reference; multiple matches exist for key value [doc]
```

## Steps

1. Use the initialize operation from the vendor bill to get doc and line values.
   Expected: Exact sublist coordinates.
2. Include both doc and line in the VendorPaymentApply sublist entry.
   Expected: An unambiguous reference.
3. Retry the payment apply call.
   Expected: A successful application.
4. For multiple bills, initialize once per bill.
   Expected: Each application unambiguous.
5. Log the doc-plus-line pattern in your integration code.
   Expected: The error stops recurring.

## When to use

- Applying vendor payments via SuiteTalk
- Payment apply fails with ambiguous reference
- Partial payments against bills

## When not to use

- Creating vendor bills
- Payment method or bank errors
- REST API payment endpoints (different shape)

## Compatibility

NetSuite SuiteTalk SOAP, 2011.1 endpoint and later.

## Variant phrasings

### ambiguous sublist reference vendor payment

### multiple matches exist for key value doc

### NetSuite payment apply line element

## Root cause

A document number can appear on multiple sublist lines (multiple bills from one vendor payment run). The doc element alone no longer identifies a unique line, so the API requires the line element too.

## Edge cases

- Earlier endpoints do not return this error but may apply to the wrong line; always send line
- Credit memos applied as payments need the same treatment
- Test with multi-line vendor bills, not single-line ones

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_VxriSBAlYm8OUnhYBCbAwQ
