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

# Lookup Invoice by Reference

Look up an invoice's ID using its external reference number. This is useful when you have the customer-facing invoice reference (e.g. "INV-001") and need to find the corresponding Alguna invoice ID to perform actions like marking it as paid.

## Query Parameters

<ParamField query="reference" type="string" required>
  The external reference number of the invoice. This is the customer-facing invoice number assigned on issuance.
</ParamField>

## Response

<ResponseField name="invoiceId" type="string">
  The Alguna invoice ID corresponding to the provided reference.
</ResponseField>

## Example

<RequestExample>
  ```bash cURL theme={null}
  curl --request GET \
    --url 'https://api.alguna.io/invoice-lookup?reference=INV-001' \
    --header 'Authorization: Bearer YOUR_API_KEY'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "invoiceId": "inv_abc123def456"
  }
  ```

  ```json 404 theme={null}
  {
    "code": "not_found",
    "message": "could not find invoice: INV-001"
  }
  ```
</ResponseExample>
